Search is not available for this dataset
repo_name string | path string | license string | full_code string | full_size int64 | uncommented_code string | uncommented_size int64 | function_only_code string | function_only_size int64 | is_commented bool | is_signatured bool | n_ast_errors int64 | ast_max_depth int64 | n_whitespaces int64 | n_ast_nodes int64 | n_ast_terminals int64 | n_ast_nonterminals int64 | loc int64 | cycloplexity int64 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
futufeld/eclogues | eclogues-impl/gen-hs/ReadOnlyScheduler.hs | bsd-3-clause | from_GetJobSummary_args :: GetJobSummary_args -> T.ThriftVal
from_GetJobSummary_args record = T.TStruct $ Map.fromList $ M.catMaybes
[ (\_v770 -> P.Just (1, ("role",T.TString $ E.encodeUtf8 _v770))) $ getJobSummary_args_role record
] | 237 | from_GetJobSummary_args :: GetJobSummary_args -> T.ThriftVal
from_GetJobSummary_args record = T.TStruct $ Map.fromList $ M.catMaybes
[ (\_v770 -> P.Just (1, ("role",T.TString $ E.encodeUtf8 _v770))) $ getJobSummary_args_role record
] | 237 | from_GetJobSummary_args record = T.TStruct $ Map.fromList $ M.catMaybes
[ (\_v770 -> P.Just (1, ("role",T.TString $ E.encodeUtf8 _v770))) $ getJobSummary_args_role record
] | 176 | false | true | 0 | 14 | 29 | 83 | 43 | 40 | null | null |
ekmett/reactive | src/Test/SimpleFilter.hs | agpl-3.0 | -- This one finishes fine.
e16 = filterE (const True) e7 `mappend` listEG [(maxBound, error "maxed out")] | 105 | e16 = filterE (const True) e7 `mappend` listEG [(maxBound, error "maxed out")] | 78 | e16 = filterE (const True) e7 `mappend` listEG [(maxBound, error "maxed out")] | 78 | true | false | 1 | 9 | 16 | 46 | 22 | 24 | null | null |
andreasabel/helf | src/MonoVal.hs | mit | lookupSubst = Env.lookup | 24 | lookupSubst = Env.lookup | 24 | lookupSubst = Env.lookup | 24 | false | false | 0 | 5 | 2 | 8 | 4 | 4 | null | null |
alephcloud/bayhac2014 | src/BayHac2014/Cryptmail/Json/Types.hs | mit | withObject ∷ JSONParser π ⇒ String → (Object → π α) → Value → π α
withObject _ p (Object a) = p a | 97 | withObject ∷ JSONParser π ⇒ String → (Object → π α) → Value → π α
withObject _ p (Object a) = p a | 97 | withObject _ p (Object a) = p a | 31 | false | true | 0 | 10 | 23 | 59 | 28 | 31 | null | null |
beni55/cps-core | GHC/Data.hs | bsd-3-clause | trueDataCon, falseDataCon :: DataCon
trueDataCon = DataCon {
dataConName = "True",
dataConUnivTyVars = [],
dataConExTyVars = [],
dataConFields = [],
dataConTyCon = boolTyCon,
dataConTyConArgs = [],
dataConSiblings = [falseDataCon]
} | 282 | trueDataCon, falseDataCon :: DataCon
trueDataCon = DataCon {
dataConName = "True",
dataConUnivTyVars = [],
dataConExTyVars = [],
dataConFields = [],
dataConTyCon = boolTyCon,
dataConTyConArgs = [],
dataConSiblings = [falseDataCon]
} | 282 | trueDataCon = DataCon {
dataConName = "True",
dataConUnivTyVars = [],
dataConExTyVars = [],
dataConFields = [],
dataConTyCon = boolTyCon,
dataConTyConArgs = [],
dataConSiblings = [falseDataCon]
} | 245 | false | true | 0 | 7 | 79 | 68 | 43 | 25 | null | null |
JustinUnger/haskell-book | ch11/ch11-ex.hs | mit | dropSentence [x] = [] | 21 | dropSentence [x] = [] | 21 | dropSentence [x] = [] | 21 | false | false | 0 | 6 | 3 | 14 | 7 | 7 | null | null |
gnn/Hets | Proofs/DGFlattening.hs | gpl-2.0 | getAllCombinations n xs = [ y : ys | y : xs' <- tails xs
, ys <- getAllCombinations (n - 1) xs'] | 123 | getAllCombinations n xs = [ y : ys | y : xs' <- tails xs
, ys <- getAllCombinations (n - 1) xs'] | 123 | getAllCombinations n xs = [ y : ys | y : xs' <- tails xs
, ys <- getAllCombinations (n - 1) xs'] | 123 | false | false | 0 | 10 | 49 | 53 | 26 | 27 | null | null |
punitrathore/haskell-first-principles | src/FunctionWithLet.hs | bsd-3-clause | b = x * 5 where x = 10 * 5 + y
y = 10
-- let x = 7; y = negate x; z = y * 10 in z / x + y | 106 | b = x * 5 where x = 10 * 5 + y
y = 10
-- let x = 7; y = negate x; z = y * 10 in z / x + y | 106 | b = x * 5 where x = 10 * 5 + y
y = 10
-- let x = 7; y = negate x; z = y * 10 in z / x + y | 106 | false | false | 7 | 5 | 52 | 45 | 17 | 28 | null | null |
geekingfrog/project-euler | Problem025.hs | gpl-3.0 | answer :: Integer
answer = (fst . head) $ dropWhile ((<1000) . (length . show) . snd) (zip [1..] fibs) | 102 | answer :: Integer
answer = (fst . head) $ dropWhile ((<1000) . (length . show) . snd) (zip [1..] fibs) | 102 | answer = (fst . head) $ dropWhile ((<1000) . (length . show) . snd) (zip [1..] fibs) | 84 | false | true | 2 | 10 | 19 | 67 | 34 | 33 | null | null |
CorySpitzer/FizzBuzz | sam/fizzbuzz.hs | mit | buzz :: (Int, String) -> String
buzz t =
let s = snd t
in if (fst t) `mod` 5 == 0
then s ++ "buzz"
else if null s
then s ++ (show (fst t))
else s ++ "" | 186 | buzz :: (Int, String) -> String
buzz t =
let s = snd t
in if (fst t) `mod` 5 == 0
then s ++ "buzz"
else if null s
then s ++ (show (fst t))
else s ++ "" | 186 | buzz t =
let s = snd t
in if (fst t) `mod` 5 == 0
then s ++ "buzz"
else if null s
then s ++ (show (fst t))
else s ++ "" | 154 | false | true | 2 | 13 | 74 | 104 | 52 | 52 | null | null |
DrSLDR/loop-solver | Solver.hs | mit | {-
-- Solver.hs
-- Currently a useless file, but I need a filler
-}
main = putStrLn "I'm a useless file!" | 106 | main = putStrLn "I'm a useless file!" | 37 | main = putStrLn "I'm a useless file!" | 37 | true | false | 1 | 5 | 21 | 13 | 5 | 8 | null | null |
mzero/barley | src/Barley/Loader.hs | apache-2.0 | tryEntryPoints :: Module -> [EntryPoint a] -> IO (Either String a)
tryEntryPoints m (ep:eps) =
loadEntryPoint ep m >>= maybe (tryEntryPoints m eps) (return . Right) | 168 | tryEntryPoints :: Module -> [EntryPoint a] -> IO (Either String a)
tryEntryPoints m (ep:eps) =
loadEntryPoint ep m >>= maybe (tryEntryPoints m eps) (return . Right) | 168 | tryEntryPoints m (ep:eps) =
loadEntryPoint ep m >>= maybe (tryEntryPoints m eps) (return . Right) | 101 | false | true | 0 | 9 | 29 | 77 | 38 | 39 | null | null |
frantisekfarka/ghc-dsi | compiler/utils/Binary.hs | bsd-3-clause | expandBin :: BinHandle -> Int -> IO ()
expandBin (BinMem _ _ sz_r arr_r) off = do
sz <- readFastMutInt sz_r
let sz' = head (dropWhile (<= off) (iterate (* 2) sz))
arr <- readIORef arr_r
arr' <- mallocForeignPtrBytes sz'
withForeignPtr arr $ \old ->
withForeignPtr arr' $ \new ->
copyBytes new old sz
writeFastMutInt sz_r sz'
writeIORef arr_r arr'
-- -----------------------------------------------------------------------------
-- Low-level reading/writing of bytes | 499 | expandBin :: BinHandle -> Int -> IO ()
expandBin (BinMem _ _ sz_r arr_r) off = do
sz <- readFastMutInt sz_r
let sz' = head (dropWhile (<= off) (iterate (* 2) sz))
arr <- readIORef arr_r
arr' <- mallocForeignPtrBytes sz'
withForeignPtr arr $ \old ->
withForeignPtr arr' $ \new ->
copyBytes new old sz
writeFastMutInt sz_r sz'
writeIORef arr_r arr'
-- -----------------------------------------------------------------------------
-- Low-level reading/writing of bytes | 499 | expandBin (BinMem _ _ sz_r arr_r) off = do
sz <- readFastMutInt sz_r
let sz' = head (dropWhile (<= off) (iterate (* 2) sz))
arr <- readIORef arr_r
arr' <- mallocForeignPtrBytes sz'
withForeignPtr arr $ \old ->
withForeignPtr arr' $ \new ->
copyBytes new old sz
writeFastMutInt sz_r sz'
writeIORef arr_r arr'
-- -----------------------------------------------------------------------------
-- Low-level reading/writing of bytes | 460 | false | true | 0 | 15 | 100 | 159 | 75 | 84 | null | null |
ksaveljev/hake-2 | src/Client/Menu.hs | bsd-3-clause | saveGameMenuKey :: KeyFuncT
saveGameMenuKey =
KeyFuncT "Menu.saveGameMenuKey" (\key -> do
when (key == KeyConstants.kEnter || key == KeyConstants.kEscape) $ do
saveGameMenu <- readRef saveGameMenuRef
modifyRef loadGameMenuRef (\v -> v & mfCursor .~ if (saveGameMenu^.mfCursor) - 1 < 0 then 0 else (saveGameMenu^.mfCursor) - 1)
defaultMenuKey saveGameMenuRef key
) | 394 | saveGameMenuKey :: KeyFuncT
saveGameMenuKey =
KeyFuncT "Menu.saveGameMenuKey" (\key -> do
when (key == KeyConstants.kEnter || key == KeyConstants.kEscape) $ do
saveGameMenu <- readRef saveGameMenuRef
modifyRef loadGameMenuRef (\v -> v & mfCursor .~ if (saveGameMenu^.mfCursor) - 1 < 0 then 0 else (saveGameMenu^.mfCursor) - 1)
defaultMenuKey saveGameMenuRef key
) | 394 | saveGameMenuKey =
KeyFuncT "Menu.saveGameMenuKey" (\key -> do
when (key == KeyConstants.kEnter || key == KeyConstants.kEscape) $ do
saveGameMenu <- readRef saveGameMenuRef
modifyRef loadGameMenuRef (\v -> v & mfCursor .~ if (saveGameMenu^.mfCursor) - 1 < 0 then 0 else (saveGameMenu^.mfCursor) - 1)
defaultMenuKey saveGameMenuRef key
) | 366 | false | true | 0 | 21 | 78 | 136 | 66 | 70 | null | null |
Taketrung/HsPredictor | library/HsPredictor/LoadCSV.hs | mit | -- | Insert matches into database. Only if csv was updated.
-- | checkHash prevents from processing the same file twice.
bulkInsert :: [Match] -> String -> String -> SqlPersistM ()
bulkInsert xs hashF hashDB =
when (checkHash hashF hashDB) $ do
deleteWhere ([] :: [Filter Results])
deleteWhere ([] :: [Filter StatsTable])
deleteWhere ([] :: [Filter Teams])
mapM_ insertMatch xs
-- | Main function for processing matches and inserting into database. | 467 | bulkInsert :: [Match] -> String -> String -> SqlPersistM ()
bulkInsert xs hashF hashDB =
when (checkHash hashF hashDB) $ do
deleteWhere ([] :: [Filter Results])
deleteWhere ([] :: [Filter StatsTable])
deleteWhere ([] :: [Filter Teams])
mapM_ insertMatch xs
-- | Main function for processing matches and inserting into database. | 346 | bulkInsert xs hashF hashDB =
when (checkHash hashF hashDB) $ do
deleteWhere ([] :: [Filter Results])
deleteWhere ([] :: [Filter StatsTable])
deleteWhere ([] :: [Filter Teams])
mapM_ insertMatch xs
-- | Main function for processing matches and inserting into database. | 286 | true | true | 2 | 11 | 89 | 130 | 63 | 67 | null | null |
xpika/interpreter-haskell | Plugins/Sql.hs | gpl-3.0 | sqlite_query db str = do
conn <- connectSqlite3 db
statement <- prepare conn str
-- results <- quickQuery' conn str []
i <- execute statement []
i2 <- getColumnNames statement
results <- fetchAllRows' statement
return ( [i2] ++ (map (map ( map (chr. fromIntegral). Data.ByteString.unpack . unSql)) results)) | 314 | sqlite_query db str = do
conn <- connectSqlite3 db
statement <- prepare conn str
-- results <- quickQuery' conn str []
i <- execute statement []
i2 <- getColumnNames statement
results <- fetchAllRows' statement
return ( [i2] ++ (map (map ( map (chr. fromIntegral). Data.ByteString.unpack . unSql)) results)) | 314 | sqlite_query db str = do
conn <- connectSqlite3 db
statement <- prepare conn str
-- results <- quickQuery' conn str []
i <- execute statement []
i2 <- getColumnNames statement
results <- fetchAllRows' statement
return ( [i2] ++ (map (map ( map (chr. fromIntegral). Data.ByteString.unpack . unSql)) results)) | 314 | false | false | 0 | 19 | 54 | 122 | 57 | 65 | null | null |
dawedawe/kripkeweb | src/WebParser.hs | bsd-3-clause | -- |List of StopWords of different languages.
stopWords :: [String]
stopWords = gerStopWords ++ engStopWords | 108 | stopWords :: [String]
stopWords = gerStopWords ++ engStopWords | 62 | stopWords = gerStopWords ++ engStopWords | 40 | true | true | 0 | 7 | 14 | 26 | 12 | 14 | null | null |
Tr1p0d/VYPe15 | src/VYPe15/Internal/Semantics.hs | bsd-3-clause | processExpression :: Exp -> SemanticAnalyzer (Maybe Variable)
processExpression = \case
OR e1 e2 -> matchLogical Op.Or e1 e2
AND e1 e2 -> matchLogical Op.And e1 e2
Eq e1 e2 -> matchRelation Op.Eq e1 e2
NonEq e1 e2 -> matchRelation Op.Neq e1 e2
Less e1 e2 -> matchRelation Op.LT e1 e2
Greater e1 e2 -> matchRelation Op.GT e1 e2
LessEq e1 e2 -> matchRelation Op.LE e1 e2
GreaterEq e1 e2 -> matchRelation Op.GE e1 e2
Plus e1 e2 -> matchNumeric Op.Add e1 e2
Minus e1 e2 -> matchNumeric Op.Sub e1 e2
Times e1 e2 -> matchNumeric Op.Mul e1 e2
Div e1 e2 -> matchNumeric Op.Div e1 e2
Mod e1 e2 -> matchNumeric Op.Mod e1 e2
NOT e -> processExpression e >>= \case
Just v@(Variable _ DInt) -> DInt *= Op.Not v
t -> throwError $ SError $ cannotMatchMsg' t
Cast t e -> castValue t e
ConsNum i -> DInt *= Op.Const (Const.Int i)
ConsString s -> DString *= Op.Const (Const.String s)
ConsChar c -> DChar *= Op.Const (Const.Char c)
FuncCallExp i es ->
processFunctionCall i es >>= \case
Nothing -> throwError $ SError voidAssign
v -> return v
IdentifierExp i -> Just <$> findVar i
where
castValue t e = do
v' <- processExpression e
case v' of
Just v -> castValue' t v
v -> throwError $ SError $ invalidCast v t
castValue' t v
| t == varType v = t *= Op.Set v
| otherwise = case (varType v, t) of
-- (from-type, to-type)
(DInt, DChar) -> t *= Op.MaskByte v
(DChar, DInt) -> t *= Op.Set v
(DChar, DString) -> do
str <- mkVar DString
tell [ChrStr str v]
return $ Just str
_ -> invalidCastErr
where
invalidCastErr = throwError $ SError $ invalidCast (Just v) t
matchLogical op e1 e2 = do
t1 <- processExpression e1
t2 <- processExpression e2
case (t1, t2) of
(Just v1@(Variable _ DInt), Just v2@(Variable _ DInt)) ->
DInt *= op v1 v2
_ -> throwError $ SError $ cannotMatchLogMsg (op2 op) t1 t2
matchRelation op e1 e2 = do
t1 <- processExpression e1
t2 <- processExpression e2
if isJust t1 && mVarType t1 == mVarType t2
then DInt *= op (fromJust t1) (fromJust t2)
else throwError $ SError $ cannotMatchRelMsg (op2 op) t1 t2
matchNumeric op e1 e2 = do
t1 <- processExpression e1
t2 <- processExpression e2
case (t1, t2) of
(Just v1@(Variable _ DInt), Just v2@(Variable _ DInt)) ->
DInt *= op v1 v2
(Just v1@(Variable _ DChar), Just v2@(Variable _ DInt)) ->
DInt *= op v1 v2
(Just v1@(Variable _ DInt), Just v2@(Variable _ DChar)) ->
DInt *= op v1 v2
(Just v1@(Variable _ DChar), Just v2@(Variable _ DChar)) ->
DChar *= op v1 v2
_ -> throwError $ SError $ cannotMatchNumMsg (op2 op) t1 t2
cannotMatchRelMsg op t1 t2 =
"Cannot match '" <> varShow t1 <> "' with '" <> varShow t2
<> "' in the '" <> showText op <> "' relation expression."
cannotMatchLogMsg op t1 t2
| t1 `hasType` DInt = cannotMatchLogMsg op t2 t1
| otherwise = "Cannot match '" <> varShow t1 <> "' with 'int' in '"
<> showText op <> "' expression."
cannotMatchNumMsg op t1 t2
| any (t1 `hasType`) types = msg t2
| otherwise = msg t1
where
types = [DInt, DChar]
msg t = "Cannot match '" <> varShow t <> "' with 'int' or 'char' in '"
<> showText op <> "' expression."
cannotMatchMsg' t =
"Cannot match '" <> varShow t <> "' with 'int' in '!' expression."
invalidCast from to = "Cannot cast from type '" <> varShow from
<> "' to type'" <> showText to <> "'."
dummyVar = Variable "$" DInt
op2 op = op dummyVar dummyVar | 3,985 | processExpression :: Exp -> SemanticAnalyzer (Maybe Variable)
processExpression = \case
OR e1 e2 -> matchLogical Op.Or e1 e2
AND e1 e2 -> matchLogical Op.And e1 e2
Eq e1 e2 -> matchRelation Op.Eq e1 e2
NonEq e1 e2 -> matchRelation Op.Neq e1 e2
Less e1 e2 -> matchRelation Op.LT e1 e2
Greater e1 e2 -> matchRelation Op.GT e1 e2
LessEq e1 e2 -> matchRelation Op.LE e1 e2
GreaterEq e1 e2 -> matchRelation Op.GE e1 e2
Plus e1 e2 -> matchNumeric Op.Add e1 e2
Minus e1 e2 -> matchNumeric Op.Sub e1 e2
Times e1 e2 -> matchNumeric Op.Mul e1 e2
Div e1 e2 -> matchNumeric Op.Div e1 e2
Mod e1 e2 -> matchNumeric Op.Mod e1 e2
NOT e -> processExpression e >>= \case
Just v@(Variable _ DInt) -> DInt *= Op.Not v
t -> throwError $ SError $ cannotMatchMsg' t
Cast t e -> castValue t e
ConsNum i -> DInt *= Op.Const (Const.Int i)
ConsString s -> DString *= Op.Const (Const.String s)
ConsChar c -> DChar *= Op.Const (Const.Char c)
FuncCallExp i es ->
processFunctionCall i es >>= \case
Nothing -> throwError $ SError voidAssign
v -> return v
IdentifierExp i -> Just <$> findVar i
where
castValue t e = do
v' <- processExpression e
case v' of
Just v -> castValue' t v
v -> throwError $ SError $ invalidCast v t
castValue' t v
| t == varType v = t *= Op.Set v
| otherwise = case (varType v, t) of
-- (from-type, to-type)
(DInt, DChar) -> t *= Op.MaskByte v
(DChar, DInt) -> t *= Op.Set v
(DChar, DString) -> do
str <- mkVar DString
tell [ChrStr str v]
return $ Just str
_ -> invalidCastErr
where
invalidCastErr = throwError $ SError $ invalidCast (Just v) t
matchLogical op e1 e2 = do
t1 <- processExpression e1
t2 <- processExpression e2
case (t1, t2) of
(Just v1@(Variable _ DInt), Just v2@(Variable _ DInt)) ->
DInt *= op v1 v2
_ -> throwError $ SError $ cannotMatchLogMsg (op2 op) t1 t2
matchRelation op e1 e2 = do
t1 <- processExpression e1
t2 <- processExpression e2
if isJust t1 && mVarType t1 == mVarType t2
then DInt *= op (fromJust t1) (fromJust t2)
else throwError $ SError $ cannotMatchRelMsg (op2 op) t1 t2
matchNumeric op e1 e2 = do
t1 <- processExpression e1
t2 <- processExpression e2
case (t1, t2) of
(Just v1@(Variable _ DInt), Just v2@(Variable _ DInt)) ->
DInt *= op v1 v2
(Just v1@(Variable _ DChar), Just v2@(Variable _ DInt)) ->
DInt *= op v1 v2
(Just v1@(Variable _ DInt), Just v2@(Variable _ DChar)) ->
DInt *= op v1 v2
(Just v1@(Variable _ DChar), Just v2@(Variable _ DChar)) ->
DChar *= op v1 v2
_ -> throwError $ SError $ cannotMatchNumMsg (op2 op) t1 t2
cannotMatchRelMsg op t1 t2 =
"Cannot match '" <> varShow t1 <> "' with '" <> varShow t2
<> "' in the '" <> showText op <> "' relation expression."
cannotMatchLogMsg op t1 t2
| t1 `hasType` DInt = cannotMatchLogMsg op t2 t1
| otherwise = "Cannot match '" <> varShow t1 <> "' with 'int' in '"
<> showText op <> "' expression."
cannotMatchNumMsg op t1 t2
| any (t1 `hasType`) types = msg t2
| otherwise = msg t1
where
types = [DInt, DChar]
msg t = "Cannot match '" <> varShow t <> "' with 'int' or 'char' in '"
<> showText op <> "' expression."
cannotMatchMsg' t =
"Cannot match '" <> varShow t <> "' with 'int' in '!' expression."
invalidCast from to = "Cannot cast from type '" <> varShow from
<> "' to type'" <> showText to <> "'."
dummyVar = Variable "$" DInt
op2 op = op dummyVar dummyVar | 3,985 | processExpression = \case
OR e1 e2 -> matchLogical Op.Or e1 e2
AND e1 e2 -> matchLogical Op.And e1 e2
Eq e1 e2 -> matchRelation Op.Eq e1 e2
NonEq e1 e2 -> matchRelation Op.Neq e1 e2
Less e1 e2 -> matchRelation Op.LT e1 e2
Greater e1 e2 -> matchRelation Op.GT e1 e2
LessEq e1 e2 -> matchRelation Op.LE e1 e2
GreaterEq e1 e2 -> matchRelation Op.GE e1 e2
Plus e1 e2 -> matchNumeric Op.Add e1 e2
Minus e1 e2 -> matchNumeric Op.Sub e1 e2
Times e1 e2 -> matchNumeric Op.Mul e1 e2
Div e1 e2 -> matchNumeric Op.Div e1 e2
Mod e1 e2 -> matchNumeric Op.Mod e1 e2
NOT e -> processExpression e >>= \case
Just v@(Variable _ DInt) -> DInt *= Op.Not v
t -> throwError $ SError $ cannotMatchMsg' t
Cast t e -> castValue t e
ConsNum i -> DInt *= Op.Const (Const.Int i)
ConsString s -> DString *= Op.Const (Const.String s)
ConsChar c -> DChar *= Op.Const (Const.Char c)
FuncCallExp i es ->
processFunctionCall i es >>= \case
Nothing -> throwError $ SError voidAssign
v -> return v
IdentifierExp i -> Just <$> findVar i
where
castValue t e = do
v' <- processExpression e
case v' of
Just v -> castValue' t v
v -> throwError $ SError $ invalidCast v t
castValue' t v
| t == varType v = t *= Op.Set v
| otherwise = case (varType v, t) of
-- (from-type, to-type)
(DInt, DChar) -> t *= Op.MaskByte v
(DChar, DInt) -> t *= Op.Set v
(DChar, DString) -> do
str <- mkVar DString
tell [ChrStr str v]
return $ Just str
_ -> invalidCastErr
where
invalidCastErr = throwError $ SError $ invalidCast (Just v) t
matchLogical op e1 e2 = do
t1 <- processExpression e1
t2 <- processExpression e2
case (t1, t2) of
(Just v1@(Variable _ DInt), Just v2@(Variable _ DInt)) ->
DInt *= op v1 v2
_ -> throwError $ SError $ cannotMatchLogMsg (op2 op) t1 t2
matchRelation op e1 e2 = do
t1 <- processExpression e1
t2 <- processExpression e2
if isJust t1 && mVarType t1 == mVarType t2
then DInt *= op (fromJust t1) (fromJust t2)
else throwError $ SError $ cannotMatchRelMsg (op2 op) t1 t2
matchNumeric op e1 e2 = do
t1 <- processExpression e1
t2 <- processExpression e2
case (t1, t2) of
(Just v1@(Variable _ DInt), Just v2@(Variable _ DInt)) ->
DInt *= op v1 v2
(Just v1@(Variable _ DChar), Just v2@(Variable _ DInt)) ->
DInt *= op v1 v2
(Just v1@(Variable _ DInt), Just v2@(Variable _ DChar)) ->
DInt *= op v1 v2
(Just v1@(Variable _ DChar), Just v2@(Variable _ DChar)) ->
DChar *= op v1 v2
_ -> throwError $ SError $ cannotMatchNumMsg (op2 op) t1 t2
cannotMatchRelMsg op t1 t2 =
"Cannot match '" <> varShow t1 <> "' with '" <> varShow t2
<> "' in the '" <> showText op <> "' relation expression."
cannotMatchLogMsg op t1 t2
| t1 `hasType` DInt = cannotMatchLogMsg op t2 t1
| otherwise = "Cannot match '" <> varShow t1 <> "' with 'int' in '"
<> showText op <> "' expression."
cannotMatchNumMsg op t1 t2
| any (t1 `hasType`) types = msg t2
| otherwise = msg t1
where
types = [DInt, DChar]
msg t = "Cannot match '" <> varShow t <> "' with 'int' or 'char' in '"
<> showText op <> "' expression."
cannotMatchMsg' t =
"Cannot match '" <> varShow t <> "' with 'int' in '!' expression."
invalidCast from to = "Cannot cast from type '" <> varShow from
<> "' to type'" <> showText to <> "'."
dummyVar = Variable "$" DInt
op2 op = op dummyVar dummyVar | 3,923 | false | true | 14 | 15 | 1,348 | 1,551 | 716 | 835 | null | null |
DaMSL/K3 | src/Language/K3/Interpreter/Builtins/DateTime.hs | apache-2.0 | genDateTimeBuiltin "add_time" _ = Just $ vfun $ \(VRecord map1) -> vfun $ \(VRecord map2) ->
timeBinOp map1 map2 (+) >>= return . VRecord | 139 | genDateTimeBuiltin "add_time" _ = Just $ vfun $ \(VRecord map1) -> vfun $ \(VRecord map2) ->
timeBinOp map1 map2 (+) >>= return . VRecord | 139 | genDateTimeBuiltin "add_time" _ = Just $ vfun $ \(VRecord map1) -> vfun $ \(VRecord map2) ->
timeBinOp map1 map2 (+) >>= return . VRecord | 139 | false | false | 0 | 11 | 25 | 62 | 32 | 30 | null | null |
moonKimura/vector-0.10.9.1 | Data/Vector/Fusion/Stream/Size.hs | bsd-3-clause | -- | Compute the maximum size from a size hint if possible
upperBound :: Size -> Maybe Int
upperBound (Exact n) = Just n | 120 | upperBound :: Size -> Maybe Int
upperBound (Exact n) = Just n | 61 | upperBound (Exact n) = Just n | 29 | true | true | 0 | 7 | 23 | 31 | 15 | 16 | null | null |
hvr/ghci-ng | ghc/Main.hs | bsd-3-clause | needsInputsMode :: PostLoadMode -> Bool
needsInputsMode DoMkDependHS = True | 78 | needsInputsMode :: PostLoadMode -> Bool
needsInputsMode DoMkDependHS = True | 78 | needsInputsMode DoMkDependHS = True | 38 | false | true | 0 | 5 | 11 | 18 | 9 | 9 | null | null |
bitemyapp/hoq | src/TypeChecking/Expressions/Conditions.hs | gpl-2.0 | unifyPatterns (Cons (PatDCon _ dt1 i1 _ _ _ ps1) pats1) (Cons (PatDCon _ dt2 i2 _ _ _ ps2) pats2) | dt1 == dt2 && i1 == i2 =
unifyPatterns (ps1 P.+++ pats1) (ps2 P.+++ pats2) | 178 | unifyPatterns (Cons (PatDCon _ dt1 i1 _ _ _ ps1) pats1) (Cons (PatDCon _ dt2 i2 _ _ _ ps2) pats2) | dt1 == dt2 && i1 == i2 =
unifyPatterns (ps1 P.+++ pats1) (ps2 P.+++ pats2) | 178 | unifyPatterns (Cons (PatDCon _ dt1 i1 _ _ _ ps1) pats1) (Cons (PatDCon _ dt2 i2 _ _ _ ps2) pats2) | dt1 == dt2 && i1 == i2 =
unifyPatterns (ps1 P.+++ pats1) (ps2 P.+++ pats2) | 178 | false | false | 0 | 10 | 40 | 104 | 51 | 53 | null | null |
brendanhay/gogol | gogol-doubleclick-bids/gen/Network/Google/DoubleClickBids/Types/Product.hs | mpl-2.0 | -- | Query title. It is used to name the reports generated from this query.
qmTitle :: Lens' QueryMetadata (Maybe Text)
qmTitle = lens _qmTitle (\ s a -> s{_qmTitle = a}) | 170 | qmTitle :: Lens' QueryMetadata (Maybe Text)
qmTitle = lens _qmTitle (\ s a -> s{_qmTitle = a}) | 94 | qmTitle = lens _qmTitle (\ s a -> s{_qmTitle = a}) | 50 | true | true | 0 | 9 | 31 | 46 | 25 | 21 | null | null |
gust/feature-creature | users-service/app/Users/Query.hs | mit | update :: (MonadIO app, Monad m) => UserId -> User -> DBAccess m -> app ()
update uID user DBAccess{..} =
liftIO $ runDb (updateUser uID user) | 144 | update :: (MonadIO app, Monad m) => UserId -> User -> DBAccess m -> app ()
update uID user DBAccess{..} =
liftIO $ runDb (updateUser uID user) | 144 | update uID user DBAccess{..} =
liftIO $ runDb (updateUser uID user) | 69 | false | true | 0 | 10 | 28 | 74 | 36 | 38 | null | null |
haskell-distributed/network-transport-tcp | src/Network/Transport/TCP.hs | bsd-3-clause | resolveInit :: EndPointPair -> RemoteState -> IO ()
resolveInit (ourEndPoint, theirEndPoint) newState =
modifyMVar_ (remoteState theirEndPoint) $ \st -> case st of
RemoteEndPointInit resolved crossed _ -> do
putMVar resolved ()
-- Unblock the reader (if any) if the ConnectionRequestCrossed
-- message did not come within the connection timeout.
tryPutMVar crossed ()
case newState of
RemoteEndPointClosed ->
removeRemoteEndPoint (ourEndPoint, theirEndPoint)
_ ->
return ()
return newState
RemoteEndPointFailed ex ->
throwIO ex
_ ->
relyViolation (ourEndPoint, theirEndPoint) "resolveInit"
-- | Get the next outgoing self-connection ID
--
-- Throws an IO exception when the endpoint is closed. | 792 | resolveInit :: EndPointPair -> RemoteState -> IO ()
resolveInit (ourEndPoint, theirEndPoint) newState =
modifyMVar_ (remoteState theirEndPoint) $ \st -> case st of
RemoteEndPointInit resolved crossed _ -> do
putMVar resolved ()
-- Unblock the reader (if any) if the ConnectionRequestCrossed
-- message did not come within the connection timeout.
tryPutMVar crossed ()
case newState of
RemoteEndPointClosed ->
removeRemoteEndPoint (ourEndPoint, theirEndPoint)
_ ->
return ()
return newState
RemoteEndPointFailed ex ->
throwIO ex
_ ->
relyViolation (ourEndPoint, theirEndPoint) "resolveInit"
-- | Get the next outgoing self-connection ID
--
-- Throws an IO exception when the endpoint is closed. | 792 | resolveInit (ourEndPoint, theirEndPoint) newState =
modifyMVar_ (remoteState theirEndPoint) $ \st -> case st of
RemoteEndPointInit resolved crossed _ -> do
putMVar resolved ()
-- Unblock the reader (if any) if the ConnectionRequestCrossed
-- message did not come within the connection timeout.
tryPutMVar crossed ()
case newState of
RemoteEndPointClosed ->
removeRemoteEndPoint (ourEndPoint, theirEndPoint)
_ ->
return ()
return newState
RemoteEndPointFailed ex ->
throwIO ex
_ ->
relyViolation (ourEndPoint, theirEndPoint) "resolveInit"
-- | Get the next outgoing self-connection ID
--
-- Throws an IO exception when the endpoint is closed. | 740 | false | true | 6 | 8 | 194 | 150 | 80 | 70 | null | null |
jakubfijalkowski/hsass | test/Text/Sass/CompilationSpec.hs | mit | extendedResultSpec, compilationSpec, errorReportingSpec, stripEncodingInfoSpec, spec :: Spec
spec = do
describe "Compilation" compilationSpec
describe "Extended compilation" extendedResultSpec
describe "Error reporting" errorReportingSpec
describe "Stripping encoding information" stripEncodingInfoSpec | 318 | extendedResultSpec, compilationSpec, errorReportingSpec, stripEncodingInfoSpec, spec :: Spec
spec = do
describe "Compilation" compilationSpec
describe "Extended compilation" extendedResultSpec
describe "Error reporting" errorReportingSpec
describe "Stripping encoding information" stripEncodingInfoSpec | 318 | spec = do
describe "Compilation" compilationSpec
describe "Extended compilation" extendedResultSpec
describe "Error reporting" errorReportingSpec
describe "Stripping encoding information" stripEncodingInfoSpec | 225 | false | true | 1 | 8 | 41 | 55 | 26 | 29 | null | null |
adunning/pandoc-citeproc | src/Text/CSL/Pandoc.hs | bsd-3-clause | pRoman :: Parsec [Inline] st String
pRoman = try $ do
t <- anyToken
case t of
Str xs -> case parseRomanNumeral xs of
Nothing -> mzero
Just _ -> return xs
_ -> mzero | 232 | pRoman :: Parsec [Inline] st String
pRoman = try $ do
t <- anyToken
case t of
Str xs -> case parseRomanNumeral xs of
Nothing -> mzero
Just _ -> return xs
_ -> mzero | 232 | pRoman = try $ do
t <- anyToken
case t of
Str xs -> case parseRomanNumeral xs of
Nothing -> mzero
Just _ -> return xs
_ -> mzero | 196 | false | true | 0 | 14 | 102 | 79 | 37 | 42 | null | null |
spell-music/temporal-music-notation-demo | src/Temporal/Music/Demo/GeneralMidi.hs | bsd-3-clause | muteCuica = drumInstr 78 | 24 | muteCuica = drumInstr 78 | 24 | muteCuica = drumInstr 78 | 24 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
siddhanathan/ghc | compiler/basicTypes/Id.hs | bsd-3-clause | zapInfo :: (IdInfo -> Maybe IdInfo) -> Id -> Id
zapInfo zapper id = maybeModifyIdInfo (zapper (idInfo id)) id | 109 | zapInfo :: (IdInfo -> Maybe IdInfo) -> Id -> Id
zapInfo zapper id = maybeModifyIdInfo (zapper (idInfo id)) id | 109 | zapInfo zapper id = maybeModifyIdInfo (zapper (idInfo id)) id | 61 | false | true | 0 | 9 | 18 | 51 | 25 | 26 | null | null |
peterspackman/hsqc | src/Matrix.hs | gpl-3.0 | row :: DIM2 -> Int
row (Z:.r:._) = r | 36 | row :: DIM2 -> Int
row (Z:.r:._) = r | 36 | row (Z:.r:._) = r | 17 | false | true | 0 | 8 | 8 | 29 | 15 | 14 | null | null |
Airtnp/Freshman_Simple_Haskell_Lib | Idioms/Type-arithmetic.hs | mit | listSplit :: Split n xs ls eqs gs => (n, xs) -> (ls, eqs, gs)
listSplit = const (undefined, undefined, undefined) | 113 | listSplit :: Split n xs ls eqs gs => (n, xs) -> (ls, eqs, gs)
listSplit = const (undefined, undefined, undefined) | 113 | listSplit = const (undefined, undefined, undefined) | 51 | false | true | 0 | 9 | 20 | 63 | 33 | 30 | null | null |
jwiegley/ghc-release | libraries/Cabal/cabal/Distribution/Simple/UHC.hs | gpl-3.0 | -- -----------------------------------------------------------------------------
-- Registering
registerPackage
:: Verbosity
-> InstalledPackageInfo
-> PackageDescription
-> LocalBuildInfo
-> Bool
-> PackageDBStack
-> IO ()
registerPackage verbosity installedPkgInfo pkg lbi inplace _packageDbs = do
let installDirs = absoluteInstallDirs pkg lbi NoCopyDest
pkgdir | inplace = buildDir lbi </> uhcPackageDir (display pkgid) (display compilerid)
| otherwise = libdir installDirs </> uhcPackageSubDir (display compilerid)
createDirectoryIfMissingVerbose verbosity True pkgdir
writeUTF8File (pkgdir </> installedPkgConfig)
(showInstalledPackageInfo installedPkgInfo)
where
pkgid = packageId pkg
compilerid = compilerId (compiler lbi) | 841 | registerPackage
:: Verbosity
-> InstalledPackageInfo
-> PackageDescription
-> LocalBuildInfo
-> Bool
-> PackageDBStack
-> IO ()
registerPackage verbosity installedPkgInfo pkg lbi inplace _packageDbs = do
let installDirs = absoluteInstallDirs pkg lbi NoCopyDest
pkgdir | inplace = buildDir lbi </> uhcPackageDir (display pkgid) (display compilerid)
| otherwise = libdir installDirs </> uhcPackageSubDir (display compilerid)
createDirectoryIfMissingVerbose verbosity True pkgdir
writeUTF8File (pkgdir </> installedPkgConfig)
(showInstalledPackageInfo installedPkgInfo)
where
pkgid = packageId pkg
compilerid = compilerId (compiler lbi) | 744 | registerPackage verbosity installedPkgInfo pkg lbi inplace _packageDbs = do
let installDirs = absoluteInstallDirs pkg lbi NoCopyDest
pkgdir | inplace = buildDir lbi </> uhcPackageDir (display pkgid) (display compilerid)
| otherwise = libdir installDirs </> uhcPackageSubDir (display compilerid)
createDirectoryIfMissingVerbose verbosity True pkgdir
writeUTF8File (pkgdir </> installedPkgConfig)
(showInstalledPackageInfo installedPkgInfo)
where
pkgid = packageId pkg
compilerid = compilerId (compiler lbi) | 602 | true | true | 1 | 14 | 188 | 191 | 89 | 102 | null | null |
emhoracek/smooch | app/src/ParseKCF.hs | gpl-3.0 | isValidFilemark :: Word8 -> Either Text Bool
isValidFilemark filemark =
if filemark == 0x10
then Right True
else Left errMsg
where
formatString = "Filemark should be 0x10 and is actually " % Fmt.prefixHex
errMsg = Fmt.sformat formatString filemark
-- | Return the given 'Word8' if it's 12 or 24, else an error message with the
-- invalid bits-per-pixel. | 384 | isValidFilemark :: Word8 -> Either Text Bool
isValidFilemark filemark =
if filemark == 0x10
then Right True
else Left errMsg
where
formatString = "Filemark should be 0x10 and is actually " % Fmt.prefixHex
errMsg = Fmt.sformat formatString filemark
-- | Return the given 'Word8' if it's 12 or 24, else an error message with the
-- invalid bits-per-pixel. | 384 | isValidFilemark filemark =
if filemark == 0x10
then Right True
else Left errMsg
where
formatString = "Filemark should be 0x10 and is actually " % Fmt.prefixHex
errMsg = Fmt.sformat formatString filemark
-- | Return the given 'Word8' if it's 12 or 24, else an error message with the
-- invalid bits-per-pixel. | 339 | false | true | 1 | 7 | 88 | 70 | 35 | 35 | null | null |
acowley/ghc | compiler/prelude/PrelNames.hs | bsd-3-clause | not_RDR = varQual_RDR gHC_CLASSES (fsLit "not") | 63 | not_RDR = varQual_RDR gHC_CLASSES (fsLit "not") | 63 | not_RDR = varQual_RDR gHC_CLASSES (fsLit "not") | 63 | false | false | 0 | 7 | 21 | 17 | 8 | 9 | null | null |
abuiles/turbinado-blog | Turbinado/Database/ORM/Generator.hs | bsd-3-clause | combinePrimaryKeys :: TableName -> [ColumnName] -> Tables -> Tables
combinePrimaryKeys t pks tcs = M.adjust (\(c, _) -> (c,pks)) t tcs | 135 | combinePrimaryKeys :: TableName -> [ColumnName] -> Tables -> Tables
combinePrimaryKeys t pks tcs = M.adjust (\(c, _) -> (c,pks)) t tcs | 134 | combinePrimaryKeys t pks tcs = M.adjust (\(c, _) -> (c,pks)) t tcs | 66 | false | true | 0 | 8 | 21 | 66 | 35 | 31 | null | null |
mmisamore/probabilities | test/Spec.hs | bsd-3-clause | -- Distributions are also monoidal for the applicative structure
distMonoidalProd :: Dist Numeric -> Dist Numeric -> Dist Numeric -> Bool
distMonoidalProd da db dc =
fmap right ((da <&> db) <&> dc) == da <&> (db <&> dc)
where right ((a,b),c) = (a,(b,c))
-- Distributions respect the left monoidal unit, which is "pure" | 323 | distMonoidalProd :: Dist Numeric -> Dist Numeric -> Dist Numeric -> Bool
distMonoidalProd da db dc =
fmap right ((da <&> db) <&> dc) == da <&> (db <&> dc)
where right ((a,b),c) = (a,(b,c))
-- Distributions respect the left monoidal unit, which is "pure" | 258 | distMonoidalProd da db dc =
fmap right ((da <&> db) <&> dc) == da <&> (db <&> dc)
where right ((a,b),c) = (a,(b,c))
-- Distributions respect the left monoidal unit, which is "pure" | 185 | true | true | 0 | 11 | 58 | 109 | 59 | 50 | null | null |
spechub/Hets | OMDoc/OMDocInterface.hs | gpl-2.0 | mkOMSimpleVarE :: XmlString -> OMElement
mkOMSimpleVarE xid = toElement $ mkOMSimpleVar xid | 91 | mkOMSimpleVarE :: XmlString -> OMElement
mkOMSimpleVarE xid = toElement $ mkOMSimpleVar xid | 91 | mkOMSimpleVarE xid = toElement $ mkOMSimpleVar xid | 50 | false | true | 0 | 7 | 11 | 30 | 13 | 17 | null | null |
Zigazou/ArrowPointing | src/Grid/Path.hs | gpl-3.0 | validPath' (Line Vertical) Crossroad 0 y = y == -1 || y == 1 | 69 | validPath' (Line Vertical) Crossroad 0 y = y == -1 || y == 1 | 69 | validPath' (Line Vertical) Crossroad 0 y = y == -1 || y == 1 | 69 | false | false | 0 | 8 | 22 | 35 | 17 | 18 | null | null |
GaloisInc/saw-script | src/SAWScript/Exceptions.hs | bsd-3-clause | -- | To use a custom structured exception type that works with the
-- saw-script REPL's exception handlers and stack tracing, define
-- 'fromException' as 'topLevelExceptionFromException' in the custom
-- exception type's 'Exception' class instance.
topLevelExceptionFromException :: Exception e => SomeException -> Maybe e
topLevelExceptionFromException x =
do SomeTopLevelException a <- fromException x
cast a | 418 | topLevelExceptionFromException :: Exception e => SomeException -> Maybe e
topLevelExceptionFromException x =
do SomeTopLevelException a <- fromException x
cast a | 168 | topLevelExceptionFromException x =
do SomeTopLevelException a <- fromException x
cast a | 94 | true | true | 0 | 8 | 61 | 51 | 24 | 27 | null | null |
nikki-and-the-robots/nikki | src/Graphics/Qt/CPPWrapper.hs | lgpl-3.0 | -- ** Globals
qtVersion :: IO String
qtVersion = cppQtVersion >>= peekCString | 78 | qtVersion :: IO String
qtVersion = cppQtVersion >>= peekCString | 63 | qtVersion = cppQtVersion >>= peekCString | 40 | true | true | 0 | 5 | 12 | 19 | 10 | 9 | null | null |
Gabriel439/Haskell-Index-Core-Library | Control/IMonad/Do.hs | bsd-3-clause | -- | ('>>') replaces (@>>@) from @Control.Monad@.
(>>) :: (IMonad m) => m (a := j) i -> m (b := k) j -> m (b := k) i
(>>) = (!>) | 128 | (>>) :: (IMonad m) => m (a := j) i -> m (b := k) j -> m (b := k) i
(>>) = (!>) | 78 | (>>) = (!>) | 11 | true | true | 0 | 10 | 31 | 71 | 40 | 31 | null | null |
spechub/Hets | SoftFOL/ProveDarwin.hs | gpl-2.0 | runEProverBuffered
:: Bool -- ^ save problem
-> Bool
-> Bool
-> String -- ^ options
-> String -- ^ filename without extension
-> String -- ^ problem
-> IO (String, [String], Int)
runEProverBuffered saveTPTP graph fullgraph options tmpFileName prob = do
s <- supportsProofObject
let tmpFile = basename tmpFileName ++ ".tptp"
useProofObject = s && not fullgraph
bin = if useProofObject then "eprover"
else "eproof"
noProg <- missingExecutableInPath bin
when saveTPTP (writeFile tmpFile prob)
if noProg then return (bin ++ " not found. Check your $PATH", [], -1)
else do
(err, out) <-
do
timeTmpFile <- getTempFile prob tmpFile
(_, out, err, _) <-
if graph || fullgraph || not s then do
bufferFile <- getTempFile "" "eprover-proof-buffer"
buff <- openFile bufferFile WriteMode
h <- runProcess bin (words options ++
["--proof-object" | useProofObject] ++ [timeTmpFile])
Nothing Nothing Nothing (Just buff) (Just buff)
(waitForProcess h >> removeFile timeTmpFile)
`Exception.catch` (\ ThreadKilled -> terminateProcess h)
hClose buff
mkGraph bufferFile
runInteractiveCommand $ unwords ["egrep", "axiom|SZS",
bufferFile, "&&", "rm", "-f", bufferFile]
else runInteractiveCommand $ unwords
[bin, "--proof-object", options, timeTmpFile,
"|", "egrep", "axiom|SZS", "&&", "rm", timeTmpFile]
return (out, err)
perr <- hGetContents err
pout <- hGetContents out
let l = lines $ perr ++ pout
(res, _, tUsed) = parseOutput l
return (res, l, tUsed) | 1,743 | runEProverBuffered
:: Bool -- ^ save problem
-> Bool
-> Bool
-> String -- ^ options
-> String -- ^ filename without extension
-> String -- ^ problem
-> IO (String, [String], Int)
runEProverBuffered saveTPTP graph fullgraph options tmpFileName prob = do
s <- supportsProofObject
let tmpFile = basename tmpFileName ++ ".tptp"
useProofObject = s && not fullgraph
bin = if useProofObject then "eprover"
else "eproof"
noProg <- missingExecutableInPath bin
when saveTPTP (writeFile tmpFile prob)
if noProg then return (bin ++ " not found. Check your $PATH", [], -1)
else do
(err, out) <-
do
timeTmpFile <- getTempFile prob tmpFile
(_, out, err, _) <-
if graph || fullgraph || not s then do
bufferFile <- getTempFile "" "eprover-proof-buffer"
buff <- openFile bufferFile WriteMode
h <- runProcess bin (words options ++
["--proof-object" | useProofObject] ++ [timeTmpFile])
Nothing Nothing Nothing (Just buff) (Just buff)
(waitForProcess h >> removeFile timeTmpFile)
`Exception.catch` (\ ThreadKilled -> terminateProcess h)
hClose buff
mkGraph bufferFile
runInteractiveCommand $ unwords ["egrep", "axiom|SZS",
bufferFile, "&&", "rm", "-f", bufferFile]
else runInteractiveCommand $ unwords
[bin, "--proof-object", options, timeTmpFile,
"|", "egrep", "axiom|SZS", "&&", "rm", timeTmpFile]
return (out, err)
perr <- hGetContents err
pout <- hGetContents out
let l = lines $ perr ++ pout
(res, _, tUsed) = parseOutput l
return (res, l, tUsed) | 1,743 | runEProverBuffered saveTPTP graph fullgraph options tmpFileName prob = do
s <- supportsProofObject
let tmpFile = basename tmpFileName ++ ".tptp"
useProofObject = s && not fullgraph
bin = if useProofObject then "eprover"
else "eproof"
noProg <- missingExecutableInPath bin
when saveTPTP (writeFile tmpFile prob)
if noProg then return (bin ++ " not found. Check your $PATH", [], -1)
else do
(err, out) <-
do
timeTmpFile <- getTempFile prob tmpFile
(_, out, err, _) <-
if graph || fullgraph || not s then do
bufferFile <- getTempFile "" "eprover-proof-buffer"
buff <- openFile bufferFile WriteMode
h <- runProcess bin (words options ++
["--proof-object" | useProofObject] ++ [timeTmpFile])
Nothing Nothing Nothing (Just buff) (Just buff)
(waitForProcess h >> removeFile timeTmpFile)
`Exception.catch` (\ ThreadKilled -> terminateProcess h)
hClose buff
mkGraph bufferFile
runInteractiveCommand $ unwords ["egrep", "axiom|SZS",
bufferFile, "&&", "rm", "-f", bufferFile]
else runInteractiveCommand $ unwords
[bin, "--proof-object", options, timeTmpFile,
"|", "egrep", "axiom|SZS", "&&", "rm", timeTmpFile]
return (out, err)
perr <- hGetContents err
pout <- hGetContents out
let l = lines $ perr ++ pout
(res, _, tUsed) = parseOutput l
return (res, l, tUsed) | 1,550 | false | true | 0 | 23 | 523 | 514 | 264 | 250 | null | null |
mettekou/ghc | libraries/base/GHC/Conc/Sync.hs | bsd-3-clause | bindSTM :: STM a -> (a -> STM b) -> STM b
bindSTM (STM m) k = STM ( \s ->
case m s of
(# new_s, a #) -> unSTM (k a) new_s
) | 131 | bindSTM :: STM a -> (a -> STM b) -> STM b
bindSTM (STM m) k = STM ( \s ->
case m s of
(# new_s, a #) -> unSTM (k a) new_s
) | 131 | bindSTM (STM m) k = STM ( \s ->
case m s of
(# new_s, a #) -> unSTM (k a) new_s
) | 89 | false | true | 0 | 13 | 42 | 86 | 42 | 44 | null | null |
ford-prefect/gir2jni | src/Data/GI/CodeGen/JNI/Utils/Type.hs | lgpl-2.1 | javaClassType :: [String] -> JSyn.ClassType
javaClassType n = JSyn.ClassType . fmap (,[]) $ JSyn.Ident <$> n | 108 | javaClassType :: [String] -> JSyn.ClassType
javaClassType n = JSyn.ClassType . fmap (,[]) $ JSyn.Ident <$> n | 108 | javaClassType n = JSyn.ClassType . fmap (,[]) $ JSyn.Ident <$> n | 64 | false | true | 0 | 10 | 15 | 54 | 26 | 28 | null | null |
Philonous/pontarius-xmpp | tests/Tests/Picklers.hs | bsd-3-clause | prop_xpStanzaErrorType_invertibe :: StanzaErrorType -> Bool
prop_xpStanzaErrorCondition_invertibe = tpsi xpStanzaErrorCondition | 127 | prop_xpStanzaErrorType_invertibe :: StanzaErrorType -> Bool
prop_xpStanzaErrorCondition_invertibe = tpsi xpStanzaErrorCondition | 127 | prop_xpStanzaErrorCondition_invertibe = tpsi xpStanzaErrorCondition | 67 | false | true | 0 | 5 | 8 | 18 | 9 | 9 | null | null |
phaazon/OpenGLRaw | src/Graphics/Rendering/OpenGL/Raw/Tokens.hs | bsd-3-clause | gl_NORMAL_ARRAY_PARALLEL_POINTERS_INTEL :: GLenum
gl_NORMAL_ARRAY_PARALLEL_POINTERS_INTEL = 0x83F6 | 98 | gl_NORMAL_ARRAY_PARALLEL_POINTERS_INTEL :: GLenum
gl_NORMAL_ARRAY_PARALLEL_POINTERS_INTEL = 0x83F6 | 98 | gl_NORMAL_ARRAY_PARALLEL_POINTERS_INTEL = 0x83F6 | 48 | false | true | 0 | 4 | 5 | 11 | 6 | 5 | null | null |
jkarni/forum | src/Forum/Internal/Utils.hs | bsd-3-clause | unTitleCase [] = error "Empty name" | 35 | unTitleCase [] = error "Empty name" | 35 | unTitleCase [] = error "Empty name" | 35 | false | false | 1 | 5 | 5 | 18 | 6 | 12 | null | null |
meimisaki/FingerTree | test/Main.hs | mit | prop_OrdSeqInsert :: Ord a => a -> OrdSeq a -> Bool
prop_OrdSeqInsert x xs =
toList (insert x xs) == L.insert x (toList xs) | 127 | prop_OrdSeqInsert :: Ord a => a -> OrdSeq a -> Bool
prop_OrdSeqInsert x xs =
toList (insert x xs) == L.insert x (toList xs) | 127 | prop_OrdSeqInsert x xs =
toList (insert x xs) == L.insert x (toList xs) | 75 | false | true | 2 | 9 | 27 | 64 | 29 | 35 | null | null |
kojiromike/Idris-dev | src/Idris/Reflection.hs | bsd-3-clause | reifyApp ist t [l, r] | t == reflm "Seq" = liftM2 TSeq (reify ist l) (reify ist r) | 82 | reifyApp ist t [l, r] | t == reflm "Seq" = liftM2 TSeq (reify ist l) (reify ist r) | 82 | reifyApp ist t [l, r] | t == reflm "Seq" = liftM2 TSeq (reify ist l) (reify ist r) | 82 | false | false | 0 | 9 | 18 | 55 | 26 | 29 | null | null |
frontrowed/stratosphere | library-gen/Stratosphere/Resources/EC2SecurityGroupIngress.hs | mit | -- | http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-security-group-ingress.html#cfn-ec2-security-group-ingress-cidrip
ecsgiCidrIp :: Lens' EC2SecurityGroupIngress (Maybe (Val Text))
ecsgiCidrIp = lens _eC2SecurityGroupIngressCidrIp (\s a -> s { _eC2SecurityGroupIngressCidrIp = a }) | 316 | ecsgiCidrIp :: Lens' EC2SecurityGroupIngress (Maybe (Val Text))
ecsgiCidrIp = lens _eC2SecurityGroupIngressCidrIp (\s a -> s { _eC2SecurityGroupIngressCidrIp = a }) | 164 | ecsgiCidrIp = lens _eC2SecurityGroupIngressCidrIp (\s a -> s { _eC2SecurityGroupIngressCidrIp = a }) | 100 | true | true | 0 | 9 | 22 | 52 | 28 | 24 | null | null |
shlevy/ghc | libraries/template-haskell/Language/Haskell/TH/Ppr.hs | bsd-3-clause | pprExp i (LamCaseE ms) = parensIf (i > noPrec)
$ text "\\case" $$ nest nestDepth (ppr ms) | 112 | pprExp i (LamCaseE ms) = parensIf (i > noPrec)
$ text "\\case" $$ nest nestDepth (ppr ms) | 112 | pprExp i (LamCaseE ms) = parensIf (i > noPrec)
$ text "\\case" $$ nest nestDepth (ppr ms) | 112 | false | false | 0 | 9 | 39 | 49 | 23 | 26 | null | null |
Erdwolf/autotool-bonn | src/Haskell/Data.hs | gpl-2.0 | code_example :: Code
code_example = Code "\\ n -> (0,n)" | 56 | code_example :: Code
code_example = Code "\\ n -> (0,n)" | 56 | code_example = Code "\\ n -> (0,n)" | 35 | false | true | 0 | 5 | 9 | 14 | 7 | 7 | null | null |
manuchandel/Academics | Principles-Of-Programming-Languages/binaryTree.hs | mit | preorder :: Tree -> [Integer]
preorder Nil =[] | 46 | preorder :: Tree -> [Integer]
preorder Nil =[] | 46 | preorder Nil =[] | 16 | false | true | 0 | 6 | 7 | 23 | 12 | 11 | null | null |
ntc2/cryptol | src/Cryptol/ModuleSystem/Renamer.hs | bsd-3-clause | -- | Throw errors for any names that overlap in a rewrite environment.
checkNamingEnv :: NamingEnv -> ([RenamerError],[RenamerWarning])
checkNamingEnv env = (out, [])
where
out = Map.foldr check outTys (neExprs env)
outTys = Map.foldr check mempty (neTypes env)
check ns acc = containsOverlap ns ++ acc
-- Renaming -------------------------------------------------------------------- | 397 | checkNamingEnv :: NamingEnv -> ([RenamerError],[RenamerWarning])
checkNamingEnv env = (out, [])
where
out = Map.foldr check outTys (neExprs env)
outTys = Map.foldr check mempty (neTypes env)
check ns acc = containsOverlap ns ++ acc
-- Renaming -------------------------------------------------------------------- | 326 | checkNamingEnv env = (out, [])
where
out = Map.foldr check outTys (neExprs env)
outTys = Map.foldr check mempty (neTypes env)
check ns acc = containsOverlap ns ++ acc
-- Renaming -------------------------------------------------------------------- | 261 | true | true | 3 | 9 | 62 | 116 | 54 | 62 | null | null |
gwright83/Wheeler | src/Math/Symbolic/Wheeler/Minkowski.hs | bsd-3-clause | minkowskiManifold :: Manifold
minkowskiManifold = fst minkowskiM | 64 | minkowskiManifold :: Manifold
minkowskiManifold = fst minkowskiM | 64 | minkowskiManifold = fst minkowskiM | 34 | false | true | 0 | 5 | 6 | 14 | 7 | 7 | null | null |
frantisekfarka/ghc-dsi | compiler/llvmGen/LlvmCodeGen/Base.hs | bsd-3-clause | withClearVars :: LlvmM a -> LlvmM a
withClearVars m = LlvmM $ \env -> do
(x, env') <- runLlvmM m env { envVarMap = emptyUFM, envStackRegs = [] }
return (x, env' { envVarMap = emptyUFM, envStackRegs = [] })
-- | Insert variables or functions into the environment. | 271 | withClearVars :: LlvmM a -> LlvmM a
withClearVars m = LlvmM $ \env -> do
(x, env') <- runLlvmM m env { envVarMap = emptyUFM, envStackRegs = [] }
return (x, env' { envVarMap = emptyUFM, envStackRegs = [] })
-- | Insert variables or functions into the environment. | 271 | withClearVars m = LlvmM $ \env -> do
(x, env') <- runLlvmM m env { envVarMap = emptyUFM, envStackRegs = [] }
return (x, env' { envVarMap = emptyUFM, envStackRegs = [] })
-- | Insert variables or functions into the environment. | 235 | false | true | 0 | 13 | 57 | 96 | 52 | 44 | null | null |
isomorphism/labelled-hexdump-parser | Parser.hs | bsd-3-clause | expectWords :: (Monad m) => [Word32] -> FieldParser m [Word32]
expectWords ws = expect ws $ replicateM (length ws) uint32 | 121 | expectWords :: (Monad m) => [Word32] -> FieldParser m [Word32]
expectWords ws = expect ws $ replicateM (length ws) uint32 | 121 | expectWords ws = expect ws $ replicateM (length ws) uint32 | 58 | false | true | 0 | 8 | 19 | 59 | 29 | 30 | null | null |
ezyang/ghc | compiler/prelude/PrimOp.hs | bsd-3-clause | mkCompare str ty = Compare (mkVarOccFS str) ty | 46 | mkCompare str ty = Compare (mkVarOccFS str) ty | 46 | mkCompare str ty = Compare (mkVarOccFS str) ty | 46 | false | false | 0 | 7 | 7 | 22 | 10 | 12 | null | null |
monsanto/hie | Hie/Language/Haskell/Exts/Annotated/Build.hs | gpl-3.0 | -- | A literal character expression.
charE :: l -> Char -> Exp l
charE l c = Lit l $ Char l c [c] | 97 | charE :: l -> Char -> Exp l
charE l c = Lit l $ Char l c [c] | 60 | charE l c = Lit l $ Char l c [c] | 32 | true | true | 0 | 7 | 24 | 45 | 22 | 23 | null | null |
Heather/stack | src/Stack/Config.hs | bsd-3-clause | loadConfigYaml
:: (FromJSON (WithJSONWarnings a), MonadIO m, MonadLogger m)
=> Path Abs File -> m a
loadConfigYaml path = do
eres <- loadYaml path
case eres of
Left err -> liftIO $ throwM (ParseConfigFileException path err)
Right res -> return res
-- | Load and parse YAML from the given file. | 326 | loadConfigYaml
:: (FromJSON (WithJSONWarnings a), MonadIO m, MonadLogger m)
=> Path Abs File -> m a
loadConfigYaml path = do
eres <- loadYaml path
case eres of
Left err -> liftIO $ throwM (ParseConfigFileException path err)
Right res -> return res
-- | Load and parse YAML from the given file. | 326 | loadConfigYaml path = do
eres <- loadYaml path
case eres of
Left err -> liftIO $ throwM (ParseConfigFileException path err)
Right res -> return res
-- | Load and parse YAML from the given file. | 218 | false | true | 0 | 14 | 83 | 111 | 51 | 60 | null | null |
aelve/json-x | lib/Json/Internal/TH.hs | bsd-3-clause | varTToName _ = error "Not a type variable!" | 52 | varTToName _ = error "Not a type variable!" | 52 | varTToName _ = error "Not a type variable!" | 52 | false | false | 0 | 4 | 16 | 13 | 5 | 8 | null | null |
tjakway/ghcjvm | libraries/template-haskell/Language/Haskell/TH/Syntax.hs | bsd-3-clause | -- | 'dataToPatQ' converts a value to a 'Q Pat' representation of the same
-- value, in the SYB style. It takes a function to handle type-specific cases,
-- alternatively, pass @const Nothing@ to get default behavior.
dataToPatQ :: Data a
=> (forall b . Data b => b -> Maybe (Q Pat))
-> a
-> Q Pat
dataToPatQ = dataToQa id litP conP
where litP l = return (LitP l)
conP n ps =
case nameSpace n of
Just DataName -> do
ps' <- sequence ps
return (ConP n ps')
_ -> fail $ "Can't construct a pattern from name "
++ showName n
-----------------------------------------------------
-- Names and uniques
----------------------------------------------------- | 826 | dataToPatQ :: Data a
=> (forall b . Data b => b -> Maybe (Q Pat))
-> a
-> Q Pat
dataToPatQ = dataToQa id litP conP
where litP l = return (LitP l)
conP n ps =
case nameSpace n of
Just DataName -> do
ps' <- sequence ps
return (ConP n ps')
_ -> fail $ "Can't construct a pattern from name "
++ showName n
-----------------------------------------------------
-- Names and uniques
----------------------------------------------------- | 608 | dataToPatQ = dataToQa id litP conP
where litP l = return (LitP l)
conP n ps =
case nameSpace n of
Just DataName -> do
ps' <- sequence ps
return (ConP n ps')
_ -> fail $ "Can't construct a pattern from name "
++ showName n
-----------------------------------------------------
-- Names and uniques
----------------------------------------------------- | 487 | true | true | 1 | 13 | 288 | 156 | 76 | 80 | null | null |
ocean0yohsuke/Scheme | src/Scheme/Evaluator/Chaitin.hs | bsd-3-clause | evalReadExp e = throwEvalError $ INVALIDForm $ show (cell (sym "read-exp") e) | 77 | evalReadExp e = throwEvalError $ INVALIDForm $ show (cell (sym "read-exp") e) | 77 | evalReadExp e = throwEvalError $ INVALIDForm $ show (cell (sym "read-exp") e) | 77 | false | false | 0 | 10 | 11 | 34 | 16 | 18 | null | null |
teiche/femtocc | Pretty.hs | bsd-3-clause | prettyName (If cond body) = "If" ++ (prettyName cond) | 53 | prettyName (If cond body) = "If" ++ (prettyName cond) | 53 | prettyName (If cond body) = "If" ++ (prettyName cond) | 53 | false | false | 0 | 7 | 8 | 28 | 13 | 15 | null | null |
mbixby/stackoverflow_cli | so.hs | gpl-3.0 | -- | Parses arguments
--
-- Sources:
-- http://www.haskell.org/haskellwiki/Tutorials/Programming_Haskell/Argument_handling#Parsing_the_flags
-- http://cvs.haskell.org/Hugs/pages/libraries/base/System-Console-GetOpt.html
parseArgs :: [String] -> IO (Flags, String)
parseArgs argv = case getOpt Permute flags argv of
(_,[],_) -> do
hPutStrLn stderr $ "Please type a search query.\n\n" ++ usageInfo header flags
exitWith (ExitFailure 1)
(args,ex,[]) -> do
let query = if null ex then "" else concat ex
parseArgs' args flags query header
(_,_,errs) -> do
hPutStrLn stderr (concat errs ++ usageInfo header flags)
exitWith (ExitFailure 1)
where header = usageHeader | 700 | parseArgs :: [String] -> IO (Flags, String)
parseArgs argv = case getOpt Permute flags argv of
(_,[],_) -> do
hPutStrLn stderr $ "Please type a search query.\n\n" ++ usageInfo header flags
exitWith (ExitFailure 1)
(args,ex,[]) -> do
let query = if null ex then "" else concat ex
parseArgs' args flags query header
(_,_,errs) -> do
hPutStrLn stderr (concat errs ++ usageInfo header flags)
exitWith (ExitFailure 1)
where header = usageHeader | 480 | parseArgs argv = case getOpt Permute flags argv of
(_,[],_) -> do
hPutStrLn stderr $ "Please type a search query.\n\n" ++ usageInfo header flags
exitWith (ExitFailure 1)
(args,ex,[]) -> do
let query = if null ex then "" else concat ex
parseArgs' args flags query header
(_,_,errs) -> do
hPutStrLn stderr (concat errs ++ usageInfo header flags)
exitWith (ExitFailure 1)
where header = usageHeader | 436 | true | true | 3 | 14 | 122 | 202 | 103 | 99 | null | null |
ezyang/ghc | compiler/codeGen/StgCmmPrim.hs | bsd-3-clause | emitPrimOp dflags res IndexOffAddrOp_Word8 args = doIndexOffAddrOp (Just (mo_u_8ToWord dflags)) b8 res args | 121 | emitPrimOp dflags res IndexOffAddrOp_Word8 args = doIndexOffAddrOp (Just (mo_u_8ToWord dflags)) b8 res args | 121 | emitPrimOp dflags res IndexOffAddrOp_Word8 args = doIndexOffAddrOp (Just (mo_u_8ToWord dflags)) b8 res args | 121 | false | false | 0 | 9 | 26 | 40 | 17 | 23 | null | null |
JacquesCarette/literate-scientific-software | code/drasil-example/Drasil/Projectile/GenDefs.hs | bsd-2-clause | rectVelDerivEqn1, rectVelDerivEqn2 :: Expr
rectVelDerivEqn1 = sy QP.constAccel $= deriv (sy speed) time | 103 | rectVelDerivEqn1, rectVelDerivEqn2 :: Expr
rectVelDerivEqn1 = sy QP.constAccel $= deriv (sy speed) time | 103 | rectVelDerivEqn1 = sy QP.constAccel $= deriv (sy speed) time | 60 | false | true | 0 | 8 | 12 | 33 | 17 | 16 | null | null |
google-research/dex-lang | src/lib/Type.hs | bsd-3-clause | -- nary pi nest of either only tab arrow or only non-tab arrows
asNaryPiType :: NaryPiFlavor -> Type n -> Maybe (NaryPiType n)
asNaryPiType flavor ty = case ty of
Pi (PiType b@(PiBinder _ _ arr) effs resultTy) | matchesFlavor arr -> case effs of
Pure -> case asNaryPiType (inferFlavor arr) resultTy of
Just (NaryPiType (NonEmptyNest b' bs) effs' resultTy') ->
Just $ NaryPiType (NonEmptyNest b (Nest b' bs)) effs' resultTy'
Nothing -> Just $ NaryPiType (NonEmptyNest b Empty) Pure resultTy
_ -> Just $ NaryPiType (NonEmptyNest b Empty) effs resultTy
_ -> Nothing
where
matchesFlavor arr = case flavor of
AnyFlavor -> True
TabOnlyFlavor -> arr == TabArrow
NonTabFlavor -> arr /= TabArrow
inferFlavor arr = case flavor of
AnyFlavor -> if arr == TabArrow then TabOnlyFlavor else NonTabFlavor
_ -> flavor | 883 | asNaryPiType :: NaryPiFlavor -> Type n -> Maybe (NaryPiType n)
asNaryPiType flavor ty = case ty of
Pi (PiType b@(PiBinder _ _ arr) effs resultTy) | matchesFlavor arr -> case effs of
Pure -> case asNaryPiType (inferFlavor arr) resultTy of
Just (NaryPiType (NonEmptyNest b' bs) effs' resultTy') ->
Just $ NaryPiType (NonEmptyNest b (Nest b' bs)) effs' resultTy'
Nothing -> Just $ NaryPiType (NonEmptyNest b Empty) Pure resultTy
_ -> Just $ NaryPiType (NonEmptyNest b Empty) effs resultTy
_ -> Nothing
where
matchesFlavor arr = case flavor of
AnyFlavor -> True
TabOnlyFlavor -> arr == TabArrow
NonTabFlavor -> arr /= TabArrow
inferFlavor arr = case flavor of
AnyFlavor -> if arr == TabArrow then TabOnlyFlavor else NonTabFlavor
_ -> flavor | 818 | asNaryPiType flavor ty = case ty of
Pi (PiType b@(PiBinder _ _ arr) effs resultTy) | matchesFlavor arr -> case effs of
Pure -> case asNaryPiType (inferFlavor arr) resultTy of
Just (NaryPiType (NonEmptyNest b' bs) effs' resultTy') ->
Just $ NaryPiType (NonEmptyNest b (Nest b' bs)) effs' resultTy'
Nothing -> Just $ NaryPiType (NonEmptyNest b Empty) Pure resultTy
_ -> Just $ NaryPiType (NonEmptyNest b Empty) effs resultTy
_ -> Nothing
where
matchesFlavor arr = case flavor of
AnyFlavor -> True
TabOnlyFlavor -> arr == TabArrow
NonTabFlavor -> arr /= TabArrow
inferFlavor arr = case flavor of
AnyFlavor -> if arr == TabArrow then TabOnlyFlavor else NonTabFlavor
_ -> flavor | 755 | true | true | 5 | 16 | 215 | 270 | 136 | 134 | null | null |
tolysz/prepare-ghcjs | spec-lts8/ghc-boot-th/GHC/Lexeme.hs | bsd-3-clause | startsVarSym, startsVarId, startsConSym, startsConId :: Char -> Bool
startsVarSym c = startsVarSymASCII c || (ord c > 0x7f && isSymbol c) | 137 | startsVarSym, startsVarId, startsConSym, startsConId :: Char -> Bool
startsVarSym c = startsVarSymASCII c || (ord c > 0x7f && isSymbol c) | 137 | startsVarSym c = startsVarSymASCII c || (ord c > 0x7f && isSymbol c) | 68 | false | true | 0 | 9 | 20 | 48 | 26 | 22 | null | null |
Raveline/BadIntel | testsuite/BadIntel/Game/MechanismSpec.hs | gpl-2.0 | main = hspec spec | 17 | main = hspec spec | 17 | main = hspec spec | 17 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
sdiehl/ghc | compiler/GHC/Cmm/MachOp.hs | bsd-3-clause | mo_wordURem dflags = MO_U_Rem (wordWidth dflags) | 52 | mo_wordURem dflags = MO_U_Rem (wordWidth dflags) | 52 | mo_wordURem dflags = MO_U_Rem (wordWidth dflags) | 52 | false | false | 0 | 7 | 9 | 18 | 8 | 10 | null | null |
jcollard/unm-hip | Data/Image/Interactive.hs | gpl-3.0 | {-| Sets the program to use when making a call to display and specifies if
the program can accept an image via stdin. If it cannot, then a temporary
file will be created and passed as an argument instead. By default,
ImageMagick ("display") is the default program to use and it is read
using stdin.
>>>setDisplayProgram "gimp" False
>>>setDisplayProgram "xv" False
>>>setDisplayProgram "display" True
-}
setDisplayProgram :: String -> Bool -> IO ()
setDisplayProgram program stdin = writeIORef displayProgram program >> writeIORef useStdin stdin | 581 | setDisplayProgram :: String -> Bool -> IO ()
setDisplayProgram program stdin = writeIORef displayProgram program >> writeIORef useStdin stdin | 141 | setDisplayProgram program stdin = writeIORef displayProgram program >> writeIORef useStdin stdin | 96 | true | true | 0 | 8 | 119 | 44 | 21 | 23 | null | null |
adityagupta1089/Project-Euler-Haskell | src/util/Merge.hs | bsd-3-clause | merge' [] ys = ys | 17 | merge' [] ys = ys | 17 | merge' [] ys = ys | 17 | false | false | 0 | 6 | 4 | 13 | 6 | 7 | null | null |
robdockins/edison | edison-core/src/Data/Edison/Assoc/TernaryTrie.hs | mit | strict z@(FM _ fmb) = strictFMB fmb `seq` z
where strictFMB n@E = n
strictFMB n@(I _ _ _ l (FMB' m) r) =
strictFMB l `seq` strictFMB m `seq` strictFMB r `seq` n | 179 | strict z@(FM _ fmb) = strictFMB fmb `seq` z
where strictFMB n@E = n
strictFMB n@(I _ _ _ l (FMB' m) r) =
strictFMB l `seq` strictFMB m `seq` strictFMB r `seq` n | 179 | strict z@(FM _ fmb) = strictFMB fmb `seq` z
where strictFMB n@E = n
strictFMB n@(I _ _ _ l (FMB' m) r) =
strictFMB l `seq` strictFMB m `seq` strictFMB r `seq` n | 179 | false | false | 0 | 10 | 52 | 104 | 54 | 50 | null | null |
aslpavel/geekbar | lib/GeekBar/NTree.hs | bsd-3-clause | -- | Collect zippers with move function
zs :: (NTreeZ a -> Maybe (NTreeZ a)) -> NTreeZ a -> [NTreeZ a]
zs f = drop 1 . s
where s z = z : maybe [] s (f z)
-- | Left siblings in reverse order | 194 | zs :: (NTreeZ a -> Maybe (NTreeZ a)) -> NTreeZ a -> [NTreeZ a]
zs f = drop 1 . s
where s z = z : maybe [] s (f z)
-- | Left siblings in reverse order | 154 | zs f = drop 1 . s
where s z = z : maybe [] s (f z)
-- | Left siblings in reverse order | 91 | true | true | 0 | 10 | 50 | 91 | 44 | 47 | null | null |
soupi/pureli | src/Language/Pureli/Utils.hs | bsd-3-clause | rapInList :: Metadata -> [WithMD Expr] -> WithMD Expr
wrapInList md es = WithMD md $ QUOTE $ WithMD md $ LIST es
| 113 | wrapInList :: Metadata -> [WithMD Expr] -> WithMD Expr
wrapInList md es = WithMD md $ QUOTE $ WithMD md $ LIST es | 113 | wrapInList md es = WithMD md $ QUOTE $ WithMD md $ LIST es | 58 | false | true | 0 | 8 | 23 | 54 | 25 | 29 | null | null |
polygonhell/textEditor | src/TextBuffer.hs | bsd-3-clause | endOfLine :: Buffer -> Buffer
endOfLine b@Buffer{..} = b{cursor = cursor{col = pos, preferredCol = pos}} where
pos = curLineLength b | 134 | endOfLine :: Buffer -> Buffer
endOfLine b@Buffer{..} = b{cursor = cursor{col = pos, preferredCol = pos}} where
pos = curLineLength b | 134 | endOfLine b@Buffer{..} = b{cursor = cursor{col = pos, preferredCol = pos}} where
pos = curLineLength b | 104 | false | true | 0 | 8 | 22 | 59 | 33 | 26 | null | null |
ThermalSpan/haskell-euler | src/Main.hs | bsd-3-clause | solutions :: M.Map Int String
solutions = M.fromList [
(1,show solution001),
(2,show solution002),
(3,show solution003),
(4,show solution004),
(5,show solution005),
(6,show solution006),
(7,show solution007),
(8,show solution008),
(9,show solution009),
(10,show solution010)] | 335 | solutions :: M.Map Int String
solutions = M.fromList [
(1,show solution001),
(2,show solution002),
(3,show solution003),
(4,show solution004),
(5,show solution005),
(6,show solution006),
(7,show solution007),
(8,show solution008),
(9,show solution009),
(10,show solution010)] | 335 | solutions = M.fromList [
(1,show solution001),
(2,show solution002),
(3,show solution003),
(4,show solution004),
(5,show solution005),
(6,show solution006),
(7,show solution007),
(8,show solution008),
(9,show solution009),
(10,show solution010)] | 305 | false | true | 0 | 8 | 88 | 143 | 81 | 62 | null | null |
geva995/murlyka | src/Utils/MakeContents.hs | gpl-3.0 | includes::Info1->String
includes i =
Lists.intercalate " " . map (\x-> "-I\""++x++ "\"") $ incl
where
incl = incl_dirs i | 129 | includes::Info1->String
includes i =
Lists.intercalate " " . map (\x-> "-I\""++x++ "\"") $ incl
where
incl = incl_dirs i | 129 | includes i =
Lists.intercalate " " . map (\x-> "-I\""++x++ "\"") $ incl
where
incl = incl_dirs i | 105 | false | true | 1 | 11 | 27 | 71 | 31 | 40 | null | null |
rueshyna/gogol | gogol-adexchange-buyer/gen/Network/Google/AdExchangeBuyer/Types/Product.hs | mpl-2.0 | -- | Percent of total impressions for a dimension type. e.g. {dimension_type:
-- \'GENDER\', [{dimension_value: {id: 1, name: \'MALE\', percentage:
-- 60}}]} Gender MALE is 60% of all impressions which have gender.
ddvPercentage :: Lens' DimensionDimensionValue (Maybe Int32)
ddvPercentage
= lens _ddvPercentage
(\ s a -> s{_ddvPercentage = a})
. mapping _Coerce | 376 | ddvPercentage :: Lens' DimensionDimensionValue (Maybe Int32)
ddvPercentage
= lens _ddvPercentage
(\ s a -> s{_ddvPercentage = a})
. mapping _Coerce | 161 | ddvPercentage
= lens _ddvPercentage
(\ s a -> s{_ddvPercentage = a})
. mapping _Coerce | 100 | true | true | 2 | 8 | 65 | 61 | 30 | 31 | null | null |
ben-schulz/Idris-dev | src/IRTS/JavaScript/AST.hs | bsd-3-clause | compileJS' indent (JSWord word)
| JSWord8 b <- word =
"new Uint8Array([" `T.append` T.pack (show b) `T.append` "])"
| JSWord16 b <- word =
"new Uint16Array([" `T.append` T.pack (show b) `T.append` "])"
| JSWord32 b <- word =
"new Uint32Array([" `T.append` T.pack (show b) `T.append` "])"
| JSWord64 b <- word =
"i$bigInt(\"" `T.append` T.pack (show b) `T.append` "\")" | 401 | compileJS' indent (JSWord word)
| JSWord8 b <- word =
"new Uint8Array([" `T.append` T.pack (show b) `T.append` "])"
| JSWord16 b <- word =
"new Uint16Array([" `T.append` T.pack (show b) `T.append` "])"
| JSWord32 b <- word =
"new Uint32Array([" `T.append` T.pack (show b) `T.append` "])"
| JSWord64 b <- word =
"i$bigInt(\"" `T.append` T.pack (show b) `T.append` "\")" | 401 | compileJS' indent (JSWord word)
| JSWord8 b <- word =
"new Uint8Array([" `T.append` T.pack (show b) `T.append` "])"
| JSWord16 b <- word =
"new Uint16Array([" `T.append` T.pack (show b) `T.append` "])"
| JSWord32 b <- word =
"new Uint32Array([" `T.append` T.pack (show b) `T.append` "])"
| JSWord64 b <- word =
"i$bigInt(\"" `T.append` T.pack (show b) `T.append` "\")" | 401 | false | false | 0 | 9 | 91 | 207 | 101 | 106 | null | null |
HIPERFIT/futhark | src/Futhark/IR/Parse.hs | isc | pBody :: PR rep -> Parser (Body rep)
pBody pr =
choice
[ Body (pBodyDec pr) <$> pStms pr <* keyword "in" <*> pResult,
Body (pBodyDec pr) mempty <$> pResult
] | 173 | pBody :: PR rep -> Parser (Body rep)
pBody pr =
choice
[ Body (pBodyDec pr) <$> pStms pr <* keyword "in" <*> pResult,
Body (pBodyDec pr) mempty <$> pResult
] | 173 | pBody pr =
choice
[ Body (pBodyDec pr) <$> pStms pr <* keyword "in" <*> pResult,
Body (pBodyDec pr) mempty <$> pResult
] | 136 | false | true | 0 | 12 | 46 | 86 | 39 | 47 | null | null |
brendanhay/gogol | gogol-android-publisher/gen/Network/Google/AndroidPublisher/Types/Product.hs | mpl-2.0 | -- | The token which uniquely identifies a one-time purchase or subscription.
-- To uniquely identify subscription renewals use order_id (available
-- starting from version 3 of the API).
vpPurchaseToken :: Lens' VoidedPurchase (Maybe Text)
vpPurchaseToken
= lens _vpPurchaseToken
(\ s a -> s{_vpPurchaseToken = a}) | 323 | vpPurchaseToken :: Lens' VoidedPurchase (Maybe Text)
vpPurchaseToken
= lens _vpPurchaseToken
(\ s a -> s{_vpPurchaseToken = a}) | 135 | vpPurchaseToken
= lens _vpPurchaseToken
(\ s a -> s{_vpPurchaseToken = a}) | 82 | true | true | 0 | 9 | 53 | 50 | 27 | 23 | null | null |
frsoares/hsimplesearch | src/Search/Query.hs | gpl-2.0 | -- | Counts the amount of sequences found in the list of lists.
-- e.g., [[1,6,9],[2,7,10],[3,8,12]] would only count 2 sequences (1-2-3 and 6-7-8)
-- Not considering empty lists. Those should never be passed as arguments.
findSequences :: (Eq a, Num a) => [[a]] -> Int
findSequences (h:t) = length [ x | x <- h , inLists (x+1) t ] where
inLists :: (Eq a, Num a) => a -> [[a]] -> Bool
inLists _ [] = True
inLists x (h:t)
| x `elem` h = inLists (x+1) t
| otherwise = False
-- = Utility functions =
-- | Intersects lists, but keeps all elements. | 583 | findSequences :: (Eq a, Num a) => [[a]] -> Int
findSequences (h:t) = length [ x | x <- h , inLists (x+1) t ] where
inLists :: (Eq a, Num a) => a -> [[a]] -> Bool
inLists _ [] = True
inLists x (h:t)
| x `elem` h = inLists (x+1) t
| otherwise = False
-- = Utility functions =
-- | Intersects lists, but keeps all elements. | 360 | findSequences (h:t) = length [ x | x <- h , inLists (x+1) t ] where
inLists :: (Eq a, Num a) => a -> [[a]] -> Bool
inLists _ [] = True
inLists x (h:t)
| x `elem` h = inLists (x+1) t
| otherwise = False
-- = Utility functions =
-- | Intersects lists, but keeps all elements. | 313 | true | true | 0 | 11 | 146 | 179 | 96 | 83 | null | null |
rolph-recto/liquid-fixpoint | src/Language/Fixpoint/Types/Substitutions.hs | bsd-3-clause | substfExcept :: (Symbol -> Expr) -> [Symbol] -> Symbol -> Expr
substfExcept f xs y = if y `elem` xs then EVar y else f y | 120 | substfExcept :: (Symbol -> Expr) -> [Symbol] -> Symbol -> Expr
substfExcept f xs y = if y `elem` xs then EVar y else f y | 120 | substfExcept f xs y = if y `elem` xs then EVar y else f y | 57 | false | true | 0 | 9 | 25 | 65 | 33 | 32 | null | null |
fmthoma/ghc | compiler/prelude/PrelNames.hs | bsd-3-clause | ratioTyConKey = mkPreludeTyConUnique 32 | 65 | ratioTyConKey = mkPreludeTyConUnique 32 | 65 | ratioTyConKey = mkPreludeTyConUnique 32 | 65 | false | false | 0 | 5 | 29 | 9 | 4 | 5 | null | null |
ksoda/scheme48 | src/Lib.hs | bsd-3-clause | showError (Parser parseErr) = "Parse error at " ++ show parseErr | 64 | showError (Parser parseErr) = "Parse error at " ++ show parseErr | 64 | showError (Parser parseErr) = "Parse error at " ++ show parseErr | 64 | false | false | 0 | 7 | 10 | 22 | 10 | 12 | null | null |
agrafix/Spock | Spock-core/src/Web/Spock/Internal/Wire.hs | bsd-3-clause | multiHeaderMap :: HM.HashMap (CI.CI BS.ByteString) MultiHeader
multiHeaderMap =
HM.fromList $
flip map allHeaders $ \mh ->
(multiHeaderCI mh, mh)
where
-- this is a nasty hack until we know more about the origin of uncaught
-- exception: ErrorCall (toEnum{MultiHeader}: tag (-12565) is outside of
-- enumeration's range (0,12)) see:
-- https://ghc.haskell.org/trac/ghc/ticket/10792 and
-- https://github.com/agrafix/Spock/issues/44
allHeaders =
[ MultiHeaderCacheControl,
MultiHeaderConnection,
MultiHeaderContentEncoding,
MultiHeaderContentLanguage,
MultiHeaderPragma,
MultiHeaderProxyAuthenticate,
MultiHeaderTrailer,
MultiHeaderTransferEncoding,
MultiHeaderUpgrade,
MultiHeaderVia,
MultiHeaderWarning,
MultiHeaderWWWAuth,
MultiHeaderSetCookie
] | 893 | multiHeaderMap :: HM.HashMap (CI.CI BS.ByteString) MultiHeader
multiHeaderMap =
HM.fromList $
flip map allHeaders $ \mh ->
(multiHeaderCI mh, mh)
where
-- this is a nasty hack until we know more about the origin of uncaught
-- exception: ErrorCall (toEnum{MultiHeader}: tag (-12565) is outside of
-- enumeration's range (0,12)) see:
-- https://ghc.haskell.org/trac/ghc/ticket/10792 and
-- https://github.com/agrafix/Spock/issues/44
allHeaders =
[ MultiHeaderCacheControl,
MultiHeaderConnection,
MultiHeaderContentEncoding,
MultiHeaderContentLanguage,
MultiHeaderPragma,
MultiHeaderProxyAuthenticate,
MultiHeaderTrailer,
MultiHeaderTransferEncoding,
MultiHeaderUpgrade,
MultiHeaderVia,
MultiHeaderWarning,
MultiHeaderWWWAuth,
MultiHeaderSetCookie
] | 893 | multiHeaderMap =
HM.fromList $
flip map allHeaders $ \mh ->
(multiHeaderCI mh, mh)
where
-- this is a nasty hack until we know more about the origin of uncaught
-- exception: ErrorCall (toEnum{MultiHeader}: tag (-12565) is outside of
-- enumeration's range (0,12)) see:
-- https://ghc.haskell.org/trac/ghc/ticket/10792 and
-- https://github.com/agrafix/Spock/issues/44
allHeaders =
[ MultiHeaderCacheControl,
MultiHeaderConnection,
MultiHeaderContentEncoding,
MultiHeaderContentLanguage,
MultiHeaderPragma,
MultiHeaderProxyAuthenticate,
MultiHeaderTrailer,
MultiHeaderTransferEncoding,
MultiHeaderUpgrade,
MultiHeaderVia,
MultiHeaderWarning,
MultiHeaderWWWAuth,
MultiHeaderSetCookie
] | 830 | false | true | 4 | 8 | 216 | 117 | 64 | 53 | null | null |
michaeljklein/CPlug | src/Aux.hs | bsd-3-clause | lastTup x = Just . liftM2 (,) init last $ x | 44 | lastTup x = Just . liftM2 (,) init last $ x | 44 | lastTup x = Just . liftM2 (,) init last $ x | 44 | false | false | 0 | 8 | 11 | 27 | 13 | 14 | null | null |
basvandijk/explicit-iomodes-bytestring | Data/ByteString/Lazy/Char8/ExplicitIOModes.hs | bsd-3-clause | -- | Wraps @Data.ByteString.@'B.hGetNonBlocking'.
hGetNonBlocking ∷ ReadModes ioMode ⇒ Handle ioMode → Int → IO ByteString
hGetNonBlocking = wrap2 B.hGetNonBlocking | 164 | hGetNonBlocking ∷ ReadModes ioMode ⇒ Handle ioMode → Int → IO ByteString
hGetNonBlocking = wrap2 B.hGetNonBlocking | 114 | hGetNonBlocking = wrap2 B.hGetNonBlocking | 41 | true | true | 0 | 8 | 19 | 38 | 18 | 20 | null | null |
J2RGEZ/haskell-do | src/ghc-specific/Foreign/JQuery.hs | apache-2.0 | activateScriptTags :: String -> IO ()
activateScriptTags _ = return () | 70 | activateScriptTags :: String -> IO ()
activateScriptTags _ = return () | 70 | activateScriptTags _ = return () | 32 | false | true | 0 | 7 | 10 | 28 | 13 | 15 | null | null |
brendanhay/gogol | gogol-dfareporting/gen/Network/Google/Resource/DFAReporting/SubAccounts/Get.hs | mpl-2.0 | -- | JSONP
sagCallback :: Lens' SubAccountsGet (Maybe Text)
sagCallback
= lens _sagCallback (\ s a -> s{_sagCallback = a}) | 124 | sagCallback :: Lens' SubAccountsGet (Maybe Text)
sagCallback
= lens _sagCallback (\ s a -> s{_sagCallback = a}) | 113 | sagCallback
= lens _sagCallback (\ s a -> s{_sagCallback = a}) | 64 | true | true | 1 | 9 | 21 | 52 | 25 | 27 | null | null |
lmj/cayley-dickson | src/Math/CayleyDickson.hs | mit | (x1 :@ x2) `dot` (y1 :@ y2) = (x1 `dot` y1) + (x2 `dot` y2) | 59 | (x1 :@ x2) `dot` (y1 :@ y2) = (x1 `dot` y1) + (x2 `dot` y2) | 59 | (x1 :@ x2) `dot` (y1 :@ y2) = (x1 `dot` y1) + (x2 `dot` y2) | 59 | false | false | 0 | 7 | 14 | 50 | 29 | 21 | null | null |
ddssff/pandoc | src/Text/Pandoc/Writers/RST.hs | gpl-2.0 | blockToRST (Div attr bs) = do
contents <- blockListToRST bs
let startTag = ".. raw:: html" $+$ nest 3 (tagWithAttrs "div" attr)
let endTag = ".. raw:: html" $+$ nest 3 "</div>"
return $ blankline <> startTag $+$ contents $+$ endTag $$ blankline | 252 | blockToRST (Div attr bs) = do
contents <- blockListToRST bs
let startTag = ".. raw:: html" $+$ nest 3 (tagWithAttrs "div" attr)
let endTag = ".. raw:: html" $+$ nest 3 "</div>"
return $ blankline <> startTag $+$ contents $+$ endTag $$ blankline | 252 | blockToRST (Div attr bs) = do
contents <- blockListToRST bs
let startTag = ".. raw:: html" $+$ nest 3 (tagWithAttrs "div" attr)
let endTag = ".. raw:: html" $+$ nest 3 "</div>"
return $ blankline <> startTag $+$ contents $+$ endTag $$ blankline | 252 | false | false | 0 | 13 | 50 | 94 | 43 | 51 | null | null |
Thhethssmuz/ppp | src/Filter/WrapFloat.hs | mit | mkId "Table" = return "table" | 30 | mkId "Table" = return "table" | 30 | mkId "Table" = return "table" | 30 | false | false | 1 | 5 | 5 | 16 | 5 | 11 | null | null |
vikraman/ghc | compiler/cmm/CmmNode.hs | bsd-3-clause | mapExpM _ (CmmComment _) = Nothing | 45 | mapExpM _ (CmmComment _) = Nothing | 45 | mapExpM _ (CmmComment _) = Nothing | 45 | false | false | 1 | 6 | 16 | 20 | 8 | 12 | null | null |
kapilash/scheme | pf/PostFix/src/Language/PostFix/DT.hs | apache-2.0 | remainder :: PFCommand ()
remainder = do
i1 <- readNum
i2 <- readNum
if i1 == 0
then fail "modulo zero"
else writeNum $ i2 `rem` i1 | 145 | remainder :: PFCommand ()
remainder = do
i1 <- readNum
i2 <- readNum
if i1 == 0
then fail "modulo zero"
else writeNum $ i2 `rem` i1 | 145 | remainder = do
i1 <- readNum
i2 <- readNum
if i1 == 0
then fail "modulo zero"
else writeNum $ i2 `rem` i1 | 119 | false | true | 0 | 9 | 40 | 58 | 29 | 29 | null | null |
kadena-io/pact | src/Pact/Native/Db.hs | bsd-3-clause | keys' :: GasRNativeFun e
keys' g i [table@TTable {}] = do
gasPostReads i g
((\b -> TList (V.fromList b) tTyString def) . map toTerm) $ do
guardTable i table GtKeys
keys (_faInfo i) (userTable table) | 216 | keys' :: GasRNativeFun e
keys' g i [table@TTable {}] = do
gasPostReads i g
((\b -> TList (V.fromList b) tTyString def) . map toTerm) $ do
guardTable i table GtKeys
keys (_faInfo i) (userTable table) | 216 | keys' g i [table@TTable {}] = do
gasPostReads i g
((\b -> TList (V.fromList b) tTyString def) . map toTerm) $ do
guardTable i table GtKeys
keys (_faInfo i) (userTable table) | 191 | false | true | 0 | 16 | 52 | 108 | 52 | 56 | null | null |
mbakke/ganeti | src/Ganeti/DataCollectors/XenCpuLoad.hs | bsd-2-clause | -- | Read xentop output, if this program is available.
readXentop :: IO (Result String)
readXentop =
runResultT . liftIO $ readProcess C.xentopCommand ["-f", "-b", "-i", "1"] "" | 179 | readXentop :: IO (Result String)
readXentop =
runResultT . liftIO $ readProcess C.xentopCommand ["-f", "-b", "-i", "1"] "" | 124 | readXentop =
runResultT . liftIO $ readProcess C.xentopCommand ["-f", "-b", "-i", "1"] "" | 91 | true | true | 0 | 7 | 29 | 50 | 27 | 23 | null | null |
tolysz/prepare-ghcjs | spec-lts8/cabal/Cabal/Distribution/Simple/Utils.hs | bsd-3-clause | notice :: Verbosity -> String -> IO ()
notice verbosity msg =
when (verbosity >= normal) $
putStr (wrapText msg) | 118 | notice :: Verbosity -> String -> IO ()
notice verbosity msg =
when (verbosity >= normal) $
putStr (wrapText msg) | 118 | notice verbosity msg =
when (verbosity >= normal) $
putStr (wrapText msg) | 79 | false | true | 0 | 8 | 25 | 52 | 25 | 27 | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.