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
kolmodin/cabal
cabal-install/tests/IntegrationTests2.hs
bsd-3-clause
testSetupScriptStyles :: ProjectConfig -> (String -> IO ()) -> Assertion testSetupScriptStyles config reportSubCase = do reportSubCase (show SetupCustomExplicitDeps) plan1 <- executePlan =<< planProject testdir1 config (pkg1, _, _) <- expectPackageInstalled plan1 pkgidA pkgSetupScriptStyle pkg1 @?= SetupCustomExplicitDeps hasDefaultSetupDeps pkg1 @?= Just False marker1 <- readFile (basedir </> testdir1 </> "marker") marker1 @?= "ok" removeFile (basedir </> testdir1 </> "marker") reportSubCase (show SetupCustomImplicitDeps) plan2 <- executePlan =<< planProject testdir2 config (pkg2, _, _) <- expectPackageInstalled plan2 pkgidA pkgSetupScriptStyle pkg2 @?= SetupCustomImplicitDeps hasDefaultSetupDeps pkg2 @?= Just True marker2 <- readFile (basedir </> testdir2 </> "marker") marker2 @?= "ok" removeFile (basedir </> testdir2 </> "marker") reportSubCase (show SetupNonCustomInternalLib) plan3 <- executePlan =<< planProject testdir3 config (pkg3, _, _) <- expectPackageInstalled plan3 pkgidA pkgSetupScriptStyle pkg3 @?= SetupNonCustomInternalLib {- --TODO: the SetupNonCustomExternalLib case is hard to test since it -- requires a version of Cabal that's later than the one we're testing -- e.g. needs a .cabal file that specifies cabal-version: >= 2.0 -- and a corresponding Cabal package that we can use to try and build a -- default Setup.hs. reportSubCase (show SetupNonCustomExternalLib) plan4 <- executePlan =<< planProject testdir4 config (pkg4, _, _) <- expectPackageInstalled plan4 pkgidA pkgSetupScriptStyle pkg4 @?= SetupNonCustomExternalLib -} where testdir1 = "build/setup-custom1" testdir2 = "build/setup-custom2" testdir3 = "build/setup-simple" pkgidA = PackageIdentifier (PackageName "a") (Version [0,1] []) -- The solver fills in default setup deps explicitly, but marks them as such hasDefaultSetupDeps = fmap defaultSetupDepends . setupBuildInfo . pkgDescription -- | Test the behaviour with and without @--keep-going@ --
2,123
testSetupScriptStyles :: ProjectConfig -> (String -> IO ()) -> Assertion testSetupScriptStyles config reportSubCase = do reportSubCase (show SetupCustomExplicitDeps) plan1 <- executePlan =<< planProject testdir1 config (pkg1, _, _) <- expectPackageInstalled plan1 pkgidA pkgSetupScriptStyle pkg1 @?= SetupCustomExplicitDeps hasDefaultSetupDeps pkg1 @?= Just False marker1 <- readFile (basedir </> testdir1 </> "marker") marker1 @?= "ok" removeFile (basedir </> testdir1 </> "marker") reportSubCase (show SetupCustomImplicitDeps) plan2 <- executePlan =<< planProject testdir2 config (pkg2, _, _) <- expectPackageInstalled plan2 pkgidA pkgSetupScriptStyle pkg2 @?= SetupCustomImplicitDeps hasDefaultSetupDeps pkg2 @?= Just True marker2 <- readFile (basedir </> testdir2 </> "marker") marker2 @?= "ok" removeFile (basedir </> testdir2 </> "marker") reportSubCase (show SetupNonCustomInternalLib) plan3 <- executePlan =<< planProject testdir3 config (pkg3, _, _) <- expectPackageInstalled plan3 pkgidA pkgSetupScriptStyle pkg3 @?= SetupNonCustomInternalLib {- --TODO: the SetupNonCustomExternalLib case is hard to test since it -- requires a version of Cabal that's later than the one we're testing -- e.g. needs a .cabal file that specifies cabal-version: >= 2.0 -- and a corresponding Cabal package that we can use to try and build a -- default Setup.hs. reportSubCase (show SetupNonCustomExternalLib) plan4 <- executePlan =<< planProject testdir4 config (pkg4, _, _) <- expectPackageInstalled plan4 pkgidA pkgSetupScriptStyle pkg4 @?= SetupNonCustomExternalLib -} where testdir1 = "build/setup-custom1" testdir2 = "build/setup-custom2" testdir3 = "build/setup-simple" pkgidA = PackageIdentifier (PackageName "a") (Version [0,1] []) -- The solver fills in default setup deps explicitly, but marks them as such hasDefaultSetupDeps = fmap defaultSetupDepends . setupBuildInfo . pkgDescription -- | Test the behaviour with and without @--keep-going@ --
2,123
testSetupScriptStyles config reportSubCase = do reportSubCase (show SetupCustomExplicitDeps) plan1 <- executePlan =<< planProject testdir1 config (pkg1, _, _) <- expectPackageInstalled plan1 pkgidA pkgSetupScriptStyle pkg1 @?= SetupCustomExplicitDeps hasDefaultSetupDeps pkg1 @?= Just False marker1 <- readFile (basedir </> testdir1 </> "marker") marker1 @?= "ok" removeFile (basedir </> testdir1 </> "marker") reportSubCase (show SetupCustomImplicitDeps) plan2 <- executePlan =<< planProject testdir2 config (pkg2, _, _) <- expectPackageInstalled plan2 pkgidA pkgSetupScriptStyle pkg2 @?= SetupCustomImplicitDeps hasDefaultSetupDeps pkg2 @?= Just True marker2 <- readFile (basedir </> testdir2 </> "marker") marker2 @?= "ok" removeFile (basedir </> testdir2 </> "marker") reportSubCase (show SetupNonCustomInternalLib) plan3 <- executePlan =<< planProject testdir3 config (pkg3, _, _) <- expectPackageInstalled plan3 pkgidA pkgSetupScriptStyle pkg3 @?= SetupNonCustomInternalLib {- --TODO: the SetupNonCustomExternalLib case is hard to test since it -- requires a version of Cabal that's later than the one we're testing -- e.g. needs a .cabal file that specifies cabal-version: >= 2.0 -- and a corresponding Cabal package that we can use to try and build a -- default Setup.hs. reportSubCase (show SetupNonCustomExternalLib) plan4 <- executePlan =<< planProject testdir4 config (pkg4, _, _) <- expectPackageInstalled plan4 pkgidA pkgSetupScriptStyle pkg4 @?= SetupNonCustomExternalLib -} where testdir1 = "build/setup-custom1" testdir2 = "build/setup-custom2" testdir3 = "build/setup-simple" pkgidA = PackageIdentifier (PackageName "a") (Version [0,1] []) -- The solver fills in default setup deps explicitly, but marks them as such hasDefaultSetupDeps = fmap defaultSetupDepends . setupBuildInfo . pkgDescription -- | Test the behaviour with and without @--keep-going@ --
2,050
false
true
0
11
422
399
190
209
null
null
bartoszw/elca
Loans.hs
gpl-2.0
-- creates amortization plan -- Difference between both amorPlan functions: -- Main one (amorPlan) puts unpaid interest into late interest. This amortization plan is official and can be given to customer -- Row one (amorPlanRow) increases capital by unpaid interest. Calculates same plan, but because of negative capital payment cannot be given to customer. It allows to understand figures and calculations. -- lI - late interest (not paid from previous instalment) -- rN - nominal rate (list) -- (i:is) - installment list -- res - result, put empty list -- aT - amortization type amorPlan :: (RealFloat a1, Eq a2, Num a2) => Int -> Int -> [a1] -> a2 -> a1 -> a1 -> Int -> [Int] -> AmortizationType -> AmorPlan -> AmorPlan amorPlan c _ rN 0 d d1 _ [] _ res = res
794
amorPlan :: (RealFloat a1, Eq a2, Num a2) => Int -> Int -> [a1] -> a2 -> a1 -> a1 -> Int -> [Int] -> AmortizationType -> AmorPlan -> AmorPlan amorPlan c _ rN 0 d d1 _ [] _ res = res
195
amorPlan c _ rN 0 d d1 _ [] _ res = res
53
true
true
0
18
168
116
62
54
null
null
ekmett/ghc
compiler/codeGen/StgCmmUtils.hs
bsd-3-clause
-- The simplifier might have eliminated a case -- so we may have e.g. case xs of -- [] -> e -- In that situation we can be sure the (:) case -- can't happen, so no need to test -- SINGLETON BRANCH: one equality check to do mk_switch tag_expr [(tag,lbl)] (Just deflt) _ _ _ = do dflags <- getDynFlags let cond = cmmNeWord dflags tag_expr (mkIntExpr dflags tag) -- We have lo_tag < hi_tag, but there's only one branch, -- so there must be a default return (mkCbranch cond deflt lbl) -- ToDo: we might want to check for the two branch case, where one of -- the branches is the tag 0, because comparing '== 0' is likely to be -- more efficient than other kinds of comparison. -- DENSE TAG RANGE: use a switch statment. -- -- We also use a switch uncoditionally when compiling via C, because -- this will get emitted as a C switch statement and the C compiler -- should do a good job of optimising it. Also, older GCC versions -- (2.95 in particular) have problems compiling the complicated -- if-trees generated by this code, so compiling to a switch every -- time works around that problem. --
1,203
mk_switch tag_expr [(tag,lbl)] (Just deflt) _ _ _ = do dflags <- getDynFlags let cond = cmmNeWord dflags tag_expr (mkIntExpr dflags tag) -- We have lo_tag < hi_tag, but there's only one branch, -- so there must be a default return (mkCbranch cond deflt lbl) -- ToDo: we might want to check for the two branch case, where one of -- the branches is the tag 0, because comparing '== 0' is likely to be -- more efficient than other kinds of comparison. -- DENSE TAG RANGE: use a switch statment. -- -- We also use a switch uncoditionally when compiling via C, because -- this will get emitted as a C switch statement and the C compiler -- should do a good job of optimising it. Also, older GCC versions -- (2.95 in particular) have problems compiling the complicated -- if-trees generated by this code, so compiling to a switch every -- time works around that problem. --
911
mk_switch tag_expr [(tag,lbl)] (Just deflt) _ _ _ = do dflags <- getDynFlags let cond = cmmNeWord dflags tag_expr (mkIntExpr dflags tag) -- We have lo_tag < hi_tag, but there's only one branch, -- so there must be a default return (mkCbranch cond deflt lbl) -- ToDo: we might want to check for the two branch case, where one of -- the branches is the tag 0, because comparing '== 0' is likely to be -- more efficient than other kinds of comparison. -- DENSE TAG RANGE: use a switch statment. -- -- We also use a switch uncoditionally when compiling via C, because -- this will get emitted as a C switch statement and the C compiler -- should do a good job of optimising it. Also, older GCC versions -- (2.95 in particular) have problems compiling the complicated -- if-trees generated by this code, so compiling to a switch every -- time works around that problem. --
911
true
false
0
12
319
102
59
43
null
null
cbpark/hep-kinematics
src/HEP/Kinematics/Vector/LorentzTVector.hs
bsd-3-clause
setXYT :: a -> a -> a -> LorentzTVector a setXYT px py et = LorentzTVector (V3 et px py)
88
setXYT :: a -> a -> a -> LorentzTVector a setXYT px py et = LorentzTVector (V3 et px py)
88
setXYT px py et = LorentzTVector (V3 et px py)
46
false
true
0
8
19
46
22
24
null
null
danr/hipspec
testsuite/prod/zeno_version/PropT34.hs
gpl-3.0
(++) :: [a] -> [a] -> [a] [] ++ ys = ys
43
(++) :: [a] -> [a] -> [a] [] ++ ys = ys
43
[] ++ ys = ys
17
false
true
0
10
15
43
22
21
null
null
christiaanb/Idris-dev
src/Core/ProofState.hs
bsd-3-clause
exact _ _ _ _ = fail "Can't fill here."
39
exact _ _ _ _ = fail "Can't fill here."
39
exact _ _ _ _ = fail "Can't fill here."
39
false
false
1
5
9
18
7
11
null
null
pbevin/milner-type-poly
test/AlgorithmWSpec.hs
gpl-2.0
c = TypeVariable "c"
20
c = TypeVariable "c"
20
c = TypeVariable "c"
20
false
false
1
5
3
13
4
9
null
null
sdiehl/ghc
testsuite/tests/dependent/should_compile/T14749.hs
bsd-3-clause
zero :: TyRep STAR a -> I a zero x = case x of TyApp TyMaybe _ -> Nothing
85
zero :: TyRep STAR a -> I a zero x = case x of TyApp TyMaybe _ -> Nothing
85
zero x = case x of TyApp TyMaybe _ -> Nothing
57
false
true
0
8
30
46
20
26
null
null
forked-upstream-packages-for-ghcjs/ghc
testsuite/tests/typecheck/should_fail/FDsFromGivens.hs
bsd-3-clause
f :: C Char [a] => a -> a f = undefined
39
f :: C Char [a] => a -> a f = undefined
39
f = undefined
13
false
true
0
8
11
34
15
19
null
null
silky/pp
Language/PP/Infer.hs
mit
step p (Pure x) = return (p, return x)
42
step p (Pure x) = return (p, return x)
42
step p (Pure x) = return (p, return x)
42
false
false
0
7
12
29
14
15
null
null
kim/amazonka
amazonka-iam/gen/Network/AWS/IAM/ListSAMLProviders.hs
mpl-2.0
-- | The list of SAML providers for this account. lsamlprSAMLProviderList :: Lens' ListSAMLProvidersResponse [SAMLProviderListEntry] lsamlprSAMLProviderList = lens _lsamlprSAMLProviderList (\s a -> s { _lsamlprSAMLProviderList = a }) . _List
253
lsamlprSAMLProviderList :: Lens' ListSAMLProvidersResponse [SAMLProviderListEntry] lsamlprSAMLProviderList = lens _lsamlprSAMLProviderList (\s a -> s { _lsamlprSAMLProviderList = a }) . _List
203
lsamlprSAMLProviderList = lens _lsamlprSAMLProviderList (\s a -> s { _lsamlprSAMLProviderList = a }) . _List
120
true
true
0
10
41
47
26
21
null
null
binesiyu/ifl
examples/ch13/num.hs
mit
signum (Units xa _) = Units (signum xa) (Number 1)
50
signum (Units xa _) = Units (signum xa) (Number 1)
50
signum (Units xa _) = Units (signum xa) (Number 1)
50
false
false
0
7
9
35
16
19
null
null
fredmorcos/attic
projects/pet/archive/pet_haskell_early/Main.hs
isc
parseArgs :: [String] -> Either ParseArgsErr String parseArgs [] = Left NoArgs
79
parseArgs :: [String] -> Either ParseArgsErr String parseArgs [] = Left NoArgs
79
parseArgs [] = Left NoArgs
27
false
true
0
8
12
36
16
20
null
null
MfesGA/Smtlib
Smtlib/Parsers/CommandsParsers.hs
mit
parseGetProof :: ParsecT String u Identity Command parseGetProof = do _ <- aspO _ <- emptySpace _ <- string "get-proof" _ <- emptySpace _ <-aspC return GetProof
172
parseGetProof :: ParsecT String u Identity Command parseGetProof = do _ <- aspO _ <- emptySpace _ <- string "get-proof" _ <- emptySpace _ <-aspC return GetProof
172
parseGetProof = do _ <- aspO _ <- emptySpace _ <- string "get-proof" _ <- emptySpace _ <-aspC return GetProof
121
false
true
1
9
38
69
28
41
null
null
csrhodes/pandoc
src/Text/Pandoc/Writers/CommonMark.hs
gpl-2.0
node :: NodeType -> [Node] -> Node node = Node Nothing
54
node :: NodeType -> [Node] -> Node node = Node Nothing
54
node = Node Nothing
19
false
true
0
7
10
25
13
12
null
null
sopvop/snap-server
test/Snap/Test/Common.hs
bsd-3-clause
ditchHeaders [] = []
27
ditchHeaders [] = []
27
ditchHeaders [] = []
27
false
false
0
6
10
13
6
7
null
null
jack793/Haskell-examples
Flipped/ceaser.hs
gpl-3.0
-- find list of positions of x in the list xs positions :: Eq a => a -> [a] -> [Int] positions x xs = [ i' | (x', i') <- zip xs [0..n], x==x' ] where n = length xs - 1 -- top-level decoding function
216
positions :: Eq a => a -> [a] -> [Int] positions x xs = [ i' | (x', i') <- zip xs [0..n], x==x' ] where n = length xs - 1 -- top-level decoding function
170
positions x xs = [ i' | (x', i') <- zip xs [0..n], x==x' ] where n = length xs - 1 -- top-level decoding function
131
true
true
0
9
64
88
47
41
null
null
Athas/Sindre
Sindre/X11.hs
mit
getX11Event :: Display -> Window -> XIC -> IO (KeySym, String, X.Event) getX11Event dpy win ic = do (str,keysym,event) <- allocaXEvent $ \e -> do nextEvent dpy e ev <- X.getEvent e (ks,s) <- ifM ((ev_event_type ev /= keyPress ||) <$> filterEvent e win) (return (Nothing, Nothing)) (utf8LookupString ic e) return (ks,s,ev) return ( fromMaybe xK_VoidSymbol keysym , fromMaybe "" str , event)
500
getX11Event :: Display -> Window -> XIC -> IO (KeySym, String, X.Event) getX11Event dpy win ic = do (str,keysym,event) <- allocaXEvent $ \e -> do nextEvent dpy e ev <- X.getEvent e (ks,s) <- ifM ((ev_event_type ev /= keyPress ||) <$> filterEvent e win) (return (Nothing, Nothing)) (utf8LookupString ic e) return (ks,s,ev) return ( fromMaybe xK_VoidSymbol keysym , fromMaybe "" str , event)
500
getX11Event dpy win ic = do (str,keysym,event) <- allocaXEvent $ \e -> do nextEvent dpy e ev <- X.getEvent e (ks,s) <- ifM ((ev_event_type ev /= keyPress ||) <$> filterEvent e win) (return (Nothing, Nothing)) (utf8LookupString ic e) return (ks,s,ev) return ( fromMaybe xK_VoidSymbol keysym , fromMaybe "" str , event)
428
false
true
0
19
173
197
99
98
null
null
m-alvarez/jhc
src/FrontEnd/DeclsDepends.hs
mit
expDeps (HsVar name) = tell [name]
34
expDeps (HsVar name) = tell [name]
34
expDeps (HsVar name) = tell [name]
34
false
false
0
7
5
21
10
11
null
null
mrakgr/futhark
src/Futhark/Transform/FirstOrderTransform.hs
bsd-3-clause
newFold :: Transformer m => String -> [(SubExp,Type)] -> [VName] -> m ([Ident], [SubExp], [Ident]) newFold what accexps_and_types arrexps = do initacc <- mapM copyIfArray acc_exps acc <- mapM (newIdent "acc") acc_types arrts <- mapM lookupType arrexps inarrs <- mapM (newIdent $ what ++ "_inarr") arrts return (acc, initacc, inarrs) where (acc_exps, acc_types) = unzip accexps_and_types
417
newFold :: Transformer m => String -> [(SubExp,Type)] -> [VName] -> m ([Ident], [SubExp], [Ident]) newFold what accexps_and_types arrexps = do initacc <- mapM copyIfArray acc_exps acc <- mapM (newIdent "acc") acc_types arrts <- mapM lookupType arrexps inarrs <- mapM (newIdent $ what ++ "_inarr") arrts return (acc, initacc, inarrs) where (acc_exps, acc_types) = unzip accexps_and_types
417
newFold what accexps_and_types arrexps = do initacc <- mapM copyIfArray acc_exps acc <- mapM (newIdent "acc") acc_types arrts <- mapM lookupType arrexps inarrs <- mapM (newIdent $ what ++ "_inarr") arrts return (acc, initacc, inarrs) where (acc_exps, acc_types) = unzip accexps_and_types
299
false
true
0
11
86
167
85
82
null
null
sdiehl/ghc
compiler/main/DynFlags.hs
bsd-3-clause
exposePackageId p = upd (\s -> s{ packageFlags = parsePackageFlag "-package-id" parseUnitIdArg p : packageFlags s })
122
exposePackageId p = upd (\s -> s{ packageFlags = parsePackageFlag "-package-id" parseUnitIdArg p : packageFlags s })
122
exposePackageId p = upd (\s -> s{ packageFlags = parsePackageFlag "-package-id" parseUnitIdArg p : packageFlags s })
122
false
false
0
10
22
42
21
21
null
null
facebookincubator/duckling
Duckling/Rules/GA.hs
bsd-3-clause
langRules (Seal CreditCardNumber) = []
38
langRules (Seal CreditCardNumber) = []
38
langRules (Seal CreditCardNumber) = []
38
false
false
0
6
4
18
8
10
null
null
goens/rand-code-graph
app/Main.hs
mit
exampleMapUpTo :: Int -> Map.Map (Int,Int) Rational exampleMapUpTo n = Map.fromList [ ((a,b), (1 / 2^(b-a))) | a<- [1..n], b<-[1..n], a<b]
138
exampleMapUpTo :: Int -> Map.Map (Int,Int) Rational exampleMapUpTo n = Map.fromList [ ((a,b), (1 / 2^(b-a))) | a<- [1..n], b<-[1..n], a<b]
138
exampleMapUpTo n = Map.fromList [ ((a,b), (1 / 2^(b-a))) | a<- [1..n], b<-[1..n], a<b]
86
false
true
0
11
20
103
56
47
null
null
jespino/sth
sth.hs
bsd-3-clause
generateStatList (Stderr:xs) content = Stat Stderr (Just $ STHLib.stderr content) : generateStatList xs content
111
generateStatList (Stderr:xs) content = Stat Stderr (Just $ STHLib.stderr content) : generateStatList xs content
111
generateStatList (Stderr:xs) content = Stat Stderr (Just $ STHLib.stderr content) : generateStatList xs content
111
false
false
0
10
13
44
21
23
null
null
brendanhay/gogol
gogol-dataproc/gen/Network/Google/Resource/Dataproc/Projects/Locations/WorkflowTemplates/List.hs
mpl-2.0
-- | V1 error format. plwtlXgafv :: Lens' ProjectsLocationsWorkflowTemplatesList (Maybe Xgafv) plwtlXgafv = lens _plwtlXgafv (\ s a -> s{_plwtlXgafv = a})
156
plwtlXgafv :: Lens' ProjectsLocationsWorkflowTemplatesList (Maybe Xgafv) plwtlXgafv = lens _plwtlXgafv (\ s a -> s{_plwtlXgafv = a})
134
plwtlXgafv = lens _plwtlXgafv (\ s a -> s{_plwtlXgafv = a})
61
true
true
0
9
23
48
25
23
null
null
peter-fogg/pardoc
src/Text/Pandoc/Readers/LaTeX.hs
gpl-2.0
dot 'z' = "ż"
13
dot 'z' = "ż"
13
dot 'z' = "ż"
13
false
false
0
5
3
9
4
5
null
null
shayan-najd/HsParser
OutputableInstances.hs
gpl-3.0
ppr_monobind (FunBind { fun_id = fun, fun_matches = matches }) = pprFunBind matches
134
ppr_monobind (FunBind { fun_id = fun, fun_matches = matches }) = pprFunBind matches
134
ppr_monobind (FunBind { fun_id = fun, fun_matches = matches }) = pprFunBind matches
134
false
false
0
8
63
31
16
15
null
null
JPMoresmau/leksah
src/IDE/Session.hs
gpl-2.0
recover pp (FilesSt p) = void (recoverState pp p)
60
recover pp (FilesSt p) = void (recoverState pp p)
60
recover pp (FilesSt p) = void (recoverState pp p)
60
false
false
0
7
19
28
13
15
null
null
luqui/tigress
CLI.hs
bsd-3-clause
defineLocal :: String -> String -> Shell () defineLocal name code = do case makeDefn code of Left err -> liftIO . putStrLn $ "Parse error: " ++ err Right defn -> do addDefn name defn liftIO . putStrLn $ "defined " ++ name
265
defineLocal :: String -> String -> Shell () defineLocal name code = do case makeDefn code of Left err -> liftIO . putStrLn $ "Parse error: " ++ err Right defn -> do addDefn name defn liftIO . putStrLn $ "defined " ++ name
265
defineLocal name code = do case makeDefn code of Left err -> liftIO . putStrLn $ "Parse error: " ++ err Right defn -> do addDefn name defn liftIO . putStrLn $ "defined " ++ name
221
false
true
0
14
87
92
42
50
null
null
shlevy/ghc
compiler/hsSyn/HsUtils.hs
bsd-3-clause
nlHsVarApps :: IdP id -> [IdP id] -> LHsExpr id nlHsVarApps f xs = noLoc (foldl mk (HsVar (noLoc f)) (map (HsVar . noLoc) xs)) where mk f a = HsApp (noLoc f) (noLoc a)
203
nlHsVarApps :: IdP id -> [IdP id] -> LHsExpr id nlHsVarApps f xs = noLoc (foldl mk (HsVar (noLoc f)) (map (HsVar . noLoc) xs)) where mk f a = HsApp (noLoc f) (noLoc a)
203
nlHsVarApps f xs = noLoc (foldl mk (HsVar (noLoc f)) (map (HsVar . noLoc) xs)) where mk f a = HsApp (noLoc f) (noLoc a)
155
false
true
0
11
70
105
51
54
null
null
tjakway/ghcjvm
compiler/typecheck/TcRnTypes.hs
bsd-3-clause
eqCanRewriteFR _ _ = False
56
eqCanRewriteFR _ _ = False
56
eqCanRewriteFR _ _ = False
56
false
false
1
5
34
12
5
7
null
null
pdmurray/haskell-book-ex
src/ch7/Exercises7.8.hs
bsd-3-clause
pal xs | xs == reverse xs = True | otherwise = False
61
pal xs | xs == reverse xs = True | otherwise = False
61
pal xs | xs == reverse xs = True | otherwise = False
61
false
false
0
9
21
31
13
18
null
null
HeavenlyAwe/opetussivut
main.hs
mit
i18nCourseNameFromOodi :: Lang -- ^ The 'Lang'uage to lookup. -> Text -- ^ The WebOodi page ID. -> M (Maybe Text) -- ^ The translation if found. i18nCourseNameFromOodi lang pageId = do Config{..} <- ask ov <- liftIO $ tryTakeMVar oodiVar oodiNames <- case ov of Just x -> return x Nothing -> readOodiNames liftIO $ putMVar oodiVar oodiNames case Map.lookup (lang, pageId) oodiNames of Just name -> return $ Just name Nothing -> do raw <- liftIO $ fetch8859 (T.unpack $ weboodiLink weboodiUrl lang pageId) case getOodiName raw of Nothing -> return Nothing Just name -> do let newNames = Map.insert (lang, pageId) name oodiNames liftIO $ do _ <- swapMVar oodiVar newNames writeFile oodiNameFile (show newNames) return $ Just name {- | Reads the web page at the given URL and returns a utf-8 converted version of the page. WebOodi is encoded in iso-8859-1 encoding. -}
1,162
i18nCourseNameFromOodi :: Lang -- ^ The 'Lang'uage to lookup. -> Text -- ^ The WebOodi page ID. -> M (Maybe Text) i18nCourseNameFromOodi lang pageId = do Config{..} <- ask ov <- liftIO $ tryTakeMVar oodiVar oodiNames <- case ov of Just x -> return x Nothing -> readOodiNames liftIO $ putMVar oodiVar oodiNames case Map.lookup (lang, pageId) oodiNames of Just name -> return $ Just name Nothing -> do raw <- liftIO $ fetch8859 (T.unpack $ weboodiLink weboodiUrl lang pageId) case getOodiName raw of Nothing -> return Nothing Just name -> do let newNames = Map.insert (lang, pageId) name oodiNames liftIO $ do _ <- swapMVar oodiVar newNames writeFile oodiNameFile (show newNames) return $ Just name {- | Reads the web page at the given URL and returns a utf-8 converted version of the page. WebOodi is encoded in iso-8859-1 encoding. -}
1,128
i18nCourseNameFromOodi lang pageId = do Config{..} <- ask ov <- liftIO $ tryTakeMVar oodiVar oodiNames <- case ov of Just x -> return x Nothing -> readOodiNames liftIO $ putMVar oodiVar oodiNames case Map.lookup (lang, pageId) oodiNames of Just name -> return $ Just name Nothing -> do raw <- liftIO $ fetch8859 (T.unpack $ weboodiLink weboodiUrl lang pageId) case getOodiName raw of Nothing -> return Nothing Just name -> do let newNames = Map.insert (lang, pageId) name oodiNames liftIO $ do _ <- swapMVar oodiVar newNames writeFile oodiNameFile (show newNames) return $ Just name {- | Reads the web page at the given URL and returns a utf-8 converted version of the page. WebOodi is encoded in iso-8859-1 encoding. -}
942
true
true
0
23
444
270
126
144
null
null
Philonous/xmpp-daemon
source/Main.hs
mit
sendMethod :: Xmpp.Session -> DBus.Method sendMethod con = DBus.Method (DBus.repMethod $ sendMessage con) "sendMessage" ("recipient" :-> "message" :-> Result "")
219
sendMethod :: Xmpp.Session -> DBus.Method sendMethod con = DBus.Method (DBus.repMethod $ sendMessage con) "sendMessage" ("recipient" :-> "message" :-> Result "")
219
sendMethod con = DBus.Method (DBus.repMethod $ sendMessage con) "sendMessage" ("recipient" :-> "message" :-> Result "")
177
false
true
0
8
77
57
28
29
null
null
sgillis/HaskHull
src/View.hs
gpl-3.0
cam :: Viewer -> Camera GL.GLfloat cam player = panRad (realToFrac x) $ tiltRad (realToFrac y) $ dolly (v3toGL (position player)) $ fpsCamera where x = horizontalAngle player y = verticalAngle player
229
cam :: Viewer -> Camera GL.GLfloat cam player = panRad (realToFrac x) $ tiltRad (realToFrac y) $ dolly (v3toGL (position player)) $ fpsCamera where x = horizontalAngle player y = verticalAngle player
229
cam player = panRad (realToFrac x) $ tiltRad (realToFrac y) $ dolly (v3toGL (position player)) $ fpsCamera where x = horizontalAngle player y = verticalAngle player
194
false
true
1
11
61
90
42
48
null
null
henrytill/hecate
src/Hecate/Evaluator.hs
apache-2.0
eval ExportJSON{_exportFile} = do es <- selectAll _ <- exportJSON _exportFile es return Exported
105
eval ExportJSON{_exportFile} = do es <- selectAll _ <- exportJSON _exportFile es return Exported
105
eval ExportJSON{_exportFile} = do es <- selectAll _ <- exportJSON _exportFile es return Exported
105
false
false
1
9
22
47
18
29
null
null
jmitchell/Idris-dev
src/Idris/AbsSyntaxTree.hs
bsd-3-clause
mapPTermFC f g (PTyped t1 t2) = PTyped (mapPTermFC f g t1) (mapPTermFC f g t2)
94
mapPTermFC f g (PTyped t1 t2) = PTyped (mapPTermFC f g t1) (mapPTermFC f g t2)
94
mapPTermFC f g (PTyped t1 t2) = PTyped (mapPTermFC f g t1) (mapPTermFC f g t2)
94
false
false
0
7
31
46
22
24
null
null
uduki/hsQt
Qtc/Gui/QTextDocument.hs
bsd-2-clause
setDefaultTextOption :: QTextDocument a -> ((QTextOption t1)) -> IO () setDefaultTextOption x0 (x1) = withObjectPtr x0 $ \cobj_x0 -> withObjectPtr x1 $ \cobj_x1 -> qtc_QTextDocument_setDefaultTextOption cobj_x0 cobj_x1
228
setDefaultTextOption :: QTextDocument a -> ((QTextOption t1)) -> IO () setDefaultTextOption x0 (x1) = withObjectPtr x0 $ \cobj_x0 -> withObjectPtr x1 $ \cobj_x1 -> qtc_QTextDocument_setDefaultTextOption cobj_x0 cobj_x1
228
setDefaultTextOption x0 (x1) = withObjectPtr x0 $ \cobj_x0 -> withObjectPtr x1 $ \cobj_x1 -> qtc_QTextDocument_setDefaultTextOption cobj_x0 cobj_x1
157
false
true
0
9
36
73
36
37
null
null
amal029/haskell-tests
f.hs
mit
addList (Cons a b) x = Cons a (addList b x)
43
addList (Cons a b) x = Cons a (addList b x)
43
addList (Cons a b) x = Cons a (addList b x)
43
false
false
1
7
10
38
15
23
null
null
DavidAlphaFox/ghc
libraries/bytestring/Data/ByteString/Unsafe.hs
bsd-3-clause
-- | A variety of 'take' which omits the checks on @n@ so there is an -- obligation on the programmer to provide a proof that @0 <= n <= 'length' xs@. unsafeTake :: Int -> ByteString -> ByteString unsafeTake n (PS x s l) = assert (0 <= n && n <= l) $ PS x s n
259
unsafeTake :: Int -> ByteString -> ByteString unsafeTake n (PS x s l) = assert (0 <= n && n <= l) $ PS x s n
108
unsafeTake n (PS x s l) = assert (0 <= n && n <= l) $ PS x s n
62
true
true
0
10
58
65
33
32
null
null
Tarrasch/Hong
GameState.hs
bsd-3-clause
ballPos, ballDir :: State -> (Float, Float) ballPos s = (xPosition s, yPosition s)
82
ballPos, ballDir :: State -> (Float, Float) ballPos s = (xPosition s, yPosition s)
82
ballPos s = (xPosition s, yPosition s)
38
false
true
2
8
13
48
22
26
null
null
weiningl/tic-tac-toe
Board.hs
bsd-3-clause
-- | Get diagonal diagonal :: Board a -> Bool -> [Maybe a] diagonal b rev = fmap (flip getBoard b) indices where n = (size b) - 1 indices = if rev then zip [0..n] (reverse [0..n]) else zip [0..n] [0..n]
230
diagonal :: Board a -> Bool -> [Maybe a] diagonal b rev = fmap (flip getBoard b) indices where n = (size b) - 1 indices = if rev then zip [0..n] (reverse [0..n]) else zip [0..n] [0..n]
212
diagonal b rev = fmap (flip getBoard b) indices where n = (size b) - 1 indices = if rev then zip [0..n] (reverse [0..n]) else zip [0..n] [0..n]
171
true
true
2
10
69
127
60
67
null
null
JacquesCarette/literate-scientific-software
code/drasil-docLang/Drasil/Sections/Requirements.hs
bsd-2-clause
mkQRTuple :: (Quantity i, MayHaveUnit i, HasShortName i, Referable i) => [i] -> [(QuantityDict, Sentence)] mkQRTuple = map (\c -> (qw c, makeRef2S c))
150
mkQRTuple :: (Quantity i, MayHaveUnit i, HasShortName i, Referable i) => [i] -> [(QuantityDict, Sentence)] mkQRTuple = map (\c -> (qw c, makeRef2S c))
150
mkQRTuple = map (\c -> (qw c, makeRef2S c))
43
false
true
0
9
23
77
42
35
null
null
romanb/amazonka
amazonka-glacier/gen/Network/AWS/Glacier/ListParts.hs
mpl-2.0
-- | The part size in bytes. lprPartSizeInBytes :: Lens' ListPartsResponse (Maybe Integer) lprPartSizeInBytes = lens _lprPartSizeInBytes (\s a -> s { _lprPartSizeInBytes = a })
180
lprPartSizeInBytes :: Lens' ListPartsResponse (Maybe Integer) lprPartSizeInBytes = lens _lprPartSizeInBytes (\s a -> s { _lprPartSizeInBytes = a })
151
lprPartSizeInBytes = lens _lprPartSizeInBytes (\s a -> s { _lprPartSizeInBytes = a })
89
true
true
1
9
29
50
25
25
null
null
michaelbeaumont/pandoc
src/Text/Pandoc/Writers/Markdown.hs
gpl-2.0
blockToMarkdown opts (Para inlines) = (<> blankline) `fmap` blockToMarkdown opts (Plain inlines)
98
blockToMarkdown opts (Para inlines) = (<> blankline) `fmap` blockToMarkdown opts (Plain inlines)
98
blockToMarkdown opts (Para inlines) = (<> blankline) `fmap` blockToMarkdown opts (Plain inlines)
98
false
false
0
8
13
38
20
18
null
null
cocreature/stack
src/Stack/Build/Execute.hs
bsd-3-clause
displayTask :: Task -> Text displayTask task = T.pack $ concat [ packageIdentifierString $ taskProvides task , ": database=" , case taskLocation task of Snap -> "snapshot" Local -> "local" , ", source=" , case taskType task of TTLocal lp -> concat [ toFilePath $ lpDir lp ] TTUpstream _ _ -> "package index" , if Set.null missing then "" else ", after: " ++ intercalate "," (map packageIdentifierString $ Set.toList missing) ] where missing = tcoMissing $ taskConfigOpts task
581
displayTask :: Task -> Text displayTask task = T.pack $ concat [ packageIdentifierString $ taskProvides task , ": database=" , case taskLocation task of Snap -> "snapshot" Local -> "local" , ", source=" , case taskType task of TTLocal lp -> concat [ toFilePath $ lpDir lp ] TTUpstream _ _ -> "package index" , if Set.null missing then "" else ", after: " ++ intercalate "," (map packageIdentifierString $ Set.toList missing) ] where missing = tcoMissing $ taskConfigOpts task
581
displayTask task = T.pack $ concat [ packageIdentifierString $ taskProvides task , ": database=" , case taskLocation task of Snap -> "snapshot" Local -> "local" , ", source=" , case taskType task of TTLocal lp -> concat [ toFilePath $ lpDir lp ] TTUpstream _ _ -> "package index" , if Set.null missing then "" else ", after: " ++ intercalate "," (map packageIdentifierString $ Set.toList missing) ] where missing = tcoMissing $ taskConfigOpts task
553
false
true
1
12
185
169
81
88
null
null
brendanhay/gogol
gogol-bigquerydatatransfer/gen/Network/Google/BigQueryDataTransfer/Types/Product.hs
mpl-2.0
-- | Minimum time after which a transfer run can be started. tScheduleTime :: Lens' TransferRun (Maybe UTCTime) tScheduleTime = lens _tScheduleTime (\ s a -> s{_tScheduleTime = a}) . mapping _DateTime
214
tScheduleTime :: Lens' TransferRun (Maybe UTCTime) tScheduleTime = lens _tScheduleTime (\ s a -> s{_tScheduleTime = a}) . mapping _DateTime
153
tScheduleTime = lens _tScheduleTime (\ s a -> s{_tScheduleTime = a}) . mapping _DateTime
102
true
true
1
8
45
57
28
29
null
null
mikeizbicki/homoiconic
old/Topology2.hs
bsd-3-clause
isLawful :: forall cxt. Lawful cxt => IO () isLawful = defaultMain [lawful (undefined::proxy cxt)]
98
isLawful :: forall cxt. Lawful cxt => IO () isLawful = defaultMain [lawful (undefined::proxy cxt)]
98
isLawful = defaultMain [lawful (undefined::proxy cxt)]
54
false
true
0
9
14
46
23
23
null
null
quixoftic/wwdcc
src/Logging.hs
bsd-3-clause
defaultLogging :: IO () defaultLogging = updateGlobalLogger defaultName (setLevel WARNING)
90
defaultLogging :: IO () defaultLogging = updateGlobalLogger defaultName (setLevel WARNING)
90
defaultLogging = updateGlobalLogger defaultName (setLevel WARNING)
66
false
true
0
7
9
27
13
14
null
null
4ZP6Capstone2015/ampersand
src/Database/Design/Ampersand/Input/ADL1/Lexer.hs
gpl-3.0
symbols :: String -- ^ The list of symbol characters / [Char] symbols = "()[],{}<>"
83
symbols :: String symbols = "()[],{}<>"
39
symbols = "()[],{}<>"
21
true
true
0
4
14
12
7
5
null
null
othercriteria/blaze
RAE_draft.hs
mit
showE (Node (SNode _ (StringDatum s)) [c1,c2,c3] _) | (s == "let" ) = printf "(let (%s = %s) in %s)" sc1 sc2 sc3 | (s == "if" ) = printf "(if %s then %s else %s)" sc1 sc2 sc3 | otherwise = error $ printf "showE: invalid ternary op %s" s where [sc1,sc2,sc3] = map showE [c1,c2,c3]
300
showE (Node (SNode _ (StringDatum s)) [c1,c2,c3] _) | (s == "let" ) = printf "(let (%s = %s) in %s)" sc1 sc2 sc3 | (s == "if" ) = printf "(if %s then %s else %s)" sc1 sc2 sc3 | otherwise = error $ printf "showE: invalid ternary op %s" s where [sc1,sc2,sc3] = map showE [c1,c2,c3]
300
showE (Node (SNode _ (StringDatum s)) [c1,c2,c3] _) | (s == "let" ) = printf "(let (%s = %s) in %s)" sc1 sc2 sc3 | (s == "if" ) = printf "(if %s then %s else %s)" sc1 sc2 sc3 | otherwise = error $ printf "showE: invalid ternary op %s" s where [sc1,sc2,sc3] = map showE [c1,c2,c3]
300
false
false
0
11
78
138
70
68
null
null
kovach/web2
src/REPL.hs
mit
-- TODO use standard code for this queryEval :: Graph -> LHS -> M2 ([Msg], [Context]) queryEval g lhs = do pairs <- mapM applyMatch matches let (deletions, ctxts) = unzip pairs return (concat deletions, ctxts) where rule = (Rule Nothing Nothing Event lhs []) rrule = RankedRule 1 rule rels = lhsRels rule ts = filter (\t -> label t `elem` rels) $ fromGraph g (matches, _) = foldl' step ([], emptyGraph) ts step (ms, g) t = (getMatches t rrule g ++ ms, insertTuple t g) --foo str = do -- ok <- newProgram "query" str -- if ok -- then do -- -- run "query" -- return () -- else do -- -- TODO return "bad parse" -- return () -- TODO integrate this -- -- TODO refactor this into Graph? -- step2 :: Rule -> Tuple -> (Graph, [Context]) -> (Graph, [Context]) -- step2 rule t (g, out) = (g2, cs ++ out) -- where -- matches = map fix $ getMatches t (unsafeRanked 0 rule) g -- cs :: [Context] -- cs = map snd matches -- removed = concatMap fst matches -- g2 = foldr removeTuple (insertTuple t g) removed -- fix (p,c,_) = (consumed p, c) -- -- step1 :: [Rule] -> Graph -> [Tuple] -- step1 rules g = ts -- where -- rels = nub . concatMap lhsRels $ rules -- ts = S.toList $ mconcat $ M.elems $ subg -- subg = M.filterWithKey (\k _ -> k `elem` rels) $ relations g -- -- eval :: Action -> Graph -> M2 Out -- eval (ARule rule) g = do -- NNode rid <- freshNode -- let ts = step1 [rule] g -- (output, _) <- stepRule (MQ { m_pos = ts, m_neg = [] }) (RankedRule rid rule) g -- return (ORule output) -- eval (AQuery q) g = do -- let rule = Rule Event q [] -- fake rule -- let ts = step1 [rule] g -- (_, cs) = foldr (step2 rule) (g, []) ts -- return (OQuery cs)
1,767
queryEval :: Graph -> LHS -> M2 ([Msg], [Context]) queryEval g lhs = do pairs <- mapM applyMatch matches let (deletions, ctxts) = unzip pairs return (concat deletions, ctxts) where rule = (Rule Nothing Nothing Event lhs []) rrule = RankedRule 1 rule rels = lhsRels rule ts = filter (\t -> label t `elem` rels) $ fromGraph g (matches, _) = foldl' step ([], emptyGraph) ts step (ms, g) t = (getMatches t rrule g ++ ms, insertTuple t g) --foo str = do -- ok <- newProgram "query" str -- if ok -- then do -- -- run "query" -- return () -- else do -- -- TODO return "bad parse" -- return () -- TODO integrate this -- -- TODO refactor this into Graph? -- step2 :: Rule -> Tuple -> (Graph, [Context]) -> (Graph, [Context]) -- step2 rule t (g, out) = (g2, cs ++ out) -- where -- matches = map fix $ getMatches t (unsafeRanked 0 rule) g -- cs :: [Context] -- cs = map snd matches -- removed = concatMap fst matches -- g2 = foldr removeTuple (insertTuple t g) removed -- fix (p,c,_) = (consumed p, c) -- -- step1 :: [Rule] -> Graph -> [Tuple] -- step1 rules g = ts -- where -- rels = nub . concatMap lhsRels $ rules -- ts = S.toList $ mconcat $ M.elems $ subg -- subg = M.filterWithKey (\k _ -> k `elem` rels) $ relations g -- -- eval :: Action -> Graph -> M2 Out -- eval (ARule rule) g = do -- NNode rid <- freshNode -- let ts = step1 [rule] g -- (output, _) <- stepRule (MQ { m_pos = ts, m_neg = [] }) (RankedRule rid rule) g -- return (ORule output) -- eval (AQuery q) g = do -- let rule = Rule Event q [] -- fake rule -- let ts = step1 [rule] g -- (_, cs) = foldr (step2 rule) (g, []) ts -- return (OQuery cs)
1,732
queryEval g lhs = do pairs <- mapM applyMatch matches let (deletions, ctxts) = unzip pairs return (concat deletions, ctxts) where rule = (Rule Nothing Nothing Event lhs []) rrule = RankedRule 1 rule rels = lhsRels rule ts = filter (\t -> label t `elem` rels) $ fromGraph g (matches, _) = foldl' step ([], emptyGraph) ts step (ms, g) t = (getMatches t rrule g ++ ms, insertTuple t g) --foo str = do -- ok <- newProgram "query" str -- if ok -- then do -- -- run "query" -- return () -- else do -- -- TODO return "bad parse" -- return () -- TODO integrate this -- -- TODO refactor this into Graph? -- step2 :: Rule -> Tuple -> (Graph, [Context]) -> (Graph, [Context]) -- step2 rule t (g, out) = (g2, cs ++ out) -- where -- matches = map fix $ getMatches t (unsafeRanked 0 rule) g -- cs :: [Context] -- cs = map snd matches -- removed = concatMap fst matches -- g2 = foldr removeTuple (insertTuple t g) removed -- fix (p,c,_) = (consumed p, c) -- -- step1 :: [Rule] -> Graph -> [Tuple] -- step1 rules g = ts -- where -- rels = nub . concatMap lhsRels $ rules -- ts = S.toList $ mconcat $ M.elems $ subg -- subg = M.filterWithKey (\k _ -> k `elem` rels) $ relations g -- -- eval :: Action -> Graph -> M2 Out -- eval (ARule rule) g = do -- NNode rid <- freshNode -- let ts = step1 [rule] g -- (output, _) <- stepRule (MQ { m_pos = ts, m_neg = [] }) (RankedRule rid rule) g -- return (ORule output) -- eval (AQuery q) g = do -- let rule = Rule Event q [] -- fake rule -- let ts = step1 [rule] g -- (_, cs) = foldr (step2 rule) (g, []) ts -- return (OQuery cs)
1,681
true
true
0
10
470
265
156
109
null
null
DanielWaterworth/Idris-dev
src/Idris/REPL.hs
bsd-3-clause
getPkgClean :: Opt -> Maybe String getPkgClean (PkgClean str) = Just str
72
getPkgClean :: Opt -> Maybe String getPkgClean (PkgClean str) = Just str
72
getPkgClean (PkgClean str) = Just str
37
false
true
0
7
11
30
14
16
null
null
ihc/futhark
src/Futhark/Representation/Primitive.hs
isc
intValue Int32 = Int32Value . fromIntegral
42
intValue Int32 = Int32Value . fromIntegral
42
intValue Int32 = Int32Value . fromIntegral
42
false
false
0
5
5
13
6
7
null
null
diminishedprime/.org
programmey_stuff/write_yourself_a_scheme/ch_05/hello.hs
mit
showVal (Atom name) = name
26
showVal (Atom name) = name
26
showVal (Atom name) = name
26
false
false
0
7
4
15
7
8
null
null
Neuromancer42/ministgwasm
src/Compiler/Util.hs
bsd-3-clause
decOp :: Integer -> STG.PrimOp decOp n = case n of 0 -> STG.Add 1 -> STG.Sub 2 -> STG.Mul 3 -> STG.Div 4 -> STG.Mod _ -> error "Error: primitive function not supported" -- | encode a constructor into a number
235
decOp :: Integer -> STG.PrimOp decOp n = case n of 0 -> STG.Add 1 -> STG.Sub 2 -> STG.Mul 3 -> STG.Div 4 -> STG.Mod _ -> error "Error: primitive function not supported" -- | encode a constructor into a number
235
decOp n = case n of 0 -> STG.Add 1 -> STG.Sub 2 -> STG.Mul 3 -> STG.Div 4 -> STG.Mod _ -> error "Error: primitive function not supported" -- | encode a constructor into a number
204
false
true
0
8
68
79
38
41
null
null
andreasfrom/truths
Form.hs
mit
grade p@(If _ _) = Precedence p 3 5 AssocRight
47
grade p@(If _ _) = Precedence p 3 5 AssocRight
47
grade p@(If _ _) = Precedence p 3 5 AssocRight
47
false
false
0
8
10
29
14
15
null
null
opqdonut/nikls
test/Test.hs
gpl-3.0
genAccounts :: Gen [Account] genAccounts = fmap nub $ listOf1 arbitrary
71
genAccounts :: Gen [Account] genAccounts = fmap nub $ listOf1 arbitrary
71
genAccounts = fmap nub $ listOf1 arbitrary
42
false
true
0
6
10
27
13
14
null
null
hvr/vector
Data/Vector/Primitive/Mutable.hs
bsd-3-clause
set = G.set
11
set = G.set
11
set = G.set
11
false
false
0
5
2
8
4
4
null
null
Mikolaj/miniutter
test/test-miniutter.hs
bsd-3-clause
testMakePhraseEnumeration :: Test testMakePhraseEnumeration = testGroup "enumeration and collection" [ tp [MU.WWandW [MU.String "dog", "eagle", MU.Cardinal 7]] "dog, eagle and seven" , tp [MU.WWxW "then" [MU.Ordinal 113, MU.AW (MU.String "eagle"), "parrot"]] "113th, an eagle then parrot" , tp [MU.WWandW [ MU.String "I" , MU.WWandW [MU.String "I", MU.Ordinal 31, MU.Cardinal 17] , MU.WWandW ["I", MU.AW (MU.Ordinal 18)] ]] "I, I, 31st and 17 and I and an 18th" , tp [MU.WWxW " and perhaps%" [" dog ", "", "%eagle."]] " dog and perhaps% %eagle." ]
780
testMakePhraseEnumeration :: Test testMakePhraseEnumeration = testGroup "enumeration and collection" [ tp [MU.WWandW [MU.String "dog", "eagle", MU.Cardinal 7]] "dog, eagle and seven" , tp [MU.WWxW "then" [MU.Ordinal 113, MU.AW (MU.String "eagle"), "parrot"]] "113th, an eagle then parrot" , tp [MU.WWandW [ MU.String "I" , MU.WWandW [MU.String "I", MU.Ordinal 31, MU.Cardinal 17] , MU.WWandW ["I", MU.AW (MU.Ordinal 18)] ]] "I, I, 31st and 17 and I and an 18th" , tp [MU.WWxW " and perhaps%" [" dog ", "", "%eagle."]] " dog and perhaps% %eagle." ]
780
testMakePhraseEnumeration = testGroup "enumeration and collection" [ tp [MU.WWandW [MU.String "dog", "eagle", MU.Cardinal 7]] "dog, eagle and seven" , tp [MU.WWxW "then" [MU.Ordinal 113, MU.AW (MU.String "eagle"), "parrot"]] "113th, an eagle then parrot" , tp [MU.WWandW [ MU.String "I" , MU.WWandW [MU.String "I", MU.Ordinal 31, MU.Cardinal 17] , MU.WWandW ["I", MU.AW (MU.Ordinal 18)] ]] "I, I, 31st and 17 and I and an 18th" , tp [MU.WWxW " and perhaps%" [" dog ", "", "%eagle."]] " dog and perhaps% %eagle." ]
746
false
true
0
15
316
207
106
101
null
null
Laar/CodeGenerating
tests/Utils/Type.hs
bsd-3-clause
------------------------------------------------------------------------ forAllShrinkType :: Testable prop => (Type -> prop) -> Property forAllShrinkType = forAllShrink (typeJunkGen Ascii) shrinkType
200
forAllShrinkType :: Testable prop => (Type -> prop) -> Property forAllShrinkType = forAllShrink (typeJunkGen Ascii) shrinkType
126
forAllShrinkType = forAllShrink (typeJunkGen Ascii) shrinkType
62
true
true
0
8
17
41
21
20
null
null
Deewiant/haschoo
Haschoo/Utils.hs
bsd-3-clause
eqWithM p (x:xs) (y:ys) = do b <- p x y if b then eqWithM p xs ys else return False -- Applies the function on element pairs while there are enough elements to -- form pairs
192
eqWithM p (x:xs) (y:ys) = do b <- p x y if b then eqWithM p xs ys else return False -- Applies the function on element pairs while there are enough elements to -- form pairs
192
eqWithM p (x:xs) (y:ys) = do b <- p x y if b then eqWithM p xs ys else return False -- Applies the function on element pairs while there are enough elements to -- form pairs
192
false
false
0
8
55
62
31
31
null
null
wellposed/hblas
src/Numerical/HBLAS/BLAS/Level1.hs
bsd-3-clause
dscal :: PrimMonad m => ScalFun Double Double (PrimState m) m dscal = scalAbstraction "dscal" cblas_dscal_safe cblas_dscal_unsafe (\x f -> f x )
144
dscal :: PrimMonad m => ScalFun Double Double (PrimState m) m dscal = scalAbstraction "dscal" cblas_dscal_safe cblas_dscal_unsafe (\x f -> f x )
144
dscal = scalAbstraction "dscal" cblas_dscal_safe cblas_dscal_unsafe (\x f -> f x )
82
false
true
0
9
22
60
28
32
null
null
GaloisInc/halvm-ghc
compiler/llvmGen/LlvmCodeGen/Base.hs
bsd-3-clause
markUsedVar :: LlvmVar -> LlvmM () markUsedVar v = modifyEnv $ \env -> env { envUsedVars = v : envUsedVars env }
112
markUsedVar :: LlvmVar -> LlvmM () markUsedVar v = modifyEnv $ \env -> env { envUsedVars = v : envUsedVars env }
112
markUsedVar v = modifyEnv $ \env -> env { envUsedVars = v : envUsedVars env }
77
false
true
0
10
21
47
24
23
null
null
kishoredbn/barrelfish
hake/RuleDefs.hs
mit
cInDir :: TreeDB -> String -> String -> [String] cInDir tdb tf dir = inDir tdb tf dir ".c"
90
cInDir :: TreeDB -> String -> String -> [String] cInDir tdb tf dir = inDir tdb tf dir ".c"
90
cInDir tdb tf dir = inDir tdb tf dir ".c"
41
false
true
0
8
18
42
21
21
null
null
unclechu/haskell-qm-interpolated-string
src/Text/InterpolatedString/QM/Internal/Parsers/Helpers.hs
unlicense
makeExpr (Literal a : xs) = TH.appE [| mappend (fromString a) |] $ makeExpr xs
83
makeExpr (Literal a : xs) = TH.appE [| mappend (fromString a) |] $ makeExpr xs
83
makeExpr (Literal a : xs) = TH.appE [| mappend (fromString a) |] $ makeExpr xs
83
false
false
0
7
19
35
17
18
null
null
spechub/Hets
CSL/Keywords.hs
gpl-2.0
whileS :: String whileS = "while"
33
whileS :: String whileS = "while"
33
whileS = "while"
16
false
true
0
6
5
18
7
11
null
null
jystic/QuickSpec
qs1/Equations.hs
bsd-3-clause
canDerive :: Term Symbol -> Term Symbol -> CC Bool canDerive t u = do t' <- flatten (killSymbols t) u' <- flatten (killSymbols u) t' =?= u'
145
canDerive :: Term Symbol -> Term Symbol -> CC Bool canDerive t u = do t' <- flatten (killSymbols t) u' <- flatten (killSymbols u) t' =?= u'
145
canDerive t u = do t' <- flatten (killSymbols t) u' <- flatten (killSymbols u) t' =?= u'
94
false
true
0
10
33
77
33
44
null
null
gianlucagiorgolo/glue-tp
TP.hs
mit
etaReduce :: LambdaTerm -> LambdaTerm etaReduce c@(C _) = c
59
etaReduce :: LambdaTerm -> LambdaTerm etaReduce c@(C _) = c
59
etaReduce c@(C _) = c
21
false
true
0
8
9
27
14
13
null
null
apyrgio/ganeti
src/Ganeti/Query/Exec.hs
bsd-2-clause
forkJobProcess :: (Error e, Show e) => JobId -- ^ a job to process -> FilePath -- ^ the daemons own livelock file -> (FilePath -> ResultT e IO ()) -- ^ a callback function to update the livelock file -- and process id in the job file -> ResultT e IO (FilePath, ProcessID) forkJobProcess jid luxiLivelock update = do logDebug $ "Setting the lockfile temporarily to " ++ luxiLivelock update luxiLivelock -- Due to a bug in GHC forking process, we want to retry, -- if the forked process fails to start. -- If it fails later on, the failure is handled by 'ResultT' -- and no retry is performed. let execWriterLogInside = MaybeT . ResultT . execWriterLogT . runResultT . runMaybeT resultOpt <- retryMaybeN C.luxidRetryForkCount $ \tryNo -> execWriterLogInside $ do let maxWaitUS = 2^(tryNo - 1) * C.luxidRetryForkStepUS when (tryNo >= 2) . liftIO $ delayRandom (0, maxWaitUS) (pid, master) <- liftIO $ forkWithPipe connectConfig (runJobProcess jid) let onError = do logDebug "Closing the pipe to the client" withErrorLogAt WARNING "Closing the communication pipe failed" (liftIO (closeClient master)) `orElse` return () logDebug $ "Getting the status of job process " ++ show (fromJobId jid) status <- liftIO $ getProcessStatus False True pid case status of Just s -> logDebug $ "Child process (job " ++ show (fromJobId jid) ++ ") status: " ++ show s Nothing -> do logDebug $ "Child process (job " ++ show (fromJobId jid) ++ ") running, killing by SIGTERM" liftIO $ signalProcess sigTERM pid flip onException onError $ do let recv = liftIO $ recvMsg master `rethrowAnnotateIOError` "ganeti job process input pipe" `onException` logError "recv from ganeti job process pipe failed" send x = liftIO $ sendMsg master x `rethrowAnnotateIOError` "ganeti job process output pipe" `onException` logError "send to ganeti job process pipe failed" logDebug "Getting the lockfile of the client" lockfile <- recv `orElse` mzero logDebug $ "Setting the lockfile to the final " ++ lockfile toErrorBase $ update lockfile logDebug "Confirming the client it can start" send "" -- from now on, we communicate with the job's Python process logDebug "Waiting for the job to ask for the job id" _ <- recv logDebug "Writing job id to the client" send . show $ fromJobId jid logDebug "Waiting for the job to ask for the lock file name" _ <- recv logDebug "Writing the lock file name to the client" send lockfile return (lockfile, pid) maybe (failError "Unable to start the client process\ \ - fork timed out repeatedly") return resultOpt
3,151
forkJobProcess :: (Error e, Show e) => JobId -- ^ a job to process -> FilePath -- ^ the daemons own livelock file -> (FilePath -> ResultT e IO ()) -- ^ a callback function to update the livelock file -- and process id in the job file -> ResultT e IO (FilePath, ProcessID) forkJobProcess jid luxiLivelock update = do logDebug $ "Setting the lockfile temporarily to " ++ luxiLivelock update luxiLivelock -- Due to a bug in GHC forking process, we want to retry, -- if the forked process fails to start. -- If it fails later on, the failure is handled by 'ResultT' -- and no retry is performed. let execWriterLogInside = MaybeT . ResultT . execWriterLogT . runResultT . runMaybeT resultOpt <- retryMaybeN C.luxidRetryForkCount $ \tryNo -> execWriterLogInside $ do let maxWaitUS = 2^(tryNo - 1) * C.luxidRetryForkStepUS when (tryNo >= 2) . liftIO $ delayRandom (0, maxWaitUS) (pid, master) <- liftIO $ forkWithPipe connectConfig (runJobProcess jid) let onError = do logDebug "Closing the pipe to the client" withErrorLogAt WARNING "Closing the communication pipe failed" (liftIO (closeClient master)) `orElse` return () logDebug $ "Getting the status of job process " ++ show (fromJobId jid) status <- liftIO $ getProcessStatus False True pid case status of Just s -> logDebug $ "Child process (job " ++ show (fromJobId jid) ++ ") status: " ++ show s Nothing -> do logDebug $ "Child process (job " ++ show (fromJobId jid) ++ ") running, killing by SIGTERM" liftIO $ signalProcess sigTERM pid flip onException onError $ do let recv = liftIO $ recvMsg master `rethrowAnnotateIOError` "ganeti job process input pipe" `onException` logError "recv from ganeti job process pipe failed" send x = liftIO $ sendMsg master x `rethrowAnnotateIOError` "ganeti job process output pipe" `onException` logError "send to ganeti job process pipe failed" logDebug "Getting the lockfile of the client" lockfile <- recv `orElse` mzero logDebug $ "Setting the lockfile to the final " ++ lockfile toErrorBase $ update lockfile logDebug "Confirming the client it can start" send "" -- from now on, we communicate with the job's Python process logDebug "Waiting for the job to ask for the job id" _ <- recv logDebug "Writing job id to the client" send . show $ fromJobId jid logDebug "Waiting for the job to ask for the lock file name" _ <- recv logDebug "Writing the lock file name to the client" send lockfile return (lockfile, pid) maybe (failError "Unable to start the client process\ \ - fork timed out repeatedly") return resultOpt
3,151
forkJobProcess jid luxiLivelock update = do logDebug $ "Setting the lockfile temporarily to " ++ luxiLivelock update luxiLivelock -- Due to a bug in GHC forking process, we want to retry, -- if the forked process fails to start. -- If it fails later on, the failure is handled by 'ResultT' -- and no retry is performed. let execWriterLogInside = MaybeT . ResultT . execWriterLogT . runResultT . runMaybeT resultOpt <- retryMaybeN C.luxidRetryForkCount $ \tryNo -> execWriterLogInside $ do let maxWaitUS = 2^(tryNo - 1) * C.luxidRetryForkStepUS when (tryNo >= 2) . liftIO $ delayRandom (0, maxWaitUS) (pid, master) <- liftIO $ forkWithPipe connectConfig (runJobProcess jid) let onError = do logDebug "Closing the pipe to the client" withErrorLogAt WARNING "Closing the communication pipe failed" (liftIO (closeClient master)) `orElse` return () logDebug $ "Getting the status of job process " ++ show (fromJobId jid) status <- liftIO $ getProcessStatus False True pid case status of Just s -> logDebug $ "Child process (job " ++ show (fromJobId jid) ++ ") status: " ++ show s Nothing -> do logDebug $ "Child process (job " ++ show (fromJobId jid) ++ ") running, killing by SIGTERM" liftIO $ signalProcess sigTERM pid flip onException onError $ do let recv = liftIO $ recvMsg master `rethrowAnnotateIOError` "ganeti job process input pipe" `onException` logError "recv from ganeti job process pipe failed" send x = liftIO $ sendMsg master x `rethrowAnnotateIOError` "ganeti job process output pipe" `onException` logError "send to ganeti job process pipe failed" logDebug "Getting the lockfile of the client" lockfile <- recv `orElse` mzero logDebug $ "Setting the lockfile to the final " ++ lockfile toErrorBase $ update lockfile logDebug "Confirming the client it can start" send "" -- from now on, we communicate with the job's Python process logDebug "Waiting for the job to ask for the job id" _ <- recv logDebug "Writing job id to the client" send . show $ fromJobId jid logDebug "Waiting for the job to ask for the lock file name" _ <- recv logDebug "Writing the lock file name to the client" send lockfile return (lockfile, pid) maybe (failError "Unable to start the client process\ \ - fork timed out repeatedly") return resultOpt
2,782
false
true
0
27
1,062
619
293
326
null
null
geekingfrog/advent-of-code
src/Y2018/Day14.hs
bsd-3-clause
digits :: Int -> [Int] digits 0 = [0]
37
digits :: Int -> [Int] digits 0 = [0]
37
digits 0 = [0]
14
false
true
0
8
8
30
14
16
null
null
gspia/reflex-dom-htmlea
lib/src/Reflex/Dom/HTML5/Elements/Interactive.hs
bsd-3-clause
-- | A short-hand notion for @ el\' \"select\" ... @ selectN' ∷ forall t m a. DomBuilder t m ⇒ m a → m (Element EventResult (DomBuilderSpace m) t, a) selectN' = el' "select"
173
selectN' ∷ forall t m a. DomBuilder t m ⇒ m a → m (Element EventResult (DomBuilderSpace m) t, a) selectN' = el' "select"
120
selectN' = el' "select"
23
true
true
0
12
34
60
31
29
null
null
fryguybob/NonEmptyList
Data/List/NonEmpty.hs
bsd-3-clause
tails :: [a] -> NonEmpty [a] tails = unsafeToNonEmpty . L.tails
72
tails :: [a] -> NonEmpty [a] tails = unsafeToNonEmpty . L.tails
72
tails = unsafeToNonEmpty . L.tails
34
false
true
0
7
19
30
16
14
null
null
shlevy/ghc
compiler/utils/Util.hs
bsd-3-clause
restrictedDamerauLevenshteinDistance' :: (Bits bv, Num bv) => bv -> Int -> Int -> String -> String -> Int restrictedDamerauLevenshteinDistance' _bv_dummy m n str1 str2 | [] <- str1 = n | otherwise = extractAnswer $ foldl' (restrictedDamerauLevenshteinDistanceWorker (matchVectors str1) top_bit_mask vector_mask) (0, 0, m_ones, 0, m) str2 where m_ones@vector_mask = (2 ^ m) - 1 top_bit_mask = (1 `shiftL` (m - 1)) `asTypeOf` _bv_dummy extractAnswer (_, _, _, _, distance) = distance
572
restrictedDamerauLevenshteinDistance' :: (Bits bv, Num bv) => bv -> Int -> Int -> String -> String -> Int restrictedDamerauLevenshteinDistance' _bv_dummy m n str1 str2 | [] <- str1 = n | otherwise = extractAnswer $ foldl' (restrictedDamerauLevenshteinDistanceWorker (matchVectors str1) top_bit_mask vector_mask) (0, 0, m_ones, 0, m) str2 where m_ones@vector_mask = (2 ^ m) - 1 top_bit_mask = (1 `shiftL` (m - 1)) `asTypeOf` _bv_dummy extractAnswer (_, _, _, _, distance) = distance
572
restrictedDamerauLevenshteinDistance' _bv_dummy m n str1 str2 | [] <- str1 = n | otherwise = extractAnswer $ foldl' (restrictedDamerauLevenshteinDistanceWorker (matchVectors str1) top_bit_mask vector_mask) (0, 0, m_ones, 0, m) str2 where m_ones@vector_mask = (2 ^ m) - 1 top_bit_mask = (1 `shiftL` (m - 1)) `asTypeOf` _bv_dummy extractAnswer (_, _, _, _, distance) = distance
464
false
true
1
10
162
195
105
90
null
null
themoritz/cabal
Cabal/Distribution/Simple/BuildPaths.hs
bsd-3-clause
haddockDirName ForHackage = (++ "-docs") . display . packageId
62
haddockDirName ForHackage = (++ "-docs") . display . packageId
62
haddockDirName ForHackage = (++ "-docs") . display . packageId
62
false
false
0
7
8
21
11
10
null
null
laszlopandy/elm-compiler
src/Optimize.hs
bsd-3-clause
optimizeDefHelp :: Maybe ModuleName.Canonical -> [Var.TopLevel] -> P.CanonicalPattern -> [P.CanonicalPattern] -> Can.Expr -> Env.Optimizer [Opt.Def] optimizeDefHelp home deps pattern@(A.A _ ptrn) args rawBody = let facts = Opt.Facts home deps in case (ptrn, args) of (P.Var name, _ : _) -> do htc <- Env.getTailCall Env.setTailCall False (args, body) <- optimizeFunction (Just name) args rawBody isTailCall <- Env.getTailCall Env.setTailCall htc return $ if isTailCall then [ Opt.TailDef facts name args body ] else [ Opt.Def facts name (Opt.Function args body) ] (P.Var name, []) -> do hasTailCall <- Env.getTailCall body <- optimizeExpr Nothing rawBody Env.setTailCall hasTailCall return [ Opt.Def facts name body ] (_, []) -> do name <- Env.freshName optBody <- optimizeExpr Nothing rawBody let optDef = Opt.Def facts name optBody return (optDef : patternToDefs home name pattern) _ -> error "there should never be a function where the name is not a P.Var" -- OPTIMIZE FUNCTION
1,280
optimizeDefHelp :: Maybe ModuleName.Canonical -> [Var.TopLevel] -> P.CanonicalPattern -> [P.CanonicalPattern] -> Can.Expr -> Env.Optimizer [Opt.Def] optimizeDefHelp home deps pattern@(A.A _ ptrn) args rawBody = let facts = Opt.Facts home deps in case (ptrn, args) of (P.Var name, _ : _) -> do htc <- Env.getTailCall Env.setTailCall False (args, body) <- optimizeFunction (Just name) args rawBody isTailCall <- Env.getTailCall Env.setTailCall htc return $ if isTailCall then [ Opt.TailDef facts name args body ] else [ Opt.Def facts name (Opt.Function args body) ] (P.Var name, []) -> do hasTailCall <- Env.getTailCall body <- optimizeExpr Nothing rawBody Env.setTailCall hasTailCall return [ Opt.Def facts name body ] (_, []) -> do name <- Env.freshName optBody <- optimizeExpr Nothing rawBody let optDef = Opt.Def facts name optBody return (optDef : patternToDefs home name pattern) _ -> error "there should never be a function where the name is not a P.Var" -- OPTIMIZE FUNCTION
1,280
optimizeDefHelp home deps pattern@(A.A _ ptrn) args rawBody = let facts = Opt.Facts home deps in case (ptrn, args) of (P.Var name, _ : _) -> do htc <- Env.getTailCall Env.setTailCall False (args, body) <- optimizeFunction (Just name) args rawBody isTailCall <- Env.getTailCall Env.setTailCall htc return $ if isTailCall then [ Opt.TailDef facts name args body ] else [ Opt.Def facts name (Opt.Function args body) ] (P.Var name, []) -> do hasTailCall <- Env.getTailCall body <- optimizeExpr Nothing rawBody Env.setTailCall hasTailCall return [ Opt.Def facts name body ] (_, []) -> do name <- Env.freshName optBody <- optimizeExpr Nothing rawBody let optDef = Opt.Def facts name optBody return (optDef : patternToDefs home name pattern) _ -> error "there should never be a function where the name is not a P.Var" -- OPTIMIZE FUNCTION
1,107
false
true
19
10
447
346
187
159
null
null
adamse/haddock
haddock-api/src/Haddock/Backends/Hoogle.hs
bsd-2-clause
asInline :: Tag -> Tags asInline (TagP xs) = xs
47
asInline :: Tag -> Tags asInline (TagP xs) = xs
47
asInline (TagP xs) = xs
23
false
true
0
9
9
30
13
17
null
null
brendanhay/gogol
gogol-admin-directory/gen/Network/Google/Resource/Directory/MobileDevices/Get.hs
mpl-2.0
-- | V1 error format. mdgXgafv :: Lens' MobileDevicesGet (Maybe Xgafv) mdgXgafv = lens _mdgXgafv (\ s a -> s{_mdgXgafv = a})
124
mdgXgafv :: Lens' MobileDevicesGet (Maybe Xgafv) mdgXgafv = lens _mdgXgafv (\ s a -> s{_mdgXgafv = a})
102
mdgXgafv = lens _mdgXgafv (\ s a -> s{_mdgXgafv = a})
53
true
true
1
9
21
52
25
27
null
null
GaloisInc/halvm-ghc
compiler/hsSyn/HsBinds.hs
bsd-3-clause
pprTcSpecPrags (SpecPrags ps) = vcat (map (ppr . unLoc) ps)
60
pprTcSpecPrags (SpecPrags ps) = vcat (map (ppr . unLoc) ps)
60
pprTcSpecPrags (SpecPrags ps) = vcat (map (ppr . unLoc) ps)
60
false
false
0
9
10
34
16
18
null
null
zoranbosnjak/deseo
Data/BitString.hs
gpl-3.0
fromInteger :: Int -> Integer -> Bits fromInteger = fromIntegral
64
fromInteger :: Int -> Integer -> Bits fromInteger = fromIntegral
64
fromInteger = fromIntegral
26
false
true
0
6
9
19
10
9
null
null
rosenbergdm/language-r
src/Language/R/Lexer.hs
bsd-3-clause
whiteSpace = T.whiteSpace rlang
39
whiteSpace = T.whiteSpace rlang
39
whiteSpace = T.whiteSpace rlang
39
false
false
0
6
11
11
5
6
null
null
yairchu/ad
src/Numeric/AD/Mode/Tower.hs
bsd-3-clause
du' :: (Functor f, Num a) => (forall s. Mode s => f (AD s a) -> AD s a) -> f (a, a) -> (a, a) du' f = d' . getADTower . f . fmap withD
134
du' :: (Functor f, Num a) => (forall s. Mode s => f (AD s a) -> AD s a) -> f (a, a) -> (a, a) du' f = d' . getADTower . f . fmap withD
134
du' f = d' . getADTower . f . fmap withD
40
false
true
1
14
37
108
53
55
null
null
headprogrammingczar/cabal
cabal-install/Distribution/Client/SetupWrapper.hs
bsd-3-clause
buildTypeAction (UnknownBuildType _) = error "buildTypeAction UnknownBuildType"
79
buildTypeAction (UnknownBuildType _) = error "buildTypeAction UnknownBuildType"
79
buildTypeAction (UnknownBuildType _) = error "buildTypeAction UnknownBuildType"
79
false
false
0
6
6
19
8
11
null
null
TachoMex/MiniSequel
src/MiniSequel/Model.hs
mit
showType _ _ SequelDateTime = "DATETIME"
40
showType _ _ SequelDateTime = "DATETIME"
40
showType _ _ SequelDateTime = "DATETIME"
40
false
false
0
5
5
13
6
7
null
null
TomMD/io-streams
test/System/IO/Streams/Tests/Combinators.hs
bsd-3-clause
testContramapM_ :: Test testContramapM_ = testCase "combinators/contramapM_" $ do ref <- newIORef 0 is <- fromList [1,2,3::Int] _ <- outputToList (contramapM_ (modifyIORef ref . (+)) >=> connect is) readIORef ref >>= assertEqual "contramapM_" 6 ------------------------------------------------------------------------------
345
testContramapM_ :: Test testContramapM_ = testCase "combinators/contramapM_" $ do ref <- newIORef 0 is <- fromList [1,2,3::Int] _ <- outputToList (contramapM_ (modifyIORef ref . (+)) >=> connect is) readIORef ref >>= assertEqual "contramapM_" 6 ------------------------------------------------------------------------------
345
testContramapM_ = testCase "combinators/contramapM_" $ do ref <- newIORef 0 is <- fromList [1,2,3::Int] _ <- outputToList (contramapM_ (modifyIORef ref . (+)) >=> connect is) readIORef ref >>= assertEqual "contramapM_" 6 ------------------------------------------------------------------------------
321
false
true
0
16
56
108
50
58
null
null
shayan-najd/Haskell-Desugar-Generic
Language/Haskell/Exts/Desugar/Generic/Others.hs
bsd-3-clause
desugarSpecial = noDesugaring
29
desugarSpecial = noDesugaring
29
desugarSpecial = noDesugaring
29
false
false
0
4
2
6
3
3
null
null
contivero/hasmin
src/Hasmin/Parser/Value.hs
bsd-3-clause
textualParsers :: Text -> Parser Value textualParsers i = let t = T.toCaseFold i in fromMaybe (pure $ mkOther i) (Map.lookup t textualParsersMap) where textualParsersMap = Map.union csswideKeywordsMap namedColorsValueParsersMap namedColorsValueParsersMap = (fmap . fmap) ColorV namedColorsParsersMap
328
textualParsers :: Text -> Parser Value textualParsers i = let t = T.toCaseFold i in fromMaybe (pure $ mkOther i) (Map.lookup t textualParsersMap) where textualParsersMap = Map.union csswideKeywordsMap namedColorsValueParsersMap namedColorsValueParsersMap = (fmap . fmap) ColorV namedColorsParsersMap
328
textualParsers i = let t = T.toCaseFold i in fromMaybe (pure $ mkOther i) (Map.lookup t textualParsersMap) where textualParsersMap = Map.union csswideKeywordsMap namedColorsValueParsersMap namedColorsValueParsersMap = (fmap . fmap) ColorV namedColorsParsersMap
289
false
true
0
10
64
95
45
50
null
null
phischu/fragnix
benchmarks/containers/Data.Utils.BitUtil.hs
bsd-3-clause
shiftLL (W# x) (I# i) = W# (uncheckedShiftL# x i)
50
shiftLL (W# x) (I# i) = W# (uncheckedShiftL# x i)
50
shiftLL (W# x) (I# i) = W# (uncheckedShiftL# x i)
50
false
false
0
7
10
34
16
18
null
null
enolive/exercism
haskell/beer-song/src/Beer.hs
mit
maxBeers :: Int maxBeers = 99
29
maxBeers :: Int maxBeers = 99
29
maxBeers = 99
13
false
true
0
6
5
18
7
11
null
null
robeverest/accelerate
Data/Array/Accelerate/Interpreter.hs
bsd-3-clause
-- The interpreter does not handle foreign functions so use the pure accelerate version evalPreOpenAcc (Foreign _ (Alam (Abody funAcc)) acc) aenv = let !arr = force $ evalOpenAcc acc aenv in evalOpenAcc funAcc (Empty `Push` arr)
234
evalPreOpenAcc (Foreign _ (Alam (Abody funAcc)) acc) aenv = let !arr = force $ evalOpenAcc acc aenv in evalOpenAcc funAcc (Empty `Push` arr)
146
evalPreOpenAcc (Foreign _ (Alam (Abody funAcc)) acc) aenv = let !arr = force $ evalOpenAcc acc aenv in evalOpenAcc funAcc (Empty `Push` arr)
146
true
false
0
11
42
70
34
36
null
null
ku-fpg/kansas-amber
System/Hardware/Haskino/Data.hs
bsd-3-clause
servoDetach :: Word8 -> Arduino () servoDetach s = evalExprUnit <$> (Arduino $ primitive $ ServoDetachE (lit s))
112
servoDetach :: Word8 -> Arduino () servoDetach s = evalExprUnit <$> (Arduino $ primitive $ ServoDetachE (lit s))
112
servoDetach s = evalExprUnit <$> (Arduino $ primitive $ ServoDetachE (lit s))
77
false
true
0
10
17
47
23
24
null
null
sbditto85/parsedsltest
test/Generators.hs
apache-2.0
genErrorHandlerToParsed (ErrorHandlerEmail strConcat) = ErrorHandlerEmail $ genStrConcatToParsed strConcat
106
genErrorHandlerToParsed (ErrorHandlerEmail strConcat) = ErrorHandlerEmail $ genStrConcatToParsed strConcat
106
genErrorHandlerToParsed (ErrorHandlerEmail strConcat) = ErrorHandlerEmail $ genStrConcatToParsed strConcat
106
false
false
0
7
7
22
10
12
null
null
yyotti/99Haskell
src/main/BinaryTrees.hs
mit
treeToString (Branch v l r) = v:"(" ++ treeToString l ++ "," ++ treeToString r ++ ")"
85
treeToString (Branch v l r) = v:"(" ++ treeToString l ++ "," ++ treeToString r ++ ")"
85
treeToString (Branch v l r) = v:"(" ++ treeToString l ++ "," ++ treeToString r ++ ")"
85
false
false
0
9
16
45
21
24
null
null
markus1189/formatting
src/Formatting/Internal.hs
bsd-3-clause
-- | Function compose two formatters. Will feed the result of one -- formatter into another. (%.) :: Format r (Builder -> r') -> Format r' a -> Format r a (%.) (Format a) (Format b) = Format (b . a)
198
(%.) :: Format r (Builder -> r') -> Format r' a -> Format r a (%.) (Format a) (Format b) = Format (b . a)
105
(%.) (Format a) (Format b) = Format (b . a)
43
true
true
0
10
40
78
40
38
null
null
ssbl/globber
globber-1.0.0/Globber.hs
mit
matchGlob :: GlobPattern -> String -> Bool matchGlob p = maybe (const False) go (parsePattern p) where go [Eof] [] = True go [Eof] _ = False go [Many,Eof] _ = True go _ [] = False go (x:xs) t@(y:ys) = case x of U c -> (c == y) && go xs ys S cs -> elem y (setToList cs) && go xs ys Any -> isJust (runParser anyChar t) && go xs ys Many -> go xs t || go (x:xs) ys
543
matchGlob :: GlobPattern -> String -> Bool matchGlob p = maybe (const False) go (parsePattern p) where go [Eof] [] = True go [Eof] _ = False go [Many,Eof] _ = True go _ [] = False go (x:xs) t@(y:ys) = case x of U c -> (c == y) && go xs ys S cs -> elem y (setToList cs) && go xs ys Any -> isJust (runParser anyChar t) && go xs ys Many -> go xs t || go (x:xs) ys
543
matchGlob p = maybe (const False) go (parsePattern p) where go [Eof] [] = True go [Eof] _ = False go [Many,Eof] _ = True go _ [] = False go (x:xs) t@(y:ys) = case x of U c -> (c == y) && go xs ys S cs -> elem y (setToList cs) && go xs ys Any -> isJust (runParser anyChar t) && go xs ys Many -> go xs t || go (x:xs) ys
500
false
true
4
12
266
239
118
121
null
null
onponomarev/ganeti
src/Ganeti/Utils.hs
bsd-2-clause
-- | Try an IO interaction and return a default value if the interaction -- throws an IOError. withDefaultOnIOError :: a -> IO a -> IO a withDefaultOnIOError a io = try io >>= either (\ (_ :: IOError) -> return a) return
222
withDefaultOnIOError :: a -> IO a -> IO a withDefaultOnIOError a io = try io >>= either (\ (_ :: IOError) -> return a) return
127
withDefaultOnIOError a io = try io >>= either (\ (_ :: IOError) -> return a) return
85
true
true
2
9
44
69
33
36
null
null
awagner83/powermap
src/Data/Wikipedia/Response/JSON.hs
bsd-3-clause
-- | Convert JSON Response (intermediate) to a proper Wikipedia Response toProperResponse :: Response -> R.Response toProperResponse x | Just qc <- queryContinue x = R.Partial go (plcontinue $ links qc) | otherwise = R.Final go where go = P.fromList ps ps = map assoc $ H.elems $ pages (query x) assoc p = (title p, pageLinks p)
377
toProperResponse :: Response -> R.Response toProperResponse x | Just qc <- queryContinue x = R.Partial go (plcontinue $ links qc) | otherwise = R.Final go where go = P.fromList ps ps = map assoc $ H.elems $ pages (query x) assoc p = (title p, pageLinks p)
304
toProperResponse x | Just qc <- queryContinue x = R.Partial go (plcontinue $ links qc) | otherwise = R.Final go where go = P.fromList ps ps = map assoc $ H.elems $ pages (query x) assoc p = (title p, pageLinks p)
261
true
true
3
9
106
126
60
66
null
null
orion-42/barnes-hut
BH.hs
mit
-- fake mass :: Float mass = 100
33
mass :: Float mass = 100
24
mass = 100
10
true
true
0
6
8
19
8
11
null
null
pparkkin/eta
compiler/ETA/DeSugar/DsBinds.hs
bsd-3-clause
dictArity :: [Var] -> Arity -- Don't count coercion variables in arity dictArity dicts = count isId dicts
105
dictArity :: [Var] -> Arity dictArity dicts = count isId dicts
62
dictArity dicts = count isId dicts
34
true
true
0
7
17
33
15
18
null
null
pyrtsa/yampa-demos-template
src/Shapes.hs
bsd-3-clause
pos_ :: (Double, Double) -> AttributeSetter pos_ pos obj = obj { objPos = pos }
79
pos_ :: (Double, Double) -> AttributeSetter pos_ pos obj = obj { objPos = pos }
79
pos_ pos obj = obj { objPos = pos }
35
false
true
0
7
15
43
21
22
null
null