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
frantisekfarka/ghc-dsi
compiler/nativeGen/PPC/Instr.hs
bsd-3-clause
ppc_takeRegRegMoveInstr _ = Nothing
36
ppc_takeRegRegMoveInstr _ = Nothing
36
ppc_takeRegRegMoveInstr _ = Nothing
36
false
false
0
5
4
9
4
5
null
null
tgdavies/codeworld
codeworld-base/src/Internal/Text.hs
apache-2.0
fromString :: String -> Text fromString = T . J.pack
52
fromString :: String -> Text fromString = T . J.pack
52
fromString = T . J.pack
23
false
true
1
7
9
29
12
17
null
null
creswick/Newt
src/Newt/Outputs.hs
bsd-3-clause
writeTo StandardOut str = putStr str
39
writeTo StandardOut str = putStr str
39
writeTo StandardOut str = putStr str
39
false
false
0
5
8
14
6
8
null
null
ekalosak/haskell-practice
tictactoe/Tictactoe.hs
lgpl-3.0
-- main loop main = playGame initial_board
42
main = playGame initial_board
29
main = playGame initial_board
29
true
false
1
5
6
13
5
8
null
null
dysinger/amazonka
amazonka-codedeploy/gen/Network/AWS/CodeDeploy/RegisterApplicationRevision.hs
mpl-2.0
-- | Information about the application revision to register, including the -- revision's type and its location. rarRevision :: Lens' RegisterApplicationRevision RevisionLocation rarRevision = lens _rarRevision (\s a -> s { _rarRevision = a })
242
rarRevision :: Lens' RegisterApplicationRevision RevisionLocation rarRevision = lens _rarRevision (\s a -> s { _rarRevision = a })
130
rarRevision = lens _rarRevision (\s a -> s { _rarRevision = a })
64
true
true
0
9
34
41
23
18
null
null
infotroph/pandoc-crossref
lib/Text/Pandoc/CrossRef/Util/Meta.hs
gpl-2.0
getList _ x = Just x
20
getList _ x = Just x
20
getList _ x = Just x
20
false
false
0
5
5
14
6
8
null
null
mgrabmueller/waddle
Game/Waddle/Load.hs
bsd-3-clause
convertPicture :: ExtPicture -> [ExtPost] -> Picture convertPicture ExtPicture{..} extPosts = Picture {pictureWidth = fromIntegral extPictureWidth, pictureHeight = fromIntegral extPictureHeight, pictureLeftOffset = fromIntegral extPictureLeftOffset, pictureTopOffset = fromIntegral extPictureTopOffset, picturePosts = map convertPosts extPosts}
390
convertPicture :: ExtPicture -> [ExtPost] -> Picture convertPicture ExtPicture{..} extPosts = Picture {pictureWidth = fromIntegral extPictureWidth, pictureHeight = fromIntegral extPictureHeight, pictureLeftOffset = fromIntegral extPictureLeftOffset, pictureTopOffset = fromIntegral extPictureTopOffset, picturePosts = map convertPosts extPosts}
390
convertPicture ExtPicture{..} extPosts = Picture {pictureWidth = fromIntegral extPictureWidth, pictureHeight = fromIntegral extPictureHeight, pictureLeftOffset = fromIntegral extPictureLeftOffset, pictureTopOffset = fromIntegral extPictureTopOffset, picturePosts = map convertPosts extPosts}
337
false
true
0
7
78
82
44
38
null
null
iamkingmaker/HLearn
src/HLearn/Data/Graph.hs
bsd-3-clause
e = edgeList2UndirectedGraph 3 $ [(2,2),(1,1)]
46
e = edgeList2UndirectedGraph 3 $ [(2,2),(1,1)]
46
e = edgeList2UndirectedGraph 3 $ [(2,2),(1,1)]
46
false
false
1
8
5
35
18
17
null
null
sgillespie/ghc
compiler/codeGen/StgCmmPrim.hs
bsd-3-clause
translateOp dflags AddrAddOp = Just (mo_wordAdd dflags)
60
translateOp dflags AddrAddOp = Just (mo_wordAdd dflags)
60
translateOp dflags AddrAddOp = Just (mo_wordAdd dflags)
60
false
false
0
7
11
20
9
11
null
null
kisom/pkcs7
src/Crypto/Data/PKCS7.hs
mit
pad :: String -> String pad = padN 16
37
pad :: String -> String pad = padN 16
37
pad = padN 16
13
false
true
0
5
8
18
9
9
null
null
gnn/Hets
Common/Keywords.hs
gpl-2.0
-- * logic definition symbols newlogicS :: String newlogicS = "newlogic"
73
newlogicS :: String newlogicS = "newlogic"
42
newlogicS = "newlogic"
22
true
true
0
6
11
19
8
11
null
null
ahmadsalim/micro-dsl-properties
src/SystemT.hs
gpl-3.0
inferType ctxt (Snd tm) = do ty <- inferType ctxt tm case ty of (sg :*: tu) -> return tu _ -> Nothing
127
inferType ctxt (Snd tm) = do ty <- inferType ctxt tm case ty of (sg :*: tu) -> return tu _ -> Nothing
127
inferType ctxt (Snd tm) = do ty <- inferType ctxt tm case ty of (sg :*: tu) -> return tu _ -> Nothing
127
false
false
0
11
48
60
27
33
null
null
alexander-at-github/eta
compiler/ETA/Utils/JAR.hs
bsd-3-clause
getEntriesFromJar :: (MonadThrow m, MonadCatch m, MonadIO m) => FilePath -> m (AbsoluteFile, [EntrySelector]) getEntriesFromJar jarLocation = do p <- makeAbsoluteFilePath jarLocation fmap (p,) $ withArchive p $ keys <$> getEntries
240
getEntriesFromJar :: (MonadThrow m, MonadCatch m, MonadIO m) => FilePath -> m (AbsoluteFile, [EntrySelector]) getEntriesFromJar jarLocation = do p <- makeAbsoluteFilePath jarLocation fmap (p,) $ withArchive p $ keys <$> getEntries
240
getEntriesFromJar jarLocation = do p <- makeAbsoluteFilePath jarLocation fmap (p,) $ withArchive p $ keys <$> getEntries
124
false
true
0
11
40
91
44
47
null
null
bravit/Idris-dev
src/Idris/Elab/Record.hs
bsd-3-clause
-- | Creates a PArg with a given plicity, name, and term. asArg :: Plicity -> Name -> PTerm -> PArg asArg (Imp os _ _ _ _ _) n t = PImp 0 False os n t
150
asArg :: Plicity -> Name -> PTerm -> PArg asArg (Imp os _ _ _ _ _) n t = PImp 0 False os n t
92
asArg (Imp os _ _ _ _ _) n t = PImp 0 False os n t
50
true
true
0
7
37
58
29
29
null
null
yousufmsoliman/music
Source (Haskell)/main.hs
gpl-3.0
allAgents = GeneralSpecies.agents ++ FirstSpecies.agents
56
allAgents = GeneralSpecies.agents ++ FirstSpecies.agents
56
allAgents = GeneralSpecies.agents ++ FirstSpecies.agents
56
false
false
0
6
4
14
7
7
null
null
beala/twitter-bot
src/OAuth.hs
bsd-3-clause
twitterCredential :: AccessToken -> AccessSecret -> UserId -> ScreenName -> TwitterCredential twitterCredential token secret user_id screen_name = TwitterCredential $ Credential $ [ ("oauth_token", token) , ("oauth_token_secret", secret) , ("user_id", user_id) , ("screen_name", screen_name) , ("x_auth_expires", "0") ]
341
twitterCredential :: AccessToken -> AccessSecret -> UserId -> ScreenName -> TwitterCredential twitterCredential token secret user_id screen_name = TwitterCredential $ Credential $ [ ("oauth_token", token) , ("oauth_token_secret", secret) , ("user_id", user_id) , ("screen_name", screen_name) , ("x_auth_expires", "0") ]
341
twitterCredential token secret user_id screen_name = TwitterCredential $ Credential $ [ ("oauth_token", token) , ("oauth_token_secret", secret) , ("user_id", user_id) , ("screen_name", screen_name) , ("x_auth_expires", "0") ]
237
false
true
0
8
58
89
52
37
null
null
vesalvojdani/haskell-fm
ParseC.hs
gpl-2.0
test = do ast <- parseMyFile "test.c" (globals,warnings) <- (checkResult "[Analysis]" . runTrav_) (analyseAST ast) print . pretty $ globals
146
test = do ast <- parseMyFile "test.c" (globals,warnings) <- (checkResult "[Analysis]" . runTrav_) (analyseAST ast) print . pretty $ globals
146
test = do ast <- parseMyFile "test.c" (globals,warnings) <- (checkResult "[Analysis]" . runTrav_) (analyseAST ast) print . pretty $ globals
146
false
false
1
11
26
63
28
35
null
null
xfchen/Monud
src/AnsiParse.hs
bsd-3-clause
deAnsiText :: A.Parser Text deAnsiText = A.takeWhile1 (\x -> x /='\27' && x /= '\13')
86
deAnsiText :: A.Parser Text deAnsiText = A.takeWhile1 (\x -> x /='\27' && x /= '\13')
86
deAnsiText = A.takeWhile1 (\x -> x /='\27' && x /= '\13')
58
false
true
0
10
15
47
22
25
null
null
bravit/Idris-dev
src/Idris/Error.hs
bsd-3-clause
getErrSpan :: Err -> FC getErrSpan (At fc _) = fc
49
getErrSpan :: Err -> FC getErrSpan (At fc _) = fc
49
getErrSpan (At fc _) = fc
25
false
true
0
9
10
32
14
18
null
null
GaloisInc/SHA
src/Data/Digest/Pure/SHA.hs
bsd-3-clause
sha1 :: ByteString -> Digest SHA1State sha1 bs_in = Digest bs_out where bs_pad = padSHA1 bs_in fstate = runSHA initialSHA1State processSHA1Block bs_pad bs_out = runPut $! synthesizeSHA1 fstate -- |Similar to `sha1` but use an incremental interface. When the decoder has -- been completely fed, `completeSha1Incremental` must be used so it can -- finish successfully.
374
sha1 :: ByteString -> Digest SHA1State sha1 bs_in = Digest bs_out where bs_pad = padSHA1 bs_in fstate = runSHA initialSHA1State processSHA1Block bs_pad bs_out = runPut $! synthesizeSHA1 fstate -- |Similar to `sha1` but use an incremental interface. When the decoder has -- been completely fed, `completeSha1Incremental` must be used so it can -- finish successfully.
374
sha1 bs_in = Digest bs_out where bs_pad = padSHA1 bs_in fstate = runSHA initialSHA1State processSHA1Block bs_pad bs_out = runPut $! synthesizeSHA1 fstate -- |Similar to `sha1` but use an incremental interface. When the decoder has -- been completely fed, `completeSha1Incremental` must be used so it can -- finish successfully.
335
false
true
4
7
62
73
32
41
null
null
dylanmc/cryptol
sbv/Data/SBV/Tools/Polynomial.hs
bsd-3-clause
addPoly (x:xs) (y:ys) = x <+> y : addPoly xs ys
47
addPoly (x:xs) (y:ys) = x <+> y : addPoly xs ys
47
addPoly (x:xs) (y:ys) = x <+> y : addPoly xs ys
47
false
false
0
7
10
38
19
19
null
null
fpco/fay
src/Fay/Compiler/Desugar.hs
bsd-3-clause
checkEnum :: (Data l, Typeable l) => Module l -> Desugar l () checkEnum = mapM_ f . universeBi where f ex = case ex of e@(EnumFrom _ e1) -> checkIntOrUnknown e [e1] e@(EnumFromTo _ e1 e2) -> checkIntOrUnknown e [e1,e2] e@(EnumFromThen _ e1 e2) -> checkIntOrUnknown e [e1,e2] e@(EnumFromThenTo _ e1 e2 e3) -> checkIntOrUnknown e [e1,e2,e3] _ -> return () checkIntOrUnknown :: Exp l -> [Exp l] -> Desugar l () checkIntOrUnknown exp es = unless (any isIntOrUnknown es) (throwError . UnsupportedEnum $ unAnn exp) isIntOrUnknown :: Exp l -> Bool isIntOrUnknown e = case e of Con {} -> False Lit _ Int{} -> True Lit {} -> False Tuple {} -> False List {} -> False EnumFrom {} -> False EnumFromTo {} -> False EnumFromThen {} -> False EnumFromThenTo {} -> False _ -> True -- | Adds an explicit import Prelude statement when appropriate.
1,040
checkEnum :: (Data l, Typeable l) => Module l -> Desugar l () checkEnum = mapM_ f . universeBi where f ex = case ex of e@(EnumFrom _ e1) -> checkIntOrUnknown e [e1] e@(EnumFromTo _ e1 e2) -> checkIntOrUnknown e [e1,e2] e@(EnumFromThen _ e1 e2) -> checkIntOrUnknown e [e1,e2] e@(EnumFromThenTo _ e1 e2 e3) -> checkIntOrUnknown e [e1,e2,e3] _ -> return () checkIntOrUnknown :: Exp l -> [Exp l] -> Desugar l () checkIntOrUnknown exp es = unless (any isIntOrUnknown es) (throwError . UnsupportedEnum $ unAnn exp) isIntOrUnknown :: Exp l -> Bool isIntOrUnknown e = case e of Con {} -> False Lit _ Int{} -> True Lit {} -> False Tuple {} -> False List {} -> False EnumFrom {} -> False EnumFromTo {} -> False EnumFromThen {} -> False EnumFromThenTo {} -> False _ -> True -- | Adds an explicit import Prelude statement when appropriate.
1,040
checkEnum = mapM_ f . universeBi where f ex = case ex of e@(EnumFrom _ e1) -> checkIntOrUnknown e [e1] e@(EnumFromTo _ e1 e2) -> checkIntOrUnknown e [e1,e2] e@(EnumFromThen _ e1 e2) -> checkIntOrUnknown e [e1,e2] e@(EnumFromThenTo _ e1 e2 e3) -> checkIntOrUnknown e [e1,e2,e3] _ -> return () checkIntOrUnknown :: Exp l -> [Exp l] -> Desugar l () checkIntOrUnknown exp es = unless (any isIntOrUnknown es) (throwError . UnsupportedEnum $ unAnn exp) isIntOrUnknown :: Exp l -> Bool isIntOrUnknown e = case e of Con {} -> False Lit _ Int{} -> True Lit {} -> False Tuple {} -> False List {} -> False EnumFrom {} -> False EnumFromTo {} -> False EnumFromThen {} -> False EnumFromThenTo {} -> False _ -> True -- | Adds an explicit import Prelude statement when appropriate.
978
false
true
2
10
361
404
197
207
null
null
fhaust/aer-utils
src/OlshausenOnStreams.hs
mit
doTheTimeWarpAgain :: (Floating a, Ord a) => Events a -> [Events a] -> [Event a] -> [Event a] doTheTimeWarpAgain patch φs = go . doTheTimeWarp patch φs where go (a:b:xs) | errDiff a b < 0.01 = b | otherwise = go (b:xs) go _ = error "shouldn't happen" errFun = errorFunction patch φs errDiff a b = abs (errFun a - errFun b) {--- | calculate as per patch, outer list is per patch, inner is as -} {-fitAs :: MonadRandom m-} {- => [Patch Float] -> [Phi Float] -> m [[Event Float]]-} {-fitAs patches φs = mapM (\patch -> fitSingleAs patch φs) patches-} {-fitSingleAs ::-} {- (Floating a, Ord a, Random a, MonadRandom m) =>-} {- Events a -> [Events a] -> [a] -> m [Event a]-} {-fitSingleAs patch φs as = do-} {- -- do gradient descent to find "perfect" as for this patch-} {- return $ doTheTimeWarpAgain patch φs as-} -- | calculate the "vector" along which the phi has to be pushed to get -- closer to the patch
1,009
doTheTimeWarpAgain :: (Floating a, Ord a) => Events a -> [Events a] -> [Event a] -> [Event a] doTheTimeWarpAgain patch φs = go . doTheTimeWarp patch φs where go (a:b:xs) | errDiff a b < 0.01 = b | otherwise = go (b:xs) go _ = error "shouldn't happen" errFun = errorFunction patch φs errDiff a b = abs (errFun a - errFun b) {--- | calculate as per patch, outer list is per patch, inner is as -} {-fitAs :: MonadRandom m-} {- => [Patch Float] -> [Phi Float] -> m [[Event Float]]-} {-fitAs patches φs = mapM (\patch -> fitSingleAs patch φs) patches-} {-fitSingleAs ::-} {- (Floating a, Ord a, Random a, MonadRandom m) =>-} {- Events a -> [Events a] -> [a] -> m [Event a]-} {-fitSingleAs patch φs as = do-} {- -- do gradient descent to find "perfect" as for this patch-} {- return $ doTheTimeWarpAgain patch φs as-} -- | calculate the "vector" along which the phi has to be pushed to get -- closer to the patch
1,009
doTheTimeWarpAgain patch φs = go . doTheTimeWarp patch φs where go (a:b:xs) | errDiff a b < 0.01 = b | otherwise = go (b:xs) go _ = error "shouldn't happen" errFun = errorFunction patch φs errDiff a b = abs (errFun a - errFun b) {--- | calculate as per patch, outer list is per patch, inner is as -} {-fitAs :: MonadRandom m-} {- => [Patch Float] -> [Phi Float] -> m [[Event Float]]-} {-fitAs patches φs = mapM (\patch -> fitSingleAs patch φs) patches-} {-fitSingleAs ::-} {- (Floating a, Ord a, Random a, MonadRandom m) =>-} {- Events a -> [Events a] -> [a] -> m [Event a]-} {-fitSingleAs patch φs as = do-} {- -- do gradient descent to find "perfect" as for this patch-} {- return $ doTheTimeWarpAgain patch φs as-} -- | calculate the "vector" along which the phi has to be pushed to get -- closer to the patch
895
false
true
3
10
276
185
96
89
null
null
sdiehl/ghc
compiler/typecheck/TcType.hs
bsd-3-clause
mkTyVarNamePairs :: [TyVar] -> [(Name,TyVar)] -- Just pair each TyVar with its own name mkTyVarNamePairs tvs = [(tyVarName tv, tv) | tv <- tvs]
143
mkTyVarNamePairs :: [TyVar] -> [(Name,TyVar)] mkTyVarNamePairs tvs = [(tyVarName tv, tv) | tv <- tvs]
101
mkTyVarNamePairs tvs = [(tyVarName tv, tv) | tv <- tvs]
55
true
true
0
7
23
51
29
22
null
null
GaloisInc/halvm-ghc
compiler/prelude/PrelNames.hs
bsd-3-clause
negateIntegerIdKey = mkPreludeMiscIdUnique 69
56
negateIntegerIdKey = mkPreludeMiscIdUnique 69
56
negateIntegerIdKey = mkPreludeMiscIdUnique 69
56
false
false
0
5
14
9
4
5
null
null
Teaspot-Studio/Urho3D-Haskell
src/Graphics/Urho3D/Graphics/StaticModel.hs
mit
staticModelSetOcclusionLodLevel :: (Parent StaticModel a, Pointer p a, MonadIO m) => p -- ^ Pointer to static model -> Word -- ^ level -> m () staticModelSetOcclusionLodLevel p i = liftIO $ do let ptr = parentPointer p wi = fromIntegral i [C.exp| void { $(StaticModel* ptr)->SetOcclusionLodLevel($(unsigned int wi)) } |] -- | Apply default materials from a material list file. If filename is empty (default), the model's resource name with extension .txt will be used.
485
staticModelSetOcclusionLodLevel :: (Parent StaticModel a, Pointer p a, MonadIO m) => p -- ^ Pointer to static model -> Word -- ^ level -> m () staticModelSetOcclusionLodLevel p i = liftIO $ do let ptr = parentPointer p wi = fromIntegral i [C.exp| void { $(StaticModel* ptr)->SetOcclusionLodLevel($(unsigned int wi)) } |] -- | Apply default materials from a material list file. If filename is empty (default), the model's resource name with extension .txt will be used.
485
staticModelSetOcclusionLodLevel p i = liftIO $ do let ptr = parentPointer p wi = fromIntegral i [C.exp| void { $(StaticModel* ptr)->SetOcclusionLodLevel($(unsigned int wi)) } |] -- | Apply default materials from a material list file. If filename is empty (default), the model's resource name with extension .txt will be used.
336
false
true
0
11
92
91
47
44
null
null
research-team/robot-dream
src/Driver/Interpreter_v2.hs
mit
workTime False dist power (Humanoid (HumanoidConfig s t _)) = let mult = dist/s in round . (*mult) $ t
102
workTime False dist power (Humanoid (HumanoidConfig s t _)) = let mult = dist/s in round . (*mult) $ t
102
workTime False dist power (Humanoid (HumanoidConfig s t _)) = let mult = dist/s in round . (*mult) $ t
102
false
false
0
9
19
58
29
29
null
null
ezyang/ghc
compiler/simplCore/FloatIn.hs
bsd-3-clause
floatIsCase (FloatLet {}) = False
34
floatIsCase (FloatLet {}) = False
34
floatIsCase (FloatLet {}) = False
34
false
false
0
7
5
16
8
8
null
null
daleooo/barrelfish
tools/mackerel/TypeName.hs
mit
null :: Name null = Name "" ""
30
null :: Name null = Name "" ""
30
null = Name "" ""
17
false
true
0
5
7
16
8
8
null
null
blax/icfp-contest-2015
src/Simulation.hs
mit
checkBounds :: Cell -> Int -> Int -> Bool checkBounds cell width height = (x >= 0) && (x < width) && (y >= 0) && (y < height) where (x,y) = unskewedCoords cell -- hexagonal coordinate system is very convinient -- but it has one downside – x coordinates are skewed -- so we need to normalize before checking vs bounds
327
checkBounds :: Cell -> Int -> Int -> Bool checkBounds cell width height = (x >= 0) && (x < width) && (y >= 0) && (y < height) where (x,y) = unskewedCoords cell -- hexagonal coordinate system is very convinient -- but it has one downside – x coordinates are skewed -- so we need to normalize before checking vs bounds
327
checkBounds cell width height = (x >= 0) && (x < width) && (y >= 0) && (y < height) where (x,y) = unskewedCoords cell -- hexagonal coordinate system is very convinient -- but it has one downside – x coordinates are skewed -- so we need to normalize before checking vs bounds
285
false
true
0
9
72
91
49
42
null
null
spechub/Hets
CSL/Keywords.hs
gpl-2.0
trintS :: String trintS = "trint"
33
trintS :: String trintS = "trint"
33
trintS = "trint"
16
false
true
0
6
5
18
7
11
null
null
isaiah/cis194
src/Ch07.hs
mit
-- Exercise 1 (+++) :: Monoid m => JoinList m a -> JoinList m a -> JoinList m a (+++) jl jl' = Append (mappend (tag jl) (tag jl')) jl jl'
137
(+++) :: Monoid m => JoinList m a -> JoinList m a -> JoinList m a (+++) jl jl' = Append (mappend (tag jl) (tag jl')) jl jl'
123
(+++) jl jl' = Append (mappend (tag jl) (tag jl')) jl jl'
57
true
true
0
9
30
78
39
39
null
null
diogob/postgrest
src/PostgREST/QueryBuilder.hs
mit
pgFmtAs _ _ (Just alias) = " AS " <> pgFmtIdent alias
53
pgFmtAs _ _ (Just alias) = " AS " <> pgFmtIdent alias
53
pgFmtAs _ _ (Just alias) = " AS " <> pgFmtIdent alias
53
false
false
1
6
11
26
11
15
null
null
Proclivis/wxHaskell
wxcore/src/haskell/Graphics/UI/WXCore/WxcDefs.hs
lgpl-2.1
wxSTC_KEY_PRIOR :: Int wxSTC_KEY_PRIOR = 306
44
wxSTC_KEY_PRIOR :: Int wxSTC_KEY_PRIOR = 306
44
wxSTC_KEY_PRIOR = 306
21
false
true
0
4
5
11
6
5
null
null
HIPERFIT/hopencl
tests/unit/HOpenCL/Device_Test.hs
bsd-3-clause
test_deviceAvailable = void . deviceAvailable
45
test_deviceAvailable = void . deviceAvailable
45
test_deviceAvailable = void . deviceAvailable
45
false
false
0
5
4
10
5
5
null
null
ipuustin/propositional-planning
tests/Bench.hs
bsd-3-clause
main = defaultMain [ bench "flashlight problem (using incremental-sat-solver)" $ nf (runSat flprob) 10, bench "block world problem 2 (using incremental-sat-solver)" $ nf (runSat bwprob2) 10, bench "block world problem 3 (using incremental-sat-solver)" $ nf (runSat bwprob3) 10, bench "flashlight problem (using toysolver)" $ nfIO $ runSat' flprob 10, bench "block world problem 1 (using toysolver)" $ nfIO $ runSat' bwprob1 10, bench "block world problem 2 (using toysolver)" $ nfIO $ runSat' bwprob2 10, bench "block world problem 3 (using toysolver)" $ nfIO $ runSat' bwprob3 10 ]
642
main = defaultMain [ bench "flashlight problem (using incremental-sat-solver)" $ nf (runSat flprob) 10, bench "block world problem 2 (using incremental-sat-solver)" $ nf (runSat bwprob2) 10, bench "block world problem 3 (using incremental-sat-solver)" $ nf (runSat bwprob3) 10, bench "flashlight problem (using toysolver)" $ nfIO $ runSat' flprob 10, bench "block world problem 1 (using toysolver)" $ nfIO $ runSat' bwprob1 10, bench "block world problem 2 (using toysolver)" $ nfIO $ runSat' bwprob2 10, bench "block world problem 3 (using toysolver)" $ nfIO $ runSat' bwprob3 10 ]
642
main = defaultMain [ bench "flashlight problem (using incremental-sat-solver)" $ nf (runSat flprob) 10, bench "block world problem 2 (using incremental-sat-solver)" $ nf (runSat bwprob2) 10, bench "block world problem 3 (using incremental-sat-solver)" $ nf (runSat bwprob3) 10, bench "flashlight problem (using toysolver)" $ nfIO $ runSat' flprob 10, bench "block world problem 1 (using toysolver)" $ nfIO $ runSat' bwprob1 10, bench "block world problem 2 (using toysolver)" $ nfIO $ runSat' bwprob2 10, bench "block world problem 3 (using toysolver)" $ nfIO $ runSat' bwprob3 10 ]
642
false
false
0
10
148
148
70
78
null
null
meiersi/blaze-binary
src/Codec/MsgPack.hs
bsd-3-clause
hexWord8 :: Word8 -> String hexWord8 w = pad (showHex w "") where pad cs = replicate (2 - length cs) '0' ++ cs ------------------------------------------------------------------------ -- Simple instances -- wrongTag :: Show a => String -> a -> D.Decoder b -- wrongTag loc tag = fail $ "decode " ++ loc ++ ": could not parse tag " ++ show tag -- The () type need never be written to disk: values of singleton type -- can be reconstructed from the type alone
465
hexWord8 :: Word8 -> String hexWord8 w = pad (showHex w "") where pad cs = replicate (2 - length cs) '0' ++ cs ------------------------------------------------------------------------ -- Simple instances -- wrongTag :: Show a => String -> a -> D.Decoder b -- wrongTag loc tag = fail $ "decode " ++ loc ++ ": could not parse tag " ++ show tag -- The () type need never be written to disk: values of singleton type -- can be reconstructed from the type alone
465
hexWord8 w = pad (showHex w "") where pad cs = replicate (2 - length cs) '0' ++ cs ------------------------------------------------------------------------ -- Simple instances -- wrongTag :: Show a => String -> a -> D.Decoder b -- wrongTag loc tag = fail $ "decode " ++ loc ++ ": could not parse tag " ++ show tag -- The () type need never be written to disk: values of singleton type -- can be reconstructed from the type alone
437
false
true
0
9
91
65
34
31
null
null
plumlife/cabal
cabal-install/Distribution/Client/PackageIndex.hs
bsd-3-clause
-- | Does a lookup by package id (name & version). -- -- Since multiple package DBs mask each other case-sensitively by package name, -- then we get back at most one package. -- lookupPackageId :: Package pkg => PackageIndex pkg -> PackageIdentifier -> Maybe pkg lookupPackageId index pkgid = case [ pkg | pkg <- lookup index (packageName pkgid) , packageId pkg == pkgid ] of [] -> Nothing [pkg] -> Just pkg _ -> internalError "lookupPackageIdentifier" -- | Does a case-sensitive search by package name. --
541
lookupPackageId :: Package pkg => PackageIndex pkg -> PackageIdentifier -> Maybe pkg lookupPackageId index pkgid = case [ pkg | pkg <- lookup index (packageName pkgid) , packageId pkg == pkgid ] of [] -> Nothing [pkg] -> Just pkg _ -> internalError "lookupPackageIdentifier" -- | Does a case-sensitive search by package name. --
363
lookupPackageId index pkgid = case [ pkg | pkg <- lookup index (packageName pkgid) , packageId pkg == pkgid ] of [] -> Nothing [pkg] -> Just pkg _ -> internalError "lookupPackageIdentifier" -- | Does a case-sensitive search by package name. --
278
true
true
0
11
122
110
56
54
null
null
ekmett/ghc
ghc/Main.hs
bsd-3-clause
ghciUI _ _ = throwGhcException (CmdLineError "not built for interactive use")
77
ghciUI _ _ = throwGhcException (CmdLineError "not built for interactive use")
77
ghciUI _ _ = throwGhcException (CmdLineError "not built for interactive use")
77
false
false
0
7
10
20
9
11
null
null
Frefreak/hnem
src/Player.hs
bsd-3-clause
appendMusicFile :: FilePath -> MVar MpObject -> IO () appendMusicFile fp = sendCommand ("loadlist " ++ fp ++ " 1")
114
appendMusicFile :: FilePath -> MVar MpObject -> IO () appendMusicFile fp = sendCommand ("loadlist " ++ fp ++ " 1")
114
appendMusicFile fp = sendCommand ("loadlist " ++ fp ++ " 1")
60
false
true
0
9
19
48
22
26
null
null
ctlab/gShell
src/Gshell/State.hs
mit
workingState :: Applicative f => FileName -> (String -> f String) -> GState -> f GState workingState name = gshellRoot.traverse.filteredByName name._contents.traverse.filteredByName workHelperFileName._file
239
workingState :: Applicative f => FileName -> (String -> f String) -> GState -> f GState workingState name = gshellRoot.traverse.filteredByName name._contents.traverse.filteredByName workHelperFileName._file
239
workingState name = gshellRoot.traverse.filteredByName name._contents.traverse.filteredByName workHelperFileName._file
118
false
true
0
11
54
67
31
36
null
null
valderman/lambnyaa
Network/LambNyaa/Log/IO.hs
bsd-3-clause
level :: IORef LogLevel level = unsafePerformIO $ newIORef Info
63
level :: IORef LogLevel level = unsafePerformIO $ newIORef Info
63
level = unsafePerformIO $ newIORef Info
39
false
true
2
6
9
28
11
17
null
null
Melvar/Idris-dev
src/Idris/AbsSyntaxTree.hs
bsd-3-clause
inferOpts = []
14
inferOpts = []
14
inferOpts = []
14
false
false
1
6
2
12
4
8
null
null
dmjio/stripe
stripe-tests/tests/Web/Stripe/Test/Customer.hs
mit
customerTests :: StripeSpec customerTests stripe = describe "Customer tests" $ do it "Creates an empty customer" $ do result <- stripe $ do c@Customer{..} <- createCustomer _ <- deleteCustomer customerId return c result `shouldSatisfy` isRight it "Deletes a customer" $ do result <- stripe $ do c@Customer{..} <- createCustomer _ <- deleteCustomer customerId return c result `shouldSatisfy` isRight it "Gets a customer" $ do result <- stripe $ do Customer { customerId = cid } <- createCustomer customer <- getCustomer cid _ <- deleteCustomer cid return customer result `shouldSatisfy` isRight it "Gets a customer expandable" $ do result <- stripe $ do Customer { customerId = cid } <- createCustomer customer <- getCustomer cid -&- ExpandParams ["default_card"] _ <- deleteCustomer cid return customer result `shouldSatisfy` isRight it "Gets customers" $ do result <- stripe $ void $ getCustomers -&- Limit 100 result `shouldSatisfy` isRight it "Gets customers expandable" $ do result <- stripe $ void $ getCustomers -&- ExpandParams ["data.default_card"] result `shouldSatisfy` isRight it "Updates a customer" $ do result <- stripe $ do Customer { customerId = cid } <- createCustomer customer <- updateCustomer cid -&- bal -&- desc -&- email -&- meta _ <- deleteCustomer cid return customer result `shouldSatisfy` isRight let Right Customer{..} = result (AccountBalance customerAccountBalance) `shouldBe` bal customerDescription `shouldBe` (Just desc) customerEmail `shouldBe` (Just email) customerMetaData `shouldBe` meta where bal = AccountBalance 100 desc = Description "hey" email = Email "djohnson.m@gmail.com" meta = MetaData [("hey","there")]
2,067
customerTests :: StripeSpec customerTests stripe = describe "Customer tests" $ do it "Creates an empty customer" $ do result <- stripe $ do c@Customer{..} <- createCustomer _ <- deleteCustomer customerId return c result `shouldSatisfy` isRight it "Deletes a customer" $ do result <- stripe $ do c@Customer{..} <- createCustomer _ <- deleteCustomer customerId return c result `shouldSatisfy` isRight it "Gets a customer" $ do result <- stripe $ do Customer { customerId = cid } <- createCustomer customer <- getCustomer cid _ <- deleteCustomer cid return customer result `shouldSatisfy` isRight it "Gets a customer expandable" $ do result <- stripe $ do Customer { customerId = cid } <- createCustomer customer <- getCustomer cid -&- ExpandParams ["default_card"] _ <- deleteCustomer cid return customer result `shouldSatisfy` isRight it "Gets customers" $ do result <- stripe $ void $ getCustomers -&- Limit 100 result `shouldSatisfy` isRight it "Gets customers expandable" $ do result <- stripe $ void $ getCustomers -&- ExpandParams ["data.default_card"] result `shouldSatisfy` isRight it "Updates a customer" $ do result <- stripe $ do Customer { customerId = cid } <- createCustomer customer <- updateCustomer cid -&- bal -&- desc -&- email -&- meta _ <- deleteCustomer cid return customer result `shouldSatisfy` isRight let Right Customer{..} = result (AccountBalance customerAccountBalance) `shouldBe` bal customerDescription `shouldBe` (Just desc) customerEmail `shouldBe` (Just email) customerMetaData `shouldBe` meta where bal = AccountBalance 100 desc = Description "hey" email = Email "djohnson.m@gmail.com" meta = MetaData [("hey","there")]
2,067
customerTests stripe = describe "Customer tests" $ do it "Creates an empty customer" $ do result <- stripe $ do c@Customer{..} <- createCustomer _ <- deleteCustomer customerId return c result `shouldSatisfy` isRight it "Deletes a customer" $ do result <- stripe $ do c@Customer{..} <- createCustomer _ <- deleteCustomer customerId return c result `shouldSatisfy` isRight it "Gets a customer" $ do result <- stripe $ do Customer { customerId = cid } <- createCustomer customer <- getCustomer cid _ <- deleteCustomer cid return customer result `shouldSatisfy` isRight it "Gets a customer expandable" $ do result <- stripe $ do Customer { customerId = cid } <- createCustomer customer <- getCustomer cid -&- ExpandParams ["default_card"] _ <- deleteCustomer cid return customer result `shouldSatisfy` isRight it "Gets customers" $ do result <- stripe $ void $ getCustomers -&- Limit 100 result `shouldSatisfy` isRight it "Gets customers expandable" $ do result <- stripe $ void $ getCustomers -&- ExpandParams ["data.default_card"] result `shouldSatisfy` isRight it "Updates a customer" $ do result <- stripe $ do Customer { customerId = cid } <- createCustomer customer <- updateCustomer cid -&- bal -&- desc -&- email -&- meta _ <- deleteCustomer cid return customer result `shouldSatisfy` isRight let Right Customer{..} = result (AccountBalance customerAccountBalance) `shouldBe` bal customerDescription `shouldBe` (Just desc) customerEmail `shouldBe` (Just email) customerMetaData `shouldBe` meta where bal = AccountBalance 100 desc = Description "hey" email = Email "djohnson.m@gmail.com" meta = MetaData [("hey","there")]
2,039
false
true
0
20
654
589
275
314
null
null
oldmanmike/ghc
libraries/base/GHC/Real.hs
bsd-3-clause
(^^%^^) :: Integral a => Rational -> a -> Rational (n :% d) ^^%^^ e | e > 0 = (n ^ e) :% (d ^ e) | e == 0 = 1 :% 1 | n > 0 = (d ^ (negate e)) :% (n ^ (negate e)) | n == 0 = ratioZeroDenominatorError | otherwise = let nn = d ^ (negate e) dd = (negate n) ^ (negate e) in if even e then (nn :% dd) else (negate nn :% dd)
399
(^^%^^) :: Integral a => Rational -> a -> Rational (n :% d) ^^%^^ e | e > 0 = (n ^ e) :% (d ^ e) | e == 0 = 1 :% 1 | n > 0 = (d ^ (negate e)) :% (n ^ (negate e)) | n == 0 = ratioZeroDenominatorError | otherwise = let nn = d ^ (negate e) dd = (negate n) ^ (negate e) in if even e then (nn :% dd) else (negate nn :% dd)
399
(n :% d) ^^%^^ e | e > 0 = (n ^ e) :% (d ^ e) | e == 0 = 1 :% 1 | n > 0 = (d ^ (negate e)) :% (n ^ (negate e)) | n == 0 = ratioZeroDenominatorError | otherwise = let nn = d ^ (negate e) dd = (negate n) ^ (negate e) in if even e then (nn :% dd) else (negate nn :% dd)
340
false
true
4
11
166
220
111
109
null
null
Russell91/pyfi
Python.hs
mit
defOOV :: (FromJSON b) => String -> (PyObject a1) -> (PyObject a2) -> IO b defOOV s x1 x2 = do fr <- def3 s "OOV" x1 x2 b <- fromPyObject fr return b
161
defOOV :: (FromJSON b) => String -> (PyObject a1) -> (PyObject a2) -> IO b defOOV s x1 x2 = do fr <- def3 s "OOV" x1 x2 b <- fromPyObject fr return b
161
defOOV s x1 x2 = do fr <- def3 s "OOV" x1 x2 b <- fromPyObject fr return b
86
false
true
0
10
45
86
40
46
null
null
DATx02-16-14/Hastings
test/Server/ChatTest.hs
bsd-3-clause
prop_sendChatMessage :: Int -> Int -> [String] -> [ClientEntry] -> Property prop_sendChatMessage randomClientIndex randomChatIndex chatNameList clientList = monadicIO $ do pre $ not $ null chatNameList pre $ not $ null clientList let randomClientIndex' = abs $ randomClientIndex `mod` length chatNameList let randomChatIndex' = abs $ randomChatIndex `mod` length clientList -- pick a subset of the clients let (clientHead, clients) = splitAt randomChatIndex' clientList cLobbyChan <- run newChan cGameChan <- run newChan let c = ClientEntry 123456654321 "Sending client" [] cLobbyChan cGameChan chatList <- run $ makeChatsOfStrings $ makeUnique chatNameList let chat@(chatName, chatChan) = chatList !! randomClientIndex' mVarChats <- run $ newMVar chatList -- Add the chat to the clients before creating MVar clientsWithChat <- run $ mapM (\cl -> do dChan <- dupChan chatChan let newChat = (chatName, dChan) return $ cl {chats = newChat : chats cl}) (c:clients) mVarClients <- run $ newMVar $ clientHead ++ clientsWithChat -- send message to all let message = ChatMessage (name c) "prop" run $ Server.Chat.sendChatMessage mVarClients mVarChats (sessionID c) chatName message newClients <- run $ readMVar mVarClients let (_, newClientTail) = splitAt randomChatIndex' newClients -- collect all received messages messages <- run $ mapM (\cl -> case lookup chatName $ chats cl of Nothing -> return $ ChatError "Channel not found" Just chan -> readChan chan) newClientTail -- make sure the messages are the same assert $ all (msgProp "prop") messages where msgProp msg (ChatMessage _ msgContent) = msgContent == msg msgProp _ _ = False makeUnique list = [ name ++ show x | (x, name) <- zip [1..] list ]
1,828
prop_sendChatMessage :: Int -> Int -> [String] -> [ClientEntry] -> Property prop_sendChatMessage randomClientIndex randomChatIndex chatNameList clientList = monadicIO $ do pre $ not $ null chatNameList pre $ not $ null clientList let randomClientIndex' = abs $ randomClientIndex `mod` length chatNameList let randomChatIndex' = abs $ randomChatIndex `mod` length clientList -- pick a subset of the clients let (clientHead, clients) = splitAt randomChatIndex' clientList cLobbyChan <- run newChan cGameChan <- run newChan let c = ClientEntry 123456654321 "Sending client" [] cLobbyChan cGameChan chatList <- run $ makeChatsOfStrings $ makeUnique chatNameList let chat@(chatName, chatChan) = chatList !! randomClientIndex' mVarChats <- run $ newMVar chatList -- Add the chat to the clients before creating MVar clientsWithChat <- run $ mapM (\cl -> do dChan <- dupChan chatChan let newChat = (chatName, dChan) return $ cl {chats = newChat : chats cl}) (c:clients) mVarClients <- run $ newMVar $ clientHead ++ clientsWithChat -- send message to all let message = ChatMessage (name c) "prop" run $ Server.Chat.sendChatMessage mVarClients mVarChats (sessionID c) chatName message newClients <- run $ readMVar mVarClients let (_, newClientTail) = splitAt randomChatIndex' newClients -- collect all received messages messages <- run $ mapM (\cl -> case lookup chatName $ chats cl of Nothing -> return $ ChatError "Channel not found" Just chan -> readChan chan) newClientTail -- make sure the messages are the same assert $ all (msgProp "prop") messages where msgProp msg (ChatMessage _ msgContent) = msgContent == msg msgProp _ _ = False makeUnique list = [ name ++ show x | (x, name) <- zip [1..] list ]
1,828
prop_sendChatMessage randomClientIndex randomChatIndex chatNameList clientList = monadicIO $ do pre $ not $ null chatNameList pre $ not $ null clientList let randomClientIndex' = abs $ randomClientIndex `mod` length chatNameList let randomChatIndex' = abs $ randomChatIndex `mod` length clientList -- pick a subset of the clients let (clientHead, clients) = splitAt randomChatIndex' clientList cLobbyChan <- run newChan cGameChan <- run newChan let c = ClientEntry 123456654321 "Sending client" [] cLobbyChan cGameChan chatList <- run $ makeChatsOfStrings $ makeUnique chatNameList let chat@(chatName, chatChan) = chatList !! randomClientIndex' mVarChats <- run $ newMVar chatList -- Add the chat to the clients before creating MVar clientsWithChat <- run $ mapM (\cl -> do dChan <- dupChan chatChan let newChat = (chatName, dChan) return $ cl {chats = newChat : chats cl}) (c:clients) mVarClients <- run $ newMVar $ clientHead ++ clientsWithChat -- send message to all let message = ChatMessage (name c) "prop" run $ Server.Chat.sendChatMessage mVarClients mVarChats (sessionID c) chatName message newClients <- run $ readMVar mVarClients let (_, newClientTail) = splitAt randomChatIndex' newClients -- collect all received messages messages <- run $ mapM (\cl -> case lookup chatName $ chats cl of Nothing -> return $ ChatError "Channel not found" Just chan -> readChan chan) newClientTail -- make sure the messages are the same assert $ all (msgProp "prop") messages where msgProp msg (ChatMessage _ msgContent) = msgContent == msg msgProp _ _ = False makeUnique list = [ name ++ show x | (x, name) <- zip [1..] list ]
1,752
false
true
0
19
391
576
278
298
null
null
kawamuray/ganeti
src/Ganeti/HTools/Node.hs
gpl-2.0
-- | Computes the maximum reserved memory for peers from a peer map. computeMaxRes :: P.PeerMap -> P.Elem computeMaxRes = P.maxElem
131
computeMaxRes :: P.PeerMap -> P.Elem computeMaxRes = P.maxElem
62
computeMaxRes = P.maxElem
25
true
true
0
6
20
22
12
10
null
null
TomMD/ghc
compiler/hsSyn/HsDecls.hs
bsd-3-clause
-- Dealing with names tyFamInstDeclName :: TyFamInstDecl name -> name tyFamInstDeclName = unLoc . tyFamInstDeclLName
117
tyFamInstDeclName :: TyFamInstDecl name -> name tyFamInstDeclName = unLoc . tyFamInstDeclLName
94
tyFamInstDeclName = unLoc . tyFamInstDeclLName
46
true
true
0
7
15
30
13
17
null
null
kandersen/tic-tac-toe
src/Main.hs
mit
root :: Rose a -> a root (a :> _) = a
37
root :: Rose a -> a root (a :> _) = a
37
root (a :> _) = a
17
false
true
0
9
11
34
15
19
null
null
literate-unitb/literate-unitb
app/Continuous.hs
mit
check_theory :: (MonadIO m, MonadState Params m) => (String,Theory) -> m (Int,String) check_theory (name,th) = do param <- get let old_po = M.findWithDefault M.empty (label name) $ _pos param po = either (assertFalse' "check_theory") id $ theory_po th new_po = po `M.difference` old_po ch_po = po `M.intersection` old_po ch = M.filterWithKey (\k x -> snd (old_po ! k) /= x) ch_po all_po = new_po `M.union` ch -- handle :: ErrorCall -> IO (Map Label Bool) -- revise: do not return empty handle (SomeException e) = do putStrLn "> error" print (typeOf e) print e return $ M.map (const False) all_po res <- liftIO $ catch (verify_all all_po) handle let p_r = M.mapWithKey f po f k x = maybe (old_po ! k) (\b -> (b,x)) $ M.lookup k res put param { _pos = M.insert (label name) p_r $ _pos param } let s = unlines $ map (\(k,r) -> success r ++ pretty k) $ M.toAscList res return (M.size res,"> theory " ++ pretty (label name) ++ ":\n" ++ s) where success True = " o " success False = " xxx "
1,320
check_theory :: (MonadIO m, MonadState Params m) => (String,Theory) -> m (Int,String) check_theory (name,th) = do param <- get let old_po = M.findWithDefault M.empty (label name) $ _pos param po = either (assertFalse' "check_theory") id $ theory_po th new_po = po `M.difference` old_po ch_po = po `M.intersection` old_po ch = M.filterWithKey (\k x -> snd (old_po ! k) /= x) ch_po all_po = new_po `M.union` ch -- handle :: ErrorCall -> IO (Map Label Bool) -- revise: do not return empty handle (SomeException e) = do putStrLn "> error" print (typeOf e) print e return $ M.map (const False) all_po res <- liftIO $ catch (verify_all all_po) handle let p_r = M.mapWithKey f po f k x = maybe (old_po ! k) (\b -> (b,x)) $ M.lookup k res put param { _pos = M.insert (label name) p_r $ _pos param } let s = unlines $ map (\(k,r) -> success r ++ pretty k) $ M.toAscList res return (M.size res,"> theory " ++ pretty (label name) ++ ":\n" ++ s) where success True = " o " success False = " xxx "
1,320
check_theory (name,th) = do param <- get let old_po = M.findWithDefault M.empty (label name) $ _pos param po = either (assertFalse' "check_theory") id $ theory_po th new_po = po `M.difference` old_po ch_po = po `M.intersection` old_po ch = M.filterWithKey (\k x -> snd (old_po ! k) /= x) ch_po all_po = new_po `M.union` ch -- handle :: ErrorCall -> IO (Map Label Bool) -- revise: do not return empty handle (SomeException e) = do putStrLn "> error" print (typeOf e) print e return $ M.map (const False) all_po res <- liftIO $ catch (verify_all all_po) handle let p_r = M.mapWithKey f po f k x = maybe (old_po ! k) (\b -> (b,x)) $ M.lookup k res put param { _pos = M.insert (label name) p_r $ _pos param } let s = unlines $ map (\(k,r) -> success r ++ pretty k) $ M.toAscList res return (M.size res,"> theory " ++ pretty (label name) ++ ":\n" ++ s) where success True = " o " success False = " xxx "
1,220
false
true
2
16
519
488
239
249
null
null
kisp/ksquant2
Measure.hs
gpl-3.0
eid (L _ _ x _ _) = x
21
eid (L _ _ x _ _) = x
21
eid (L _ _ x _ _) = x
21
false
false
0
6
8
24
11
13
null
null
dmp1ce/Haskell-Programming-Exercises
Chapter 9/PoemLines.hs
unlicense
mySection d x = (takeSection x):(mySection d $ dropSection x) where takeSection = takeWhile (/=d) dropSection = (dropWhile (==d) . dropWhile (/=d)) -- The main function here is a small test -- to ensure you've written your function -- correctly.
256
mySection d x = (takeSection x):(mySection d $ dropSection x) where takeSection = takeWhile (/=d) dropSection = (dropWhile (==d) . dropWhile (/=d)) -- The main function here is a small test -- to ensure you've written your function -- correctly.
256
mySection d x = (takeSection x):(mySection d $ dropSection x) where takeSection = takeWhile (/=d) dropSection = (dropWhile (==d) . dropWhile (/=d)) -- The main function here is a small test -- to ensure you've written your function -- correctly.
256
false
false
3
9
50
89
42
47
null
null
open-etcs/openetcs-sdm
src/ETCS/SDM/SpecialBreaks.hs
bsd-3-clause
activeBreaksOn :: SpecialBreakConfiguration -> SpecialBreakModel -> ActiveBreaks activeBreaksOn p m = ActiveBreaks (specialBreakAffected p sbmRegenerativeBreak m) (specialBreakAffected p sbmEddyCurrentBreak m) (specialBreakAffected p sbmMagneticShoeBreak m) (specialBreakAffected p sbmEpBreak m)
303
activeBreaksOn :: SpecialBreakConfiguration -> SpecialBreakModel -> ActiveBreaks activeBreaksOn p m = ActiveBreaks (specialBreakAffected p sbmRegenerativeBreak m) (specialBreakAffected p sbmEddyCurrentBreak m) (specialBreakAffected p sbmMagneticShoeBreak m) (specialBreakAffected p sbmEpBreak m)
303
activeBreaksOn p m = ActiveBreaks (specialBreakAffected p sbmRegenerativeBreak m) (specialBreakAffected p sbmEddyCurrentBreak m) (specialBreakAffected p sbmMagneticShoeBreak m) (specialBreakAffected p sbmEpBreak m)
222
false
true
0
7
35
81
37
44
null
null
schernichkin/yarn-client
src/YARN/Client_r2_7_3.hs
bsd-3-clause
getClusterApplicationStatistics :: B.ByteString -> Int -> Manager -> IO AppStatInfo getClusterApplicationStatistics h p m = do let request = defaultRequest { host = h, port = p, path = "/ws/v1/cluster/appstatistics", method = "GET" } b <- responseBody <$> httpLbs request m return $ case eitherDecode' b of Right r -> r Left e -> error e -- | Cluster Application API -- http://<rm http address:port>/ws/v1/cluster/apps/{appid} -- An application resource contains information about a particular application that was submitted to a cluster.
671
getClusterApplicationStatistics :: B.ByteString -> Int -> Manager -> IO AppStatInfo getClusterApplicationStatistics h p m = do let request = defaultRequest { host = h, port = p, path = "/ws/v1/cluster/appstatistics", method = "GET" } b <- responseBody <$> httpLbs request m return $ case eitherDecode' b of Right r -> r Left e -> error e -- | Cluster Application API -- http://<rm http address:port>/ws/v1/cluster/apps/{appid} -- An application resource contains information about a particular application that was submitted to a cluster.
671
getClusterApplicationStatistics h p m = do let request = defaultRequest { host = h, port = p, path = "/ws/v1/cluster/appstatistics", method = "GET" } b <- responseBody <$> httpLbs request m return $ case eitherDecode' b of Right r -> r Left e -> error e -- | Cluster Application API -- http://<rm http address:port>/ws/v1/cluster/apps/{appid} -- An application resource contains information about a particular application that was submitted to a cluster.
587
false
true
0
11
213
124
63
61
null
null
IanConnolly/aws-sdk-fork
AWS/RDS/Internal.hs
bsd-3-clause
dbSecurityGroupMembershipSink :: MonadThrow m => Consumer Event m DBSecurityGroupMembership dbSecurityGroupMembershipSink = DBSecurityGroupMembership <$> getT "Status" <*> getT "DBSecurityGroupName"
214
dbSecurityGroupMembershipSink :: MonadThrow m => Consumer Event m DBSecurityGroupMembership dbSecurityGroupMembershipSink = DBSecurityGroupMembership <$> getT "Status" <*> getT "DBSecurityGroupName"
214
dbSecurityGroupMembershipSink = DBSecurityGroupMembership <$> getT "Status" <*> getT "DBSecurityGroupName"
114
false
true
5
6
33
46
21
25
null
null
yu-i9/HaSS
src/MifParser.hs
mit
parseMif :: String -> IO [(Int16, Int16)] parseMif fileName = parseFromFile mif fileName >>= either report return where report err = error $ show err
151
parseMif :: String -> IO [(Int16, Int16)] parseMif fileName = parseFromFile mif fileName >>= either report return where report err = error $ show err
151
parseMif fileName = parseFromFile mif fileName >>= either report return where report err = error $ show err
109
false
true
0
8
26
61
30
31
null
null
brendanhay/gogol
gogol-translate/gen/Network/Google/Resource/Translate/Projects/Locations/List.hs
mpl-2.0
-- | OAuth access token. pllAccessToken :: Lens' ProjectsLocationsList (Maybe Text) pllAccessToken = lens _pllAccessToken (\ s a -> s{_pllAccessToken = a})
163
pllAccessToken :: Lens' ProjectsLocationsList (Maybe Text) pllAccessToken = lens _pllAccessToken (\ s a -> s{_pllAccessToken = a})
138
pllAccessToken = lens _pllAccessToken (\ s a -> s{_pllAccessToken = a})
79
true
true
1
9
29
52
25
27
null
null
zinfra/khan
khan/src/Khan/Model/AutoScaling/ScalingGroup.hs
mpl-2.0
update :: Naming a => a -> Maybe Integer -> Maybe Integer -> Maybe Integer -> Maybe Integer -> Maybe Integer -> AWS () update (names -> n@Names{..}) cool desired grace min max = do AutoScalingGroup{..} <- find n >>= noteAWS "Auto Scaling Group {} doesn't exist." [B appName] say "Updating Auto Scaling Group {}" [appName] send_ UpdateAutoScalingGroup { uasgAutoScalingGroupName = appName , uasgAvailabilityZones = Members asgAvailabilityZones , uasgDefaultCooldown = cool , uasgDesiredCapacity = desired , uasgHealthCheckGracePeriod = grace , uasgHealthCheckType = Nothing , uasgLaunchConfigurationName = Nothing , uasgMaxSize = max , uasgMinSize = min , uasgPlacementGroup = Nothing , uasgTerminationPolicies = Members asgTerminationPolicies , uasgVPCZoneIdentifier = Nothing }
1,036
update :: Naming a => a -> Maybe Integer -> Maybe Integer -> Maybe Integer -> Maybe Integer -> Maybe Integer -> AWS () update (names -> n@Names{..}) cool desired grace min max = do AutoScalingGroup{..} <- find n >>= noteAWS "Auto Scaling Group {} doesn't exist." [B appName] say "Updating Auto Scaling Group {}" [appName] send_ UpdateAutoScalingGroup { uasgAutoScalingGroupName = appName , uasgAvailabilityZones = Members asgAvailabilityZones , uasgDefaultCooldown = cool , uasgDesiredCapacity = desired , uasgHealthCheckGracePeriod = grace , uasgHealthCheckType = Nothing , uasgLaunchConfigurationName = Nothing , uasgMaxSize = max , uasgMinSize = min , uasgPlacementGroup = Nothing , uasgTerminationPolicies = Members asgTerminationPolicies , uasgVPCZoneIdentifier = Nothing }
1,036
update (names -> n@Names{..}) cool desired grace min max = do AutoScalingGroup{..} <- find n >>= noteAWS "Auto Scaling Group {} doesn't exist." [B appName] say "Updating Auto Scaling Group {}" [appName] send_ UpdateAutoScalingGroup { uasgAutoScalingGroupName = appName , uasgAvailabilityZones = Members asgAvailabilityZones , uasgDefaultCooldown = cool , uasgDesiredCapacity = desired , uasgHealthCheckGracePeriod = grace , uasgHealthCheckType = Nothing , uasgLaunchConfigurationName = Nothing , uasgMaxSize = max , uasgMinSize = min , uasgPlacementGroup = Nothing , uasgTerminationPolicies = Members asgTerminationPolicies , uasgVPCZoneIdentifier = Nothing }
868
false
true
0
13
366
219
115
104
null
null
thalerjonathan/phd
public/ArtIterating/code/haskell/PureAgentsPar/src/PureAgentsPar.hs
gpl-3.0
splitAgentLocalEnvPairs :: [(Agent m s e, LocalEnvironment e)] -> GlobalEnvironment e -> ([Agent m s e], GlobalEnvironment e) splitAgentLocalEnvPairs aeps ge = foldl (\(as, ge') (a, le) -> (a : as, Map.insert (agentId a) le ge') ) ([], ge) aeps
244
splitAgentLocalEnvPairs :: [(Agent m s e, LocalEnvironment e)] -> GlobalEnvironment e -> ([Agent m s e], GlobalEnvironment e) splitAgentLocalEnvPairs aeps ge = foldl (\(as, ge') (a, le) -> (a : as, Map.insert (agentId a) le ge') ) ([], ge) aeps
244
splitAgentLocalEnvPairs aeps ge = foldl (\(as, ge') (a, le) -> (a : as, Map.insert (agentId a) le ge') ) ([], ge) aeps
118
false
true
0
11
39
127
68
59
null
null
ezyang/ghc
testsuite/tests/gadt/nbe.hs
bsd-3-clause
eqE (EFalse) (EFalse) = True
28
eqE (EFalse) (EFalse) = True
28
eqE (EFalse) (EFalse) = True
28
false
false
0
5
4
19
9
10
null
null
nushio3/ghc
libraries/ghci/GHCi/TH.hs
bsd-3-clause
putState :: QState -> GHCiQ () putState s = GHCiQ $ \_ -> return ((),s)
71
putState :: QState -> GHCiQ () putState s = GHCiQ $ \_ -> return ((),s)
71
putState s = GHCiQ $ \_ -> return ((),s)
40
false
true
2
8
14
48
23
25
null
null
elfeck/elfeckcom
src/Web/View.hs
mit
site404 :: Html site404 = div "Sorry nothing to see here" ! class_ "errorbody"
78
site404 :: Html site404 = div "Sorry nothing to see here" ! class_ "errorbody"
78
site404 = div "Sorry nothing to see here" ! class_ "errorbody"
62
false
true
0
6
13
21
10
11
null
null
rodrigogribeiro/mptc
src/Tc/TcClassInstGen.hs
bsd-3-clause
genConstraints :: ClassEnv -> KcEnv -> LabelEnv -> [Assumption] -> TcM ([Class], KcEnv, [Assumption]) genConstraints cenv kenv env as = do (cs, env') <- foldM (gen cenv) ([],kenv) candidates return (cs, env', concat candidates) where candidates = groupById (select env as) -- generating the constraints for a set of overloaded identifiers
374
genConstraints :: ClassEnv -> KcEnv -> LabelEnv -> [Assumption] -> TcM ([Class], KcEnv, [Assumption]) genConstraints cenv kenv env as = do (cs, env') <- foldM (gen cenv) ([],kenv) candidates return (cs, env', concat candidates) where candidates = groupById (select env as) -- generating the constraints for a set of overloaded identifiers
374
genConstraints cenv kenv env as = do (cs, env') <- foldM (gen cenv) ([],kenv) candidates return (cs, env', concat candidates) where candidates = groupById (select env as) -- generating the constraints for a set of overloaded identifiers
272
false
true
0
11
86
128
68
60
null
null
NightRa/Idris-dev
src/IRTS/CodegenC.hs
bsd-3-clause
doOp v (LTrunc (ITFixed from) (ITFixed to)) [x] | nativeTyWidth from > nativeTyWidth to = bitCoerce v "T" from to x
119
doOp v (LTrunc (ITFixed from) (ITFixed to)) [x] | nativeTyWidth from > nativeTyWidth to = bitCoerce v "T" from to x
119
doOp v (LTrunc (ITFixed from) (ITFixed to)) [x] | nativeTyWidth from > nativeTyWidth to = bitCoerce v "T" from to x
119
false
false
0
9
24
63
29
34
null
null
mdsteele/fallback
src/Fallback/Data/Point.hs
gpl-3.0
isCardinal DirN = True
22
isCardinal DirN = True
22
isCardinal DirN = True
22
false
false
0
5
3
9
4
5
null
null
nothiphop/project-euler
021/solution.hs
apache-2.0
sumDivisorsUnder :: Int -> [(Int,Int)] sumDivisorsUnder n = map (\num -> (num, sumDivisors num)) [2..(n-1)]
107
sumDivisorsUnder :: Int -> [(Int,Int)] sumDivisorsUnder n = map (\num -> (num, sumDivisors num)) [2..(n-1)]
107
sumDivisorsUnder n = map (\num -> (num, sumDivisors num)) [2..(n-1)]
68
false
true
0
9
14
64
35
29
null
null
MarcusVoelker/MuCurse
LParse.hs
mit
pFail :: String -> Parser r a pFail err = Parser (const $ throw err)
68
pFail :: String -> Parser r a pFail err = Parser (const $ throw err)
68
pFail err = Parser (const $ throw err)
38
false
true
0
8
14
36
17
19
null
null
rahulmutt/ghcvm
compiler/Eta/HsSyn/HsUtils.hs
bsd-3-clause
----------------- Patterns -------------------------- collectPatBinders :: LPat a -> [a] collectPatBinders pat = collect_lpat pat []
132
collectPatBinders :: LPat a -> [a] collectPatBinders pat = collect_lpat pat []
78
collectPatBinders pat = collect_lpat pat []
43
true
true
0
8
14
39
17
22
null
null
equational/JL2012
HaskellExamples/src/MMM.hs
mit
foldState :: (stateIn -> RetState err stateOut ret) -> StateR err stateIn stateOut ret foldState f = toState (\ s -> f s)
130
foldState :: (stateIn -> RetState err stateOut ret) -> StateR err stateIn stateOut ret foldState f = toState (\ s -> f s)
130
foldState f = toState (\ s -> f s)
35
false
true
0
8
31
55
27
28
null
null
jimsnow/polink
PolinkState.hs
gpl-2.0
-- Create a user. addUser :: T.Text -> T.Text -> S Uid addUser name email = do invertErr (getUserByName name) "user by that name already exists" invertErr (getUserByEmail email) "user with that email already exists" id <- bumpId let uid = Uid id let perm = case id of 0 -> adminPerm _ -> defaultPerm let user = User uid perm name [email] Nothing SEQ.empty SEQ.empty S.empty S.empty S.empty S.empty M.empty users . at uid ?= user usersByName . at name ?= uid usersByEmail . at email ?= uid addContrib uid (U uid) return uid
610
addUser :: T.Text -> T.Text -> S Uid addUser name email = do invertErr (getUserByName name) "user by that name already exists" invertErr (getUserByEmail email) "user with that email already exists" id <- bumpId let uid = Uid id let perm = case id of 0 -> adminPerm _ -> defaultPerm let user = User uid perm name [email] Nothing SEQ.empty SEQ.empty S.empty S.empty S.empty S.empty M.empty users . at uid ?= user usersByName . at name ?= uid usersByEmail . at email ?= uid addContrib uid (U uid) return uid
592
addUser name email = do invertErr (getUserByName name) "user by that name already exists" invertErr (getUserByEmail email) "user with that email already exists" id <- bumpId let uid = Uid id let perm = case id of 0 -> adminPerm _ -> defaultPerm let user = User uid perm name [email] Nothing SEQ.empty SEQ.empty S.empty S.empty S.empty S.empty M.empty users . at uid ?= user usersByName . at name ?= uid usersByEmail . at email ?= uid addContrib uid (U uid) return uid
555
true
true
0
13
182
222
100
122
null
null
forste/haReFork
tools/base/syntax/SyntaxUtil.hs
bsd-3-clause
isConE _ = False
37
isConE _ = False
37
isConE _ = False
37
false
false
0
4
24
10
4
6
null
null
tavisrudd/ghcjs-base
JavaScript/JSON/Types/Class.hs
mit
genericToJSON :: (Generic a, GToJSON (Rep a)) => Options -> a -> Value genericToJSON opts = gToJSON opts . from
111
genericToJSON :: (Generic a, GToJSON (Rep a)) => Options -> a -> Value genericToJSON opts = gToJSON opts . from
111
genericToJSON opts = gToJSON opts . from
40
false
true
0
9
19
56
26
30
null
null
kajigor/uKanren_transformations
test/auto/Test/Embed.hs
bsd-3-clause
v18 = V 18
10
v18 = V 18
10
v18 = V 18
10
false
false
0
5
3
9
4
5
null
null
wizzup/advent_of_code
2016/2/part2.hs
mit
step U BB = B7
14
step U BB = B7
14
step U BB = B7
14
false
false
1
5
4
16
5
11
null
null
pparkkin/eta
compiler/ETA/Main/TidyPgm.hs
bsd-3-clause
cafRefsEs :: CafRefEnv -> [Expr a] -> FastBool cafRefsEs _ [] = fastBool False
82
cafRefsEs :: CafRefEnv -> [Expr a] -> FastBool cafRefsEs _ [] = fastBool False
82
cafRefsEs _ [] = fastBool False
35
false
true
0
8
17
35
17
18
null
null
x-y-z/cabal
Cabal/Distribution/Simple/Utils.hs
bsd-3-clause
shortRelativePath :: FilePath -> FilePath -> FilePath shortRelativePath from to = case dropCommonPrefix (splitDirectories from) (splitDirectories to) of (stuff, path) -> joinPath (map (const "..") stuff ++ path) where dropCommonPrefix :: Eq a => [a] -> [a] -> ([a],[a]) dropCommonPrefix (x:xs) (y:ys) | x == y = dropCommonPrefix xs ys dropCommonPrefix xs ys = (xs,ys) -- ------------------------------------------------------------ -- * Finding the description file -- ------------------------------------------------------------ -- |Package description file (/pkgname/@.cabal@)
617
shortRelativePath :: FilePath -> FilePath -> FilePath shortRelativePath from to = case dropCommonPrefix (splitDirectories from) (splitDirectories to) of (stuff, path) -> joinPath (map (const "..") stuff ++ path) where dropCommonPrefix :: Eq a => [a] -> [a] -> ([a],[a]) dropCommonPrefix (x:xs) (y:ys) | x == y = dropCommonPrefix xs ys dropCommonPrefix xs ys = (xs,ys) -- ------------------------------------------------------------ -- * Finding the description file -- ------------------------------------------------------------ -- |Package description file (/pkgname/@.cabal@)
617
shortRelativePath from to = case dropCommonPrefix (splitDirectories from) (splitDirectories to) of (stuff, path) -> joinPath (map (const "..") stuff ++ path) where dropCommonPrefix :: Eq a => [a] -> [a] -> ([a],[a]) dropCommonPrefix (x:xs) (y:ys) | x == y = dropCommonPrefix xs ys dropCommonPrefix xs ys = (xs,ys) -- ------------------------------------------------------------ -- * Finding the description file -- ------------------------------------------------------------ -- |Package description file (/pkgname/@.cabal@)
563
false
true
5
13
108
177
94
83
null
null
AaronFriel/eff-experiments
src/Eff/Internal/Eff1.hs
bsd-3-clause
-- Again, all three choices are accounted for. ex2r_1 = (Left (TooBig 11) ==) $ run . runErrBig . makeChoice $ exRec (ex2 (choose [5,7,11,1]))
152
ex2r_1 = (Left (TooBig 11) ==) $ run . runErrBig . makeChoice $ exRec (ex2 (choose [5,7,11,1]))
104
ex2r_1 = (Left (TooBig 11) ==) $ run . runErrBig . makeChoice $ exRec (ex2 (choose [5,7,11,1]))
104
true
false
0
12
34
63
34
29
null
null
pparkkin/eta
compiler/ETA/Prelude/PrimOp.hs
bsd-3-clause
tagOf_PrimOp Int642Int = _ILIT(1089)
36
tagOf_PrimOp Int642Int = _ILIT(1089)
36
tagOf_PrimOp Int642Int = _ILIT(1089)
36
false
false
0
6
3
15
7
8
null
null
BartAdv/hoogle
src/General/Util.hs
bsd-3-clause
testing_, testing :: String -> IO () -> IO () testing_ name act = do putStr $ "Test " ++ name ++ " "; act
105
testing_, testing :: String -> IO () -> IO () testing_ name act = do putStr $ "Test " ++ name ++ " "; act
105
testing_ name act = do putStr $ "Test " ++ name ++ " "; act
59
false
true
2
9
24
64
28
36
null
null
Helkafen/haddock
haddock-api/src/Haddock/Utils.hs
bsd-2-clause
markup m (DocModule mod0) = markupModule m mod0
58
markup m (DocModule mod0) = markupModule m mod0
58
markup m (DocModule mod0) = markupModule m mod0
58
false
false
0
7
18
22
10
12
null
null
abakst/liquidhaskell
benchmarks/hmatrix-0.15.0.1/lib/Data/Packed/Internal/Common.hs
bsd-3-clause
errorCode 2001 = "bad function code"
36
errorCode 2001 = "bad function code"
36
errorCode 2001 = "bad function code"
36
false
false
1
5
5
13
4
9
null
null
lorenzojlamas/ejercicios
1.hs
gpl-3.0
yLogico2 x y = False
20
yLogico2 x y = False
20
yLogico2 x y = False
20
false
false
0
5
4
11
5
6
null
null
stevely/hspirv
src/SpirV/Builder.hs
bsd-3-clause
-- Id 1: Result type, must be matrix type -- Id 2: Matrix, must be floating point matrix -- Id 3: Matrix, must be floating point matrix matrixTimesMatrix :: TypeId -> Id -> Id -> Builder Id matrixTimesMatrix (TypeId i) = R.matrixTimesMatrix i
242
matrixTimesMatrix :: TypeId -> Id -> Id -> Builder Id matrixTimesMatrix (TypeId i) = R.matrixTimesMatrix i
106
matrixTimesMatrix (TypeId i) = R.matrixTimesMatrix i
52
true
true
0
11
42
47
23
24
null
null
silkapp/haskell-opaleye
src/Opaleye/Internal/Print.hs
bsd-3-clause
ppAttrs xs = HPrint.commaV nameAs xs
36
ppAttrs xs = HPrint.commaV nameAs xs
36
ppAttrs xs = HPrint.commaV nameAs xs
36
false
false
0
6
5
16
7
9
null
null
chadbrewbaker/combinat
Math/Combinat/LatticePaths.hs
bsd-3-clause
| Counts the down-steps pathNumberOfDownSteps :: LatticePath -> Int pathNumberOfDownSteps = snd . pathNumberOfUpDownSteps
126
pathNumberOfDownSteps :: LatticePath -> Int pathNumberOfDownSteps = snd . pathNumberOfUpDownSteps
97
pathNumberOfDownSteps = snd . pathNumberOfUpDownSteps
53
true
true
1
6
17
33
16
17
null
null
phaazon/OpenGLRaw
src/Graphics/Rendering/OpenGL/Raw/Tokens.hs
bsd-3-clause
gl_SAMPLER_CUBE_MAP_ARRAY_SHADOW_ARB :: GLenum gl_SAMPLER_CUBE_MAP_ARRAY_SHADOW_ARB = 0x900D
92
gl_SAMPLER_CUBE_MAP_ARRAY_SHADOW_ARB :: GLenum gl_SAMPLER_CUBE_MAP_ARRAY_SHADOW_ARB = 0x900D
92
gl_SAMPLER_CUBE_MAP_ARRAY_SHADOW_ARB = 0x900D
45
false
true
0
4
5
11
6
5
null
null
markflorisson/packages
Pkgs/Eval.hs
bsd-3-clause
evalExpr val -- Value, nothing to do = return val
57
evalExpr val -- Value, nothing to do = return val
57
evalExpr val -- Value, nothing to do = return val
57
false
false
1
5
17
17
6
11
null
null
Enamex/Idris-dev
src/Idris/Core/TT.hs
bsd-3-clause
implicitable _ = False
22
implicitable _ = False
22
implicitable _ = False
22
false
false
0
4
3
10
4
6
null
null
visood/bioalgo
src/lib/Genome/Data/FrequencyArray.hs
bsd-3-clause
freqKmerLexicords :: Lexicord b => Int -> Int -> [b] -> Map Int [Int] freqKmerLexicords c k text = invertedMap (kmerLexicordCounts c k text)
140
freqKmerLexicords :: Lexicord b => Int -> Int -> [b] -> Map Int [Int] freqKmerLexicords c k text = invertedMap (kmerLexicordCounts c k text)
140
freqKmerLexicords c k text = invertedMap (kmerLexicordCounts c k text)
70
false
true
0
10
23
66
31
35
null
null
haslab/SecreC
src/Language/SecreC/Transformation/Dafny.hs
gpl-3.0
varToDafny :: DafnyK m => VarName GIdentifier (Typed Position) -> DafnyM m DDoc varToDafny (VarName (Typed l t) n) = do let suffix = if isPublicType t then "Public" else "Private" let dn = DIden n return $ dn <<>> dtext suffix
238
varToDafny :: DafnyK m => VarName GIdentifier (Typed Position) -> DafnyM m DDoc varToDafny (VarName (Typed l t) n) = do let suffix = if isPublicType t then "Public" else "Private" let dn = DIden n return $ dn <<>> dtext suffix
238
varToDafny (VarName (Typed l t) n) = do let suffix = if isPublicType t then "Public" else "Private" let dn = DIden n return $ dn <<>> dtext suffix
158
false
true
0
11
53
103
48
55
null
null
wavewave/qft
old/lib/Util.hs
gpl-3.0
-------------------- -- either utility -- -------------------- -- | guardEither :: String -> Bool -> Either String () guardEither str False = Left str
151
guardEither :: String -> Bool -> Either String () guardEither str False = Left str
82
guardEither str False = Left str
32
true
true
0
8
23
38
20
18
null
null
Teaspot-Studio/GPipe-Core
src/Graphics/GPipe/Internal/Texture.hs
mit
setSamplerFilter t SamplerNearest = setSamplerFilter' t Nearest Nearest Nearest Nothing
87
setSamplerFilter t SamplerNearest = setSamplerFilter' t Nearest Nearest Nearest Nothing
87
setSamplerFilter t SamplerNearest = setSamplerFilter' t Nearest Nearest Nearest Nothing
87
false
false
0
5
9
24
10
14
null
null
roman/Haskell-teardown
src/Control/Teardown/Internal/Printer.hs
isc
-- | Renders an ASCII Tree with the "TeardownResult" of a "Teardown" sub-routine -- execution prettyTeardownResult :: TeardownResult -> Doc ann prettyTeardownResult result = render 0 0 result <> hardline where renderError start level (SomeException err) = let (fstErrLine, errLines) = case Text.lines (tshow err) of [] -> error "Expecting reported error to have a line of content, got none" (fstErrLine' : errLines') -> (fstErrLine', errLines') errorReport = treeTrunk (start - 1) (level + 1) <> ">" <> indent 2 (pretty (show (typeOf err)) <> ":") <+> pretty (Text.unpack fstErrLine) : map (\l -> treeTrunk (start - 1) (level + 1) <> ">" <> indent 2 (pretty $ Text.unpack l) ) errLines in vcat errorReport renderTree start level disposeResults = case disposeResults of [] -> mempty [lastResult] -> treeTrunk start (level + 1) <> render (start + 1) (level + 1) lastResult (r : results) -> treeTrunk start (level + 1) <> render start (level + 1) r <> hardline <> renderTree start level results render start level disposeResult = case disposeResult of EmptyResult desc -> "`-" <+> "✓" <+> pretty (Text.unpack desc) <+> "(empty)" LeafResult desc elapsed Nothing -> "`-" <+> "✓" <+> pretty (Text.unpack desc) <+> pretty ("(" <> show elapsed <> ")") LeafResult desc elapsed (Just err) -> "`-" <+> "✘" <+> pretty (Text.unpack desc) <+> pretty ("(" <> show elapsed <> ")") <> hardline <> renderError start level err BranchResult desc elapsed didFail results -> vcat [ "`-" <+> (if didFail then "✘" else "✓") <+> pretty (Text.unpack desc) <+> parens (pretty $ show elapsed) , renderTree start level results ]
1,969
prettyTeardownResult :: TeardownResult -> Doc ann prettyTeardownResult result = render 0 0 result <> hardline where renderError start level (SomeException err) = let (fstErrLine, errLines) = case Text.lines (tshow err) of [] -> error "Expecting reported error to have a line of content, got none" (fstErrLine' : errLines') -> (fstErrLine', errLines') errorReport = treeTrunk (start - 1) (level + 1) <> ">" <> indent 2 (pretty (show (typeOf err)) <> ":") <+> pretty (Text.unpack fstErrLine) : map (\l -> treeTrunk (start - 1) (level + 1) <> ">" <> indent 2 (pretty $ Text.unpack l) ) errLines in vcat errorReport renderTree start level disposeResults = case disposeResults of [] -> mempty [lastResult] -> treeTrunk start (level + 1) <> render (start + 1) (level + 1) lastResult (r : results) -> treeTrunk start (level + 1) <> render start (level + 1) r <> hardline <> renderTree start level results render start level disposeResult = case disposeResult of EmptyResult desc -> "`-" <+> "✓" <+> pretty (Text.unpack desc) <+> "(empty)" LeafResult desc elapsed Nothing -> "`-" <+> "✓" <+> pretty (Text.unpack desc) <+> pretty ("(" <> show elapsed <> ")") LeafResult desc elapsed (Just err) -> "`-" <+> "✘" <+> pretty (Text.unpack desc) <+> pretty ("(" <> show elapsed <> ")") <> hardline <> renderError start level err BranchResult desc elapsed didFail results -> vcat [ "`-" <+> (if didFail then "✘" else "✓") <+> pretty (Text.unpack desc) <+> parens (pretty $ show elapsed) , renderTree start level results ]
1,875
prettyTeardownResult result = render 0 0 result <> hardline where renderError start level (SomeException err) = let (fstErrLine, errLines) = case Text.lines (tshow err) of [] -> error "Expecting reported error to have a line of content, got none" (fstErrLine' : errLines') -> (fstErrLine', errLines') errorReport = treeTrunk (start - 1) (level + 1) <> ">" <> indent 2 (pretty (show (typeOf err)) <> ":") <+> pretty (Text.unpack fstErrLine) : map (\l -> treeTrunk (start - 1) (level + 1) <> ">" <> indent 2 (pretty $ Text.unpack l) ) errLines in vcat errorReport renderTree start level disposeResults = case disposeResults of [] -> mempty [lastResult] -> treeTrunk start (level + 1) <> render (start + 1) (level + 1) lastResult (r : results) -> treeTrunk start (level + 1) <> render start (level + 1) r <> hardline <> renderTree start level results render start level disposeResult = case disposeResult of EmptyResult desc -> "`-" <+> "✓" <+> pretty (Text.unpack desc) <+> "(empty)" LeafResult desc elapsed Nothing -> "`-" <+> "✓" <+> pretty (Text.unpack desc) <+> pretty ("(" <> show elapsed <> ")") LeafResult desc elapsed (Just err) -> "`-" <+> "✘" <+> pretty (Text.unpack desc) <+> pretty ("(" <> show elapsed <> ")") <> hardline <> renderError start level err BranchResult desc elapsed didFail results -> vcat [ "`-" <+> (if didFail then "✘" else "✓") <+> pretty (Text.unpack desc) <+> parens (pretty $ show elapsed) , renderTree start level results ]
1,825
true
true
0
19
634
648
316
332
null
null
andrewMacmurray/haskell-book-solutions
src/ch17/MakePerson.hs
mit
mkPhone :: String -> Maybe Phone mkPhone n = fmap Phone $ valiatePhone n
72
mkPhone :: String -> Maybe Phone mkPhone n = fmap Phone $ valiatePhone n
72
mkPhone n = fmap Phone $ valiatePhone n
39
false
true
0
7
13
35
15
20
null
null
jabaraster/network-qiita
src/Network/QiitaTest.hs
bsd-3-clause
runGetStocksCore :: StateT QiitaContext IO () runGetStocksCore = do liftIO $ putStrLn "" liftIO $ putStrLn "- 1. -----------------------------" items <- getStocksAFirstPage liftIO $ mapM_ (\l -> print $ l) (list items) liftIO $ mapM_ (\l -> print $ l) (pagenation items) ctx2 <- get liftIO $ putStrLn ("Post: " ++ (show ctx2)) liftIO $ putStrLn "" liftIO $ putStrLn "- 2. -----------------------------" items <- getStocksAFirstPage' 2 liftIO $ mapM_ (\l -> print $ l) (list items) liftIO $ mapM_ (\l -> print $ l) (pagenation items) ctx2 <- get liftIO $ putStrLn ("Post: " ++ (show ctx2)) liftIO $ putStrLn "" liftIO $ putStrLn "- 3. -----------------------------" items <- getStocksAWithPage (pagenation items !! 0) liftIO $ mapM_ (\l -> print $ l) (list items) liftIO $ mapM_ (\l -> print $ l) (pagenation items) ctx2 <- get liftIO $ putStrLn ("Post: " ++ (show ctx2))
920
runGetStocksCore :: StateT QiitaContext IO () runGetStocksCore = do liftIO $ putStrLn "" liftIO $ putStrLn "- 1. -----------------------------" items <- getStocksAFirstPage liftIO $ mapM_ (\l -> print $ l) (list items) liftIO $ mapM_ (\l -> print $ l) (pagenation items) ctx2 <- get liftIO $ putStrLn ("Post: " ++ (show ctx2)) liftIO $ putStrLn "" liftIO $ putStrLn "- 2. -----------------------------" items <- getStocksAFirstPage' 2 liftIO $ mapM_ (\l -> print $ l) (list items) liftIO $ mapM_ (\l -> print $ l) (pagenation items) ctx2 <- get liftIO $ putStrLn ("Post: " ++ (show ctx2)) liftIO $ putStrLn "" liftIO $ putStrLn "- 3. -----------------------------" items <- getStocksAWithPage (pagenation items !! 0) liftIO $ mapM_ (\l -> print $ l) (list items) liftIO $ mapM_ (\l -> print $ l) (pagenation items) ctx2 <- get liftIO $ putStrLn ("Post: " ++ (show ctx2))
920
runGetStocksCore = do liftIO $ putStrLn "" liftIO $ putStrLn "- 1. -----------------------------" items <- getStocksAFirstPage liftIO $ mapM_ (\l -> print $ l) (list items) liftIO $ mapM_ (\l -> print $ l) (pagenation items) ctx2 <- get liftIO $ putStrLn ("Post: " ++ (show ctx2)) liftIO $ putStrLn "" liftIO $ putStrLn "- 2. -----------------------------" items <- getStocksAFirstPage' 2 liftIO $ mapM_ (\l -> print $ l) (list items) liftIO $ mapM_ (\l -> print $ l) (pagenation items) ctx2 <- get liftIO $ putStrLn ("Post: " ++ (show ctx2)) liftIO $ putStrLn "" liftIO $ putStrLn "- 3. -----------------------------" items <- getStocksAWithPage (pagenation items !! 0) liftIO $ mapM_ (\l -> print $ l) (list items) liftIO $ mapM_ (\l -> print $ l) (pagenation items) ctx2 <- get liftIO $ putStrLn ("Post: " ++ (show ctx2))
874
false
true
1
13
195
391
182
209
null
null
siddhanathan/yi
yi-keymap-vim/src/Yi/Keymap/Vim/ExMap.hs
gpl-2.0
historyBinding :: VimBinding historyBinding = VimBindingE f where f evs (VimState { vsMode = Ex }) | evs `elem` fmap fst binds = WholeMatch $ do fromJust $ lookup evs binds command <- withCurrentBuffer elemsB modifyStateE $ \state -> state { vsOngoingInsertEvents = Ev $ R.toText command } return Drop f _ _ = NoMatch binds = [ ("<Up>", historyUp) , ("<C-p>", historyUp) , ("<Down>", historyDown) , ("<C-n>", historyDown) ]
618
historyBinding :: VimBinding historyBinding = VimBindingE f where f evs (VimState { vsMode = Ex }) | evs `elem` fmap fst binds = WholeMatch $ do fromJust $ lookup evs binds command <- withCurrentBuffer elemsB modifyStateE $ \state -> state { vsOngoingInsertEvents = Ev $ R.toText command } return Drop f _ _ = NoMatch binds = [ ("<Up>", historyUp) , ("<C-p>", historyUp) , ("<Down>", historyDown) , ("<C-n>", historyDown) ]
618
historyBinding = VimBindingE f where f evs (VimState { vsMode = Ex }) | evs `elem` fmap fst binds = WholeMatch $ do fromJust $ lookup evs binds command <- withCurrentBuffer elemsB modifyStateE $ \state -> state { vsOngoingInsertEvents = Ev $ R.toText command } return Drop f _ _ = NoMatch binds = [ ("<Up>", historyUp) , ("<C-p>", historyUp) , ("<Down>", historyDown) , ("<C-n>", historyDown) ]
589
false
true
0
17
264
167
88
79
null
null
PipocaQuemada/ermine
src/Ermine/Parser.hs
bsd-2-clause
layoutEndsWith :: Parser () layoutEndsWith = Parser $ \s -> runParser (views parserLayout go s) s where go (BracedLayout _ p _ _:_) = p go (IndentedLayout _ : xs) = go xs go [] = eof
211
layoutEndsWith :: Parser () layoutEndsWith = Parser $ \s -> runParser (views parserLayout go s) s where go (BracedLayout _ p _ _:_) = p go (IndentedLayout _ : xs) = go xs go [] = eof
211
layoutEndsWith = Parser $ \s -> runParser (views parserLayout go s) s where go (BracedLayout _ p _ _:_) = p go (IndentedLayout _ : xs) = go xs go [] = eof
183
false
true
0
10
65
97
48
49
null
null
hsyl20/ViperVM
haskus-system-tools/src/elf/Main.hs
bsd-3-clause
showDebugInfo :: [DebugInfo] -> Html () showDebugInfo dis = do forM_ dis $ \di -> table_ $ do let cuh = debugInfoCompilationUnitHeader di tr_ $ do th_ "Format" td_ . toHtml $ show (cuhDwarfFormat cuh) tr_ $ do th_ "Compilation unit length" td_ . toHtml $ show (cuhUnitLength cuh) tr_ $ do th_ "DWARF version" td_ . toHtml $ show (cuhVersion cuh) tr_ $ do th_ "Offset in abbreviation table" td_ . toHtml $ show (cuhAbbrevOffset cuh) tr_ $ do th_ "Address size" td_ . toHtml $ show (cuhAddressSize cuh) tr_ $ do th_ "Entries" td_ $ table_ $ do tr_ $ do th_ "Abbrev code" th_ "Tag" th_ "Has children" th_ "Attributes" forM_ (debugInfoEntries di) $ \ent -> case ent of Nothing -> tr_ $ td_ [colspan_ "4"] "NULL entry" Just e -> tr_ $ do td_ . toHtml $ show (debugEntryAbbrevCode e) td_ . toHtml $ show (debugEntryTag e) td_ . toHtml $ show (debugEntryHasChildren e) td_ $ table_ $ do tr_ $ do th_ "Name" th_ "Value" forM_ (debugEntryAttributes e) $ \att -> tr_ $ do td_ . toHtml $ show (debugAttrName att) td_ . toHtml $ show (debugAttrValue att) tr_ $ do th_ "Entry tree" td_ . pre_ . toHtml . drawTree . fmap show $ debugEntryTree (debugInfoEntries di)
1,704
showDebugInfo :: [DebugInfo] -> Html () showDebugInfo dis = do forM_ dis $ \di -> table_ $ do let cuh = debugInfoCompilationUnitHeader di tr_ $ do th_ "Format" td_ . toHtml $ show (cuhDwarfFormat cuh) tr_ $ do th_ "Compilation unit length" td_ . toHtml $ show (cuhUnitLength cuh) tr_ $ do th_ "DWARF version" td_ . toHtml $ show (cuhVersion cuh) tr_ $ do th_ "Offset in abbreviation table" td_ . toHtml $ show (cuhAbbrevOffset cuh) tr_ $ do th_ "Address size" td_ . toHtml $ show (cuhAddressSize cuh) tr_ $ do th_ "Entries" td_ $ table_ $ do tr_ $ do th_ "Abbrev code" th_ "Tag" th_ "Has children" th_ "Attributes" forM_ (debugInfoEntries di) $ \ent -> case ent of Nothing -> tr_ $ td_ [colspan_ "4"] "NULL entry" Just e -> tr_ $ do td_ . toHtml $ show (debugEntryAbbrevCode e) td_ . toHtml $ show (debugEntryTag e) td_ . toHtml $ show (debugEntryHasChildren e) td_ $ table_ $ do tr_ $ do th_ "Name" th_ "Value" forM_ (debugEntryAttributes e) $ \att -> tr_ $ do td_ . toHtml $ show (debugAttrName att) td_ . toHtml $ show (debugAttrValue att) tr_ $ do th_ "Entry tree" td_ . pre_ . toHtml . drawTree . fmap show $ debugEntryTree (debugInfoEntries di)
1,704
showDebugInfo dis = do forM_ dis $ \di -> table_ $ do let cuh = debugInfoCompilationUnitHeader di tr_ $ do th_ "Format" td_ . toHtml $ show (cuhDwarfFormat cuh) tr_ $ do th_ "Compilation unit length" td_ . toHtml $ show (cuhUnitLength cuh) tr_ $ do th_ "DWARF version" td_ . toHtml $ show (cuhVersion cuh) tr_ $ do th_ "Offset in abbreviation table" td_ . toHtml $ show (cuhAbbrevOffset cuh) tr_ $ do th_ "Address size" td_ . toHtml $ show (cuhAddressSize cuh) tr_ $ do th_ "Entries" td_ $ table_ $ do tr_ $ do th_ "Abbrev code" th_ "Tag" th_ "Has children" th_ "Attributes" forM_ (debugInfoEntries di) $ \ent -> case ent of Nothing -> tr_ $ td_ [colspan_ "4"] "NULL entry" Just e -> tr_ $ do td_ . toHtml $ show (debugEntryAbbrevCode e) td_ . toHtml $ show (debugEntryTag e) td_ . toHtml $ show (debugEntryHasChildren e) td_ $ table_ $ do tr_ $ do th_ "Name" th_ "Value" forM_ (debugEntryAttributes e) $ \att -> tr_ $ do td_ . toHtml $ show (debugAttrName att) td_ . toHtml $ show (debugAttrValue att) tr_ $ do th_ "Entry tree" td_ . pre_ . toHtml . drawTree . fmap show $ debugEntryTree (debugInfoEntries di)
1,664
false
true
0
38
766
540
236
304
null
null
holzensp/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