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
ambiata/highlighting-kate
Text/Highlighting/Kate/Syntax/Modula2.hs
gpl-2.0
-- | Highlight source code using this syntax definition. highlight :: String -> [SourceLine] highlight input = evalState (mapM parseSourceLine $ lines input) startingState
171
highlight :: String -> [SourceLine] highlight input = evalState (mapM parseSourceLine $ lines input) startingState
114
highlight input = evalState (mapM parseSourceLine $ lines input) startingState
78
true
true
0
8
23
40
20
20
null
null
denibertovic/haskell
kubernetes/lib/Kubernetes/OpenAPI/ModelLens.hs
bsd-3-clause
-- | 'v1beta2StatefulSetStatusConditions' Lens v1beta2StatefulSetStatusConditionsL :: Lens_' V1beta2StatefulSetStatus (Maybe [V1beta2StatefulSetCondition]) v1beta2StatefulSetStatusConditionsL f V1beta2StatefulSetStatus{..} = (\v1beta2StatefulSetStatusConditions -> V1beta2StatefulSetStatus { v1beta2StatefulSetStatusConditions, ..} ) <$> f v1beta2StatefulSetStatusConditions
374
v1beta2StatefulSetStatusConditionsL :: Lens_' V1beta2StatefulSetStatus (Maybe [V1beta2StatefulSetCondition]) v1beta2StatefulSetStatusConditionsL f V1beta2StatefulSetStatus{..} = (\v1beta2StatefulSetStatusConditions -> V1beta2StatefulSetStatus { v1beta2StatefulSetStatusConditions, ..} ) <$> f v1beta2StatefulSetStatusConditions
327
v1beta2StatefulSetStatusConditionsL f V1beta2StatefulSetStatus{..} = (\v1beta2StatefulSetStatusConditions -> V1beta2StatefulSetStatus { v1beta2StatefulSetStatusConditions, ..} ) <$> f v1beta2StatefulSetStatusConditions
218
true
true
0
8
23
60
32
28
null
null
bus000/Dikunt
test/Types/Internal/ServerMessageTest.hs
bsd-3-clause
parserIdent :: ServerMessage -> Bool parserIdent serv = Right serv == (parseMessage . T.pack . writeServerMessage) serv
119
parserIdent :: ServerMessage -> Bool parserIdent serv = Right serv == (parseMessage . T.pack . writeServerMessage) serv
119
parserIdent serv = Right serv == (parseMessage . T.pack . writeServerMessage) serv
82
false
true
0
10
16
41
20
21
null
null
robdockins/edison
edison-core/src/Data/Edison/Assoc/StandardMap.hs
mit
minElem = snd . DM.findMin
37
minElem = snd . DM.findMin
37
minElem = snd . DM.findMin
37
false
false
0
6
15
12
6
6
null
null
mike-burns/trajectory
LsStory.hs
bsd-3-clause
main = do args <- cmdArgs lsStoryArgDefinition withKey (profileName args) $ \key -> do stories <- getStories key (accountName args) (projectName args) putStrLn $ either (\error -> "Error: " ++ show error) (handle args) stories
290
main = do args <- cmdArgs lsStoryArgDefinition withKey (profileName args) $ \key -> do stories <- getStories key (accountName args) (projectName args) putStrLn $ either (\error -> "Error: " ++ show error) (handle args) stories
290
main = do args <- cmdArgs lsStoryArgDefinition withKey (profileName args) $ \key -> do stories <- getStories key (accountName args) (projectName args) putStrLn $ either (\error -> "Error: " ++ show error) (handle args) stories
290
false
false
0
16
98
98
46
52
null
null
TomMD/ghc
libraries/template-haskell/Language/Haskell/TH/Lib.hs
bsd-3-clause
tySynD :: Name -> [TyVarBndr] -> TypeQ -> DecQ tySynD tc tvs rhs = do { rhs1 <- rhs; return (TySynD tc tvs rhs1) }
114
tySynD :: Name -> [TyVarBndr] -> TypeQ -> DecQ tySynD tc tvs rhs = do { rhs1 <- rhs; return (TySynD tc tvs rhs1) }
114
tySynD tc tvs rhs = do { rhs1 <- rhs; return (TySynD tc tvs rhs1) }
67
false
true
0
10
24
65
31
34
null
null
capitanbatata/sandbox
free-monads/src/TestDSLGADTs.hs
gpl-3.0
create :: EntityType e -> Command e create et = liftF $ Create et id
68
create :: EntityType e -> Command e create et = liftF $ Create et id
68
create et = liftF $ Create et id
32
false
true
0
6
14
33
15
18
null
null
llelf/prose
gather-props.hs
bsd-3-clause
main = do props <- (readSavedProps `catch` \(e::IOException) -> saveProps) print $ length props genDecompositions props genCCC props genFullDecExcl props genCompositions props
263
main = do props <- (readSavedProps `catch` \(e::IOException) -> saveProps) print $ length props genDecompositions props genCCC props genFullDecExcl props genCompositions props
263
main = do props <- (readSavedProps `catch` \(e::IOException) -> saveProps) print $ length props genDecompositions props genCCC props genFullDecExcl props genCompositions props
263
false
false
0
12
109
68
31
37
null
null
scolobb/fgl
Data/Graph/Inductive/Basic.hs
bsd-3-clause
elfilter :: (DynGraph gr) => (b -> Bool) -> gr a b -> gr a b elfilter f = efilter (\(_,_,b)->f b)
97
elfilter :: (DynGraph gr) => (b -> Bool) -> gr a b -> gr a b elfilter f = efilter (\(_,_,b)->f b)
97
elfilter f = efilter (\(_,_,b)->f b)
36
false
true
0
8
21
71
37
34
null
null
alphalambda/codeworld
codeworld-base/src/Sketches.hs
apache-2.0
-- | Rough sketch of a tree sketchedTree :: HasCallStack => Picture sketchedTree = withFrozenCallStack $ CWPic CW.sketchedTree
126
sketchedTree :: HasCallStack => Picture sketchedTree = withFrozenCallStack $ CWPic CW.sketchedTree
98
sketchedTree = withFrozenCallStack $ CWPic CW.sketchedTree
58
true
true
0
7
17
26
13
13
null
null
silky/pp
Language/PP/Examples/StickyState.hs
mit
-- | Actually generate observations generate :: MonadRandom m => Double -> Int -> [S -> PP m (S, Y)] generate theta n = replicate n (f theta) where f theta = go theta (\s -> liftF $ gaussian (mu s) 1) -- | Use pre-observed data as the observations
250
generate :: MonadRandom m => Double -> Int -> [S -> PP m (S, Y)] generate theta n = replicate n (f theta) where f theta = go theta (\s -> liftF $ gaussian (mu s) 1) -- | Use pre-observed data as the observations
214
generate theta n = replicate n (f theta) where f theta = go theta (\s -> liftF $ gaussian (mu s) 1) -- | Use pre-observed data as the observations
149
true
true
0
11
52
100
51
49
null
null
pgj/bead
snaplets/fay/src/Bead/View/Fay/HookIds.hs
bsd-3-clause
assignmentStartDefaultHour = HookId "asg-start-def-hour"
56
assignmentStartDefaultHour = HookId "asg-start-def-hour"
56
assignmentStartDefaultHour = HookId "asg-start-def-hour"
56
false
false
0
5
3
9
4
5
null
null
shlevy/ghc
compiler/iface/BuildTyCl.hs
bsd-3-clause
newImplicitBinderLoc :: Name -- Base name -> (OccName -> OccName) -- Occurrence name modifier -> SrcSpan -> TcRnIf m n Name -- Implicit name -- Just the same, but lets you specify the SrcSpan newImplicitBinderLoc base_name mk_sys_occ loc | Just mod <- nameModule_maybe base_name = newGlobalBinder mod occ loc | otherwise -- When typechecking a [d| decl bracket |], -- TH generates types, classes etc with Internal names, -- so we follow suit for the implicit binders = do { uniq <- newUnique ; return (mkInternalName uniq occ loc) } where occ = mk_sys_occ (nameOccName base_name) -- | Make the 'TyConRepName' for this 'TyCon'
809
newImplicitBinderLoc :: Name -- Base name -> (OccName -> OccName) -- Occurrence name modifier -> SrcSpan -> TcRnIf m n Name newImplicitBinderLoc base_name mk_sys_occ loc | Just mod <- nameModule_maybe base_name = newGlobalBinder mod occ loc | otherwise -- When typechecking a [d| decl bracket |], -- TH generates types, classes etc with Internal names, -- so we follow suit for the implicit binders = do { uniq <- newUnique ; return (mkInternalName uniq occ loc) } where occ = mk_sys_occ (nameOccName base_name) -- | Make the 'TyConRepName' for this 'TyCon'
730
newImplicitBinderLoc base_name mk_sys_occ loc | Just mod <- nameModule_maybe base_name = newGlobalBinder mod occ loc | otherwise -- When typechecking a [d| decl bracket |], -- TH generates types, classes etc with Internal names, -- so we follow suit for the implicit binders = do { uniq <- newUnique ; return (mkInternalName uniq occ loc) } where occ = mk_sys_occ (nameOccName base_name) -- | Make the 'TyConRepName' for this 'TyCon'
515
true
true
0
10
287
129
65
64
null
null
tpsinnem/Idris-dev
src/IRTS/Bytecode.hs
bsd-3-clause
bc reg (SLet (Loc i) e sc) r = bc (L i) e False ++ bc reg sc r
62
bc reg (SLet (Loc i) e sc) r = bc (L i) e False ++ bc reg sc r
62
bc reg (SLet (Loc i) e sc) r = bc (L i) e False ++ bc reg sc r
62
false
false
1
10
18
56
25
31
null
null
ffwng/tagfs
RouteTest.hs
gpl-3.0
dir3 :: Route Int dir3 = do match Nothing "dir3" match (Just Dir3) "dir3a" choice [dir1, match Nothing "file3" >> return 3]
126
dir3 :: Route Int dir3 = do match Nothing "dir3" match (Just Dir3) "dir3a" choice [dir1, match Nothing "file3" >> return 3]
126
dir3 = do match Nothing "dir3" match (Just Dir3) "dir3a" choice [dir1, match Nothing "file3" >> return 3]
108
false
true
0
11
24
66
28
38
null
null
nickng/gong
TypeSize.hs
apache-2.0
sizeOfT seen defEnv (IChoice ty1 ty2) = maximum [sizeOfT seen defEnv ty1, sizeOfT seen defEnv ty2]
100
sizeOfT seen defEnv (IChoice ty1 ty2) = maximum [sizeOfT seen defEnv ty1, sizeOfT seen defEnv ty2]
100
sizeOfT seen defEnv (IChoice ty1 ty2) = maximum [sizeOfT seen defEnv ty1, sizeOfT seen defEnv ty2]
100
false
false
0
6
17
47
21
26
null
null
mhwombat/creatur-image-wains
src/ALife/Creatur/Wain/Image/Pattern.hs
bsd-3-clause
mkImage :: Int -> Int -> [Word8] -> Pattern mkImage w h ps = Image w h ps' where ps' = take (w*h) (ps ++ repeat 0)
116
mkImage :: Int -> Int -> [Word8] -> Pattern mkImage w h ps = Image w h ps' where ps' = take (w*h) (ps ++ repeat 0)
116
mkImage w h ps = Image w h ps' where ps' = take (w*h) (ps ++ repeat 0)
72
false
true
1
9
28
82
36
46
null
null
phylake/avm3
vm/store.hs
mit
xform_opCode {- 0x0C -} i u d s m t (Abc.IfNotLessThan s24) = [IfNotLessThan s24]
81
xform_opCode {- 0x0C -} i u d s m t (Abc.IfNotLessThan s24) = [IfNotLessThan s24]
81
xform_opCode {- 0x0C -} i u d s m t (Abc.IfNotLessThan s24) = [IfNotLessThan s24]
81
false
false
0
8
14
36
18
18
null
null
alexander-at-github/eta
compiler/ETA/TypeCheck/TcGenDeriv.hs
bsd-3-clause
f_Pat = nlVarPat f_RDR
32
f_Pat = nlVarPat f_RDR
32
f_Pat = nlVarPat f_RDR
32
false
false
0
5
13
9
4
5
null
null
krauthaufen/AdaptiveHaskell
src/Adaptive.hs
apache-2.0
modId :: IORef Int modId = unsafePerformIO $ newIORef 0
55
modId :: IORef Int modId = unsafePerformIO $ newIORef 0
55
modId = unsafePerformIO $ newIORef 0
36
false
true
0
6
9
21
10
11
null
null
ozgurakgun/Idris-dev
src/Idris/TypeSearch.hs
bsd-3-clause
tcToMaybe (Error _) = Nothing
29
tcToMaybe (Error _) = Nothing
29
tcToMaybe (Error _) = Nothing
29
false
false
0
7
4
15
7
8
null
null
agbrooks/concurrent-phasers
src/Control/Concurrent/Phaser/Generic.hs
mit
{- | Returns 'False' for waiting modes (`Wait`, `SignalWait`). -} modeWaits :: PhaserMode -> Bool modeWaits Signal = False
122
modeWaits :: PhaserMode -> Bool modeWaits Signal = False
56
modeWaits Signal = False
24
true
true
0
5
18
19
10
9
null
null
JacquesCarette/literate-scientific-software
code/drasil-example/Drasil/SSP/GenDefs.hs
bsd-2-clause
sliceWghtGD = gd sliceWght (getUnit slcWght) (Just sliceWghtDeriv) [makeCite fredlund1977] "sliceWght" [sliceWghtNotes]
148
sliceWghtGD = gd sliceWght (getUnit slcWght) (Just sliceWghtDeriv) [makeCite fredlund1977] "sliceWght" [sliceWghtNotes]
148
sliceWghtGD = gd sliceWght (getUnit slcWght) (Just sliceWghtDeriv) [makeCite fredlund1977] "sliceWght" [sliceWghtNotes]
148
false
false
0
7
40
42
20
22
null
null
gereeter/bounded-intmap
src/Data/WordMap/Lazy.hs
mit
updateMaxWithKey f m = updateWithKey f (fst (findMax m)) m
58
updateMaxWithKey f m = updateWithKey f (fst (findMax m)) m
58
updateMaxWithKey f m = updateWithKey f (fst (findMax m)) m
58
false
false
1
9
9
34
14
20
null
null
bravit/Idris-dev
src/Idris/CaseSplit.hs
bsd-3-clause
nameMissing :: [PTerm] -> Idris [PTerm] nameMissing ps = do ist <- get newPats <- mapM nm ps let newPats' = mergeAllPats ist (sUN "_") (base (head ps)) newPats return (map fst newPats') where base (PApp fc f args) = PApp fc f (map (fmap (const (PRef fc [] (sUN "_")))) args) base t = t nm ptm = do mptm <- elabNewPat ptm case mptm of (False, _) -> return ptm (True, ptm') -> return ptm'
567
nameMissing :: [PTerm] -> Idris [PTerm] nameMissing ps = do ist <- get newPats <- mapM nm ps let newPats' = mergeAllPats ist (sUN "_") (base (head ps)) newPats return (map fst newPats') where base (PApp fc f args) = PApp fc f (map (fmap (const (PRef fc [] (sUN "_")))) args) base t = t nm ptm = do mptm <- elabNewPat ptm case mptm of (False, _) -> return ptm (True, ptm') -> return ptm'
567
nameMissing ps = do ist <- get newPats <- mapM nm ps let newPats' = mergeAllPats ist (sUN "_") (base (head ps)) newPats return (map fst newPats') where base (PApp fc f args) = PApp fc f (map (fmap (const (PRef fc [] (sUN "_")))) args) base t = t nm ptm = do mptm <- elabNewPat ptm case mptm of (False, _) -> return ptm (True, ptm') -> return ptm'
527
false
true
2
15
257
237
109
128
null
null
UCSD-PL/nano-js
Language/Nano/Types.hs
bsd-3-clause
returnId :: a -> Id a returnId x = Id x returnName
52
returnId :: a -> Id a returnId x = Id x returnName
52
returnId x = Id x returnName
28
false
true
0
7
13
32
13
19
null
null
eddywestbrook/hobbits
archival/Bench/LocallyNameless.hs
bsd-3-clause
freshName :: (Name -> Fresh b) -> Fresh b freshName f = local (+1) (ask >>= f)
78
freshName :: (Name -> Fresh b) -> Fresh b freshName f = local (+1) (ask >>= f)
78
freshName f = local (+1) (ask >>= f)
36
false
true
0
8
16
47
24
23
null
null
diku-kmc/regexps-syntax
KMC/Syntax/Internal.hs
mit
vpos :: Value -> [Pos] vpos Unit = [[]]
39
vpos :: Value -> [Pos] vpos Unit = [[]]
39
vpos Unit = [[]]
16
false
true
0
6
8
26
14
12
null
null
Javran/Project-Euler
src/ProjectEuler/Problem98.hs
mit
parseWords :: T.Text -> [String] parseWords raw = read $ "[" <> T.unpack raw <> "]"
83
parseWords :: T.Text -> [String] parseWords raw = read $ "[" <> T.unpack raw <> "]"
83
parseWords raw = read $ "[" <> T.unpack raw <> "]"
50
false
true
2
8
15
47
21
26
null
null
HackerFoo/peg
Peg/Monad.hs
gpl-3.0
force = do st <- get case psStack st of (W w : _) -> doWord w #ifdef DEBUG >> traceStack #endif (S s : _) -> (popStack >> addConstraint ([S s], [])) `mplus` do v <- newVar s' <- newSVar popStack pushStack s' pushStack v addConstraint ([v, s'], [S s]) _ -> return ()
401
force = do st <- get case psStack st of (W w : _) -> doWord w #ifdef DEBUG >> traceStack #endif (S s : _) -> (popStack >> addConstraint ([S s], [])) `mplus` do v <- newVar s' <- newSVar popStack pushStack s' pushStack v addConstraint ([v, s'], [S s]) _ -> return ()
401
force = do st <- get case psStack st of (W w : _) -> doWord w #ifdef DEBUG >> traceStack #endif (S s : _) -> (popStack >> addConstraint ([S s], [])) `mplus` do v <- newVar s' <- newSVar popStack pushStack s' pushStack v addConstraint ([v, s'], [S s]) _ -> return ()
401
false
false
1
17
190
162
77
85
null
null
adarqui/ToyBox
haskell/Core/src/Core/IntList.hs
gpl-3.0
x :: [Int] x = [41,42,43]
25
x :: [Int] x = [41,42,43]
25
x = [41,42,43]
14
false
true
0
7
5
30
15
15
null
null
olorin/amazonka
amazonka-s3/gen/Network/AWS/S3/PutObject.hs
mpl-2.0
-- | Undocumented member. poRequestPayer :: Lens' PutObject (Maybe RequestPayer) poRequestPayer = lens _poRequestPayer (\ s a -> s{_poRequestPayer = a})
152
poRequestPayer :: Lens' PutObject (Maybe RequestPayer) poRequestPayer = lens _poRequestPayer (\ s a -> s{_poRequestPayer = a})
126
poRequestPayer = lens _poRequestPayer (\ s a -> s{_poRequestPayer = a})
71
true
true
0
9
20
46
25
21
null
null
romanb/amazonka
amazonka-kms/gen/Network/AWS/KMS/ReEncrypt.hs
mpl-2.0
-- | Encryption context to be used when the data is re-encrypted. reDestinationEncryptionContext :: Lens' ReEncrypt (HashMap Text Text) reDestinationEncryptionContext = lens _reDestinationEncryptionContext (\s a -> s { _reDestinationEncryptionContext = a }) . _Map
288
reDestinationEncryptionContext :: Lens' ReEncrypt (HashMap Text Text) reDestinationEncryptionContext = lens _reDestinationEncryptionContext (\s a -> s { _reDestinationEncryptionContext = a }) . _Map
222
reDestinationEncryptionContext = lens _reDestinationEncryptionContext (\s a -> s { _reDestinationEncryptionContext = a }) . _Map
152
true
true
0
10
57
52
28
24
null
null
JacquesCarette/literate-scientific-software
code/drasil-example/Drasil/SWHS/Assumptions.hs
bsd-2-clause
assumpTPCAV = cic "assumpTPCAV" assumpS4 "Temp-PCM-Constant-Across-Volume" assumpDom
125
assumpTPCAV = cic "assumpTPCAV" assumpS4 "Temp-PCM-Constant-Across-Volume" assumpDom
125
assumpTPCAV = cic "assumpTPCAV" assumpS4 "Temp-PCM-Constant-Across-Volume" assumpDom
125
false
false
0
5
47
15
7
8
null
null
literate-unitb/literate-unitb
src/UnitB/UnitB.hs
mit
str_verify_machine_with :: HasExpr expr => (Label -> Sequent -> Maybe Sequent) -> Machine' expr -> IO (String,Int,Int) str_verify_machine_with opt m = do let pos = mapMaybeWithKey opt $ proof_obligation m xs <- verify_all pos format_result xs
340
str_verify_machine_with :: HasExpr expr => (Label -> Sequent -> Maybe Sequent) -> Machine' expr -> IO (String,Int,Int) str_verify_machine_with opt m = do let pos = mapMaybeWithKey opt $ proof_obligation m xs <- verify_all pos format_result xs
340
str_verify_machine_with opt m = do let pos = mapMaybeWithKey opt $ proof_obligation m xs <- verify_all pos format_result xs
147
false
true
0
11
133
95
44
51
null
null
lux01/synacor
grid-src/Main.hs
mit
getValue (2, 2) = 11
20
getValue (2, 2) = 11
20
getValue (2, 2) = 11
20
false
false
0
6
4
15
8
7
null
null
syunta/Scheme-hs
src/Evaluator.hs
mit
evalDef [SSymbol var, val] = do val' <- eval val env <- get put $ defineVar var val' env return $ SSymbol "ok"
118
evalDef [SSymbol var, val] = do val' <- eval val env <- get put $ defineVar var val' env return $ SSymbol "ok"
118
evalDef [SSymbol var, val] = do val' <- eval val env <- get put $ defineVar var val' env return $ SSymbol "ok"
118
false
false
0
8
30
60
26
34
null
null
da-x/lamdu
Lamdu/Eval/JS.hs
gpl-3.0
parseBytes _ = error "Bytes with non-array data"
48
parseBytes _ = error "Bytes with non-array data"
48
parseBytes _ = error "Bytes with non-array data"
48
false
false
0
5
7
12
5
7
null
null
tibbe/ghc
compiler/nativeGen/X86/CodeGen.hs
bsd-3-clause
isVecExpr (CmmMachOp (MO_V_Extract {}) _) = True
49
isVecExpr (CmmMachOp (MO_V_Extract {}) _) = True
49
isVecExpr (CmmMachOp (MO_V_Extract {}) _) = True
49
false
false
0
9
7
24
12
12
null
null
sdiehl/ghc
compiler/GHC/Stg/Lint.hs
bsd-3-clause
lint_binds_help :: (OutputablePass a, BinderP a ~ Id) => TopLevelFlag -> (Id, GenStgRhs a) -> LintM () lint_binds_help top_lvl (binder, rhs) = addLoc (RhsOf binder) $ do when (isTopLevel top_lvl) (checkNoCurrentCCS rhs) lintStgRhs rhs -- Check binder doesn't have unlifted type or it's a join point checkL (isJoinId binder || not (isUnliftedType (idType binder))) (mkUnliftedTyMsg binder rhs) -- | Top-level bindings can't inherit the cost centre stack from their -- (static) allocation site.
558
lint_binds_help :: (OutputablePass a, BinderP a ~ Id) => TopLevelFlag -> (Id, GenStgRhs a) -> LintM () lint_binds_help top_lvl (binder, rhs) = addLoc (RhsOf binder) $ do when (isTopLevel top_lvl) (checkNoCurrentCCS rhs) lintStgRhs rhs -- Check binder doesn't have unlifted type or it's a join point checkL (isJoinId binder || not (isUnliftedType (idType binder))) (mkUnliftedTyMsg binder rhs) -- | Top-level bindings can't inherit the cost centre stack from their -- (static) allocation site.
558
lint_binds_help top_lvl (binder, rhs) = addLoc (RhsOf binder) $ do when (isTopLevel top_lvl) (checkNoCurrentCCS rhs) lintStgRhs rhs -- Check binder doesn't have unlifted type or it's a join point checkL (isJoinId binder || not (isUnliftedType (idType binder))) (mkUnliftedTyMsg binder rhs) -- | Top-level bindings can't inherit the cost centre stack from their -- (static) allocation site.
439
false
true
0
16
138
152
73
79
null
null
zeniuseducation/poly-euler
Alfa/haskell/impure/common.hs
epl-1.0
prime' :: Int -> Bool prime' n | n < 2 = False | n == 2 = True | even n = False | otherwise = iter 3 where iter i | i * i > n = True | rem n i == 0 = False | otherwise = iter (i+2)
220
prime' :: Int -> Bool prime' n | n < 2 = False | n == 2 = True | even n = False | otherwise = iter 3 where iter i | i * i > n = True | rem n i == 0 = False | otherwise = iter (i+2)
220
prime' n | n < 2 = False | n == 2 = True | even n = False | otherwise = iter 3 where iter i | i * i > n = True | rem n i == 0 = False | otherwise = iter (i+2)
198
false
true
3
9
92
122
57
65
null
null
monamonamonad/RegexDSL
src/Automaton/Regex.hs
bsd-3-clause
-- r の1回以上の繰り返し (+:) :: Regex alpha -> Regex alpha (+:) r = r >: (r *:)
71
(+:) :: Regex alpha -> Regex alpha (+:) r = r >: (r *:)
55
(+:) r = r >: (r *:)
20
true
true
0
6
16
37
21
16
null
null
keithshep/txt-sushi
Database/TxtSushi/SQLExecution.hs
bsd-3-clause
flattenGroups (GroupedData grps) = concatMap flattenGroups grps
63
flattenGroups (GroupedData grps) = concatMap flattenGroups grps
63
flattenGroups (GroupedData grps) = concatMap flattenGroups grps
63
false
false
0
7
6
20
9
11
null
null
loadimpact/http2-test
hs-src/Rede/SpdyProtocol/Framing/AnyFrame.hs
bsd-3-clause
writeFrame (DataFrame_AF acf) = writeDataFrame acf
51
writeFrame (DataFrame_AF acf) = writeDataFrame acf
51
writeFrame (DataFrame_AF acf) = writeDataFrame acf
51
false
false
0
6
6
19
8
11
null
null
bredelings/BAli-Phy
haskell/Range.hs
gpl-2.0
integer_above l = IntegerInterval (Just l) Nothing
50
integer_above l = IntegerInterval (Just l) Nothing
50
integer_above l = IntegerInterval (Just l) Nothing
50
false
false
0
7
6
20
9
11
null
null
Sintrastes/LynCrypt
command_line/Main.hs
mit
-- TODO: Factor this into something more readable main = do rgen <- newStdGen args <- getArgs interface <- cmdInterface let parsed = parseArgs args interface case parsed of -- Use my custom help screen. Left x -> mapM_ putStrLn help -- Bind successfuly parsed arguments Right (Data n k encrypt (d:ds) (o:os) readable) -> if encrypt == "\0" && (d:ds) == [] then putStrLn "Must specify an input file for either encryption, or decryption. See lyncrypt --help for proper usage." else do -- *** Encrypt *** -- if encrypt /= "\0" then do message <- (liftM stringDecode $ readFile encrypt) let (shares,m0s) = makeShares message (fromIntegral n) (fromIntegral k) rgen if readable then do Prelude.writeFile o (show m0s) -- Write each one of the shares to a seperate output file zipWithM_ Prelude.writeFile os (map show shares) else do -- Write m0 to the first specified file) B.writeFile o (encode m0s) -- Write each one of the shares to a seperate output file zipWithM_ B.writeFile os (map encode shares) -- *** Decrypt *** -- else do -- TODO: Better error handling m0s <- B.readFile d shares <- mapM B.readFile ds -- need to figure out a better format for this, but it works for now. -- I could use optflag args. parse_expr <- return ((map decode shares :: [Either String [(Integer,Integer)]]), (decode m0s :: Either String [Integer])) case parse_expr of (as@(anyRight -> True), Right b) -> Prelude.writeFile o $ stringEncode $ decryptShares (fromEither as) b -- TODO: Make error more specific _ -> print "Error deserializing files"
2,112
main = do rgen <- newStdGen args <- getArgs interface <- cmdInterface let parsed = parseArgs args interface case parsed of -- Use my custom help screen. Left x -> mapM_ putStrLn help -- Bind successfuly parsed arguments Right (Data n k encrypt (d:ds) (o:os) readable) -> if encrypt == "\0" && (d:ds) == [] then putStrLn "Must specify an input file for either encryption, or decryption. See lyncrypt --help for proper usage." else do -- *** Encrypt *** -- if encrypt /= "\0" then do message <- (liftM stringDecode $ readFile encrypt) let (shares,m0s) = makeShares message (fromIntegral n) (fromIntegral k) rgen if readable then do Prelude.writeFile o (show m0s) -- Write each one of the shares to a seperate output file zipWithM_ Prelude.writeFile os (map show shares) else do -- Write m0 to the first specified file) B.writeFile o (encode m0s) -- Write each one of the shares to a seperate output file zipWithM_ B.writeFile os (map encode shares) -- *** Decrypt *** -- else do -- TODO: Better error handling m0s <- B.readFile d shares <- mapM B.readFile ds -- need to figure out a better format for this, but it works for now. -- I could use optflag args. parse_expr <- return ((map decode shares :: [Either String [(Integer,Integer)]]), (decode m0s :: Either String [Integer])) case parse_expr of (as@(anyRight -> True), Right b) -> Prelude.writeFile o $ stringEncode $ decryptShares (fromEither as) b -- TODO: Make error more specific _ -> print "Error deserializing files"
2,062
main = do rgen <- newStdGen args <- getArgs interface <- cmdInterface let parsed = parseArgs args interface case parsed of -- Use my custom help screen. Left x -> mapM_ putStrLn help -- Bind successfuly parsed arguments Right (Data n k encrypt (d:ds) (o:os) readable) -> if encrypt == "\0" && (d:ds) == [] then putStrLn "Must specify an input file for either encryption, or decryption. See lyncrypt --help for proper usage." else do -- *** Encrypt *** -- if encrypt /= "\0" then do message <- (liftM stringDecode $ readFile encrypt) let (shares,m0s) = makeShares message (fromIntegral n) (fromIntegral k) rgen if readable then do Prelude.writeFile o (show m0s) -- Write each one of the shares to a seperate output file zipWithM_ Prelude.writeFile os (map show shares) else do -- Write m0 to the first specified file) B.writeFile o (encode m0s) -- Write each one of the shares to a seperate output file zipWithM_ B.writeFile os (map encode shares) -- *** Decrypt *** -- else do -- TODO: Better error handling m0s <- B.readFile d shares <- mapM B.readFile ds -- need to figure out a better format for this, but it works for now. -- I could use optflag args. parse_expr <- return ((map decode shares :: [Either String [(Integer,Integer)]]), (decode m0s :: Either String [Integer])) case parse_expr of (as@(anyRight -> True), Right b) -> Prelude.writeFile o $ stringEncode $ decryptShares (fromEither as) b -- TODO: Make error more specific _ -> print "Error deserializing files"
2,062
true
false
1
24
843
456
225
231
null
null
GaloisInc/saw-script
saw-core/src/Verifier/SAW/Term/Pretty.hs
bsd-3-clause
ppDef :: SawDoc -> SawDoc -> Maybe SawDoc -> SawDoc ppDef d tp Nothing = ppTypeConstraint d tp
94
ppDef :: SawDoc -> SawDoc -> Maybe SawDoc -> SawDoc ppDef d tp Nothing = ppTypeConstraint d tp
94
ppDef d tp Nothing = ppTypeConstraint d tp
42
false
true
0
8
17
38
18
20
null
null
davidlazar/language-k
src/Language/K/Parser.hs
mit
-- TODO should include children splitParts :: String -> [SyntaxPart] splitParts s = splitParts' (filter (/= '`') s)
116
splitParts :: String -> [SyntaxPart] splitParts s = splitParts' (filter (/= '`') s)
83
splitParts s = splitParts' (filter (/= '`') s)
46
true
true
0
8
18
37
20
17
null
null
lettier/gifcurry
src/gui/GuiStyle.hs
bsd-3-clause
widgetRemoveStyleClass :: ( GI.GLib.GObject a , Data.GI.Base.Overloading.IsDescendantOf GI.Gtk.Widget a ) => a -> Text -> IO () widgetRemoveStyleClass widget styleClass = do styleContext <- GI.Gtk.widgetGetStyleContext widget GI.Gtk.styleContextRemoveClass styleContext styleClass
308
widgetRemoveStyleClass :: ( GI.GLib.GObject a , Data.GI.Base.Overloading.IsDescendantOf GI.Gtk.Widget a ) => a -> Text -> IO () widgetRemoveStyleClass widget styleClass = do styleContext <- GI.Gtk.widgetGetStyleContext widget GI.Gtk.styleContextRemoveClass styleContext styleClass
308
widgetRemoveStyleClass widget styleClass = do styleContext <- GI.Gtk.widgetGetStyleContext widget GI.Gtk.styleContextRemoveClass styleContext styleClass
156
false
true
0
10
56
86
43
43
null
null
IanConnolly/distributed-process-aws
src/Control/Distributed/Process/Backend/AWS.hs
bsd-3-clause
serviceProcessStatic :: Static (Backend -> Process ()) serviceProcessStatic = staticLabel "serviceProcess"
106
serviceProcessStatic :: Static (Backend -> Process ()) serviceProcessStatic = staticLabel "serviceProcess"
106
serviceProcessStatic = staticLabel "serviceProcess"
51
false
true
0
9
10
29
14
15
null
null
AlexeyRaga/eta
compiler/ETA/TypeCheck/TcType.hs
bsd-3-clause
orphNamesOfCos :: [Coercion] -> NameSet orphNamesOfCos = orphNamesOfThings orphNamesOfCo
88
orphNamesOfCos :: [Coercion] -> NameSet orphNamesOfCos = orphNamesOfThings orphNamesOfCo
88
orphNamesOfCos = orphNamesOfThings orphNamesOfCo
48
false
true
0
7
8
27
12
15
null
null
bitemyapp/lens-simple
examples/Pong.hs
bsd-3-clause
drawPaddle :: Picture drawPaddle = rectangleSolid paddleWidth paddleHeight
74
drawPaddle :: Picture drawPaddle = rectangleSolid paddleWidth paddleHeight
74
drawPaddle = rectangleSolid paddleWidth paddleHeight
52
false
true
0
6
7
24
9
15
null
null
thalerjonathan/phd
thesis/code/sugarscape/src/SugarScape/Core/Model.hs
gpl-3.0
-- the sugarscape is 51x51 in our implementation sugarscapeDimensions :: Discrete2dCoord sugarscapeDimensions = (51, 51)
120
sugarscapeDimensions :: Discrete2dCoord sugarscapeDimensions = (51, 51)
71
sugarscapeDimensions = (51, 51)
31
true
true
0
6
14
25
12
13
null
null
LukaHorvat/Halt
test/Parsing/AST.hs
mit
expression' :: ExpressionVariant -> Gen Expression expression' variant = frequency $ [ (1, FunctionApp <$> expression' NonLiteral <*> resize 4 (listOf1 arbitrary)) , (3, Identifier <$> rightIdentifier) ] ++ case variant of WithLiterals -> [ (3, IntLiteral <$> positiveNum) , (3, DoubleLiteral <$> positiveNum) , (3, StringLiteral <$> arbitrary) ] _ -> []
478
expression' :: ExpressionVariant -> Gen Expression expression' variant = frequency $ [ (1, FunctionApp <$> expression' NonLiteral <*> resize 4 (listOf1 arbitrary)) , (3, Identifier <$> rightIdentifier) ] ++ case variant of WithLiterals -> [ (3, IntLiteral <$> positiveNum) , (3, DoubleLiteral <$> positiveNum) , (3, StringLiteral <$> arbitrary) ] _ -> []
478
expression' variant = frequency $ [ (1, FunctionApp <$> expression' NonLiteral <*> resize 4 (listOf1 arbitrary)) , (3, Identifier <$> rightIdentifier) ] ++ case variant of WithLiterals -> [ (3, IntLiteral <$> positiveNum) , (3, DoubleLiteral <$> positiveNum) , (3, StringLiteral <$> arbitrary) ] _ -> []
427
false
true
2
11
176
132
71
61
null
null
MasseR/xmonadcontrib
XMonad/Layout/LimitWindows.hs
bsd-3-clause
-- | Only display @n@ windows around the focused window. This makes sense with -- layouts that arrange windows linearily, like 'XMonad.Layout.Layout.Accordion'. limitSlice :: Int -> l a -> ModifiedLayout LimitWindows l a limitSlice n = ModifiedLayout (LimitWindows Slice n)
273
limitSlice :: Int -> l a -> ModifiedLayout LimitWindows l a limitSlice n = ModifiedLayout (LimitWindows Slice n)
112
limitSlice n = ModifiedLayout (LimitWindows Slice n)
52
true
true
0
8
39
49
23
26
null
null
mcschroeder/ghc
compiler/coreSyn/MkCore.hs
bsd-3-clause
-- | Make a list containing the given expressions, where the list has the given type mkListExpr :: Type -> [CoreExpr] -> CoreExpr mkListExpr ty xs = foldr (mkConsExpr ty) (mkNilExpr ty) xs
188
mkListExpr :: Type -> [CoreExpr] -> CoreExpr mkListExpr ty xs = foldr (mkConsExpr ty) (mkNilExpr ty) xs
103
mkListExpr ty xs = foldr (mkConsExpr ty) (mkNilExpr ty) xs
58
true
true
0
7
32
47
24
23
null
null
ezyang/ghc
compiler/utils/Pretty.hs
bsd-3-clause
nilBeside g p | g = textBeside_ spaceText 1 p | otherwise = p
83
nilBeside g p | g = textBeside_ spaceText 1 p | otherwise = p
83
nilBeside g p | g = textBeside_ spaceText 1 p | otherwise = p
83
false
false
0
7
35
33
14
19
null
null
leshchevds/ganeti
test/hs/Test/Ganeti/Utils.hs
bsd-2-clause
-- | Test that functional if' behaves like the syntactic sugar if. prop_if'if :: Bool -> Int -> Int -> Property prop_if'if cnd a b = if' cnd a b ==? if cnd then a else b
171
prop_if'if :: Bool -> Int -> Int -> Property prop_if'if cnd a b = if' cnd a b ==? if cnd then a else b
104
prop_if'if cnd a b = if' cnd a b ==? if cnd then a else b
59
true
true
0
7
38
50
26
24
null
null
pwestling/hmonit
src/Html.hs
bsd-3-clause
addSystemHeader :: Page -> Page addSystemHeader page = sub (Rgx "(<tr>.*?Process.*?</th>)</tr>") page (Replacement "$1<th align='right'>Host</th></tr>")
152
addSystemHeader :: Page -> Page addSystemHeader page = sub (Rgx "(<tr>.*?Process.*?</th>)</tr>") page (Replacement "$1<th align='right'>Host</th></tr>")
152
addSystemHeader page = sub (Rgx "(<tr>.*?Process.*?</th>)</tr>") page (Replacement "$1<th align='right'>Host</th></tr>")
120
false
true
0
7
14
37
18
19
null
null
tamasgal/haskell_exercises
maybe_haskell/Datatypes.hs
mit
getName (PersonWithoutAge name) = name
38
getName (PersonWithoutAge name) = name
38
getName (PersonWithoutAge name) = name
38
false
false
0
7
4
15
7
8
null
null
hackern/ghc-7.8.3
libraries/Cabal/cabal-install/Distribution/Client/SrcDist.hs
bsd-3-clause
-- |Create a source distribution. sdist :: SDistFlags -> SDistExFlags -> IO () sdist flags exflags = do pkg <- return . flattenPackageDescription =<< readPackageDescription verbosity =<< defaultPackageDesc verbosity let withDir = if not needMakeArchive then (\f -> f tmpTargetDir) else withTempDirectory verbosity tmpTargetDir "sdist." -- 'withTempDir' fails if we don't create 'tmpTargetDir'... when needMakeArchive $ createDirectoryIfMissingVerbose verbosity True tmpTargetDir withDir $ \tmpDir -> do let outDir = if isOutDirectory then tmpDir else tmpDir </> tarBallName pkg flags' = (if not needMakeArchive then flags else flags { sDistDirectory = Flag outDir }) { sDistVerbosity = Flag $ if verbosity == normal then lessVerbose verbosity else verbosity } unless isListSources $ createDirectoryIfMissingVerbose verbosity True outDir -- Run 'setup sdist --output-directory=tmpDir' (or -- '--list-source'/'--output-directory=someOtherDir') in case we were passed -- those options. setupWrapper verbosity setupOpts (Just pkg) sdistCommand (const flags') [] -- Unless we were given --list-sources or --output-directory ourselves, -- create an archive. when needMakeArchive $ createArchive verbosity pkg tmpDir distPref when isOutDirectory $ notice verbosity $ "Source directory created: " ++ tmpTargetDir when isListSources $ notice verbosity $ "List of package sources written to file '" ++ (fromFlag . sDistListSources $ flags) ++ "'" where flagEnabled f = not . null . flagToList . f $ flags isListSources = flagEnabled sDistListSources isOutDirectory = flagEnabled sDistDirectory needMakeArchive = not (isListSources || isOutDirectory) verbosity = fromFlag (sDistVerbosity flags) distPref = fromFlag (sDistDistPref flags) tmpTargetDir = fromFlagOrDefault (srcPref distPref) (sDistDirectory flags) setupOpts = defaultSetupScriptOptions { -- The '--output-directory' sdist flag was introduced in Cabal 1.12, and -- '--list-sources' in 1.17. useCabalVersion = if isListSources then orLaterVersion $ Version [1,17,0] [] else orLaterVersion $ Version [1,12,0] [] } format = fromFlag (sDistFormat exflags) createArchive = case format of TargzFormat -> createTarGzArchive ZipFormat -> createZipArchive
2,637
sdist :: SDistFlags -> SDistExFlags -> IO () sdist flags exflags = do pkg <- return . flattenPackageDescription =<< readPackageDescription verbosity =<< defaultPackageDesc verbosity let withDir = if not needMakeArchive then (\f -> f tmpTargetDir) else withTempDirectory verbosity tmpTargetDir "sdist." -- 'withTempDir' fails if we don't create 'tmpTargetDir'... when needMakeArchive $ createDirectoryIfMissingVerbose verbosity True tmpTargetDir withDir $ \tmpDir -> do let outDir = if isOutDirectory then tmpDir else tmpDir </> tarBallName pkg flags' = (if not needMakeArchive then flags else flags { sDistDirectory = Flag outDir }) { sDistVerbosity = Flag $ if verbosity == normal then lessVerbose verbosity else verbosity } unless isListSources $ createDirectoryIfMissingVerbose verbosity True outDir -- Run 'setup sdist --output-directory=tmpDir' (or -- '--list-source'/'--output-directory=someOtherDir') in case we were passed -- those options. setupWrapper verbosity setupOpts (Just pkg) sdistCommand (const flags') [] -- Unless we were given --list-sources or --output-directory ourselves, -- create an archive. when needMakeArchive $ createArchive verbosity pkg tmpDir distPref when isOutDirectory $ notice verbosity $ "Source directory created: " ++ tmpTargetDir when isListSources $ notice verbosity $ "List of package sources written to file '" ++ (fromFlag . sDistListSources $ flags) ++ "'" where flagEnabled f = not . null . flagToList . f $ flags isListSources = flagEnabled sDistListSources isOutDirectory = flagEnabled sDistDirectory needMakeArchive = not (isListSources || isOutDirectory) verbosity = fromFlag (sDistVerbosity flags) distPref = fromFlag (sDistDistPref flags) tmpTargetDir = fromFlagOrDefault (srcPref distPref) (sDistDirectory flags) setupOpts = defaultSetupScriptOptions { -- The '--output-directory' sdist flag was introduced in Cabal 1.12, and -- '--list-sources' in 1.17. useCabalVersion = if isListSources then orLaterVersion $ Version [1,17,0] [] else orLaterVersion $ Version [1,12,0] [] } format = fromFlag (sDistFormat exflags) createArchive = case format of TargzFormat -> createTarGzArchive ZipFormat -> createZipArchive
2,603
sdist flags exflags = do pkg <- return . flattenPackageDescription =<< readPackageDescription verbosity =<< defaultPackageDesc verbosity let withDir = if not needMakeArchive then (\f -> f tmpTargetDir) else withTempDirectory verbosity tmpTargetDir "sdist." -- 'withTempDir' fails if we don't create 'tmpTargetDir'... when needMakeArchive $ createDirectoryIfMissingVerbose verbosity True tmpTargetDir withDir $ \tmpDir -> do let outDir = if isOutDirectory then tmpDir else tmpDir </> tarBallName pkg flags' = (if not needMakeArchive then flags else flags { sDistDirectory = Flag outDir }) { sDistVerbosity = Flag $ if verbosity == normal then lessVerbose verbosity else verbosity } unless isListSources $ createDirectoryIfMissingVerbose verbosity True outDir -- Run 'setup sdist --output-directory=tmpDir' (or -- '--list-source'/'--output-directory=someOtherDir') in case we were passed -- those options. setupWrapper verbosity setupOpts (Just pkg) sdistCommand (const flags') [] -- Unless we were given --list-sources or --output-directory ourselves, -- create an archive. when needMakeArchive $ createArchive verbosity pkg tmpDir distPref when isOutDirectory $ notice verbosity $ "Source directory created: " ++ tmpTargetDir when isListSources $ notice verbosity $ "List of package sources written to file '" ++ (fromFlag . sDistListSources $ flags) ++ "'" where flagEnabled f = not . null . flagToList . f $ flags isListSources = flagEnabled sDistListSources isOutDirectory = flagEnabled sDistDirectory needMakeArchive = not (isListSources || isOutDirectory) verbosity = fromFlag (sDistVerbosity flags) distPref = fromFlag (sDistDistPref flags) tmpTargetDir = fromFlagOrDefault (srcPref distPref) (sDistDirectory flags) setupOpts = defaultSetupScriptOptions { -- The '--output-directory' sdist flag was introduced in Cabal 1.12, and -- '--list-sources' in 1.17. useCabalVersion = if isListSources then orLaterVersion $ Version [1,17,0] [] else orLaterVersion $ Version [1,12,0] [] } format = fromFlag (sDistFormat exflags) createArchive = case format of TargzFormat -> createTarGzArchive ZipFormat -> createZipArchive
2,558
true
true
0
19
728
538
272
266
null
null
nushio3/ghc
compiler/main/DynFlags.hs
bsd-3-clause
setDynHiSuf f d = d{ dynHiSuf = f}
42
setDynHiSuf f d = d{ dynHiSuf = f}
42
setDynHiSuf f d = d{ dynHiSuf = f}
42
false
false
0
6
15
19
10
9
null
null
noughtmare/yi
yi-keymap-vim/src/Yi/Keymap/Vim/Digraph.hs
gpl-2.0
-- KATAKANA LETTER RO switch 'W' 'A' = '\x30EE'
47
switch 'W' 'A' = '\x30EE'
25
switch 'W' 'A' = '\x30EE'
25
true
false
0
5
8
12
6
6
null
null
tomahawkins/trs
attic/C/Compiler.hs
bsd-3-clause
-- | Compiles a TRS 'System' to C. compile :: String -> Word -> System () -> IO () compile name word system = do sys <- extract system case sys of Nothing -> putStrLn "ERROR: Design rule checks failed. Compilation aborted." >> exitWith (ExitFailure 1) Just (SystemElab rules regs asserts exprs) -> do asserts' <- filterM isAssertSupported asserts writeFile (name ++ ".c") (code word rules regs asserts' exprs) where isAssertSupported :: Assert -> IO Bool isAssertSupported (Assert name prop) = case prop of PropertyAlways (PropertyExpr _) -> return True PropertyAlways (PropertyImply (PropertyExpr _) (PropertyExpr _)) -> return True _ -> do putStrLn $ "WARNING: Assertion " ++ name ++ " is not supported in C." return False
781
compile :: String -> Word -> System () -> IO () compile name word system = do sys <- extract system case sys of Nothing -> putStrLn "ERROR: Design rule checks failed. Compilation aborted." >> exitWith (ExitFailure 1) Just (SystemElab rules regs asserts exprs) -> do asserts' <- filterM isAssertSupported asserts writeFile (name ++ ".c") (code word rules regs asserts' exprs) where isAssertSupported :: Assert -> IO Bool isAssertSupported (Assert name prop) = case prop of PropertyAlways (PropertyExpr _) -> return True PropertyAlways (PropertyImply (PropertyExpr _) (PropertyExpr _)) -> return True _ -> do putStrLn $ "WARNING: Assertion " ++ name ++ " is not supported in C." return False
746
compile name word system = do sys <- extract system case sys of Nothing -> putStrLn "ERROR: Design rule checks failed. Compilation aborted." >> exitWith (ExitFailure 1) Just (SystemElab rules regs asserts exprs) -> do asserts' <- filterM isAssertSupported asserts writeFile (name ++ ".c") (code word rules regs asserts' exprs) where isAssertSupported :: Assert -> IO Bool isAssertSupported (Assert name prop) = case prop of PropertyAlways (PropertyExpr _) -> return True PropertyAlways (PropertyImply (PropertyExpr _) (PropertyExpr _)) -> return True _ -> do putStrLn $ "WARNING: Assertion " ++ name ++ " is not supported in C." return False
698
true
true
0
14
174
254
118
136
null
null
snoyberg/ghc
libraries/template-haskell/Language/Haskell/TH/Lib.hs
bsd-3-clause
noSourceUnpackedness, sourceNoUnpack, sourceUnpack :: SourceUnpackednessQ noSourceUnpackedness = return NoSourceUnpackedness
124
noSourceUnpackedness, sourceNoUnpack, sourceUnpack :: SourceUnpackednessQ noSourceUnpackedness = return NoSourceUnpackedness
124
noSourceUnpackedness = return NoSourceUnpackedness
50
false
true
0
5
8
18
11
7
null
null
lekto/haskell
Project-Euler-Solutions/problem0028.hs
mit
spiral' :: Int -> Int spiral' 1 = 1
35
spiral' :: Int -> Int spiral' 1 = 1
35
spiral' 1 = 1
13
false
true
0
7
8
24
10
14
null
null
bartolkaruza/software-testing-2014-group-W1
week1/week_1_group_w1/GS.hs
apache-2.0
h1 x = 2 * (h1 x)
17
h1 x = 2 * (h1 x)
17
h1 x = 2 * (h1 x)
17
false
false
0
7
6
19
9
10
null
null
uroboros/haskell_design_patterns
chapter6/1_sum_of_products.hs
mit
-- type RList a = Choice U (Combo a (List' a)) rList :: TypeRep a -> TypeRep (List' a) rList tr = RType (EP fromL toL) (RChoice RUnit (RCombo tr (rList tr)))
175
rList :: TypeRep a -> TypeRep (List' a) rList tr = RType (EP fromL toL) (RChoice RUnit (RCombo tr (rList tr)))
127
rList tr = RType (EP fromL toL) (RChoice RUnit (RCombo tr (rList tr)))
87
true
true
0
11
49
66
32
34
null
null
mannersio/manners
cli/src/Provider.hs
mit
newFakeProviderState :: IO FakeProviderState newFakeProviderState = newTVarIO initialFakeProvider
97
newFakeProviderState :: IO FakeProviderState newFakeProviderState = newTVarIO initialFakeProvider
97
newFakeProviderState = newTVarIO initialFakeProvider
52
false
true
1
5
7
20
8
12
null
null
Teaspot-Studio/Urho3D-Haskell
src/Graphics/Urho3D/Graphics/Animation.hs
mit
animationGetTracks :: (Parent Animation a, Pointer p a, MonadIO m) => p -- ^ Pointer to Animation or ascentor -> m (H.HashMap StringHash AnimationTrack) animationGetTracks p = liftIO $ do let ptr = parentPointer p peekForeignHashMap =<< [C.exp| const HashMapStringHashAnimationTrack* {&$(Animation* ptr)->GetTracks()} |] -- | Return number of animation tracks.
369
animationGetTracks :: (Parent Animation a, Pointer p a, MonadIO m) => p -- ^ Pointer to Animation or ascentor -> m (H.HashMap StringHash AnimationTrack) animationGetTracks p = liftIO $ do let ptr = parentPointer p peekForeignHashMap =<< [C.exp| const HashMapStringHashAnimationTrack* {&$(Animation* ptr)->GetTracks()} |] -- | Return number of animation tracks.
369
animationGetTracks p = liftIO $ do let ptr = parentPointer p peekForeignHashMap =<< [C.exp| const HashMapStringHashAnimationTrack* {&$(Animation* ptr)->GetTracks()} |] -- | Return number of animation tracks.
212
false
true
0
11
58
88
45
43
null
null
olorin/amazonka
amazonka-s3/gen/Network/AWS/S3/DeleteObject.hs
mpl-2.0
-- | Creates a value of 'DeleteObject' with the minimum fields required to make a request. -- -- Use one of the following lenses to modify other fields as desired: -- -- * 'doVersionId' -- -- * 'doMFA' -- -- * 'doRequestPayer' -- -- * 'doBucket' -- -- * 'doKey' deleteObject :: BucketName -- ^ 'doBucket' -> ObjectKey -- ^ 'doKey' -> DeleteObject deleteObject pBucket_ pKey_ = DeleteObject' { _doVersionId = Nothing , _doMFA = Nothing , _doRequestPayer = Nothing , _doBucket = pBucket_ , _doKey = pKey_ }
544
deleteObject :: BucketName -- ^ 'doBucket' -> ObjectKey -- ^ 'doKey' -> DeleteObject deleteObject pBucket_ pKey_ = DeleteObject' { _doVersionId = Nothing , _doMFA = Nothing , _doRequestPayer = Nothing , _doBucket = pBucket_ , _doKey = pKey_ }
282
deleteObject pBucket_ pKey_ = DeleteObject' { _doVersionId = Nothing , _doMFA = Nothing , _doRequestPayer = Nothing , _doBucket = pBucket_ , _doKey = pKey_ }
185
true
true
0
6
128
71
48
23
null
null
mfpi/OpenGLRaw
src/Graphics/Rendering/OpenGL/Raw/ARB/Compatibility/Tokens.hs
bsd-3-clause
gl_ALIASED_POINT_SIZE_RANGE :: GLenum gl_ALIASED_POINT_SIZE_RANGE = 0x846D
74
gl_ALIASED_POINT_SIZE_RANGE :: GLenum gl_ALIASED_POINT_SIZE_RANGE = 0x846D
74
gl_ALIASED_POINT_SIZE_RANGE = 0x846D
36
false
true
0
4
5
11
6
5
null
null
hjwylde/werewolf
app/Werewolf/Options.hs
bsd-3-clause
werewolf :: Parser Options werewolf = Options <$> fmap T.pack (strOption $ mconcat [ long "caller", metavar "PLAYER" , help "Specify the calling player's name" ]) <*> fmap T.pack (strOption $ mconcat [ long "tag", metavar "TAG" , help "Specify the game tag (for running multiple games at once)" ]) <*> subparser (mconcat [ command "boot" $ info (helper <*> boot) (fullDesc <> progDesc "Vote to boot a player") , command "choose" $ info (helper <*> choose) (fullDesc <> progDesc "Choose an allegiance or player(s)") , command "circle" $ info (helper <*> circle) (fullDesc <> progDesc "Get the game circle") , command "divine" $ info (helper <*> divine) (fullDesc <> progDesc "Divine a player's role") , command "end" $ info (helper <*> end) (fullDesc <> progDesc "End the current game") , command "heal" $ info (helper <*> heal) (fullDesc <> progDesc "Heal the devoured player") , command "help" $ info (helper <*> help_) (fullDesc <> progDesc "Help documents") , command "interpret" $ info (helper <*> interpret) (fullDesc <> noIntersperse <> progDesc "Interpret a command") , command "pass" $ info (helper <*> pass) (fullDesc <> progDesc "Pass") , command "ping" $ info (helper <*> ping) (fullDesc <> progDesc "Ping the status of the current game publicly") , command "poison" $ info (helper <*> poison) (fullDesc <> progDesc "Poison a player") , command "protect" $ info (helper <*> protect) (fullDesc <> progDesc "Protect a player") , command "quit" $ info (helper <*> quit) (fullDesc <> progDesc "Quit the current game") , command "raise" $ info (helper <*> raise) (fullDesc <> progDesc "Raise the dead as Zombies") , command "see" $ info (helper <*> see) (fullDesc <> progDesc "See a player's allegiance") , command "start" $ info (helper <*> start) (fullDesc <> progDesc "Start a new game") , command "status" $ info (helper <*> status) (fullDesc <> progDesc "Get the status of the current game") , command "unvote" $ info (helper <*> unvote) (fullDesc <> progDesc "Rescind a vote") , command "version" $ info (helper <*> version) (fullDesc <> progDesc "Show this engine's version") , command "vote" $ info (helper <*> vote) (fullDesc <> progDesc "Vote against a player") ])
2,641
werewolf :: Parser Options werewolf = Options <$> fmap T.pack (strOption $ mconcat [ long "caller", metavar "PLAYER" , help "Specify the calling player's name" ]) <*> fmap T.pack (strOption $ mconcat [ long "tag", metavar "TAG" , help "Specify the game tag (for running multiple games at once)" ]) <*> subparser (mconcat [ command "boot" $ info (helper <*> boot) (fullDesc <> progDesc "Vote to boot a player") , command "choose" $ info (helper <*> choose) (fullDesc <> progDesc "Choose an allegiance or player(s)") , command "circle" $ info (helper <*> circle) (fullDesc <> progDesc "Get the game circle") , command "divine" $ info (helper <*> divine) (fullDesc <> progDesc "Divine a player's role") , command "end" $ info (helper <*> end) (fullDesc <> progDesc "End the current game") , command "heal" $ info (helper <*> heal) (fullDesc <> progDesc "Heal the devoured player") , command "help" $ info (helper <*> help_) (fullDesc <> progDesc "Help documents") , command "interpret" $ info (helper <*> interpret) (fullDesc <> noIntersperse <> progDesc "Interpret a command") , command "pass" $ info (helper <*> pass) (fullDesc <> progDesc "Pass") , command "ping" $ info (helper <*> ping) (fullDesc <> progDesc "Ping the status of the current game publicly") , command "poison" $ info (helper <*> poison) (fullDesc <> progDesc "Poison a player") , command "protect" $ info (helper <*> protect) (fullDesc <> progDesc "Protect a player") , command "quit" $ info (helper <*> quit) (fullDesc <> progDesc "Quit the current game") , command "raise" $ info (helper <*> raise) (fullDesc <> progDesc "Raise the dead as Zombies") , command "see" $ info (helper <*> see) (fullDesc <> progDesc "See a player's allegiance") , command "start" $ info (helper <*> start) (fullDesc <> progDesc "Start a new game") , command "status" $ info (helper <*> status) (fullDesc <> progDesc "Get the status of the current game") , command "unvote" $ info (helper <*> unvote) (fullDesc <> progDesc "Rescind a vote") , command "version" $ info (helper <*> version) (fullDesc <> progDesc "Show this engine's version") , command "vote" $ info (helper <*> vote) (fullDesc <> progDesc "Vote against a player") ])
2,641
werewolf = Options <$> fmap T.pack (strOption $ mconcat [ long "caller", metavar "PLAYER" , help "Specify the calling player's name" ]) <*> fmap T.pack (strOption $ mconcat [ long "tag", metavar "TAG" , help "Specify the game tag (for running multiple games at once)" ]) <*> subparser (mconcat [ command "boot" $ info (helper <*> boot) (fullDesc <> progDesc "Vote to boot a player") , command "choose" $ info (helper <*> choose) (fullDesc <> progDesc "Choose an allegiance or player(s)") , command "circle" $ info (helper <*> circle) (fullDesc <> progDesc "Get the game circle") , command "divine" $ info (helper <*> divine) (fullDesc <> progDesc "Divine a player's role") , command "end" $ info (helper <*> end) (fullDesc <> progDesc "End the current game") , command "heal" $ info (helper <*> heal) (fullDesc <> progDesc "Heal the devoured player") , command "help" $ info (helper <*> help_) (fullDesc <> progDesc "Help documents") , command "interpret" $ info (helper <*> interpret) (fullDesc <> noIntersperse <> progDesc "Interpret a command") , command "pass" $ info (helper <*> pass) (fullDesc <> progDesc "Pass") , command "ping" $ info (helper <*> ping) (fullDesc <> progDesc "Ping the status of the current game publicly") , command "poison" $ info (helper <*> poison) (fullDesc <> progDesc "Poison a player") , command "protect" $ info (helper <*> protect) (fullDesc <> progDesc "Protect a player") , command "quit" $ info (helper <*> quit) (fullDesc <> progDesc "Quit the current game") , command "raise" $ info (helper <*> raise) (fullDesc <> progDesc "Raise the dead as Zombies") , command "see" $ info (helper <*> see) (fullDesc <> progDesc "See a player's allegiance") , command "start" $ info (helper <*> start) (fullDesc <> progDesc "Start a new game") , command "status" $ info (helper <*> status) (fullDesc <> progDesc "Get the status of the current game") , command "unvote" $ info (helper <*> unvote) (fullDesc <> progDesc "Rescind a vote") , command "version" $ info (helper <*> version) (fullDesc <> progDesc "Show this engine's version") , command "vote" $ info (helper <*> vote) (fullDesc <> progDesc "Vote against a player") ])
2,614
false
true
0
14
817
749
373
376
null
null
VictorCMiraldo/mmm
MMM/Core/Distributive.hs
mit
nothing :: FreeMaybe a nothing = Free K
39
nothing :: FreeMaybe a nothing = Free K
39
nothing = Free K
16
false
true
0
5
7
17
8
9
null
null
solatis/haskell-bitcoin-api-extra
test/Control/Bitcoin/Api/TransactionSpec.hs
mit
spec :: Spec spec = do describe "when testing transaction functions" $ do it "can watch for new transactions" $ do testClient $ \client -> do _ <- Mining.generate client 10 result <- newEmptyMVar -- This forks a thread, consumes a single transaction from the conduit, -- and puts it in the MVar. _ <- forkIO $ do list <- runConduit $ Transaction.watch client (Just 1) $= CL.take 1 putMVar result list -- Now, let's generate a transaction and some blocks to put the -- the transaction in. utxs <- Wallet.listUnspent client (length utxs) `shouldSatisfy` (>= 1) -- Calculate the total BTC of all unspent transactions let btc = foldr (+) 0 $ map (^. amount) utxs addr <- Wallet.newAddress client tx <- Transaction.create client utxs [(addr, (btc - 0.0001))] (tx', completed) <- Transaction.sign client tx (Just utxs) Nothing completed `shouldBe` True _ <- Transaction.send client tx' _ <- Mining.generate client 10 val <- takeMVar result length (val) `shouldBe` 1
1,245
spec :: Spec spec = do describe "when testing transaction functions" $ do it "can watch for new transactions" $ do testClient $ \client -> do _ <- Mining.generate client 10 result <- newEmptyMVar -- This forks a thread, consumes a single transaction from the conduit, -- and puts it in the MVar. _ <- forkIO $ do list <- runConduit $ Transaction.watch client (Just 1) $= CL.take 1 putMVar result list -- Now, let's generate a transaction and some blocks to put the -- the transaction in. utxs <- Wallet.listUnspent client (length utxs) `shouldSatisfy` (>= 1) -- Calculate the total BTC of all unspent transactions let btc = foldr (+) 0 $ map (^. amount) utxs addr <- Wallet.newAddress client tx <- Transaction.create client utxs [(addr, (btc - 0.0001))] (tx', completed) <- Transaction.sign client tx (Just utxs) Nothing completed `shouldBe` True _ <- Transaction.send client tx' _ <- Mining.generate client 10 val <- takeMVar result length (val) `shouldBe` 1
1,245
spec = do describe "when testing transaction functions" $ do it "can watch for new transactions" $ do testClient $ \client -> do _ <- Mining.generate client 10 result <- newEmptyMVar -- This forks a thread, consumes a single transaction from the conduit, -- and puts it in the MVar. _ <- forkIO $ do list <- runConduit $ Transaction.watch client (Just 1) $= CL.take 1 putMVar result list -- Now, let's generate a transaction and some blocks to put the -- the transaction in. utxs <- Wallet.listUnspent client (length utxs) `shouldSatisfy` (>= 1) -- Calculate the total BTC of all unspent transactions let btc = foldr (+) 0 $ map (^. amount) utxs addr <- Wallet.newAddress client tx <- Transaction.create client utxs [(addr, (btc - 0.0001))] (tx', completed) <- Transaction.sign client tx (Just utxs) Nothing completed `shouldBe` True _ <- Transaction.send client tx' _ <- Mining.generate client 10 val <- takeMVar result length (val) `shouldBe` 1
1,232
false
true
0
26
445
317
154
163
null
null
Verites/verigraph
src/library/Rewriting/DPO/TypedGraph/GraphProcess.hs
apache-2.0
-- | Given an doubly typed grammar, it returns its initial graph initialGraph :: DoublyTypedGrammar a b -> TypedGraph a b initialGraph = start . singleTypedGrammar
163
initialGraph :: DoublyTypedGrammar a b -> TypedGraph a b initialGraph = start . singleTypedGrammar
98
initialGraph = start . singleTypedGrammar
41
true
true
1
7
25
37
16
21
null
null
tpsinnem/Idris-dev
src/Idris/Reflection.hs
bsd-3-clause
rFunArgToPArg (RFunArg n _ RConstraint e) = PConstraint 0 (rArgOpts e) n Placeholder
84
rFunArgToPArg (RFunArg n _ RConstraint e) = PConstraint 0 (rArgOpts e) n Placeholder
84
rFunArgToPArg (RFunArg n _ RConstraint e) = PConstraint 0 (rArgOpts e) n Placeholder
84
false
false
0
7
12
36
17
19
null
null
MichielDerhaeg/stack
src/Stack/Setup/Installed.hs
bsd-3-clause
listInstalled :: (MonadIO m, MonadThrow m) => Path Abs Dir -> m [Tool] listInstalled programsPath = do doesDirExist programsPath >>= \case False -> return [] True -> do (_, files) <- listDir programsPath return $ mapMaybe toTool files where toTool fp = do x <- T.stripSuffix ".installed" $ T.pack $ toFilePath $ filename fp parseToolText x
428
listInstalled :: (MonadIO m, MonadThrow m) => Path Abs Dir -> m [Tool] listInstalled programsPath = do doesDirExist programsPath >>= \case False -> return [] True -> do (_, files) <- listDir programsPath return $ mapMaybe toTool files where toTool fp = do x <- T.stripSuffix ".installed" $ T.pack $ toFilePath $ filename fp parseToolText x
428
listInstalled programsPath = do doesDirExist programsPath >>= \case False -> return [] True -> do (_, files) <- listDir programsPath return $ mapMaybe toTool files where toTool fp = do x <- T.stripSuffix ".installed" $ T.pack $ toFilePath $ filename fp parseToolText x
329
false
true
1
14
144
155
69
86
null
null
green-haskell/ghc
compiler/typecheck/TcEvidence.hs
bsd-3-clause
evBindMapBinds :: EvBindMap -> Bag EvBind evBindMapBinds = foldEvBindMap consBag emptyBag
89
evBindMapBinds :: EvBindMap -> Bag EvBind evBindMapBinds = foldEvBindMap consBag emptyBag
89
evBindMapBinds = foldEvBindMap consBag emptyBag
47
false
true
0
6
10
23
11
12
null
null
ocramz/monad-bayes
src/Control/Monad/Bayes/Conditional.hs
mit
hoist :: (CustomReal m ~ CustomReal n) => (forall x. m x -> n x) -> Conditional m a -> Conditional n a hoist f (Conditional m) = Conditional $ mapStateT (mapMaybeT f) m
168
hoist :: (CustomReal m ~ CustomReal n) => (forall x. m x -> n x) -> Conditional m a -> Conditional n a hoist f (Conditional m) = Conditional $ mapStateT (mapMaybeT f) m
168
hoist f (Conditional m) = Conditional $ mapStateT (mapMaybeT f) m
65
false
true
0
10
33
90
43
47
null
null
barak/haskell-cmath
tests/QC.hs
bsd-3-clause
main = sequence_ [ quickCheck $ \x -> C.acos x == acos x , quickCheck $ \x -> C.asin x == asin x , quickCheck $ \x -> C.atan x == atan x -- note: , quickCheck $ \x y -> C.atan2 x y == atan2 x y , quickCheck $ \x -> C.cos x == cos x , quickCheck $ \x -> C.sin x == sin x , quickCheck $ \x -> C.tan x == tan x , quickCheck $ \x -> C.cosh x == cosh x , quickCheck $ \x -> C.sinh x == sinh x , quickCheck $ \x -> C.tanh x == tanh x , quickCheck $ \x -> C.exp x == exp x , quickCheck $ \x -> C.log x == log x , quickCheck $ \x y -> x >= 0 ==> C.pow x y == x ** y , quickCheck $ \x -> x >= 0 ==> C.sqrt x == sqrt x , quickCheck $ \x -> C.log10 x == (log x / log 10 ) ]
879
main = sequence_ [ quickCheck $ \x -> C.acos x == acos x , quickCheck $ \x -> C.asin x == asin x , quickCheck $ \x -> C.atan x == atan x -- note: , quickCheck $ \x y -> C.atan2 x y == atan2 x y , quickCheck $ \x -> C.cos x == cos x , quickCheck $ \x -> C.sin x == sin x , quickCheck $ \x -> C.tan x == tan x , quickCheck $ \x -> C.cosh x == cosh x , quickCheck $ \x -> C.sinh x == sinh x , quickCheck $ \x -> C.tanh x == tanh x , quickCheck $ \x -> C.exp x == exp x , quickCheck $ \x -> C.log x == log x , quickCheck $ \x y -> x >= 0 ==> C.pow x y == x ** y , quickCheck $ \x -> x >= 0 ==> C.sqrt x == sqrt x , quickCheck $ \x -> C.log10 x == (log x / log 10 ) ]
879
main = sequence_ [ quickCheck $ \x -> C.acos x == acos x , quickCheck $ \x -> C.asin x == asin x , quickCheck $ \x -> C.atan x == atan x -- note: , quickCheck $ \x y -> C.atan2 x y == atan2 x y , quickCheck $ \x -> C.cos x == cos x , quickCheck $ \x -> C.sin x == sin x , quickCheck $ \x -> C.tan x == tan x , quickCheck $ \x -> C.cosh x == cosh x , quickCheck $ \x -> C.sinh x == sinh x , quickCheck $ \x -> C.tanh x == tanh x , quickCheck $ \x -> C.exp x == exp x , quickCheck $ \x -> C.log x == log x , quickCheck $ \x y -> x >= 0 ==> C.pow x y == x ** y , quickCheck $ \x -> x >= 0 ==> C.sqrt x == sqrt x , quickCheck $ \x -> C.log10 x == (log x / log 10 ) ]
879
false
false
1
13
390
411
204
207
null
null
energyflowanalysis/efa-2.1
src/EFA/Application/Flow/Sequence/SystemEta.hs
bsd-3-clause
objectiveFunction :: (Node.C node, Arith.Product v) => Condition node a v -> Forcing node a v -> SeqFlow.Graph node a (Result v) -> Maybe (v, v) objectiveFunction cond forcing env = let eta = detEtaSys "objectiveFunction" env in toMaybe (cond env) $ (eta ~+ forcing env, eta)
297
objectiveFunction :: (Node.C node, Arith.Product v) => Condition node a v -> Forcing node a v -> SeqFlow.Graph node a (Result v) -> Maybe (v, v) objectiveFunction cond forcing env = let eta = detEtaSys "objectiveFunction" env in toMaybe (cond env) $ (eta ~+ forcing env, eta)
297
objectiveFunction cond forcing env = let eta = detEtaSys "objectiveFunction" env in toMaybe (cond env) $ (eta ~+ forcing env, eta)
137
false
true
0
11
68
129
63
66
null
null
myShoggoth/shakespeare
Text/Hamlet.hs
mit
docToExp env hr scope (DocWith [] inside) = do inside' <- docsToExp env hr scope inside return $ inside'
112
docToExp env hr scope (DocWith [] inside) = do inside' <- docsToExp env hr scope inside return $ inside'
112
docToExp env hr scope (DocWith [] inside) = do inside' <- docsToExp env hr scope inside return $ inside'
112
false
false
0
8
26
48
22
26
null
null
XinhuaZhang/PetaVisionHaskell
Application/Caffe/LMDB.hs
gpl-3.0
saveDataSink :: String -> Int -> Sink [(Int, R.Array U DIM3 Double)] (ResourceT IO) () saveDataSink path batchSize = do x <- CL.peek case x of Nothing -> return () Just y -> do let numLayer = L.length y liftIO $ createDirectoryIfMissing True path liftIO $ M.mapM_ (\i -> do let p = path L.++ "_" L.++ show i removePathForcibly p) [0 .. numLayer - 1] pathCSString <- liftIO $ newCString path typeCSString <- liftIO $ newCString "lmdb" liftIO $ c'openDatabase typeCSString pathCSString (fromIntegral . L.length $ y) saveData batchSize 0
676
saveDataSink :: String -> Int -> Sink [(Int, R.Array U DIM3 Double)] (ResourceT IO) () saveDataSink path batchSize = do x <- CL.peek case x of Nothing -> return () Just y -> do let numLayer = L.length y liftIO $ createDirectoryIfMissing True path liftIO $ M.mapM_ (\i -> do let p = path L.++ "_" L.++ show i removePathForcibly p) [0 .. numLayer - 1] pathCSString <- liftIO $ newCString path typeCSString <- liftIO $ newCString "lmdb" liftIO $ c'openDatabase typeCSString pathCSString (fromIntegral . L.length $ y) saveData batchSize 0
676
saveDataSink path batchSize = do x <- CL.peek case x of Nothing -> return () Just y -> do let numLayer = L.length y liftIO $ createDirectoryIfMissing True path liftIO $ M.mapM_ (\i -> do let p = path L.++ "_" L.++ show i removePathForcibly p) [0 .. numLayer - 1] pathCSString <- liftIO $ newCString path typeCSString <- liftIO $ newCString "lmdb" liftIO $ c'openDatabase typeCSString pathCSString (fromIntegral . L.length $ y) saveData batchSize 0
563
false
true
0
22
232
244
114
130
null
null
kkardzis/sdlhs
test/Graphics/UI/SDL20Spec.hs
isc
testlib :: LIBSDL -> IO (Either String ()) testlib lib = let maybeEx s = if (isPrefixOf "<sdlhs>" s) then Just s else Nothing in tryJust (\(ErrorCall s) -> maybeEx s) (withlib lib (return ()))
197
testlib :: LIBSDL -> IO (Either String ()) testlib lib = let maybeEx s = if (isPrefixOf "<sdlhs>" s) then Just s else Nothing in tryJust (\(ErrorCall s) -> maybeEx s) (withlib lib (return ()))
197
testlib lib = let maybeEx s = if (isPrefixOf "<sdlhs>" s) then Just s else Nothing in tryJust (\(ErrorCall s) -> maybeEx s) (withlib lib (return ()))
154
false
true
0
11
39
107
51
56
null
null
spechub/Hets
OWL2/ManchesterPrint.hs
gpl-2.0
-- | OWL2 signature printing printOWLBasicTheory :: (Sign, [Named AS.Axiom]) -> Doc printOWLBasicTheory = printBasicTheory . prepareBasicTheory
145
printOWLBasicTheory :: (Sign, [Named AS.Axiom]) -> Doc printOWLBasicTheory = printBasicTheory . prepareBasicTheory
114
printOWLBasicTheory = printBasicTheory . prepareBasicTheory
59
true
true
0
9
18
34
19
15
null
null
bitemyapp/irc-core
driver/ClientState.hs
bsd-3-clause
isRelevant (ActionMsgType msg) = Just msg
41
isRelevant (ActionMsgType msg) = Just msg
41
isRelevant (ActionMsgType msg) = Just msg
41
false
false
0
7
5
18
8
10
null
null
rvion/ride
jetpack/src/Codec/Archive/Tar/AsTar.hs
bsd-3-clause
-- tar_create :: FilePath -> FilePath -> [FilePath] -> IO () tar_create = I.create
82
tar_create = I.create
21
tar_create = I.create
21
true
false
1
6
13
13
5
8
null
null
wat-aro/scheme
app/Main.hs
bsd-3-clause
makeString badArgList = throwError $ NumArgs 2 badArgList
57
makeString badArgList = throwError $ NumArgs 2 badArgList
57
makeString badArgList = throwError $ NumArgs 2 badArgList
57
false
false
0
6
7
18
8
10
null
null
forked-upstream-packages-for-ghcjs/ghcjs
ghcjs/src/Gen2/TH.hs
mit
sendToRunner :: ThRunner -> Int -> TH.Message -> IO () sendToRunner runner responseTo msg = sendToRunnerRaw runner responseTo (BL.toStrict . runPut . put $ msg)
162
sendToRunner :: ThRunner -> Int -> TH.Message -> IO () sendToRunner runner responseTo msg = sendToRunnerRaw runner responseTo (BL.toStrict . runPut . put $ msg)
162
sendToRunner runner responseTo msg = sendToRunnerRaw runner responseTo (BL.toStrict . runPut . put $ msg)
107
false
true
0
10
26
61
30
31
null
null
kawu/sgd
src/Numeric/SGD/DataSet.hs
bsd-2-clause
withDisk :: Binary a => [a] -> (DataSet a -> IO b) -> IO b withDisk xs handler = withTempDirectory "." ".sgd" $ \tmpDir -> do -- We use state monad to compute the number of dataset elements. n <- flip S.execStateT 0 $ forM_ (zip xs [0 :: Int ..]) $ \(x, ix) -> do S.lift $ encodeFile (tmpDir </> show ix) x S.modify (+1) -- Avoid decodeFile laziness when using some older versions of the binary -- library (as of year 2019, this could be probably simplified) let at ix = do cs <- B.readFile (tmpDir </> show ix) return . decode $ BL.fromChunks [cs] handler $ DataSet {size = n, elemAt = at} ------------------------------------------- -- Lazy IO Utils ------------------------------------------- -- | Lazily evaluate each action in the sequence from left to right, -- and collect the results.
859
withDisk :: Binary a => [a] -> (DataSet a -> IO b) -> IO b withDisk xs handler = withTempDirectory "." ".sgd" $ \tmpDir -> do -- We use state monad to compute the number of dataset elements. n <- flip S.execStateT 0 $ forM_ (zip xs [0 :: Int ..]) $ \(x, ix) -> do S.lift $ encodeFile (tmpDir </> show ix) x S.modify (+1) -- Avoid decodeFile laziness when using some older versions of the binary -- library (as of year 2019, this could be probably simplified) let at ix = do cs <- B.readFile (tmpDir </> show ix) return . decode $ BL.fromChunks [cs] handler $ DataSet {size = n, elemAt = at} ------------------------------------------- -- Lazy IO Utils ------------------------------------------- -- | Lazily evaluate each action in the sequence from left to right, -- and collect the results.
859
withDisk xs handler = withTempDirectory "." ".sgd" $ \tmpDir -> do -- We use state monad to compute the number of dataset elements. n <- flip S.execStateT 0 $ forM_ (zip xs [0 :: Int ..]) $ \(x, ix) -> do S.lift $ encodeFile (tmpDir </> show ix) x S.modify (+1) -- Avoid decodeFile laziness when using some older versions of the binary -- library (as of year 2019, this could be probably simplified) let at ix = do cs <- B.readFile (tmpDir </> show ix) return . decode $ BL.fromChunks [cs] handler $ DataSet {size = n, elemAt = at} ------------------------------------------- -- Lazy IO Utils ------------------------------------------- -- | Lazily evaluate each action in the sequence from left to right, -- and collect the results.
800
false
true
0
18
206
233
119
114
null
null
josuf107/xioqbot
src/Messages.hs
bsd-3-clause
skipMsg (Just skipped, Just next) = "Skipped " & skipped % ". Next up is " % next % "!"
91
skipMsg (Just skipped, Just next) = "Skipped " & skipped % ". Next up is " % next % "!"
91
skipMsg (Just skipped, Just next) = "Skipped " & skipped % ". Next up is " % next % "!"
91
false
false
0
8
23
37
18
19
null
null
icyfork/shellcheck
ShellCheck/Analytics.hs
gpl-3.0
prop_checkArithmeticDeref12= verify checkArithmeticDeref "for ((i=0; $i < 3; i)); do true; done"
96
prop_checkArithmeticDeref12= verify checkArithmeticDeref "for ((i=0; $i < 3; i)); do true; done"
96
prop_checkArithmeticDeref12= verify checkArithmeticDeref "for ((i=0; $i < 3; i)); do true; done"
96
false
false
1
5
11
15
5
10
null
null
themoritz/cabal
Cabal/tests/ParserHackageTests.hs
bsd-3-clause
buildInfos_ :: Traversal' GenericPackageDescription BuildInfo buildInfos_ f gpd = mkGpd <$> (traverse . traverse . buildInfo_) f (condLibrary gpd) <*> (traverse . _2 . traverse . buildInfo_) f (condExecutables gpd) where mkGpd lib exe = gpd { condLibrary = lib , condExecutables = exe }
336
buildInfos_ :: Traversal' GenericPackageDescription BuildInfo buildInfos_ f gpd = mkGpd <$> (traverse . traverse . buildInfo_) f (condLibrary gpd) <*> (traverse . _2 . traverse . buildInfo_) f (condExecutables gpd) where mkGpd lib exe = gpd { condLibrary = lib , condExecutables = exe }
336
buildInfos_ f gpd = mkGpd <$> (traverse . traverse . buildInfo_) f (condLibrary gpd) <*> (traverse . _2 . traverse . buildInfo_) f (condExecutables gpd) where mkGpd lib exe = gpd { condLibrary = lib , condExecutables = exe }
274
false
true
5
9
94
109
55
54
null
null
brendanhay/gogol
gogol-shopping-content/gen/Network/Google/ShoppingContent/Types/Product.hs
mpl-2.0
-- | A list of inclusive order weight upper bounds. The last weight\'s value -- can be \`\"infinity\"\`. For example \`[{\"value\": \"10\", \"unit\": -- \"kg\"}, {\"value\": \"50\", \"unit\": \"kg\"}, {\"value\": -- \"infinity\", \"unit\": \"kg\"}]\` represents the headers \"\<= 10kg\", -- \"\<= 50kg\", and \"> 50kg\". All weights within a service must have the -- same unit. Must be non-empty. Can only be set if all other fields are -- not set. hWeights :: Lens' Headers [Weight] hWeights = lens _hWeights (\ s a -> s{_hWeights = a}) . _Default . _Coerce
572
hWeights :: Lens' Headers [Weight] hWeights = lens _hWeights (\ s a -> s{_hWeights = a}) . _Default . _Coerce
123
hWeights = lens _hWeights (\ s a -> s{_hWeights = a}) . _Default . _Coerce
88
true
true
0
11
104
59
34
25
null
null
DataStewardshipPortal/ds-wizard
DSServer/app/Actions/EditProfile/Handler.hs
apache-2.0
profileForm :: Monad m => User -> D.Form Html m ProfileData profileForm user = ProfileData <$> "email" .: emailFormlet (Just $ TL.toStrict $ runEmail $ u_email user) <*> "name" .: D.validate notEmpty (D.text $ Just $ TL.toStrict $ u_name user) <*> "affiliation" .: D.validate notEmpty (D.text $ Just $ TL.toStrict $ u_affiliation user)
365
profileForm :: Monad m => User -> D.Form Html m ProfileData profileForm user = ProfileData <$> "email" .: emailFormlet (Just $ TL.toStrict $ runEmail $ u_email user) <*> "name" .: D.validate notEmpty (D.text $ Just $ TL.toStrict $ u_name user) <*> "affiliation" .: D.validate notEmpty (D.text $ Just $ TL.toStrict $ u_affiliation user)
365
profileForm user = ProfileData <$> "email" .: emailFormlet (Just $ TL.toStrict $ runEmail $ u_email user) <*> "name" .: D.validate notEmpty (D.text $ Just $ TL.toStrict $ u_name user) <*> "affiliation" .: D.validate notEmpty (D.text $ Just $ TL.toStrict $ u_affiliation user)
305
false
true
0
15
82
139
67
72
null
null
robertclancy/tapl
inference/src/Main.hs
gpl-2.0
evalString :: String -> String evalString input = either id id $ do term <- first show $ readTerm input ty <- first show $ infer term result <- first show $ evaluate term return $ showTermType result ty
224
evalString :: String -> String evalString input = either id id $ do term <- first show $ readTerm input ty <- first show $ infer term result <- first show $ evaluate term return $ showTermType result ty
224
evalString input = either id id $ do term <- first show $ readTerm input ty <- first show $ infer term result <- first show $ evaluate term return $ showTermType result ty
193
false
true
0
10
60
90
39
51
null
null
kmate/imperative-edsl
src/Language/Embedded/Concurrent/Backend/C.hs
bsd-3-clause
compChanCMD cmd@(WriteOne c (x :: exp a)) = do x' <- compExp x v :: Val a <- freshVar (proxyPred cmd) ok <- freshVar (proxyPred cmd) addStm [cstm| $id:v = $x'; |] addStm [cstm| $id:ok = chan_write($id:c, sizeof($id:v), &$id:v); |] return ok
268
compChanCMD cmd@(WriteOne c (x :: exp a)) = do x' <- compExp x v :: Val a <- freshVar (proxyPred cmd) ok <- freshVar (proxyPred cmd) addStm [cstm| $id:v = $x'; |] addStm [cstm| $id:ok = chan_write($id:c, sizeof($id:v), &$id:v); |] return ok
268
compChanCMD cmd@(WriteOne c (x :: exp a)) = do x' <- compExp x v :: Val a <- freshVar (proxyPred cmd) ok <- freshVar (proxyPred cmd) addStm [cstm| $id:v = $x'; |] addStm [cstm| $id:ok = chan_write($id:c, sizeof($id:v), &$id:v); |] return ok
268
false
false
0
11
69
105
50
55
null
null
green-haskell/ghc
testsuite/tests/th/TH_ppr1.hs
bsd-3-clause
f :: a f = undefined
20
f :: a f = undefined
20
f = undefined
13
false
true
0
6
5
18
7
11
null
null
anttisalonen/starrover2
src/Utils.hs
mit
while :: (Monad m) => m Bool -> m () -> m () while n m = do r <- n if r then m >> while n m else return ()
118
while :: (Monad m) => m Bool -> m () -> m () while n m = do r <- n if r then m >> while n m else return ()
118
while n m = do r <- n if r then m >> while n m else return ()
73
false
true
0
9
43
78
37
41
null
null