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
MaximKN/Haskell1
src/REPL.hs
gpl-3.0
-- | Add variable to tree of variables updateTreeVars :: (Ord a) => a -> b -> Tree (a, b) -> Tree (a, b) updateTreeVars n v Empty = Node (n,v) Empty Empty
155
updateTreeVars :: (Ord a) => a -> b -> Tree (a, b) -> Tree (a, b) updateTreeVars n v Empty = Node (n,v) Empty Empty
116
updateTreeVars n v Empty = Node (n,v) Empty Empty
50
true
true
0
10
33
71
38
33
null
null
badp/ganeti
test/hs/Test/Ganeti/OpCodes.hs
gpl-2.0
case_py_compat_fields :: HUnit.Assertion case_py_compat_fields = do let hs_fields = sort $ map (\op_id -> (op_id, OpCodes.allOpFields op_id)) OpCodes.allOpIDs py_stdout <- runPython "from ganeti import opcodes\n\ \import sys\n\ \from ganeti import serializer\n\ \fields = [(k, sorted([p[0] for p in v.OP_PARAMS]))\n\ \ for k, v in opcodes.OP_MAPPING.items()]\n\ \print serializer.Dump(fields)" "" >>= checkPythonResult let deserialised = J.decode py_stdout::J.Result [(String, [String])] py_fields <- case deserialised of J.Ok v -> return $ sort v J.Error msg -> HUnit.assertFailure ("Unable to decode op fields: " ++ msg) -- this already raised an expection, but we need it -- for proper types >> fail "Unable to decode op fields" HUnit.assertEqual "Mismatch in number of returned opcodes" (length hs_fields) (length py_fields) HUnit.assertEqual "Mismatch in defined OP_IDs" (map fst hs_fields) (map fst py_fields) mapM_ (\((py_id, py_flds), (hs_id, hs_flds)) -> do HUnit.assertEqual "Mismatch in OP_ID" py_id hs_id HUnit.assertEqual ("Mismatch in fields for " ++ hs_id) py_flds hs_flds ) $ zip py_fields hs_fields -- | Checks that setOpComment works correctly.
1,458
case_py_compat_fields :: HUnit.Assertion case_py_compat_fields = do let hs_fields = sort $ map (\op_id -> (op_id, OpCodes.allOpFields op_id)) OpCodes.allOpIDs py_stdout <- runPython "from ganeti import opcodes\n\ \import sys\n\ \from ganeti import serializer\n\ \fields = [(k, sorted([p[0] for p in v.OP_PARAMS]))\n\ \ for k, v in opcodes.OP_MAPPING.items()]\n\ \print serializer.Dump(fields)" "" >>= checkPythonResult let deserialised = J.decode py_stdout::J.Result [(String, [String])] py_fields <- case deserialised of J.Ok v -> return $ sort v J.Error msg -> HUnit.assertFailure ("Unable to decode op fields: " ++ msg) -- this already raised an expection, but we need it -- for proper types >> fail "Unable to decode op fields" HUnit.assertEqual "Mismatch in number of returned opcodes" (length hs_fields) (length py_fields) HUnit.assertEqual "Mismatch in defined OP_IDs" (map fst hs_fields) (map fst py_fields) mapM_ (\((py_id, py_flds), (hs_id, hs_flds)) -> do HUnit.assertEqual "Mismatch in OP_ID" py_id hs_id HUnit.assertEqual ("Mismatch in fields for " ++ hs_id) py_flds hs_flds ) $ zip py_fields hs_fields -- | Checks that setOpComment works correctly.
1,458
case_py_compat_fields = do let hs_fields = sort $ map (\op_id -> (op_id, OpCodes.allOpFields op_id)) OpCodes.allOpIDs py_stdout <- runPython "from ganeti import opcodes\n\ \import sys\n\ \from ganeti import serializer\n\ \fields = [(k, sorted([p[0] for p in v.OP_PARAMS]))\n\ \ for k, v in opcodes.OP_MAPPING.items()]\n\ \print serializer.Dump(fields)" "" >>= checkPythonResult let deserialised = J.decode py_stdout::J.Result [(String, [String])] py_fields <- case deserialised of J.Ok v -> return $ sort v J.Error msg -> HUnit.assertFailure ("Unable to decode op fields: " ++ msg) -- this already raised an expection, but we need it -- for proper types >> fail "Unable to decode op fields" HUnit.assertEqual "Mismatch in number of returned opcodes" (length hs_fields) (length py_fields) HUnit.assertEqual "Mismatch in defined OP_IDs" (map fst hs_fields) (map fst py_fields) mapM_ (\((py_id, py_flds), (hs_id, hs_flds)) -> do HUnit.assertEqual "Mismatch in OP_ID" py_id hs_id HUnit.assertEqual ("Mismatch in fields for " ++ hs_id) py_flds hs_flds ) $ zip py_fields hs_fields -- | Checks that setOpComment works correctly.
1,417
false
true
0
16
454
288
143
145
null
null
nikivazou/hscolour
Language/Haskell/HsColour/MIRC.hs
gpl-2.0
code Green False = "3"
24
code Green False = "3"
24
code Green False = "3"
24
false
false
1
5
6
16
5
11
null
null
rrnewton/hgdata_trash
src/Main.hs
mit
-- | Dispatch a command-line request. dispatch :: HGData -> IO () dispatch (OAuth2Url clientId) = putStrLn $ OA2.formUrl (OA2.OAuth2Client clientId undefined) $ mapMaybe (`lookup` OA2.googleScopes) [ "Google Cloud Storage" , "Contacts" , "Picasa Web" , "Google Books" ]
302
dispatch :: HGData -> IO () dispatch (OAuth2Url clientId) = putStrLn $ OA2.formUrl (OA2.OAuth2Client clientId undefined) $ mapMaybe (`lookup` OA2.googleScopes) [ "Google Cloud Storage" , "Contacts" , "Picasa Web" , "Google Books" ]
263
dispatch (OAuth2Url clientId) = putStrLn $ OA2.formUrl (OA2.OAuth2Client clientId undefined) $ mapMaybe (`lookup` OA2.googleScopes) [ "Google Cloud Storage" , "Contacts" , "Picasa Web" , "Google Books" ]
235
true
true
0
10
71
79
42
37
null
null
shlevy/ghc
compiler/types/TyCoRep.hs
bsd-3-clause
tidyType env (TyConApp tycon tys) = let args = tidyTypes env tys in args `seqList` TyConApp tycon args
138
tidyType env (TyConApp tycon tys) = let args = tidyTypes env tys in args `seqList` TyConApp tycon args
138
tidyType env (TyConApp tycon tys) = let args = tidyTypes env tys in args `seqList` TyConApp tycon args
138
false
false
0
9
53
48
22
26
null
null
rahulmutt/ghcvm
compiler/Eta/Prelude/PrelNames.hs
bsd-3-clause
geIntegerPrimIdKey = mkPreludeMiscIdUnique 77
56
geIntegerPrimIdKey = mkPreludeMiscIdUnique 77
56
geIntegerPrimIdKey = mkPreludeMiscIdUnique 77
56
false
false
0
5
14
9
4
5
null
null
lynnard/cocos2d-hs
src/Graphics/UI/Cocos2d/Std.hs
bsd-3-clause
stdString_GE :: (StdStringValue arg'1, StdStringValue arg'2) => arg'1 -> arg'2 -> HoppyP.IO HoppyP.Bool stdString_GE arg'1 arg'2 = withStdStringPtr arg'1 $ HoppyP.flip HoppyFHR.withCppPtr $ \arg'1' -> withStdStringPtr arg'2 $ HoppyP.flip HoppyFHR.withCppPtr $ \arg'2' -> HoppyP.fmap (/= 0) (stdString_GE' arg'1' arg'2')
327
stdString_GE :: (StdStringValue arg'1, StdStringValue arg'2) => arg'1 -> arg'2 -> HoppyP.IO HoppyP.Bool stdString_GE arg'1 arg'2 = withStdStringPtr arg'1 $ HoppyP.flip HoppyFHR.withCppPtr $ \arg'1' -> withStdStringPtr arg'2 $ HoppyP.flip HoppyFHR.withCppPtr $ \arg'2' -> HoppyP.fmap (/= 0) (stdString_GE' arg'1' arg'2')
327
stdString_GE arg'1 arg'2 = withStdStringPtr arg'1 $ HoppyP.flip HoppyFHR.withCppPtr $ \arg'1' -> withStdStringPtr arg'2 $ HoppyP.flip HoppyFHR.withCppPtr $ \arg'2' -> HoppyP.fmap (/= 0) (stdString_GE' arg'1' arg'2')
223
false
true
4
10
46
119
56
63
null
null
ivanperez-keera/Yampa
yampa/src/FRP/Yampa/InternalCore.hs
bsd-3-clause
sfArr (FDG f) = sfArrG f
28
sfArr (FDG f) = sfArrG f
28
sfArr (FDG f) = sfArrG f
28
false
false
0
7
9
18
8
10
null
null
splondike/depcache
src/DepProcessors/Npm.hs
gpl-3.0
findDefinitions :: [FilePath] -> IO [NpmDefinition] findDefinitions files = return $ map NpmDefinition filtered where filtered = filter ((=="package.json") . getFileName) files
185
findDefinitions :: [FilePath] -> IO [NpmDefinition] findDefinitions files = return $ map NpmDefinition filtered where filtered = filter ((=="package.json") . getFileName) files
185
findDefinitions files = return $ map NpmDefinition filtered where filtered = filter ((=="package.json") . getFileName) files
133
false
true
0
8
30
60
31
29
null
null
brendanhay/gogol
gogol-storage/gen/Network/Google/Resource/Storage/Objects/Rewrite.hs
mpl-2.0
-- | Resource name of the Cloud KMS key, of the form -- projects\/my-project\/locations\/global\/keyRings\/my-kr\/cryptoKeys\/my-key, -- that will be used to encrypt the object. Overrides the object -- metadata\'s kms_key_name value, if any. orDestinationKmsKeyName :: Lens' ObjectsRewrite (Maybe Text) orDestinationKmsKeyName = lens _orDestinationKmsKeyName (\ s a -> s{_orDestinationKmsKeyName = a})
409
orDestinationKmsKeyName :: Lens' ObjectsRewrite (Maybe Text) orDestinationKmsKeyName = lens _orDestinationKmsKeyName (\ s a -> s{_orDestinationKmsKeyName = a})
167
orDestinationKmsKeyName = lens _orDestinationKmsKeyName (\ s a -> s{_orDestinationKmsKeyName = a})
106
true
true
0
9
56
51
28
23
null
null
GaloisInc/sk-dev-platform
libs/genLobster/Main.hs
bsd-3-clause
updateList :: (a -> Maybe a) -> [a] -> [a] updateList _ [] = []
63
updateList :: (a -> Maybe a) -> [a] -> [a] updateList _ [] = []
63
updateList _ [] = []
20
false
true
0
8
14
44
23
21
null
null
ozgurakgun/Idris-dev
src/Idris/REPL/Parser.hs
bsd-3-clause
nameArgCmd names command doc = (names, NameArg, doc, fnNameArg command)
73
nameArgCmd names command doc = (names, NameArg, doc, fnNameArg command)
73
nameArgCmd names command doc = (names, NameArg, doc, fnNameArg command)
73
false
false
0
6
11
28
15
13
null
null
mcmaniac/ghc
compiler/llvmGen/LlvmCodeGen/Base.hs
bsd-3-clause
-- | Create an external definition for a 'CLabel' defined in another module. genCmmLabelRef :: LlvmEnv -> CLabel -> LMGlobal genCmmLabelRef env = genStringLabelRef . strCLabel_llvm env
184
genCmmLabelRef :: LlvmEnv -> CLabel -> LMGlobal genCmmLabelRef env = genStringLabelRef . strCLabel_llvm env
107
genCmmLabelRef env = genStringLabelRef . strCLabel_llvm env
59
true
true
0
6
26
30
15
15
null
null
spechub/Hets
OWL2/XMLConversion.hs
gpl-2.0
xmlObjProp :: ObjectPropertyExpression -> Element xmlObjProp ope = case ope of ObjectProp op -> mwNameIRI objectPropertyK op ObjectInverseOf i -> makeElement objectInverseOfK [xmlObjProp i]
197
xmlObjProp :: ObjectPropertyExpression -> Element xmlObjProp ope = case ope of ObjectProp op -> mwNameIRI objectPropertyK op ObjectInverseOf i -> makeElement objectInverseOfK [xmlObjProp i]
197
xmlObjProp ope = case ope of ObjectProp op -> mwNameIRI objectPropertyK op ObjectInverseOf i -> makeElement objectInverseOfK [xmlObjProp i]
147
false
true
0
10
31
56
26
30
null
null
zaxtax/hakaru
haskell/Tests/Disintegrate.hs
bsd-3-clause
---------------------------------------------------------------- naiveBayes :: Model ('HArray ('HArray 'HNat)) ('HArray 'HNat) naiveBayes = plate numLabels (\_ -> dirichlet (array sizeVocab (\_ -> prob_ 1))) >>= \bs -> dirichlet (array numLabels (\_ -> prob_ 1)) >>= \ts -> plate numDocs (\_ -> categorical ts) >>= \zs -> plate numDocs (\i -> plate sizeEachDoc (\_ -> categorical (bs ! (zs ! i)))) >>= \ds -> dirac (pair ds zs) where sizeVocab = nat_ 1000 numLabels = nat_ 40 numDocs = nat_ 200 sizeEachDoc = nat_ 5000
615
naiveBayes :: Model ('HArray ('HArray 'HNat)) ('HArray 'HNat) naiveBayes = plate numLabels (\_ -> dirichlet (array sizeVocab (\_ -> prob_ 1))) >>= \bs -> dirichlet (array numLabels (\_ -> prob_ 1)) >>= \ts -> plate numDocs (\_ -> categorical ts) >>= \zs -> plate numDocs (\i -> plate sizeEachDoc (\_ -> categorical (bs ! (zs ! i)))) >>= \ds -> dirac (pair ds zs) where sizeVocab = nat_ 1000 numLabels = nat_ 40 numDocs = nat_ 200 sizeEachDoc = nat_ 5000
550
naiveBayes = plate numLabels (\_ -> dirichlet (array sizeVocab (\_ -> prob_ 1))) >>= \bs -> dirichlet (array numLabels (\_ -> prob_ 1)) >>= \ts -> plate numDocs (\_ -> categorical ts) >>= \zs -> plate numDocs (\i -> plate sizeEachDoc (\_ -> categorical (bs ! (zs ! i)))) >>= \ds -> dirac (pair ds zs) where sizeVocab = nat_ 1000 numLabels = nat_ 40 numDocs = nat_ 200 sizeEachDoc = nat_ 5000
484
true
true
0
15
178
251
126
125
null
null
garetxe/cabal
cabal-install/Distribution/Client/Sandbox/Timestamp.hs
bsd-3-clause
withTimestampFile :: FilePath -> ([TimestampFileRecord] -> IO [TimestampFileRecord]) -> IO () withTimestampFile sandboxDir process = do let timestampFile = sandboxDir </> timestampFileName timestampRecords <- readTimestampFile timestampFile >>= process writeTimestampFile timestampFile timestampRecords -- | Given a list of 'AddSourceTimestamp's, a list of paths to add-source deps -- we've added and an initial timestamp, add an 'AddSourceTimestamp' to the list -- for each path. If a timestamp for a given path already exists in the list, -- update it.
603
withTimestampFile :: FilePath -> ([TimestampFileRecord] -> IO [TimestampFileRecord]) -> IO () withTimestampFile sandboxDir process = do let timestampFile = sandboxDir </> timestampFileName timestampRecords <- readTimestampFile timestampFile >>= process writeTimestampFile timestampFile timestampRecords -- | Given a list of 'AddSourceTimestamp's, a list of paths to add-source deps -- we've added and an initial timestamp, add an 'AddSourceTimestamp' to the list -- for each path. If a timestamp for a given path already exists in the list, -- update it.
603
withTimestampFile sandboxDir process = do let timestampFile = sandboxDir </> timestampFileName timestampRecords <- readTimestampFile timestampFile >>= process writeTimestampFile timestampFile timestampRecords -- | Given a list of 'AddSourceTimestamp's, a list of paths to add-source deps -- we've added and an initial timestamp, add an 'AddSourceTimestamp' to the list -- for each path. If a timestamp for a given path already exists in the list, -- update it.
467
false
true
1
10
125
84
42
42
null
null
johnjcamilleri/maltese-functional-morphology
malti/AttrMt.hs
lgpl-3.0
atP :: Attr atP = 3
20
atP :: Attr atP = 3
20
atP = 3
8
false
true
0
4
6
11
6
5
null
null
rahulmutt/ghcvm
compiler/Eta/Core/CoreFVs.hs
bsd-3-clause
idUnfoldingFVs :: Id -> FV idUnfoldingFVs id = stableUnfoldingFVs (realIdUnfolding id) `orElse` emptyFV
103
idUnfoldingFVs :: Id -> FV idUnfoldingFVs id = stableUnfoldingFVs (realIdUnfolding id) `orElse` emptyFV
103
idUnfoldingFVs id = stableUnfoldingFVs (realIdUnfolding id) `orElse` emptyFV
76
false
true
0
8
12
33
17
16
null
null
keera-studios/hsQt
Qtc/ClassTypes/Gui.hs
bsd-2-clause
qTableWidgetItemAddFinalizer1 :: QTableWidgetItem a -> IO () qTableWidgetItemAddFinalizer1 (Object fp) = addForeignPtrFinalizer qtc_QTableWidgetItem_getFinalizer1 fp
167
qTableWidgetItemAddFinalizer1 :: QTableWidgetItem a -> IO () qTableWidgetItemAddFinalizer1 (Object fp) = addForeignPtrFinalizer qtc_QTableWidgetItem_getFinalizer1 fp
167
qTableWidgetItemAddFinalizer1 (Object fp) = addForeignPtrFinalizer qtc_QTableWidgetItem_getFinalizer1 fp
106
false
true
0
7
15
37
17
20
null
null
ezyang/ghc
testsuite/tests/typecheck/should_fail/T12973.hs
bsd-3-clause
foo :: forall (a :: TYPE r). Num a => a foo = 3 + 4
51
foo :: forall (a :: TYPE r). Num a => a foo = 3 + 4
51
foo = 3 + 4
11
false
true
2
9
15
44
20
24
null
null
hsinewu/Nand2tetris
06/Decode.hs
mit
decodeJump "JGE" = "011"
24
decodeJump "JGE" = "011"
24
decodeJump "JGE" = "011"
24
false
false
1
5
3
13
4
9
null
null
elieux/ghc
compiler/nativeGen/X86/Ppr.hs
bsd-3-clause
ppr_reg_float :: Int -> LitString ppr_reg_float i = case i of 16 -> sLit "%fake0"; 17 -> sLit "%fake1" 18 -> sLit "%fake2"; 19 -> sLit "%fake3" 20 -> sLit "%fake4"; 21 -> sLit "%fake5" 24 -> sLit "%xmm0"; 25 -> sLit "%xmm1" 26 -> sLit "%xmm2"; 27 -> sLit "%xmm3" 28 -> sLit "%xmm4"; 29 -> sLit "%xmm5" 30 -> sLit "%xmm6"; 31 -> sLit "%xmm7" 32 -> sLit "%xmm8"; 33 -> sLit "%xmm9" 34 -> sLit "%xmm10"; 35 -> sLit "%xmm11" 36 -> sLit "%xmm12"; 37 -> sLit "%xmm13" 38 -> sLit "%xmm14"; 39 -> sLit "%xmm15" _ -> sLit "very naughty x86 register"
653
ppr_reg_float :: Int -> LitString ppr_reg_float i = case i of 16 -> sLit "%fake0"; 17 -> sLit "%fake1" 18 -> sLit "%fake2"; 19 -> sLit "%fake3" 20 -> sLit "%fake4"; 21 -> sLit "%fake5" 24 -> sLit "%xmm0"; 25 -> sLit "%xmm1" 26 -> sLit "%xmm2"; 27 -> sLit "%xmm3" 28 -> sLit "%xmm4"; 29 -> sLit "%xmm5" 30 -> sLit "%xmm6"; 31 -> sLit "%xmm7" 32 -> sLit "%xmm8"; 33 -> sLit "%xmm9" 34 -> sLit "%xmm10"; 35 -> sLit "%xmm11" 36 -> sLit "%xmm12"; 37 -> sLit "%xmm13" 38 -> sLit "%xmm14"; 39 -> sLit "%xmm15" _ -> sLit "very naughty x86 register"
653
ppr_reg_float i = case i of 16 -> sLit "%fake0"; 17 -> sLit "%fake1" 18 -> sLit "%fake2"; 19 -> sLit "%fake3" 20 -> sLit "%fake4"; 21 -> sLit "%fake5" 24 -> sLit "%xmm0"; 25 -> sLit "%xmm1" 26 -> sLit "%xmm2"; 27 -> sLit "%xmm3" 28 -> sLit "%xmm4"; 29 -> sLit "%xmm5" 30 -> sLit "%xmm6"; 31 -> sLit "%xmm7" 32 -> sLit "%xmm8"; 33 -> sLit "%xmm9" 34 -> sLit "%xmm10"; 35 -> sLit "%xmm11" 36 -> sLit "%xmm12"; 37 -> sLit "%xmm13" 38 -> sLit "%xmm14"; 39 -> sLit "%xmm15" _ -> sLit "very naughty x86 register"
619
false
true
0
8
218
240
114
126
null
null
bgw/hs-rpal
src/Parser.hs
gpl-3.0
parseA :: [Token] -> ParserResult parseA tokens = do (aa, ta) <- parseAtNeg tokens parseAPartial aa ta where parseAPartial leftAst partialTokens = case partialTokens of (TokenOperator "+" : ta) -> do (ab, tb) <- parseAtNeg ta parseAPartial (AstPlus leftAst ab) tb (TokenOperator "-" : ta) -> do (ab, tb) <- parseAtNeg ta parseAPartial (AstMinus leftAst ab) tb _ -> return (leftAst, partialTokens) -- handle possible '+' or '-' uniary operators parseAtNeg (TokenOperator "-" : partialTokens) = do (aa, ta) <- parseAt partialTokens return (AstNeg aa, ta) parseAtNeg (TokenOperator "+" : partialTokens) = parseAt partialTokens parseAtNeg partialTokens = parseAt partialTokens -- At -> At '*' Af -- -> At '/' Af -- -> Af
983
parseA :: [Token] -> ParserResult parseA tokens = do (aa, ta) <- parseAtNeg tokens parseAPartial aa ta where parseAPartial leftAst partialTokens = case partialTokens of (TokenOperator "+" : ta) -> do (ab, tb) <- parseAtNeg ta parseAPartial (AstPlus leftAst ab) tb (TokenOperator "-" : ta) -> do (ab, tb) <- parseAtNeg ta parseAPartial (AstMinus leftAst ab) tb _ -> return (leftAst, partialTokens) -- handle possible '+' or '-' uniary operators parseAtNeg (TokenOperator "-" : partialTokens) = do (aa, ta) <- parseAt partialTokens return (AstNeg aa, ta) parseAtNeg (TokenOperator "+" : partialTokens) = parseAt partialTokens parseAtNeg partialTokens = parseAt partialTokens -- At -> At '*' Af -- -> At '/' Af -- -> Af
983
parseA tokens = do (aa, ta) <- parseAtNeg tokens parseAPartial aa ta where parseAPartial leftAst partialTokens = case partialTokens of (TokenOperator "+" : ta) -> do (ab, tb) <- parseAtNeg ta parseAPartial (AstPlus leftAst ab) tb (TokenOperator "-" : ta) -> do (ab, tb) <- parseAtNeg ta parseAPartial (AstMinus leftAst ab) tb _ -> return (leftAst, partialTokens) -- handle possible '+' or '-' uniary operators parseAtNeg (TokenOperator "-" : partialTokens) = do (aa, ta) <- parseAt partialTokens return (AstNeg aa, ta) parseAtNeg (TokenOperator "+" : partialTokens) = parseAt partialTokens parseAtNeg partialTokens = parseAt partialTokens -- At -> At '*' Af -- -> At '/' Af -- -> Af
949
false
true
3
13
379
258
128
130
null
null
fmthoma/ghc
compiler/specialise/Rules.hs
bsd-3-clause
matchN :: InScopeEnv -> [Var] -- ^ Match template type variables -> [CoreExpr] -- ^ Match template -> [CoreExpr] -- ^ Target; can have more elements than the template -> Maybe (BindWrapper, -- Floated bindings; see Note [Matching lets] [CoreExpr]) -- For a given match template and context, find bindings to wrap around -- the entire result and what should be substituted for each template variable. -- Fail if there are two few actual arguments from the target to match the template matchN (in_scope, id_unf) tmpl_vars tmpl_es target_es = do { subst <- go init_menv emptyRuleSubst tmpl_es target_es ; return (rs_binds subst, map (lookup_tmpl subst) tmpl_vars') } where (init_rn_env, tmpl_vars') = mapAccumL rnBndrL (mkRnEnv2 in_scope) tmpl_vars -- See Note [Template binders] init_menv = RV { rv_tmpls = mkVarSet tmpl_vars', rv_lcl = init_rn_env , rv_fltR = mkEmptySubst (rnInScopeSet init_rn_env) , rv_unf = id_unf } go _ subst [] _ = Just subst go _ _ _ [] = Nothing -- Fail if too few actual args go menv subst (t:ts) (e:es) = do { subst1 <- match menv subst t e ; go menv subst1 ts es } lookup_tmpl :: RuleSubst -> Var -> CoreExpr lookup_tmpl (RS { rs_tv_subst = tv_subst, rs_id_subst = id_subst }) tmpl_var' | isId tmpl_var' = case lookupVarEnv id_subst tmpl_var' of Just e -> e _ -> unbound tmpl_var' | otherwise = case lookupVarEnv tv_subst tmpl_var' of Just ty -> Type ty Nothing -> unbound tmpl_var' unbound var = pprPanic "Template variable unbound in rewrite rule" (ppr var $$ ppr tmpl_vars $$ ppr tmpl_vars' $$ ppr tmpl_es $$ ppr target_es) {- Note [Template binders] ~~~~~~~~~~~~~~~~~~~~~~~ Consider the following match: Template: forall x. f x Target: f (x+1) This should succeed, because the template variable 'x' has nothing to do with the 'x' in the target. On reflection, this case probably does just work, but this might not Template: forall x. f (\x.x) Target: f (\y.y) Here we want to clone when we find the \x, but to know that x must be in scope To achive this, we use rnBndrL to rename the template variables if necessary; the renamed ones are the tmpl_vars' ************************************************************************ * * The main matcher * * ************************************************************************ --------------------------------------------- The inner workings of matching --------------------------------------------- -} -- * The domain of the TvSubstEnv and IdSubstEnv are the template -- variables passed into the match. -- -- * The BindWrapper in a RuleSubst are the bindings floated out -- from nested matches; see the Let case of match, below --
3,290
matchN :: InScopeEnv -> [Var] -- ^ Match template type variables -> [CoreExpr] -- ^ Match template -> [CoreExpr] -- ^ Target; can have more elements than the template -> Maybe (BindWrapper, -- Floated bindings; see Note [Matching lets] [CoreExpr]) matchN (in_scope, id_unf) tmpl_vars tmpl_es target_es = do { subst <- go init_menv emptyRuleSubst tmpl_es target_es ; return (rs_binds subst, map (lookup_tmpl subst) tmpl_vars') } where (init_rn_env, tmpl_vars') = mapAccumL rnBndrL (mkRnEnv2 in_scope) tmpl_vars -- See Note [Template binders] init_menv = RV { rv_tmpls = mkVarSet tmpl_vars', rv_lcl = init_rn_env , rv_fltR = mkEmptySubst (rnInScopeSet init_rn_env) , rv_unf = id_unf } go _ subst [] _ = Just subst go _ _ _ [] = Nothing -- Fail if too few actual args go menv subst (t:ts) (e:es) = do { subst1 <- match menv subst t e ; go menv subst1 ts es } lookup_tmpl :: RuleSubst -> Var -> CoreExpr lookup_tmpl (RS { rs_tv_subst = tv_subst, rs_id_subst = id_subst }) tmpl_var' | isId tmpl_var' = case lookupVarEnv id_subst tmpl_var' of Just e -> e _ -> unbound tmpl_var' | otherwise = case lookupVarEnv tv_subst tmpl_var' of Just ty -> Type ty Nothing -> unbound tmpl_var' unbound var = pprPanic "Template variable unbound in rewrite rule" (ppr var $$ ppr tmpl_vars $$ ppr tmpl_vars' $$ ppr tmpl_es $$ ppr target_es) {- Note [Template binders] ~~~~~~~~~~~~~~~~~~~~~~~ Consider the following match: Template: forall x. f x Target: f (x+1) This should succeed, because the template variable 'x' has nothing to do with the 'x' in the target. On reflection, this case probably does just work, but this might not Template: forall x. f (\x.x) Target: f (\y.y) Here we want to clone when we find the \x, but to know that x must be in scope To achive this, we use rnBndrL to rename the template variables if necessary; the renamed ones are the tmpl_vars' ************************************************************************ * * The main matcher * * ************************************************************************ --------------------------------------------- The inner workings of matching --------------------------------------------- -} -- * The domain of the TvSubstEnv and IdSubstEnv are the template -- variables passed into the match. -- -- * The BindWrapper in a RuleSubst are the bindings floated out -- from nested matches; see the Let case of match, below --
3,053
matchN (in_scope, id_unf) tmpl_vars tmpl_es target_es = do { subst <- go init_menv emptyRuleSubst tmpl_es target_es ; return (rs_binds subst, map (lookup_tmpl subst) tmpl_vars') } where (init_rn_env, tmpl_vars') = mapAccumL rnBndrL (mkRnEnv2 in_scope) tmpl_vars -- See Note [Template binders] init_menv = RV { rv_tmpls = mkVarSet tmpl_vars', rv_lcl = init_rn_env , rv_fltR = mkEmptySubst (rnInScopeSet init_rn_env) , rv_unf = id_unf } go _ subst [] _ = Just subst go _ _ _ [] = Nothing -- Fail if too few actual args go menv subst (t:ts) (e:es) = do { subst1 <- match menv subst t e ; go menv subst1 ts es } lookup_tmpl :: RuleSubst -> Var -> CoreExpr lookup_tmpl (RS { rs_tv_subst = tv_subst, rs_id_subst = id_subst }) tmpl_var' | isId tmpl_var' = case lookupVarEnv id_subst tmpl_var' of Just e -> e _ -> unbound tmpl_var' | otherwise = case lookupVarEnv tv_subst tmpl_var' of Just ty -> Type ty Nothing -> unbound tmpl_var' unbound var = pprPanic "Template variable unbound in rewrite rule" (ppr var $$ ppr tmpl_vars $$ ppr tmpl_vars' $$ ppr tmpl_es $$ ppr target_es) {- Note [Template binders] ~~~~~~~~~~~~~~~~~~~~~~~ Consider the following match: Template: forall x. f x Target: f (x+1) This should succeed, because the template variable 'x' has nothing to do with the 'x' in the target. On reflection, this case probably does just work, but this might not Template: forall x. f (\x.x) Target: f (\y.y) Here we want to clone when we find the \x, but to know that x must be in scope To achive this, we use rnBndrL to rename the template variables if necessary; the renamed ones are the tmpl_vars' ************************************************************************ * * The main matcher * * ************************************************************************ --------------------------------------------- The inner workings of matching --------------------------------------------- -} -- * The domain of the TvSubstEnv and IdSubstEnv are the template -- variables passed into the match. -- -- * The BindWrapper in a RuleSubst are the bindings floated out -- from nested matches; see the Let case of match, below --
2,718
true
true
5
12
1,095
470
237
233
null
null
olorin/amazonka
amazonka-iam/gen/Network/AWS/IAM/Types.hs
mpl-2.0
-- | The request was rejected because the same certificate is associated with -- an IAM user in the account. _DuplicateCertificateException :: AsError a => Getting (First ServiceError) a ServiceError _DuplicateCertificateException = _ServiceError . hasStatus 409 . hasCode "DuplicateCertificate"
299
_DuplicateCertificateException :: AsError a => Getting (First ServiceError) a ServiceError _DuplicateCertificateException = _ServiceError . hasStatus 409 . hasCode "DuplicateCertificate"
190
_DuplicateCertificateException = _ServiceError . hasStatus 409 . hasCode "DuplicateCertificate"
99
true
true
1
8
42
48
23
25
null
null
ad0/robozzle-hs
src/Engine.hs
gpl-3.0
turnLeft DirRight = DirUp
25
turnLeft DirRight = DirUp
25
turnLeft DirRight = DirUp
25
false
false
0
5
3
9
4
5
null
null
GaloisInc/saw-script
src/SAWScript/Builtins.hs
bsd-3-clause
cecPrim :: AIGNetwork -> AIGNetwork -> TopLevel ProofResult cecPrim (SV.AIGNetwork x) (SV.AIGNetwork y) = do y' <- case cast y of Just n -> return n Nothing -> fail "Inconsistent AIG types" io $ verifyAIGCompatible x y' res <- io $ AIG.cec x y' let stats = solverStats "ABC" 0 -- TODO, count the size of the networks... case res of AIG.Valid -> return $ ValidProof stats (error "cecPrim: deprecated function!") AIG.Invalid bs | Just _fv <- readFiniteValue (FTVec (fromIntegral (length bs)) FTBit) bs -> return $ InvalidProof stats [] (error "cecPRim : deprecated function!") | otherwise -> fail "cec: impossible, could not parse counterexample" AIG.VerifyUnknown -> fail "cec: unknown result "
758
cecPrim :: AIGNetwork -> AIGNetwork -> TopLevel ProofResult cecPrim (SV.AIGNetwork x) (SV.AIGNetwork y) = do y' <- case cast y of Just n -> return n Nothing -> fail "Inconsistent AIG types" io $ verifyAIGCompatible x y' res <- io $ AIG.cec x y' let stats = solverStats "ABC" 0 -- TODO, count the size of the networks... case res of AIG.Valid -> return $ ValidProof stats (error "cecPrim: deprecated function!") AIG.Invalid bs | Just _fv <- readFiniteValue (FTVec (fromIntegral (length bs)) FTBit) bs -> return $ InvalidProof stats [] (error "cecPRim : deprecated function!") | otherwise -> fail "cec: impossible, could not parse counterexample" AIG.VerifyUnknown -> fail "cec: unknown result "
758
cecPrim (SV.AIGNetwork x) (SV.AIGNetwork y) = do y' <- case cast y of Just n -> return n Nothing -> fail "Inconsistent AIG types" io $ verifyAIGCompatible x y' res <- io $ AIG.cec x y' let stats = solverStats "ABC" 0 -- TODO, count the size of the networks... case res of AIG.Valid -> return $ ValidProof stats (error "cecPrim: deprecated function!") AIG.Invalid bs | Just _fv <- readFiniteValue (FTVec (fromIntegral (length bs)) FTBit) bs -> return $ InvalidProof stats [] (error "cecPRim : deprecated function!") | otherwise -> fail "cec: impossible, could not parse counterexample" AIG.VerifyUnknown -> fail "cec: unknown result "
698
false
true
0
20
176
244
111
133
null
null
uriba/dwarf
src/Data/Dwarf.hs
bsd-3-clause
dw_at 0x37 = DW_AT_count
24
dw_at 0x37 = DW_AT_count
24
dw_at 0x37 = DW_AT_count
24
false
false
0
5
3
9
4
5
null
null
antarestrader/sapphire
Builtin/Bool.hs
gpl-3.0
tnot [] = replyM_ VFalse
24
tnot [] = replyM_ VFalse
24
tnot [] = replyM_ VFalse
24
false
false
1
5
4
17
6
11
null
null
johnpmayer/elm-compiler
src/AST/Expression/General.hs
bsd-3-clause
localVar :: String -> Expr' ann def Var.Canonical typ localVar x = Var (Var.Canonical Var.Local x)
100
localVar :: String -> Expr' ann def Var.Canonical typ localVar x = Var (Var.Canonical Var.Local x)
100
localVar x = Var (Var.Canonical Var.Local x)
46
false
true
0
8
17
44
21
23
null
null
AubreyEAnderson/shellcheck
ShellCheck/Analytics.hs
gpl-3.0
isConfusedGlobRegex _ = False
29
isConfusedGlobRegex _ = False
29
isConfusedGlobRegex _ = False
29
false
false
0
4
3
10
4
6
null
null
michaxm/task-distribution
src/Control/Distributed/Task/TaskSpawning/FunctionSerialization.hs
bsd-3-clause
serialize :: Typeable a => a -> IO L.ByteString serialize a = P.trySerialize a >>= return . encode
98
serialize :: Typeable a => a -> IO L.ByteString serialize a = P.trySerialize a >>= return . encode
98
serialize a = P.trySerialize a >>= return . encode
50
false
true
0
9
17
48
21
27
null
null
sordina/Deadpan-DDP
src/Web/DDP/Deadpan/GUID.hs
mit
newGuidInt :: IO Int newGuidInt = hash `fmap` hashTriple
56
newGuidInt :: IO Int newGuidInt = hash `fmap` hashTriple
56
newGuidInt = hash `fmap` hashTriple
35
false
true
0
5
8
20
11
9
null
null
kim/amazonka
amazonka-rds/gen/Network/AWS/RDS/Types.hs
mpl-2.0
-- | 'ResourcePendingMaintenanceActions' constructor. -- -- The fields accessible through corresponding lenses are: -- -- * 'rpmaPendingMaintenanceActionDetails' @::@ ['PendingMaintenanceAction'] -- -- * 'rpmaResourceIdentifier' @::@ 'Maybe' 'Text' -- resourcePendingMaintenanceActions :: ResourcePendingMaintenanceActions resourcePendingMaintenanceActions = ResourcePendingMaintenanceActions { _rpmaResourceIdentifier = Nothing , _rpmaPendingMaintenanceActionDetails = mempty }
503
resourcePendingMaintenanceActions :: ResourcePendingMaintenanceActions resourcePendingMaintenanceActions = ResourcePendingMaintenanceActions { _rpmaResourceIdentifier = Nothing , _rpmaPendingMaintenanceActionDetails = mempty }
251
resourcePendingMaintenanceActions = ResourcePendingMaintenanceActions { _rpmaResourceIdentifier = Nothing , _rpmaPendingMaintenanceActionDetails = mempty }
180
true
true
0
7
66
37
24
13
null
null
olsner/sedition
Sed.hs
mit
runIR :: IR.Insn e x -> SedM () runIR (IR.Label _) = return ()
62
runIR :: IR.Insn e x -> SedM () runIR (IR.Label _) = return ()
62
runIR (IR.Label _) = return ()
30
false
true
0
8
13
43
20
23
null
null
aa755/roshask
src/Ros/ROSCoqUtil.hs
bsd-3-clause
coFoldLeft f (h:tl) inita = do ha <- (f inita h) coFoldLeft f tl ha
75
coFoldLeft f (h:tl) inita = do ha <- (f inita h) coFoldLeft f tl ha
75
coFoldLeft f (h:tl) inita = do ha <- (f inita h) coFoldLeft f tl ha
75
false
false
0
9
22
47
21
26
null
null
traceguide/api-php
vendor/apache/thrift/test/hs/TestClient.hs
mit
runClient :: (Protocol p, Transport t) => p t -> IO () runClient p = do let prot = (p,p) putStrLn "Starting Tests" -- VOID Test Client.testVoid prot -- String Test s <- Client.testString prot "Test" when (s /= "Test") exitFailure -- Byte Test byte <- Client.testByte prot 1 when (byte /= 1) exitFailure -- I32 Test i32 <- Client.testI32 prot (-1) when (i32 /= -1) exitFailure -- I64 Test i64 <- Client.testI64 prot (-34359738368) when (i64 /= -34359738368) exitFailure -- Double Test dub <- Client.testDouble prot (-5.2098523) when (abs (dub + 5.2098523) > 0.001) exitFailure -- Struct Test let structIn = Xtruct{ xtruct_string_thing = "Zero" , xtruct_byte_thing = 1 , xtruct_i32_thing = -3 , xtruct_i64_thing = -5 } structOut <- Client.testStruct prot structIn when (structIn /= structOut) exitFailure -- Nested Struct Test let nestIn = Xtruct2{ xtruct2_byte_thing = 1 , xtruct2_struct_thing = structIn , xtruct2_i32_thing = 5 } nestOut <- Client.testNest prot nestIn when (nestIn /= nestOut) exitSuccess -- Map Test let mapIn = Map.fromList $ map (\i -> (i, i-10)) [1..5] mapOut <- Client.testMap prot mapIn when (mapIn /= mapOut) exitSuccess -- Set Test let setIn = Set.fromList [-2..3] setOut <- Client.testSet prot setIn when (setIn /= setOut) exitFailure -- List Test let listIn = Vector.fromList [-2..3] listOut <- Client.testList prot listIn when (listIn /= listOut) exitFailure -- Enum Test numz1 <- Client.testEnum prot ONE when (numz1 /= ONE) exitFailure numz2 <- Client.testEnum prot TWO when (numz2 /= TWO) exitFailure numz5 <- Client.testEnum prot FIVE when (numz5 /= FIVE) exitFailure -- Typedef Test uid <- Client.testTypedef prot 309858235082523 when (uid /= 309858235082523) exitFailure -- Nested Map Test _ <- Client.testMapMap prot 1 -- Exception Test exn1 <- try $ Client.testException prot "Xception" case exn1 of Left (Xception _ _) -> return () _ -> putStrLn (show exn1) >> exitFailure exn2 <- try $ Client.testException prot "TException" case exn2 of Left (_ :: SomeException) -> return () Right _ -> exitFailure exn3 <- try $ Client.testException prot "success" case exn3 of Left (_ :: SomeException) -> exitFailure Right _ -> return () -- Multi Exception Test multi1 <- try $ Client.testMultiException prot "Xception" "test 1" case multi1 of Left (Xception _ _) -> return () _ -> exitFailure multi2 <- try $ Client.testMultiException prot "Xception2" "test 2" case multi2 of Left (Xception2 _ _) -> return () _ -> exitFailure multi3 <- try $ Client.testMultiException prot "success" "test 3" case multi3 of Left (_ :: SomeException) -> exitFailure Right _ -> return ()
2,966
runClient :: (Protocol p, Transport t) => p t -> IO () runClient p = do let prot = (p,p) putStrLn "Starting Tests" -- VOID Test Client.testVoid prot -- String Test s <- Client.testString prot "Test" when (s /= "Test") exitFailure -- Byte Test byte <- Client.testByte prot 1 when (byte /= 1) exitFailure -- I32 Test i32 <- Client.testI32 prot (-1) when (i32 /= -1) exitFailure -- I64 Test i64 <- Client.testI64 prot (-34359738368) when (i64 /= -34359738368) exitFailure -- Double Test dub <- Client.testDouble prot (-5.2098523) when (abs (dub + 5.2098523) > 0.001) exitFailure -- Struct Test let structIn = Xtruct{ xtruct_string_thing = "Zero" , xtruct_byte_thing = 1 , xtruct_i32_thing = -3 , xtruct_i64_thing = -5 } structOut <- Client.testStruct prot structIn when (structIn /= structOut) exitFailure -- Nested Struct Test let nestIn = Xtruct2{ xtruct2_byte_thing = 1 , xtruct2_struct_thing = structIn , xtruct2_i32_thing = 5 } nestOut <- Client.testNest prot nestIn when (nestIn /= nestOut) exitSuccess -- Map Test let mapIn = Map.fromList $ map (\i -> (i, i-10)) [1..5] mapOut <- Client.testMap prot mapIn when (mapIn /= mapOut) exitSuccess -- Set Test let setIn = Set.fromList [-2..3] setOut <- Client.testSet prot setIn when (setIn /= setOut) exitFailure -- List Test let listIn = Vector.fromList [-2..3] listOut <- Client.testList prot listIn when (listIn /= listOut) exitFailure -- Enum Test numz1 <- Client.testEnum prot ONE when (numz1 /= ONE) exitFailure numz2 <- Client.testEnum prot TWO when (numz2 /= TWO) exitFailure numz5 <- Client.testEnum prot FIVE when (numz5 /= FIVE) exitFailure -- Typedef Test uid <- Client.testTypedef prot 309858235082523 when (uid /= 309858235082523) exitFailure -- Nested Map Test _ <- Client.testMapMap prot 1 -- Exception Test exn1 <- try $ Client.testException prot "Xception" case exn1 of Left (Xception _ _) -> return () _ -> putStrLn (show exn1) >> exitFailure exn2 <- try $ Client.testException prot "TException" case exn2 of Left (_ :: SomeException) -> return () Right _ -> exitFailure exn3 <- try $ Client.testException prot "success" case exn3 of Left (_ :: SomeException) -> exitFailure Right _ -> return () -- Multi Exception Test multi1 <- try $ Client.testMultiException prot "Xception" "test 1" case multi1 of Left (Xception _ _) -> return () _ -> exitFailure multi2 <- try $ Client.testMultiException prot "Xception2" "test 2" case multi2 of Left (Xception2 _ _) -> return () _ -> exitFailure multi3 <- try $ Client.testMultiException prot "success" "test 3" case multi3 of Left (_ :: SomeException) -> exitFailure Right _ -> return ()
2,966
runClient p = do let prot = (p,p) putStrLn "Starting Tests" -- VOID Test Client.testVoid prot -- String Test s <- Client.testString prot "Test" when (s /= "Test") exitFailure -- Byte Test byte <- Client.testByte prot 1 when (byte /= 1) exitFailure -- I32 Test i32 <- Client.testI32 prot (-1) when (i32 /= -1) exitFailure -- I64 Test i64 <- Client.testI64 prot (-34359738368) when (i64 /= -34359738368) exitFailure -- Double Test dub <- Client.testDouble prot (-5.2098523) when (abs (dub + 5.2098523) > 0.001) exitFailure -- Struct Test let structIn = Xtruct{ xtruct_string_thing = "Zero" , xtruct_byte_thing = 1 , xtruct_i32_thing = -3 , xtruct_i64_thing = -5 } structOut <- Client.testStruct prot structIn when (structIn /= structOut) exitFailure -- Nested Struct Test let nestIn = Xtruct2{ xtruct2_byte_thing = 1 , xtruct2_struct_thing = structIn , xtruct2_i32_thing = 5 } nestOut <- Client.testNest prot nestIn when (nestIn /= nestOut) exitSuccess -- Map Test let mapIn = Map.fromList $ map (\i -> (i, i-10)) [1..5] mapOut <- Client.testMap prot mapIn when (mapIn /= mapOut) exitSuccess -- Set Test let setIn = Set.fromList [-2..3] setOut <- Client.testSet prot setIn when (setIn /= setOut) exitFailure -- List Test let listIn = Vector.fromList [-2..3] listOut <- Client.testList prot listIn when (listIn /= listOut) exitFailure -- Enum Test numz1 <- Client.testEnum prot ONE when (numz1 /= ONE) exitFailure numz2 <- Client.testEnum prot TWO when (numz2 /= TWO) exitFailure numz5 <- Client.testEnum prot FIVE when (numz5 /= FIVE) exitFailure -- Typedef Test uid <- Client.testTypedef prot 309858235082523 when (uid /= 309858235082523) exitFailure -- Nested Map Test _ <- Client.testMapMap prot 1 -- Exception Test exn1 <- try $ Client.testException prot "Xception" case exn1 of Left (Xception _ _) -> return () _ -> putStrLn (show exn1) >> exitFailure exn2 <- try $ Client.testException prot "TException" case exn2 of Left (_ :: SomeException) -> return () Right _ -> exitFailure exn3 <- try $ Client.testException prot "success" case exn3 of Left (_ :: SomeException) -> exitFailure Right _ -> return () -- Multi Exception Test multi1 <- try $ Client.testMultiException prot "Xception" "test 1" case multi1 of Left (Xception _ _) -> return () _ -> exitFailure multi2 <- try $ Client.testMultiException prot "Xception2" "test 2" case multi2 of Left (Xception2 _ _) -> return () _ -> exitFailure multi3 <- try $ Client.testMultiException prot "success" "test 3" case multi3 of Left (_ :: SomeException) -> exitFailure Right _ -> return ()
2,911
false
true
0
16
784
1,036
493
543
null
null
kojiromike/Idris-dev
src/Idris/Reflection.hs
bsd-3-clause
reflectConstant StrType = Var (reflm "StrType")
47
reflectConstant StrType = Var (reflm "StrType")
47
reflectConstant StrType = Var (reflm "StrType")
47
false
false
0
7
5
18
8
10
null
null
ezyang/ghc
compiler/cmm/Hoopl/Block.hs
bsd-3-clause
replaceLastNode :: Block n x C -> n O C -> Block n x C replaceLastNode (BlockOC b _) n = BlockOC b n
102
replaceLastNode :: Block n x C -> n O C -> Block n x C replaceLastNode (BlockOC b _) n = BlockOC b n
102
replaceLastNode (BlockOC b _) n = BlockOC b n
47
false
true
0
10
25
60
27
33
null
null
maarons/Cortex
Common/ErrorIO.hs
agpl-3.0
----- iListenOn :: (MonadError String m, MonadIO m) => Int -> m Socket iListenOn port = ioReport $ listenOn $ PortNumber $ fromIntegral port
141
iListenOn :: (MonadError String m, MonadIO m) => Int -> m Socket iListenOn port = ioReport $ listenOn $ PortNumber $ fromIntegral port
134
iListenOn port = ioReport $ listenOn $ PortNumber $ fromIntegral port
69
true
true
0
7
24
54
27
27
null
null
Hara-Laboratory/subleq-mips
TestRFix2.hs
gpl-3.0
measureSra n = do xs <- map floor <$> res n ys <- replicateM n $ R.sample randomSize let xys = zip xs ys return $ do (x, y) <- xys let res = T.measureInsns $ executeSubroutineWithStates "sra" [0,x,y] maximumTry return (x, y, res)
277
measureSra n = do xs <- map floor <$> res n ys <- replicateM n $ R.sample randomSize let xys = zip xs ys return $ do (x, y) <- xys let res = T.measureInsns $ executeSubroutineWithStates "sra" [0,x,y] maximumTry return (x, y, res)
277
measureSra n = do xs <- map floor <$> res n ys <- replicateM n $ R.sample randomSize let xys = zip xs ys return $ do (x, y) <- xys let res = T.measureInsns $ executeSubroutineWithStates "sra" [0,x,y] maximumTry return (x, y, res)
277
false
false
1
8
91
113
59
54
null
null
egison/egison
hs-src/Language/Egison/Data/Collection.hs
mit
unsnocCollection coll@(ICollection innersRef) = do inners <- liftIO $ readIORef innersRef case Sq.viewr inners of EmptyR -> matchFail hInners :> IElement ref' -> do hInnersRef <- liftIO $ newIORef hInners lift $ (, ref') <$> newEvaluatedObjectRef (ICollection hInnersRef) hInners :> ISubCollection ref' -> do tInners <- lift $ evalRef ref' >>= expandCollection liftIO $ writeIORef innersRef (hInners >< tInners) unsnocCollection coll
479
unsnocCollection coll@(ICollection innersRef) = do inners <- liftIO $ readIORef innersRef case Sq.viewr inners of EmptyR -> matchFail hInners :> IElement ref' -> do hInnersRef <- liftIO $ newIORef hInners lift $ (, ref') <$> newEvaluatedObjectRef (ICollection hInnersRef) hInners :> ISubCollection ref' -> do tInners <- lift $ evalRef ref' >>= expandCollection liftIO $ writeIORef innersRef (hInners >< tInners) unsnocCollection coll
479
unsnocCollection coll@(ICollection innersRef) = do inners <- liftIO $ readIORef innersRef case Sq.viewr inners of EmptyR -> matchFail hInners :> IElement ref' -> do hInnersRef <- liftIO $ newIORef hInners lift $ (, ref') <$> newEvaluatedObjectRef (ICollection hInnersRef) hInners :> ISubCollection ref' -> do tInners <- lift $ evalRef ref' >>= expandCollection liftIO $ writeIORef innersRef (hInners >< tInners) unsnocCollection coll
479
false
false
1
17
106
164
72
92
null
null
vincenthz/hs-foundation
foundation/Foundation/Conduit/Internal.hs
bsd-3-clause
-- | Send a value downstream. yield :: Monad m => o -> Conduit i o m () yield o = Conduit $ \f -> Yield (f ()) (return ()) o
124
yield :: Monad m => o -> Conduit i o m () yield o = Conduit $ \f -> Yield (f ()) (return ()) o
94
yield o = Conduit $ \f -> Yield (f ()) (return ()) o
52
true
true
0
10
30
69
34
35
null
null
rahulmutt/ghcvm
compiler/Eta/TypeCheck/TcEvidence.hs
bsd-3-clause
-- input coercion is Nominal -- mkSubCo will do some normalisation. We do not do it for TcCoercions, but -- defer that to desugaring; just to reduce the code duplication a little bit mkTcSubCo :: TcCoercion -> TcCoercion mkTcSubCo co = ASSERT2( tcCoercionRole co == Nominal, ppr co) TcSubCo co
308
mkTcSubCo :: TcCoercion -> TcCoercion mkTcSubCo co = ASSERT2( tcCoercionRole co == Nominal, ppr co) TcSubCo co
125
mkTcSubCo co = ASSERT2( tcCoercionRole co == Nominal, ppr co) TcSubCo co
87
true
true
0
8
64
44
23
21
null
null
shinjiro-itagaki/shinjirecs
shinjirecs-api/src/DB/Persist.hs
gpl-3.0
createPool,connect :: (MonadIO m, MonadBaseControl IO m, MonadLogger m) => Config -> m ConnectionPool -- createPool,connect :: (MonadIO m, MonadBaseControl IO m) => Config -> m ConnectionPool createPool config = case adapter config of MySQL -> createMySQLPool (configToMySQLConnectInfo config) pool' PostgreSQL -> createPostgresqlPool (configToPgSQLConnectionString config) pool' SQLite3 -> createSqlitePool (Data.Text.pack $ database config) pool' where pool' = pool config :: Int
528
createPool,connect :: (MonadIO m, MonadBaseControl IO m, MonadLogger m) => Config -> m ConnectionPool createPool config = case adapter config of MySQL -> createMySQLPool (configToMySQLConnectInfo config) pool' PostgreSQL -> createPostgresqlPool (configToPgSQLConnectionString config) pool' SQLite3 -> createSqlitePool (Data.Text.pack $ database config) pool' where pool' = pool config :: Int
438
createPool config = case adapter config of MySQL -> createMySQLPool (configToMySQLConnectInfo config) pool' PostgreSQL -> createPostgresqlPool (configToPgSQLConnectionString config) pool' SQLite3 -> createSqlitePool (Data.Text.pack $ database config) pool' where pool' = pool config :: Int
336
true
true
3
11
107
136
64
72
null
null
lovasko/tabl
examples/Decimals.hs
bsd-2-clause
main :: IO () main = getArgs >>= (\[n] -> T.putStrLn (table (read n)))
70
main :: IO () main = getArgs >>= (\[n] -> T.putStrLn (table (read n)))
70
main = getArgs >>= (\[n] -> T.putStrLn (table (read n)))
56
false
true
0
12
13
48
25
23
null
null
jfremstad/harchey
harchey.hs
gpl-3.0
main :: IO () main = do args <- getArgs case args of ["-h"] -> printHelp ["--help"] -> printHelp ["-l"] -> printList ["--list"] -> printList _ -> putStr "" user <- getUser arch <- isArch hostname <- getHostName kernel <- getKernel uptimedirty <- getUptime processes <- getProcesses shelly <- getShell term <- getTerm pkg <- if arch then getPkg else return "" cpu <- getCpu ram <- getRam disk <- getDisk let color = case args of ["black"] -> "\x1b[38;05;16m" ["blue"] -> "\x1b[38;05;27m" ["green"] -> "\x1b[38;05;34m" ["cyan"] -> "\x1b[38;05;51m" ["sepia"] -> "\x1b[38;05;52m" ["indigo"] -> "\x1b[38;05;54m" ["steel"] -> "\x1b[38;05;67m" ["brown"] -> "\x1b[38;05;94m" ["olive"] -> "\x1b[38;05;100m" ["lime"] -> "\x1b[38;05;118m" ["red"] -> "\x1b[38;05;124m" ["crimson"] -> "\x1b[38;05;161m" ["plum"] -> "\x1b[38;05;176m" ["pink"] -> "\x1b[38;05;199m" ["orange"] -> "\x1b[38;05;208m" ["gold"] -> "\x1b[38;05;214m" ["tan"] -> "\x1b[38;05;215m" ["grey"] -> "\x1b[38;05;240m" ["darkgrey"] -> "\x1b[38;05;234m" ["white"] -> "\x1b[38;05;255m" _ -> "\x1b[38;05;226m" -- Default: Yellow p = printColorLn color fields = [("User: ", init user) ,("Hostname: ", init hostname) ,("Distro: ", if arch then "Arch Linux" else "Not Arch Linux :(") ,("Kernel: ", init kernel) ,("Uptime: ", init (if "," `isInfixOf` (words uptimedirty !! 2) then words uptimedirty !! 2 else words uptimedirty !! 2 ++ " " ++ words uptimedirty !! 3)) ,("Window Manager: ", findProcess processes windowmanagers "Unknown") ,(" Desktop Environment: ", findProcess processes desktopenvironments "None") ,("Shell: ", shelly) ,("Terminal: ", term) ,("Packages: ", (show . length . lines) pkg) ,("CPU: ", drop 13 (lines cpu !! 4)) ,("RAM: ", (words ram !! 8) ++ " MB / " ++ words ram !! 7 ++ " MB") ,("Disk: ", (words . last . lines) disk !! 2 ++ "G / " ++ (words . last . lines) disk !! 1 ++ "G") ] p " + " p " # " p " ### " p " ##### " p " ###### " putStr $ unlines $ zipWith (\line (label, value) -> color ++ line ++ label ++ nocolor ++ value) logo fields
2,796
main :: IO () main = do args <- getArgs case args of ["-h"] -> printHelp ["--help"] -> printHelp ["-l"] -> printList ["--list"] -> printList _ -> putStr "" user <- getUser arch <- isArch hostname <- getHostName kernel <- getKernel uptimedirty <- getUptime processes <- getProcesses shelly <- getShell term <- getTerm pkg <- if arch then getPkg else return "" cpu <- getCpu ram <- getRam disk <- getDisk let color = case args of ["black"] -> "\x1b[38;05;16m" ["blue"] -> "\x1b[38;05;27m" ["green"] -> "\x1b[38;05;34m" ["cyan"] -> "\x1b[38;05;51m" ["sepia"] -> "\x1b[38;05;52m" ["indigo"] -> "\x1b[38;05;54m" ["steel"] -> "\x1b[38;05;67m" ["brown"] -> "\x1b[38;05;94m" ["olive"] -> "\x1b[38;05;100m" ["lime"] -> "\x1b[38;05;118m" ["red"] -> "\x1b[38;05;124m" ["crimson"] -> "\x1b[38;05;161m" ["plum"] -> "\x1b[38;05;176m" ["pink"] -> "\x1b[38;05;199m" ["orange"] -> "\x1b[38;05;208m" ["gold"] -> "\x1b[38;05;214m" ["tan"] -> "\x1b[38;05;215m" ["grey"] -> "\x1b[38;05;240m" ["darkgrey"] -> "\x1b[38;05;234m" ["white"] -> "\x1b[38;05;255m" _ -> "\x1b[38;05;226m" -- Default: Yellow p = printColorLn color fields = [("User: ", init user) ,("Hostname: ", init hostname) ,("Distro: ", if arch then "Arch Linux" else "Not Arch Linux :(") ,("Kernel: ", init kernel) ,("Uptime: ", init (if "," `isInfixOf` (words uptimedirty !! 2) then words uptimedirty !! 2 else words uptimedirty !! 2 ++ " " ++ words uptimedirty !! 3)) ,("Window Manager: ", findProcess processes windowmanagers "Unknown") ,(" Desktop Environment: ", findProcess processes desktopenvironments "None") ,("Shell: ", shelly) ,("Terminal: ", term) ,("Packages: ", (show . length . lines) pkg) ,("CPU: ", drop 13 (lines cpu !! 4)) ,("RAM: ", (words ram !! 8) ++ " MB / " ++ words ram !! 7 ++ " MB") ,("Disk: ", (words . last . lines) disk !! 2 ++ "G / " ++ (words . last . lines) disk !! 1 ++ "G") ] p " + " p " # " p " ### " p " ##### " p " ###### " putStr $ unlines $ zipWith (\line (label, value) -> color ++ line ++ label ++ nocolor ++ value) logo fields
2,796
main = do args <- getArgs case args of ["-h"] -> printHelp ["--help"] -> printHelp ["-l"] -> printList ["--list"] -> printList _ -> putStr "" user <- getUser arch <- isArch hostname <- getHostName kernel <- getKernel uptimedirty <- getUptime processes <- getProcesses shelly <- getShell term <- getTerm pkg <- if arch then getPkg else return "" cpu <- getCpu ram <- getRam disk <- getDisk let color = case args of ["black"] -> "\x1b[38;05;16m" ["blue"] -> "\x1b[38;05;27m" ["green"] -> "\x1b[38;05;34m" ["cyan"] -> "\x1b[38;05;51m" ["sepia"] -> "\x1b[38;05;52m" ["indigo"] -> "\x1b[38;05;54m" ["steel"] -> "\x1b[38;05;67m" ["brown"] -> "\x1b[38;05;94m" ["olive"] -> "\x1b[38;05;100m" ["lime"] -> "\x1b[38;05;118m" ["red"] -> "\x1b[38;05;124m" ["crimson"] -> "\x1b[38;05;161m" ["plum"] -> "\x1b[38;05;176m" ["pink"] -> "\x1b[38;05;199m" ["orange"] -> "\x1b[38;05;208m" ["gold"] -> "\x1b[38;05;214m" ["tan"] -> "\x1b[38;05;215m" ["grey"] -> "\x1b[38;05;240m" ["darkgrey"] -> "\x1b[38;05;234m" ["white"] -> "\x1b[38;05;255m" _ -> "\x1b[38;05;226m" -- Default: Yellow p = printColorLn color fields = [("User: ", init user) ,("Hostname: ", init hostname) ,("Distro: ", if arch then "Arch Linux" else "Not Arch Linux :(") ,("Kernel: ", init kernel) ,("Uptime: ", init (if "," `isInfixOf` (words uptimedirty !! 2) then words uptimedirty !! 2 else words uptimedirty !! 2 ++ " " ++ words uptimedirty !! 3)) ,("Window Manager: ", findProcess processes windowmanagers "Unknown") ,(" Desktop Environment: ", findProcess processes desktopenvironments "None") ,("Shell: ", shelly) ,("Terminal: ", term) ,("Packages: ", (show . length . lines) pkg) ,("CPU: ", drop 13 (lines cpu !! 4)) ,("RAM: ", (words ram !! 8) ++ " MB / " ++ words ram !! 7 ++ " MB") ,("Disk: ", (words . last . lines) disk !! 2 ++ "G / " ++ (words . last . lines) disk !! 1 ++ "G") ] p " + " p " # " p " ### " p " ##### " p " ###### " putStr $ unlines $ zipWith (\line (label, value) -> color ++ line ++ label ++ nocolor ++ value) logo fields
2,782
false
true
0
21
1,106
782
408
374
null
null
benley/yet-another-haskell-scheme
Yahs/LispVal.hs
apache-2.0
showVal (IOFunc _) = "<IO primitive>"
49
showVal (IOFunc _) = "<IO primitive>"
49
showVal (IOFunc _) = "<IO primitive>"
49
false
false
0
7
17
15
7
8
null
null
sdiehl/ghc
compiler/typecheck/TcEvidence.hs
bsd-3-clause
mkWpTyLams :: [TyVar] -> HsWrapper mkWpTyLams ids = mk_co_lam_fn WpTyLam ids
76
mkWpTyLams :: [TyVar] -> HsWrapper mkWpTyLams ids = mk_co_lam_fn WpTyLam ids
76
mkWpTyLams ids = mk_co_lam_fn WpTyLam ids
41
false
true
0
7
10
32
14
18
null
null
erikd/yesod
yesod-form/Yesod/Form/MassInput.hs
mit
fixme :: (xml ~ WidgetT site IO ()) => [Either xml (FormResult a, [FieldView site])] -> (FormResult [a], [xml], [[FieldView site]]) fixme eithers = (res, xmls, map snd rest) where (xmls, rest) = partitionEithers eithers res = sequenceA $ map fst rest
276
fixme :: (xml ~ WidgetT site IO ()) => [Either xml (FormResult a, [FieldView site])] -> (FormResult [a], [xml], [[FieldView site]]) fixme eithers = (res, xmls, map snd rest) where (xmls, rest) = partitionEithers eithers res = sequenceA $ map fst rest
276
fixme eithers = (res, xmls, map snd rest) where (xmls, rest) = partitionEithers eithers res = sequenceA $ map fst rest
132
false
true
0
11
67
134
71
63
null
null
scott-fleischman/greek-grammar
haskell/greek-grammar/src/Data/Unicode/DecomposeChar.hs
mit
decomposeChar '\x2F9ED' = "\x28BFA"
35
decomposeChar '\x2F9ED' = "\x28BFA"
35
decomposeChar '\x2F9ED' = "\x28BFA"
35
false
false
0
4
3
10
4
6
null
null
nomeata/haskell-spacegoo
Game/Spacegoo.hs
mit
-- | From any own planet, send all ships to any opposing planet. sendSomewhere :: Strategy sendSomewhere (State {..}) = do me <- playerId <$> find itsme players let he = 3 - me aPlanet <- find (\p -> planetOwner p == me && planetShips p /= (0,0,0)) planets otherPlanet <- find (\p -> planetOwner p == he) planets return (planetId aPlanet, planetId otherPlanet, planetShips aPlanet) -- | Picks an own planet with a reasonable number of ships and sends it to some -- neutral planet.
501
sendSomewhere :: Strategy sendSomewhere (State {..}) = do me <- playerId <$> find itsme players let he = 3 - me aPlanet <- find (\p -> planetOwner p == me && planetShips p /= (0,0,0)) planets otherPlanet <- find (\p -> planetOwner p == he) planets return (planetId aPlanet, planetId otherPlanet, planetShips aPlanet) -- | Picks an own planet with a reasonable number of ships and sends it to some -- neutral planet.
436
sendSomewhere (State {..}) = do me <- playerId <$> find itsme players let he = 3 - me aPlanet <- find (\p -> planetOwner p == me && planetShips p /= (0,0,0)) planets otherPlanet <- find (\p -> planetOwner p == he) planets return (planetId aPlanet, planetId otherPlanet, planetShips aPlanet) -- | Picks an own planet with a reasonable number of ships and sends it to some -- neutral planet.
410
true
true
0
14
106
153
76
77
null
null
NightRa/Idris-dev
src/Idris/AbsSyntaxTree.hs
bsd-3-clause
syntaxNames :: Syntax -> [Name] syntaxNames (Rule syms _ _) = mapMaybe ename syms where ename (Keyword n) = Just n ename _ = Nothing
170
syntaxNames :: Syntax -> [Name] syntaxNames (Rule syms _ _) = mapMaybe ename syms where ename (Keyword n) = Just n ename _ = Nothing
170
syntaxNames (Rule syms _ _) = mapMaybe ename syms where ename (Keyword n) = Just n ename _ = Nothing
138
false
true
0
9
62
63
31
32
null
null
bakineggs/k-framework
tools/OutputFilter/FilterOutput.hs
gpl-2.0
pruneChars :: Configuration -> CellName -> ByteString -> ByteString pruneChars conf cn s | shouldPruneChars conf cn = pruneC conf cn s | otherwise = s
190
pruneChars :: Configuration -> CellName -> ByteString -> ByteString pruneChars conf cn s | shouldPruneChars conf cn = pruneC conf cn s | otherwise = s
188
pruneChars conf cn s | shouldPruneChars conf cn = pruneC conf cn s | otherwise = s
120
false
true
1
9
65
61
27
34
null
null
cyanut/tp-tetris-solver
solver.hs
unlicense
connLine :: (a -> a -> SBool) -> [Maybe a] -> SBool connLine f l = bAnd $ connLine' f l where connLine' f [] = [] connLine' f (p:[]) = [] connLine' f (p:Nothing:ps) = connLine' f ps connLine' f (Nothing:p:ps) = connLine' f (p:ps) connLine' f ((Just p1):(Just p2):ps) = f p1 p2 : connLine' f ((Just p2):ps)
330
connLine :: (a -> a -> SBool) -> [Maybe a] -> SBool connLine f l = bAnd $ connLine' f l where connLine' f [] = [] connLine' f (p:[]) = [] connLine' f (p:Nothing:ps) = connLine' f ps connLine' f (Nothing:p:ps) = connLine' f (p:ps) connLine' f ((Just p1):(Just p2):ps) = f p1 p2 : connLine' f ((Just p2):ps)
330
connLine f l = bAnd $ connLine' f l where connLine' f [] = [] connLine' f (p:[]) = [] connLine' f (p:Nothing:ps) = connLine' f ps connLine' f (Nothing:p:ps) = connLine' f (p:ps) connLine' f ((Just p1):(Just p2):ps) = f p1 p2 : connLine' f ((Just p2):ps)
278
false
true
0
12
84
206
104
102
null
null
vTurbine/ghc
compiler/codeGen/StgCmmClosure.hs
bsd-3-clause
closureFunInfo :: ClosureInfo -> Maybe (RepArity, ArgDescr) closureFunInfo (ClosureInfo { closureLFInfo = lf_info }) = lfFunInfo lf_info
136
closureFunInfo :: ClosureInfo -> Maybe (RepArity, ArgDescr) closureFunInfo (ClosureInfo { closureLFInfo = lf_info }) = lfFunInfo lf_info
136
closureFunInfo (ClosureInfo { closureLFInfo = lf_info }) = lfFunInfo lf_info
76
false
true
0
9
16
42
22
20
null
null
bvdelft/paragon
test/Language/Java/Paragon/ASTHelpers.hs
bsd-3-clause
modifyFieldDeclType :: ASTModifier RefType ClassBodyDecl modifyFieldDeclType f (MemberDecl fieldDecl) = let (RefType rt) = fieldDeclType fieldDecl rt' = f rt in MemberDecl fieldDecl { fieldDeclType = RefType rt' }
224
modifyFieldDeclType :: ASTModifier RefType ClassBodyDecl modifyFieldDeclType f (MemberDecl fieldDecl) = let (RefType rt) = fieldDeclType fieldDecl rt' = f rt in MemberDecl fieldDecl { fieldDeclType = RefType rt' }
224
modifyFieldDeclType f (MemberDecl fieldDecl) = let (RefType rt) = fieldDeclType fieldDecl rt' = f rt in MemberDecl fieldDecl { fieldDeclType = RefType rt' }
167
false
true
0
10
39
70
33
37
null
null
derkyjadex/aegg-bomb
src/Server.hs
mit
connectionMain :: GameChan -> WS.Connection -> String -> Chan PlayerMsg -> IO () connectionMain gameChan conn name playerChan = do reader <- forkIO . forever $ do msg <- readChan playerChan WS.sendTextData conn $ encode $ playerMsgJson msg when (msg == Removed) $ WS.sendClose conn $ T.pack "" handle (\(SomeException _) -> return ()) . forever $ do WS.Text cmdBytes <- WS.receiveDataMessage conn let cmd = T.unpack $ WS.fromLazyByteString cmdBytes case maybeRead cmd of Just (Move x y) -> writeChan gameChan (MovePlayer name (x,y)) Just (Throw x y) -> writeChan gameChan (ThrowEgg name (x,y)) Nothing -> WS.sendTextData conn $ encode $ messageJson ("Unknown command: '" ++ cmd ++ "'") killThread reader writeChan gameChan (RemovePlayer name)
856
connectionMain :: GameChan -> WS.Connection -> String -> Chan PlayerMsg -> IO () connectionMain gameChan conn name playerChan = do reader <- forkIO . forever $ do msg <- readChan playerChan WS.sendTextData conn $ encode $ playerMsgJson msg when (msg == Removed) $ WS.sendClose conn $ T.pack "" handle (\(SomeException _) -> return ()) . forever $ do WS.Text cmdBytes <- WS.receiveDataMessage conn let cmd = T.unpack $ WS.fromLazyByteString cmdBytes case maybeRead cmd of Just (Move x y) -> writeChan gameChan (MovePlayer name (x,y)) Just (Throw x y) -> writeChan gameChan (ThrowEgg name (x,y)) Nothing -> WS.sendTextData conn $ encode $ messageJson ("Unknown command: '" ++ cmd ++ "'") killThread reader writeChan gameChan (RemovePlayer name)
856
connectionMain gameChan conn name playerChan = do reader <- forkIO . forever $ do msg <- readChan playerChan WS.sendTextData conn $ encode $ playerMsgJson msg when (msg == Removed) $ WS.sendClose conn $ T.pack "" handle (\(SomeException _) -> return ()) . forever $ do WS.Text cmdBytes <- WS.receiveDataMessage conn let cmd = T.unpack $ WS.fromLazyByteString cmdBytes case maybeRead cmd of Just (Move x y) -> writeChan gameChan (MovePlayer name (x,y)) Just (Throw x y) -> writeChan gameChan (ThrowEgg name (x,y)) Nothing -> WS.sendTextData conn $ encode $ messageJson ("Unknown command: '" ++ cmd ++ "'") killThread reader writeChan gameChan (RemovePlayer name)
775
false
true
0
17
228
326
151
175
null
null
keera-studios/hsQt
Qtc/Enums/Gui/QKeySequence.hs
bsd-2-clause
eDeleteEndOfLine :: StandardKey eDeleteEndOfLine = ieStandardKey $ 60
71
eDeleteEndOfLine :: StandardKey eDeleteEndOfLine = ieStandardKey $ 60
71
eDeleteEndOfLine = ieStandardKey $ 60
39
false
true
0
6
9
18
8
10
null
null
beni55/fay
src/tests/Test/Desugar.hs
bsd-3-clause
unAnn :: Functor f => f a -> f () unAnn = void
46
unAnn :: Functor f => f a -> f () unAnn = void
46
unAnn = void
12
false
true
0
8
12
30
14
16
null
null
startling/partly
partly.hs
bsd-3-clause
main :: IO () main = execParser parser >>= apply where apply :: Command -> IO () apply c = case c of View v -> view v; Make m -> make m;
152
main :: IO () main = execParser parser >>= apply where apply :: Command -> IO () apply c = case c of View v -> view v; Make m -> make m;
152
main = execParser parser >>= apply where apply :: Command -> IO () apply c = case c of View v -> view v; Make m -> make m;
138
false
true
2
8
48
77
37
40
null
null
mikeplus64/plissken
src/Game.hs
gpl-3.0
initialGame :: StdGen -> Stage -> GameS initialGame _stdGen _stage = let _snake = Snake (S.singleton (Ent (vec3 4 4 4) (vec3 1 0 0))) S.empty _score = 0 _gameTicks = 0 _message = Nothing _gameIsPaused = False _stageBounds = 10 _snakeIsAlive = True _difficulty = medium _gameEditMode = False _scores = [] _playerName = "MAL" _gameStuck = False _gameStarted = False in Game{..}
480
initialGame :: StdGen -> Stage -> GameS initialGame _stdGen _stage = let _snake = Snake (S.singleton (Ent (vec3 4 4 4) (vec3 1 0 0))) S.empty _score = 0 _gameTicks = 0 _message = Nothing _gameIsPaused = False _stageBounds = 10 _snakeIsAlive = True _difficulty = medium _gameEditMode = False _scores = [] _playerName = "MAL" _gameStuck = False _gameStarted = False in Game{..}
480
initialGame _stdGen _stage = let _snake = Snake (S.singleton (Ent (vec3 4 4 4) (vec3 1 0 0))) S.empty _score = 0 _gameTicks = 0 _message = Nothing _gameIsPaused = False _stageBounds = 10 _snakeIsAlive = True _difficulty = medium _gameEditMode = False _scores = [] _playerName = "MAL" _gameStuck = False _gameStarted = False in Game{..}
440
false
true
0
15
168
145
78
67
null
null
olsner/ghc
compiler/prelude/THNames.hs
bsd-3-clause
-- data Type = ... forallTIdKey, varTIdKey, conTIdKey, tupleTIdKey, unboxedTupleTIdKey, unboxedSumTIdKey, arrowTIdKey, listTIdKey, appTIdKey, sigTIdKey, equalityTIdKey, litTIdKey, promotedTIdKey, promotedTupleTIdKey, promotedNilTIdKey, promotedConsTIdKey, wildCardTIdKey :: Unique forallTIdKey = mkPreludeMiscIdUnique 380
340
forallTIdKey, varTIdKey, conTIdKey, tupleTIdKey, unboxedTupleTIdKey, unboxedSumTIdKey, arrowTIdKey, listTIdKey, appTIdKey, sigTIdKey, equalityTIdKey, litTIdKey, promotedTIdKey, promotedTupleTIdKey, promotedNilTIdKey, promotedConsTIdKey, wildCardTIdKey :: Unique forallTIdKey = mkPreludeMiscIdUnique 380
321
forallTIdKey = mkPreludeMiscIdUnique 380
47
true
true
0
5
46
47
40
7
null
null
wafna/euler
Main.hs
unlicense
p4 :: Integer p4 = head $ reverse $ List.sort $ filter palindrome [x * y | x <- [100..999], y <- [100..999]] where palindrome x = let s = show x in s == reverse s -- | What is the smallest positive number that is evenly divisible by all of the numbers from 1 to 20? -- Here, I started with the product of [11..20] and then eliminated factors that were implied by divisibility by higher numbers.
401
p4 :: Integer p4 = head $ reverse $ List.sort $ filter palindrome [x * y | x <- [100..999], y <- [100..999]] where palindrome x = let s = show x in s == reverse s -- | What is the smallest positive number that is evenly divisible by all of the numbers from 1 to 20? -- Here, I started with the product of [11..20] and then eliminated factors that were implied by divisibility by higher numbers.
401
p4 = head $ reverse $ List.sort $ filter palindrome [x * y | x <- [100..999], y <- [100..999]] where palindrome x = let s = show x in s == reverse s -- | What is the smallest positive number that is evenly divisible by all of the numbers from 1 to 20? -- Here, I started with the product of [11..20] and then eliminated factors that were implied by divisibility by higher numbers.
387
false
true
0
11
85
96
49
47
null
null
hvr/text
Data/Text.hs
bsd-2-clause
-- | /O(n+m)/ Similar to 'breakOn', but searches from the end of the -- string. -- -- The first element of the returned tuple is the prefix of @haystack@ -- up to and including the last match of @needle@. The second is the -- remainder of @haystack@, following the match. -- -- > breakOnEnd "::" "a::b::c" ==> ("a::b::", "c") breakOnEnd :: Text -> Text -> (Text, Text) breakOnEnd pat src = (reverse b, reverse a) where (a,b) = breakOn (reverse pat) (reverse src)
468
breakOnEnd :: Text -> Text -> (Text, Text) breakOnEnd pat src = (reverse b, reverse a) where (a,b) = breakOn (reverse pat) (reverse src)
141
breakOnEnd pat src = (reverse b, reverse a) where (a,b) = breakOn (reverse pat) (reverse src)
98
true
true
0
7
88
81
46
35
null
null
xmonad/xmonad-contrib
XMonad/Hooks/Focus.hs
bsd-3-clause
-- | Execute 'Query', unless focus is locked. unlessFocusLock :: Monoid a => Query a -> Query a unlessFocusLock m = do FocusLock b <- liftX XS.get when' (not b) m -- Commonly used actions for modifying focus. -- -- $common -- Operations in each pair 'keepFocus' and 'switchFocus', 'keepWorkspace' and -- 'switchWorkspace' overwrite each other (the letftmost will determine what -- happened): -- -- prop> keepFocus <+> switchFocus = keepFocus -- prop> switchFocus <+> keepFocus = switchFocus -- prop> keepWorkspace <+> switchWorkspace = keepWorkspace -- prop> switchWorkspace <+> keepWorkspace = switchWorkspace -- -- and operations from different pairs are commutative: -- -- prop> keepFocus <+> switchWorkspace = switchWorkspace <+> keepFocus -- prop> switchFocus <+> switchWorkspace = switchWorkspace <+> switchFocus -- -- etc. -- | Keep focus on workspace (may not be current), where new window appears. -- Workspace will not be switched. This operation is idempotent and -- effectively returns focus to window focused on that workspace before -- applying @(Endo WindowSet)@ function.
1,125
unlessFocusLock :: Monoid a => Query a -> Query a unlessFocusLock m = do FocusLock b <- liftX XS.get when' (not b) m -- Commonly used actions for modifying focus. -- -- $common -- Operations in each pair 'keepFocus' and 'switchFocus', 'keepWorkspace' and -- 'switchWorkspace' overwrite each other (the letftmost will determine what -- happened): -- -- prop> keepFocus <+> switchFocus = keepFocus -- prop> switchFocus <+> keepFocus = switchFocus -- prop> keepWorkspace <+> switchWorkspace = keepWorkspace -- prop> switchWorkspace <+> keepWorkspace = switchWorkspace -- -- and operations from different pairs are commutative: -- -- prop> keepFocus <+> switchWorkspace = switchWorkspace <+> keepFocus -- prop> switchFocus <+> switchWorkspace = switchWorkspace <+> switchFocus -- -- etc. -- | Keep focus on workspace (may not be current), where new window appears. -- Workspace will not be switched. This operation is idempotent and -- effectively returns focus to window focused on that workspace before -- applying @(Endo WindowSet)@ function.
1,079
unlessFocusLock m = do FocusLock b <- liftX XS.get when' (not b) m -- Commonly used actions for modifying focus. -- -- $common -- Operations in each pair 'keepFocus' and 'switchFocus', 'keepWorkspace' and -- 'switchWorkspace' overwrite each other (the letftmost will determine what -- happened): -- -- prop> keepFocus <+> switchFocus = keepFocus -- prop> switchFocus <+> keepFocus = switchFocus -- prop> keepWorkspace <+> switchWorkspace = keepWorkspace -- prop> switchWorkspace <+> keepWorkspace = switchWorkspace -- -- and operations from different pairs are commutative: -- -- prop> keepFocus <+> switchWorkspace = switchWorkspace <+> keepFocus -- prop> switchFocus <+> switchWorkspace = switchWorkspace <+> switchFocus -- -- etc. -- | Keep focus on workspace (may not be current), where new window appears. -- Workspace will not be switched. This operation is idempotent and -- effectively returns focus to window focused on that workspace before -- applying @(Endo WindowSet)@ function.
1,029
true
true
0
9
201
83
49
34
null
null
dahlia/nirum
src/Nirum/Cli.hs
gpl-3.0
tryDie :: AppOptions -> String -> IO () tryDie AppOptions { watching = watching' } errorMessage | watching' = hPutStrLn stderr errorMessage | otherwise = die errorMessage
174
tryDie :: AppOptions -> String -> IO () tryDie AppOptions { watching = watching' } errorMessage | watching' = hPutStrLn stderr errorMessage | otherwise = die errorMessage
174
tryDie AppOptions { watching = watching' } errorMessage | watching' = hPutStrLn stderr errorMessage | otherwise = die errorMessage
134
false
true
1
8
30
59
28
31
null
null
oldmanmike/ghc
compiler/deSugar/DsBinds.hs
bsd-3-clause
dsEvTerm (EvDelayedError ty msg) = return $ dsEvDelayedError ty msg
67
dsEvTerm (EvDelayedError ty msg) = return $ dsEvDelayedError ty msg
67
dsEvTerm (EvDelayedError ty msg) = return $ dsEvDelayedError ty msg
67
false
false
0
6
9
27
12
15
null
null
haskell-distributed/distributed-process
src/Control/Distributed/Process/Internal/CQueue.hs
bsd-3-clause
spanMatchChan (m : ms) | MatchChan stm <- m = (stm:stms, rest) | otherwise = ([], m:ms) where !(stms,rest) = spanMatchChan ms -- | Dequeue an element -- -- The timeout (if any) is applied only to waiting for incoming messages, not -- to checking messages that have already arrived
303
spanMatchChan (m : ms) | MatchChan stm <- m = (stm:stms, rest) | otherwise = ([], m:ms) where !(stms,rest) = spanMatchChan ms -- | Dequeue an element -- -- The timeout (if any) is applied only to waiting for incoming messages, not -- to checking messages that have already arrived
303
spanMatchChan (m : ms) | MatchChan stm <- m = (stm:stms, rest) | otherwise = ([], m:ms) where !(stms,rest) = spanMatchChan ms -- | Dequeue an element -- -- The timeout (if any) is applied only to waiting for incoming messages, not -- to checking messages that have already arrived
303
false
false
0
9
72
82
43
39
null
null
kojiromike/Idris-dev
src/Idris/IdeMode.hs
bsd-3-clause
constTy (Fl _) = "Double"
25
constTy (Fl _) = "Double"
25
constTy (Fl _) = "Double"
25
false
false
0
6
4
16
7
9
null
null
ddssff/lens
src/Control/Lens/Fold.hs
bsd-3-clause
ifoldr64 :: Foldable f => (Int64 -> a -> b -> b) -> b -> f a -> b ifoldr64 f z xs = foldr (\ x g i -> i `seq` f i x (g (i+1))) (const z) xs 0
141
ifoldr64 :: Foldable f => (Int64 -> a -> b -> b) -> b -> f a -> b ifoldr64 f z xs = foldr (\ x g i -> i `seq` f i x (g (i+1))) (const z) xs 0
141
ifoldr64 f z xs = foldr (\ x g i -> i `seq` f i x (g (i+1))) (const z) xs 0
75
false
true
0
13
40
108
55
53
null
null
judah/haskeline
System/Console/Haskeline/Vi.hs
bsd-3-clause
killAndStoreI :: MonadIO m => KillHelper -> Command (ViT m) (ArgMode CommandMode) InsertMode killAndStoreI = storedIAction . killFromArgHelper
142
killAndStoreI :: MonadIO m => KillHelper -> Command (ViT m) (ArgMode CommandMode) InsertMode killAndStoreI = storedIAction . killFromArgHelper
142
killAndStoreI = storedIAction . killFromArgHelper
49
false
true
0
9
17
45
22
23
null
null
alexander-b/coreutilhs
rm.hs
gpl-3.0
bork :: String -> IOError -> IO () bork dir err = printf "rm: cannot stat '%s': %s\n" dir $ unpack . toTitle . pack $ ioeGetErrorString err
148
bork :: String -> IOError -> IO () bork dir err = printf "rm: cannot stat '%s': %s\n" dir $ unpack . toTitle . pack $ ioeGetErrorString err
148
bork dir err = printf "rm: cannot stat '%s': %s\n" dir $ unpack . toTitle . pack $ ioeGetErrorString err
112
false
true
0
9
36
53
25
28
null
null
kevinjcliao/bb
src/Parse.hs
bsd-3-clause
toHours 12 PM = 12
22
toHours 12 PM = 12
22
toHours 12 PM = 12
22
false
false
0
5
8
11
5
6
null
null
winterland1989/stdio
Data/Vector.hs
bsd-3-clause
elemIndicesBytes w (PrimVector (PrimArray (ByteArray ba#)) s l) = go s where !w' = fromIntegral w !end = s + l go !i | i >= end = [] | otherwise = let !s' = fromIntegral i !l' = fromIntegral (end - i) in case fromIntegral (c_memchr ba# s' w' l') of -1 -> [] r -> r : go (i + r)
380
elemIndicesBytes w (PrimVector (PrimArray (ByteArray ba#)) s l) = go s where !w' = fromIntegral w !end = s + l go !i | i >= end = [] | otherwise = let !s' = fromIntegral i !l' = fromIntegral (end - i) in case fromIntegral (c_memchr ba# s' w' l') of -1 -> [] r -> r : go (i + r)
380
elemIndicesBytes w (PrimVector (PrimArray (ByteArray ba#)) s l) = go s where !w' = fromIntegral w !end = s + l go !i | i >= end = [] | otherwise = let !s' = fromIntegral i !l' = fromIntegral (end - i) in case fromIntegral (c_memchr ba# s' w' l') of -1 -> [] r -> r : go (i + r)
380
false
false
4
14
165
176
80
96
null
null
JPMoresmau/rnn
test/rnn-test.hs
bsd-2-clause
checkLSTMList :: IO () checkLSTMList = do (n1::LSTMNetwork) <- evalRandIO $ randomNetwork 2 lstmFullSize (n2::LSTMNetwork) <- evalRandIO $ randomNetwork 2 lstmFullSize let (n1_2,out)=evalStep n1 $ M.fromList [1::Double,2] (n2_2,out1)=evalStep n2 out (n3,out2)=evalStep [n1,n2] $ M.fromList [1,2] n3 @=? [n1_2,n2_2] out1 @=? out2
364
checkLSTMList :: IO () checkLSTMList = do (n1::LSTMNetwork) <- evalRandIO $ randomNetwork 2 lstmFullSize (n2::LSTMNetwork) <- evalRandIO $ randomNetwork 2 lstmFullSize let (n1_2,out)=evalStep n1 $ M.fromList [1::Double,2] (n2_2,out1)=evalStep n2 out (n3,out2)=evalStep [n1,n2] $ M.fromList [1,2] n3 @=? [n1_2,n2_2] out1 @=? out2
364
checkLSTMList = do (n1::LSTMNetwork) <- evalRandIO $ randomNetwork 2 lstmFullSize (n2::LSTMNetwork) <- evalRandIO $ randomNetwork 2 lstmFullSize let (n1_2,out)=evalStep n1 $ M.fromList [1::Double,2] (n2_2,out1)=evalStep n2 out (n3,out2)=evalStep [n1,n2] $ M.fromList [1,2] n3 @=? [n1_2,n2_2] out1 @=? out2
341
false
true
0
12
76
172
88
84
null
null
gergoerdi/tecs
src/Language/TECS/Jack/ToDeck/Layout.hs
bsd-3-clause
layoutMethod :: MethodDef Name -> Reader (SymbolTable Name Id) (MethodDef Id) layoutMethod (Constructor ty name formals body) = layoutParams (Constructor ty name) formals body
175
layoutMethod :: MethodDef Name -> Reader (SymbolTable Name Id) (MethodDef Id) layoutMethod (Constructor ty name formals body) = layoutParams (Constructor ty name) formals body
175
layoutMethod (Constructor ty name formals body) = layoutParams (Constructor ty name) formals body
97
false
true
0
8
23
67
32
35
null
null
elliottt/blank-slate
src/Graphics/BlankSlate/Prim/Buffer.hs
bsd-3-clause
bindBuffer :: GLenum -> Buffer -> IO () bindBuffer name = glBindBuffer name . getBuffer
87
bindBuffer :: GLenum -> Buffer -> IO () bindBuffer name = glBindBuffer name . getBuffer
87
bindBuffer name = glBindBuffer name . getBuffer
47
false
true
0
9
14
39
17
22
null
null
naoto-ogawa/h-xproto-mysql
src/DataBase/MySQLX/DateTime.hs
mit
-- | zero padding for LocalTime formatLocalTimePadded :: LocalTime -> String formatLocalTimePadded t | length str == 19 = str ++ ".000000000000" | otherwise = str ++ "000000000000" where str = formatTime defaultTimeLocale "%FT%T%Q" t -- | Timeformat for MysqlTime. -- ex) "12:34:56.123" or "-12:34:56.123"
325
formatLocalTimePadded :: LocalTime -> String formatLocalTimePadded t | length str == 19 = str ++ ".000000000000" | otherwise = str ++ "000000000000" where str = formatTime defaultTimeLocale "%FT%T%Q" t -- | Timeformat for MysqlTime. -- ex) "12:34:56.123" or "-12:34:56.123"
292
formatLocalTimePadded t | length str == 19 = str ++ ".000000000000" | otherwise = str ++ "000000000000" where str = formatTime defaultTimeLocale "%FT%T%Q" t -- | Timeformat for MysqlTime. -- ex) "12:34:56.123" or "-12:34:56.123"
247
true
true
1
9
64
64
32
32
null
null
Changaco/haskell-plugins
src/System/Plugins/Load.hs
lgpl-2.1
resolveObjs :: IO a -> IO () resolveObjs unloadLoaded = do r <- c_resolveObjs when (not r) $ unloadLoaded >> error "resolvedObjs failed." -- | Unload a module
173
resolveObjs :: IO a -> IO () resolveObjs unloadLoaded = do r <- c_resolveObjs when (not r) $ unloadLoaded >> error "resolvedObjs failed." -- | Unload a module
173
resolveObjs unloadLoaded = do r <- c_resolveObjs when (not r) $ unloadLoaded >> error "resolvedObjs failed." -- | Unload a module
144
false
true
0
12
42
62
27
35
null
null
kmate/HaRe
old/testing/removeDef/ListCompIn2_TokOut.hs
bsd-3-clause
zipthree :: [a] -> [b] -> [c] -> [(a,b,c)] zipthree = \xs ys zs -> case (xs, ys, zs) of ([], _, _) -> [] (_, [], _) -> [] (_, _, []) -> [] (a:as, b:bs, c:cs) -> (a,b,c) : zipthree as bs cs
307
zipthree :: [a] -> [b] -> [c] -> [(a,b,c)] zipthree = \xs ys zs -> case (xs, ys, zs) of ([], _, _) -> [] (_, [], _) -> [] (_, _, []) -> [] (a:as, b:bs, c:cs) -> (a,b,c) : zipthree as bs cs
307
zipthree = \xs ys zs -> case (xs, ys, zs) of ([], _, _) -> [] (_, [], _) -> [] (_, _, []) -> [] (a:as, b:bs, c:cs) -> (a,b,c) : zipthree as bs cs
264
false
true
0
10
163
170
98
72
null
null
siddhanathan/ghc
libraries/base/GHC/Show.hs
bsd-3-clause
-- Code specific for characters -- | Convert a character to a string using only printable characters, -- using Haskell source-language escape conventions. For example: -- -- > showLitChar '\n' s = "\\n" ++ s -- showLitChar :: Char -> ShowS showLitChar c s | c > '\DEL' = showChar '\\' (protectEsc isDec (shows (ord c)) s)
341
showLitChar :: Char -> ShowS showLitChar c s | c > '\DEL' = showChar '\\' (protectEsc isDec (shows (ord c)) s)
126
showLitChar c s | c > '\DEL' = showChar '\\' (protectEsc isDec (shows (ord c)) s)
82
true
true
0
12
76
64
33
31
null
null
jlouis/combinatorrent
src/Process/ChokeMgr.hs
bsd-2-clause
informDone :: InfoHash -> PieceNum -> ChokeMgrProcess () informDone ih pn = do chn <- gets chain T.mapM inform chn >> return () where inform p | (pInfoHash p) == ih = sendDone p >> return () | otherwise = return () sendDone p = msgPeer (pChannel p) (PieceCompleted pn)
310
informDone :: InfoHash -> PieceNum -> ChokeMgrProcess () informDone ih pn = do chn <- gets chain T.mapM inform chn >> return () where inform p | (pInfoHash p) == ih = sendDone p >> return () | otherwise = return () sendDone p = msgPeer (pChannel p) (PieceCompleted pn)
310
informDone ih pn = do chn <- gets chain T.mapM inform chn >> return () where inform p | (pInfoHash p) == ih = sendDone p >> return () | otherwise = return () sendDone p = msgPeer (pChannel p) (PieceCompleted pn)
253
false
true
0
10
91
136
61
75
null
null
fmapfmapfmap/amazonka
amazonka-sts/test/Test/AWS/Gen/STS.hs
mpl-2.0
testDecodeAuthorizationMessageResponse :: DecodeAuthorizationMessageResponse -> TestTree testDecodeAuthorizationMessageResponse = res "DecodeAuthorizationMessageResponse" "fixture/DecodeAuthorizationMessageResponse.proto" sTS (Proxy :: Proxy DecodeAuthorizationMessage)
285
testDecodeAuthorizationMessageResponse :: DecodeAuthorizationMessageResponse -> TestTree testDecodeAuthorizationMessageResponse = res "DecodeAuthorizationMessageResponse" "fixture/DecodeAuthorizationMessageResponse.proto" sTS (Proxy :: Proxy DecodeAuthorizationMessage)
285
testDecodeAuthorizationMessageResponse = res "DecodeAuthorizationMessageResponse" "fixture/DecodeAuthorizationMessageResponse.proto" sTS (Proxy :: Proxy DecodeAuthorizationMessage)
196
false
true
0
6
30
36
17
19
null
null
DataStewardshipPortal/ds-form-engine
FormElement/AutoComplete.hs
apache-2.0
doAc :: String -> String -> Char -> String doAc txt ac delim = let pre = fst $ cutLastPart txt "" delim in case pre of "" -> ac _ -> pre <> [delim] <> ac
163
doAc :: String -> String -> Char -> String doAc txt ac delim = let pre = fst $ cutLastPart txt "" delim in case pre of "" -> ac _ -> pre <> [delim] <> ac
163
doAc txt ac delim = let pre = fst $ cutLastPart txt "" delim in case pre of "" -> ac _ -> pre <> [delim] <> ac
120
false
true
0
12
46
81
39
42
null
null
cartazio/scoutess
Scoutess/Service/Source/Fetch.hs
bsd-3-clause
fetchVersion :: (MonadIO m) => SourceConfig -> SourceLocation -> m (Either SourceException VersionSpec) fetchVersion sourceConfig Hackage = fetchVersionsHackage sourceConfig
219
fetchVersion :: (MonadIO m) => SourceConfig -> SourceLocation -> m (Either SourceException VersionSpec) fetchVersion sourceConfig Hackage = fetchVersionsHackage sourceConfig
219
fetchVersion sourceConfig Hackage = fetchVersionsHackage sourceConfig
73
false
true
0
10
64
47
23
24
null
null
nevrenato/HyLoRes_Source
src/HyLoRes/ClauseSet/Clauses.hs
gpl-2.0
removeById :: ClauseId -> ClausesClauseSet -> ClausesClauseSet removeById clId ccs = ccs{queuesByComplexity = qbc', clauseDataByAge = cba', clauseDataById = cbi'} where mac = IMap.lookup clId cbi cba = clauseDataByAge ccs cba' = maybe cba (\(a,_) -> Map.delete a cba) mac cbi = clauseDataById ccs cbi' = IMap.delete clId cbi qbc = queuesByComplexity ccs qbc' = maybe qbc (\(_,c) -> Map.update (removeUpdate clId) c qbc) mac
550
removeById :: ClauseId -> ClausesClauseSet -> ClausesClauseSet removeById clId ccs = ccs{queuesByComplexity = qbc', clauseDataByAge = cba', clauseDataById = cbi'} where mac = IMap.lookup clId cbi cba = clauseDataByAge ccs cba' = maybe cba (\(a,_) -> Map.delete a cba) mac cbi = clauseDataById ccs cbi' = IMap.delete clId cbi qbc = queuesByComplexity ccs qbc' = maybe qbc (\(_,c) -> Map.update (removeUpdate clId) c qbc) mac
550
removeById clId ccs = ccs{queuesByComplexity = qbc', clauseDataByAge = cba', clauseDataById = cbi'} where mac = IMap.lookup clId cbi cba = clauseDataByAge ccs cba' = maybe cba (\(a,_) -> Map.delete a cba) mac cbi = clauseDataById ccs cbi' = IMap.delete clId cbi qbc = queuesByComplexity ccs qbc' = maybe qbc (\(_,c) -> Map.update (removeUpdate clId) c qbc) mac
487
false
true
0
12
191
168
90
78
null
null
green-haskell/ghc
compiler/prelude/PrelNames.hs
bsd-3-clause
divIntegerName = varQual gHC_INTEGER_TYPE (fsLit "divInteger") divIntegerIdKey
92
divIntegerName = varQual gHC_INTEGER_TYPE (fsLit "divInteger") divIntegerIdKey
92
divIntegerName = varQual gHC_INTEGER_TYPE (fsLit "divInteger") divIntegerIdKey
92
false
false
0
7
20
19
9
10
null
null
cullina/Extractor
src/PrefixCode.hs
bsd-3-clause
safeSplitAt (_:_) [] = Nothing
30
safeSplitAt (_:_) [] = Nothing
30
safeSplitAt (_:_) [] = Nothing
30
false
false
0
7
4
20
10
10
null
null
iu-parfunc/haskell-hpx
src/Foreign/HPX.hs
bsd-3-clause
call :: Binary a => Address -> a -> StaticPtr (a -> HPX (Promise r)) -> HPX (LCO r) call (Address addr) arg sptr = do p_action <- lookupAction sptr liftIO $ do Action action <- peek p_action lco@(LCO result) <- newLCOFuture -- TODO: Exit codes _ <- withEncodedValue arg $ c'_hpx_call addr action result 2 pure lco
366
call :: Binary a => Address -> a -> StaticPtr (a -> HPX (Promise r)) -> HPX (LCO r) call (Address addr) arg sptr = do p_action <- lookupAction sptr liftIO $ do Action action <- peek p_action lco@(LCO result) <- newLCOFuture -- TODO: Exit codes _ <- withEncodedValue arg $ c'_hpx_call addr action result 2 pure lco
366
call (Address addr) arg sptr = do p_action <- lookupAction sptr liftIO $ do Action action <- peek p_action lco@(LCO result) <- newLCOFuture -- TODO: Exit codes _ <- withEncodedValue arg $ c'_hpx_call addr action result 2 pure lco
277
false
true
0
15
110
152
68
84
null
null
jkr/pandoc-citeproc
src/Text/CSL/Util.hs
bsd-3-clause
(&=) :: (ToYaml a, Monoid a, Eq a) => Text -> a -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)] x &= y = \acc -> if y == mempty then acc else (x Y..= y) : acc
205
(&=) :: (ToYaml a, Monoid a, Eq a) => Text -> a -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)] x &= y = \acc -> if y == mempty then acc else (x Y..= y) : acc
205
x &= y = \acc -> if y == mempty then acc else (x Y..= y) : acc
102
false
true
0
13
80
105
57
48
null
null
maruks/haskell-book
src/Chapter22_reader.hs
gpl-3.0
ask :: Reader a a ask = Reader id
33
ask :: Reader a a ask = Reader id
33
ask = Reader id
15
false
true
1
5
8
22
9
13
null
null
sonyandy/fd
src/Control/Monad/FD/Internal/Dom.hs
bsd-3-clause
lookupMin (Bounds min _) = Just min
35
lookupMin (Bounds min _) = Just min
35
lookupMin (Bounds min _) = Just min
35
false
false
0
7
6
20
9
11
null
null
d-day/relation
src/Data/Relation/Examples/E02.hs
bsd-3-clause
id2 s = ( v1 == v2, v1 ) where v1 = (dom e <$| s) e v2 = dom (e |> s) -- Exploring <|
105
id2 s = ( v1 == v2, v1 ) where v1 = (dom e <$| s) e v2 = dom (e |> s) -- Exploring <|
105
id2 s = ( v1 == v2, v1 ) where v1 = (dom e <$| s) e v2 = dom (e |> s) -- Exploring <|
105
false
false
0
8
45
56
29
27
null
null
eigengrau/hlint
data/Default.hs
bsd-3-clause
error "Redundant if" = (if a then x else x) ==> x where note = IncreasesLaziness
80
error "Redundant if" = (if a then x else x) ==> x where note = IncreasesLaziness
80
error "Redundant if" = (if a then x else x) ==> x where note = IncreasesLaziness
80
false
false
0
7
15
32
17
15
null
null
BartAdv/Idris-dev
src/Idris/Completion.hs
bsd-3-clause
metavars :: Idris [String] metavars = do i <- get return . map (show . nsroot) $ map fst (filter (\(_, (_,_,t)) -> not t) (idris_metavars i)) \\ primDefs
167
metavars :: Idris [String] metavars = do i <- get return . map (show . nsroot) $ map fst (filter (\(_, (_,_,t)) -> not t) (idris_metavars i)) \\ primDefs
167
metavars = do i <- get return . map (show . nsroot) $ map fst (filter (\(_, (_,_,t)) -> not t) (idris_metavars i)) \\ primDefs
140
false
true
0
15
42
94
49
45
null
null
ktemkin/dotfiles
xmonad/xmonad.hs
bsd-2-clause
localLayouts = --Smart Border Filter --(Interceps border assignments and disables borders on fullscreen items, -- when there's only one item, or when the window in focus is similarly -- unambiguous.) smartBorders --Per Workspace Layout --(Allows the user to specify default layouts on a per-workspace basis.) $ perWSLayouts --These layout functions are available to every terminal, unless overridden. --(Note that pieces of the items listed here are defined below.) $ ( tiledHinted ||| --Standard Tall tiled layout. Mirror tiled ||| --Same thing, but rotated 90 degrees. Full ||| --Single application is fullscreen. spiral (6/7) ||| --Many applications of descending size. "Spiral" imLayout ||| --Many similar/identically sized windows. --tiledHinted ||| -- normal tiled, but with Layout Hints gimp --special paneled layout for the gimp ) where --Shortcut to the standard, XMonad tall layout. tiled = ResizableTall 1 (3/100) ratio [] tiledHinted = layoutHints tiled --Shortbut to the 1/10th size IM layout, suitable for instant messengers. imLayout = withIM (1/10) (Role "roster") Grid --Calculation of the golden ratio, which keeps the host window feeling like --a nice, square window. Can be adjusted to anything between 0 and 1. ratio = toRational (2/(1+sqrt(5)::Double)) -- golden --Gimp Layout gimp = withIM (0.11) (Role "gimp-toolbox") $ reflectHoriz $ withIM(0.15) (Role "gimp-dock") Full --Per Workspace Layouts --(Specifies special layouts for the given workspaces.)
1,717
localLayouts = --Smart Border Filter --(Interceps border assignments and disables borders on fullscreen items, -- when there's only one item, or when the window in focus is similarly -- unambiguous.) smartBorders --Per Workspace Layout --(Allows the user to specify default layouts on a per-workspace basis.) $ perWSLayouts --These layout functions are available to every terminal, unless overridden. --(Note that pieces of the items listed here are defined below.) $ ( tiledHinted ||| --Standard Tall tiled layout. Mirror tiled ||| --Same thing, but rotated 90 degrees. Full ||| --Single application is fullscreen. spiral (6/7) ||| --Many applications of descending size. "Spiral" imLayout ||| --Many similar/identically sized windows. --tiledHinted ||| -- normal tiled, but with Layout Hints gimp --special paneled layout for the gimp ) where --Shortcut to the standard, XMonad tall layout. tiled = ResizableTall 1 (3/100) ratio [] tiledHinted = layoutHints tiled --Shortbut to the 1/10th size IM layout, suitable for instant messengers. imLayout = withIM (1/10) (Role "roster") Grid --Calculation of the golden ratio, which keeps the host window feeling like --a nice, square window. Can be adjusted to anything between 0 and 1. ratio = toRational (2/(1+sqrt(5)::Double)) -- golden --Gimp Layout gimp = withIM (0.11) (Role "gimp-toolbox") $ reflectHoriz $ withIM(0.15) (Role "gimp-dock") Full --Per Workspace Layouts --(Specifies special layouts for the given workspaces.)
1,717
localLayouts = --Smart Border Filter --(Interceps border assignments and disables borders on fullscreen items, -- when there's only one item, or when the window in focus is similarly -- unambiguous.) smartBorders --Per Workspace Layout --(Allows the user to specify default layouts on a per-workspace basis.) $ perWSLayouts --These layout functions are available to every terminal, unless overridden. --(Note that pieces of the items listed here are defined below.) $ ( tiledHinted ||| --Standard Tall tiled layout. Mirror tiled ||| --Same thing, but rotated 90 degrees. Full ||| --Single application is fullscreen. spiral (6/7) ||| --Many applications of descending size. "Spiral" imLayout ||| --Many similar/identically sized windows. --tiledHinted ||| -- normal tiled, but with Layout Hints gimp --special paneled layout for the gimp ) where --Shortcut to the standard, XMonad tall layout. tiled = ResizableTall 1 (3/100) ratio [] tiledHinted = layoutHints tiled --Shortbut to the 1/10th size IM layout, suitable for instant messengers. imLayout = withIM (1/10) (Role "roster") Grid --Calculation of the golden ratio, which keeps the host window feeling like --a nice, square window. Can be adjusted to anything between 0 and 1. ratio = toRational (2/(1+sqrt(5)::Double)) -- golden --Gimp Layout gimp = withIM (0.11) (Role "gimp-toolbox") $ reflectHoriz $ withIM(0.15) (Role "gimp-dock") Full --Per Workspace Layouts --(Specifies special layouts for the given workspaces.)
1,717
false
false
11
11
457
228
117
111
null
null
Kyly/liquidhaskell
src/Language/Haskell/Liquid/ANFTransform.hs
bsd-3-clause
expandDefaultCase _ _ z = return z
37
expandDefaultCase _ _ z = return z
37
expandDefaultCase _ _ z = return z
37
false
false
1
5
9
15
6
9
null
null
egaburov/funstuff
Haskell/parsec/PrettyJSON.hs
apache-2.0
renderJValue JNull = text "null"
40
renderJValue JNull = text "null"
40
renderJValue JNull = text "null"
40
false
false
0
5
12
12
5
7
null
null
jstolarek/slicer
lib/Language/Slicer/Parser.hs
gpl-3.0
strDeref = "!"
22
strDeref = "!"
22
strDeref = "!"
22
false
false
1
5
10
10
3
7
null
null