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
ml9951/ThreadScope
papers/haskell_symposium_2009/bsort/BSortPar2.hs
bsd-3-clause
------------------------------------------------------------------------------- main :: IO () main = do nums <- sequence (replicate (2^14) (getStdRandom (randomR (1,255)))) tStart <- getClockTime performGC let r = bsort nums seq r (return ()) tEnd <- getClockTime putStrLn (show (sum r)) putStrLn ("Time: " ++ show (secDiff tStart tEnd) ++ " seconds.") -------------------------------------------------------------------------------
500
main :: IO () main = do nums <- sequence (replicate (2^14) (getStdRandom (randomR (1,255)))) tStart <- getClockTime performGC let r = bsort nums seq r (return ()) tEnd <- getClockTime putStrLn (show (sum r)) putStrLn ("Time: " ++ show (secDiff tStart tEnd) ++ " seconds.") -------------------------------------------------------------------------------
416
main = do nums <- sequence (replicate (2^14) (getStdRandom (randomR (1,255)))) tStart <- getClockTime performGC let r = bsort nums seq r (return ()) tEnd <- getClockTime putStrLn (show (sum r)) putStrLn ("Time: " ++ show (secDiff tStart tEnd) ++ " seconds.") -------------------------------------------------------------------------------
402
true
true
0
15
115
154
72
82
null
null
plneappl/HaskellVectorsETC
mld.hs
mit
toBoolV :: (Vector v Z2) => v Z2 -> v Bool toBoolV = fmap (toEnum . fromEnum)
77
toBoolV :: (Vector v Z2) => v Z2 -> v Bool toBoolV = fmap (toEnum . fromEnum)
77
toBoolV = fmap (toEnum . fromEnum)
34
false
true
0
8
16
48
22
26
null
null
haliner/presenter
Main.hs
gpl-3.0
left :: ActionM () left = do liftIO $ callProcess "xdotool" ["key", "--clearmodifier", "Left"] redirect "/"
111
left :: ActionM () left = do liftIO $ callProcess "xdotool" ["key", "--clearmodifier", "Left"] redirect "/"
111
left = do liftIO $ callProcess "xdotool" ["key", "--clearmodifier", "Left"] redirect "/"
92
false
true
0
9
19
43
21
22
null
null
green-haskell/ghc
compiler/stranal/DmdAnal.hs
bsd-3-clause
addLazyFVs :: DmdType -> DmdEnv -> DmdType addLazyFVs dmd_ty lazy_fvs = dmd_ty `bothDmdType` mkBothDmdArg lazy_fvs
116
addLazyFVs :: DmdType -> DmdEnv -> DmdType addLazyFVs dmd_ty lazy_fvs = dmd_ty `bothDmdType` mkBothDmdArg lazy_fvs
116
addLazyFVs dmd_ty lazy_fvs = dmd_ty `bothDmdType` mkBothDmdArg lazy_fvs
73
false
true
0
8
16
41
19
22
null
null
ezyang/hoopl
src/Compiler/Hoopl/Stream.hs
bsd-3-clause
iterS :: Stream s a -> Stream s a iterS stream = \s -> case stream s of Nothing -> Nothing Just (Pair a s') -> Just $ Pair a (s' `thenS` iterS stream)
196
iterS :: Stream s a -> Stream s a iterS stream = \s -> case stream s of Nothing -> Nothing Just (Pair a s') -> Just $ Pair a (s' `thenS` iterS stream)
196
iterS stream = \s -> case stream s of Nothing -> Nothing Just (Pair a s') -> Just $ Pair a (s' `thenS` iterS stream)
162
false
true
0
13
79
88
42
46
null
null
sol/hpack
src/Data/Aeson/Config/FromValue.hs
mit
genericFromValueWith :: (Generic a, GenericDecode (Rep a)) => Options -> Value -> Parser a genericFromValueWith opts = fmap to . genericDecode opts
148
genericFromValueWith :: (Generic a, GenericDecode (Rep a)) => Options -> Value -> Parser a genericFromValueWith opts = fmap to . genericDecode opts
148
genericFromValueWith opts = fmap to . genericDecode opts
57
false
true
0
8
22
59
28
31
null
null
kaoskorobase/mescaline
lib/mescaline/runtests.hs
gpl-3.0
main :: IO () main = defaultMain $ Data.KDTree.Test.tests ++ Mescaline.Data.PriorityQueue.Test.tests
117
main :: IO () main = defaultMain $ Data.KDTree.Test.tests ++ Mescaline.Data.PriorityQueue.Test.tests
117
main = defaultMain $ Data.KDTree.Test.tests ++ Mescaline.Data.PriorityQueue.Test.tests
103
false
true
4
7
27
41
20
21
null
null
leepike/copilot-core
src/Copilot/Core/Locals.hs
bsd-3-clause
-------------------------------------------------------------------------------- locsExpr :: Expr a -> DList Loc locsExpr e0 = case e0 of Const _ _ -> empty Drop _ _ _ -> empty Local t _ name e1 e2 -> singleton (Loc name t) `append` locsExpr e1 `append` locsExpr e2 Var _ _ -> empty ExternVar _ _ _ -> empty ExternFun _ _ _ _ _ -> empty ExternArray _ _ _ _ _ _ _ -> empty Op1 _ e -> locsExpr e Op2 _ e1 e2 -> locsExpr e1 `append` locsExpr e2 Op3 _ e1 e2 e3 -> locsExpr e1 `append` locsExpr e2 `append` locsExpr e3 --------------------------------------------------------------------------------
851
locsExpr :: Expr a -> DList Loc locsExpr e0 = case e0 of Const _ _ -> empty Drop _ _ _ -> empty Local t _ name e1 e2 -> singleton (Loc name t) `append` locsExpr e1 `append` locsExpr e2 Var _ _ -> empty ExternVar _ _ _ -> empty ExternFun _ _ _ _ _ -> empty ExternArray _ _ _ _ _ _ _ -> empty Op1 _ e -> locsExpr e Op2 _ e1 e2 -> locsExpr e1 `append` locsExpr e2 Op3 _ e1 e2 e3 -> locsExpr e1 `append` locsExpr e2 `append` locsExpr e3 --------------------------------------------------------------------------------
769
locsExpr e0 = case e0 of Const _ _ -> empty Drop _ _ _ -> empty Local t _ name e1 e2 -> singleton (Loc name t) `append` locsExpr e1 `append` locsExpr e2 Var _ _ -> empty ExternVar _ _ _ -> empty ExternFun _ _ _ _ _ -> empty ExternArray _ _ _ _ _ _ _ -> empty Op1 _ e -> locsExpr e Op2 _ e1 e2 -> locsExpr e1 `append` locsExpr e2 Op3 _ e1 e2 e3 -> locsExpr e1 `append` locsExpr e2 `append` locsExpr e3 --------------------------------------------------------------------------------
737
true
true
0
12
358
237
114
123
null
null
jwiegley/github
samples/Users/ShowUser2.hs
bsd-3-clause
main :: IO () main = do possibleUser <- GH.executeRequest' $ GH.userInfoForR "phadej" print possibleUser
112
main :: IO () main = do possibleUser <- GH.executeRequest' $ GH.userInfoForR "phadej" print possibleUser
112
main = do possibleUser <- GH.executeRequest' $ GH.userInfoForR "phadej" print possibleUser
98
false
true
0
10
22
40
18
22
null
null
lukexi/ghc-7.8-arm64
compiler/codeGen/StgCmmClosure.hs
bsd-3-clause
maybeIsLFCon _ = Nothing
24
maybeIsLFCon _ = Nothing
24
maybeIsLFCon _ = Nothing
24
false
false
0
5
3
9
4
5
null
null
mstksg/tensor-ops
src/Data/Type/Sing.hs
bsd-3-clause
entailSing2 :: forall a b c. () => (Sing a -> Sing b -> Sing c) -> ((SingI a, SingI b) :- SingI c) entailSing2 f = Sub $ withSingI (f (sing :: Sing a) (sing :: Sing b)) Wit
184
entailSing2 :: forall a b c. () => (Sing a -> Sing b -> Sing c) -> ((SingI a, SingI b) :- SingI c) entailSing2 f = Sub $ withSingI (f (sing :: Sing a) (sing :: Sing b)) Wit
184
entailSing2 f = Sub $ withSingI (f (sing :: Sing a) (sing :: Sing b)) Wit
73
false
true
0
13
51
111
56
55
null
null
cchalmers/geometry
src/Geometry/ThreeD/Types.hs
bsd-3-clause
r3SphericalIso :: RealFloat n => Iso' (V3 n) (n, Angle n, Angle n) r3SphericalIso = iso (\v@(V3 x y z) -> (norm v, atan2A y x, acosA (z / norm v))) (\(r,θ,φ) -> V3 (r * cosA θ * sinA φ) (r * sinA θ * sinA φ) (r * cosA φ))
227
r3SphericalIso :: RealFloat n => Iso' (V3 n) (n, Angle n, Angle n) r3SphericalIso = iso (\v@(V3 x y z) -> (norm v, atan2A y x, acosA (z / norm v))) (\(r,θ,φ) -> V3 (r * cosA θ * sinA φ) (r * sinA θ * sinA φ) (r * cosA φ))
227
r3SphericalIso = iso (\v@(V3 x y z) -> (norm v, atan2A y x, acosA (z / norm v))) (\(r,θ,φ) -> V3 (r * cosA θ * sinA φ) (r * sinA θ * sinA φ) (r * cosA φ))
160
false
true
0
11
57
169
86
83
null
null
Hamcha/dvx
Dvx/Utils.hs
mit
joinstr acc depth (x:xs) = joinstr ((head acc ++ x):(tail acc)) (depth + nesting x) xs where nesting c | head c == '{' = 1 | last c == '}' = -1 | otherwise = 0 -- |1 if given True, 0 if given False
244
joinstr acc depth (x:xs) = joinstr ((head acc ++ x):(tail acc)) (depth + nesting x) xs where nesting c | head c == '{' = 1 | last c == '}' = -1 | otherwise = 0 -- |1 if given True, 0 if given False
244
joinstr acc depth (x:xs) = joinstr ((head acc ++ x):(tail acc)) (depth + nesting x) xs where nesting c | head c == '{' = 1 | last c == '}' = -1 | otherwise = 0 -- |1 if given True, 0 if given False
244
false
false
0
10
92
113
53
60
null
null
rueshyna/gogol
gogol-identity-toolkit/gen/Network/Google/IdentityToolkit/Types/Product.hs
mpl-2.0
-- | If idToken is STS id token, then this field will be refresh token. vctrRefreshToken :: Lens' VerifyCustomTokenResponse (Maybe Text) vctrRefreshToken = lens _vctrRefreshToken (\ s a -> s{_vctrRefreshToken = a})
222
vctrRefreshToken :: Lens' VerifyCustomTokenResponse (Maybe Text) vctrRefreshToken = lens _vctrRefreshToken (\ s a -> s{_vctrRefreshToken = a})
150
vctrRefreshToken = lens _vctrRefreshToken (\ s a -> s{_vctrRefreshToken = a})
85
true
true
1
9
39
51
25
26
null
null
chadbrewbaker/shellcheck
ShellCheck/Analytics.hs
gpl-3.0
prop_checkUnassignedReferences1 = verifyTree checkUnassignedReferences "echo $foo"
82
prop_checkUnassignedReferences1 = verifyTree checkUnassignedReferences "echo $foo"
82
prop_checkUnassignedReferences1 = verifyTree checkUnassignedReferences "echo $foo"
82
false
false
0
5
5
11
5
6
null
null
spechub/Hets
THF/StaticAnalysisTHF.hs
gpl-2.0
insertConst :: Constant -> As.Name -> Type -> Annotations -> State ([Diagnosis], SignTHF, Set.Set SymbolTHF) () insertConst c n t a = do (_, sig, _) <- get if sigHasTypeSymbol c sig then (appandDiag $ mkDiag Error "Duplicate definition of a symbol as a type constant. Symbol: " c) else do isTypeConsistent t if sigHasConstSymbol c sig then unless (sigHasSameType c t sig) $ appandDiag $ mkDiag Error ("A constant with the same identifier but another " ++ "type is already inside the signature") c else -- everything is fine let ci = ConstInfo { constId = c, constName = n, constType = t , constAnno = a } sym = Symbol { symId = c, symName = n , symType = ST_Const t } in do (diag', sig', syms') <- get put (diag', sig' { consts = Map.insert c ci (consts sig') , symbols = Map.insert c sym (symbols sig') } , Set.insert sym syms') -- Check if a type symbol is already inside the sig
1,246
insertConst :: Constant -> As.Name -> Type -> Annotations -> State ([Diagnosis], SignTHF, Set.Set SymbolTHF) () insertConst c n t a = do (_, sig, _) <- get if sigHasTypeSymbol c sig then (appandDiag $ mkDiag Error "Duplicate definition of a symbol as a type constant. Symbol: " c) else do isTypeConsistent t if sigHasConstSymbol c sig then unless (sigHasSameType c t sig) $ appandDiag $ mkDiag Error ("A constant with the same identifier but another " ++ "type is already inside the signature") c else -- everything is fine let ci = ConstInfo { constId = c, constName = n, constType = t , constAnno = a } sym = Symbol { symId = c, symName = n , symType = ST_Const t } in do (diag', sig', syms') <- get put (diag', sig' { consts = Map.insert c ci (consts sig') , symbols = Map.insert c sym (symbols sig') } , Set.insert sym syms') -- Check if a type symbol is already inside the sig
1,246
insertConst c n t a = do (_, sig, _) <- get if sigHasTypeSymbol c sig then (appandDiag $ mkDiag Error "Duplicate definition of a symbol as a type constant. Symbol: " c) else do isTypeConsistent t if sigHasConstSymbol c sig then unless (sigHasSameType c t sig) $ appandDiag $ mkDiag Error ("A constant with the same identifier but another " ++ "type is already inside the signature") c else -- everything is fine let ci = ConstInfo { constId = c, constName = n, constType = t , constAnno = a } sym = Symbol { symId = c, symName = n , symType = ST_Const t } in do (diag', sig', syms') <- get put (diag', sig' { consts = Map.insert c ci (consts sig') , symbols = Map.insert c sym (symbols sig') } , Set.insert sym syms') -- Check if a type symbol is already inside the sig
1,114
false
true
0
21
531
314
167
147
null
null
Ongy/monky
Monky/Examples/Combine.hs
lgpl-3.0
combine :: (PollModule a, PollModule b) => IO a -> IO b -> IO (CombiHandle a b) combine a b = do c <- a d <- b return $ C c d -- Module handle a, b. IORef for caching a, b. MVar to implement boolean, containing value doesn't matter -- |Wrapper type for 'EvtModule's
272
combine :: (PollModule a, PollModule b) => IO a -> IO b -> IO (CombiHandle a b) combine a b = do c <- a d <- b return $ C c d -- Module handle a, b. IORef for caching a, b. MVar to implement boolean, containing value doesn't matter -- |Wrapper type for 'EvtModule's
272
combine a b = do c <- a d <- b return $ C c d -- Module handle a, b. IORef for caching a, b. MVar to implement boolean, containing value doesn't matter -- |Wrapper type for 'EvtModule's
192
false
true
0
10
62
89
41
48
null
null
pyr/apotiki
System/Apotiki/Debian/Control.hs
isc
ctlEntryParser :: P.Parser (String, String) ctlEntryParser = do k <- unpack `fmap` P.takeWhile (P.notInClass ":") P.string $ pack ":" v <- if (k == "Description") then ctlFlatDescParser else ctlValParser return (k, strip v)
231
ctlEntryParser :: P.Parser (String, String) ctlEntryParser = do k <- unpack `fmap` P.takeWhile (P.notInClass ":") P.string $ pack ":" v <- if (k == "Description") then ctlFlatDescParser else ctlValParser return (k, strip v)
231
ctlEntryParser = do k <- unpack `fmap` P.takeWhile (P.notInClass ":") P.string $ pack ":" v <- if (k == "Description") then ctlFlatDescParser else ctlValParser return (k, strip v)
187
false
true
0
12
40
97
49
48
null
null
nomeata/ghc
compiler/codeGen/StgCmmForeign.hs
bsd-3-clause
getFCallArgs :: [StgArg] -> FCode [(CmmExpr, ForeignHint)] -- (a) Drop void args -- (b) Add foreign-call shim code -- It's (b) that makes this differ from getNonVoidArgAmodes getFCallArgs args = do { mb_cmms <- mapM get args ; return (catMaybes mb_cmms) } where get arg | isVoidRep arg_rep = return Nothing | otherwise = do { cmm <- getArgAmode (NonVoid arg) ; dflags <- getDynFlags ; return (Just (add_shim dflags arg_ty cmm, hint)) } where arg_ty = stgArgType arg arg_rep = typePrimRep arg_ty hint = typeForeignHint arg_ty
670
getFCallArgs :: [StgArg] -> FCode [(CmmExpr, ForeignHint)] getFCallArgs args = do { mb_cmms <- mapM get args ; return (catMaybes mb_cmms) } where get arg | isVoidRep arg_rep = return Nothing | otherwise = do { cmm <- getArgAmode (NonVoid arg) ; dflags <- getDynFlags ; return (Just (add_shim dflags arg_ty cmm, hint)) } where arg_ty = stgArgType arg arg_rep = typePrimRep arg_ty hint = typeForeignHint arg_ty
553
getFCallArgs args = do { mb_cmms <- mapM get args ; return (catMaybes mb_cmms) } where get arg | isVoidRep arg_rep = return Nothing | otherwise = do { cmm <- getArgAmode (NonVoid arg) ; dflags <- getDynFlags ; return (Just (add_shim dflags arg_ty cmm, hint)) } where arg_ty = stgArgType arg arg_rep = typePrimRep arg_ty hint = typeForeignHint arg_ty
494
true
true
0
12
232
172
86
86
null
null
ssaavedra/liquidhaskell
src/Language/Haskell/Liquid/Bare/GhcSpec.hs
bsd-3-clause
makeGhcSpec2 invs ialias measures su sp = return $ sp { invariants = subst su invs , ialiases = subst su ialias , measures = subst su <$> M.elems (Ms.measMap measures) ++ Ms.imeas measures }
311
makeGhcSpec2 invs ialias measures su sp = return $ sp { invariants = subst su invs , ialiases = subst su ialias , measures = subst su <$> M.elems (Ms.measMap measures) ++ Ms.imeas measures }
311
makeGhcSpec2 invs ialias measures su sp = return $ sp { invariants = subst su invs , ialiases = subst su ialias , measures = subst su <$> M.elems (Ms.measMap measures) ++ Ms.imeas measures }
311
false
false
0
13
155
80
40
40
null
null
spencerjanssen/cabal2nix
src/Cabal2Nix/PostProcess.hs
bsd-3-clause
ncursesPatchPhase :: String ncursesPatchPhase = "patchPhase = \"find . -type f -exec sed -i -e 's|ncursesw/||' {} \\\\;\";"
123
ncursesPatchPhase :: String ncursesPatchPhase = "patchPhase = \"find . -type f -exec sed -i -e 's|ncursesw/||' {} \\\\;\";"
123
ncursesPatchPhase = "patchPhase = \"find . -type f -exec sed -i -e 's|ncursesw/||' {} \\\\;\";"
95
false
true
0
4
17
11
6
5
null
null
Concomitant/LambdaHack
Game/LambdaHack/Common/Msg.hs
bsd-3-clause
encodeLine :: [AttrChar] -> ScreenLine encodeLine l = G.fromList $ map (fromIntegral . fromEnum) l
98
encodeLine :: [AttrChar] -> ScreenLine encodeLine l = G.fromList $ map (fromIntegral . fromEnum) l
98
encodeLine l = G.fromList $ map (fromIntegral . fromEnum) l
59
false
true
0
8
14
44
21
23
null
null
ComputationWithBoundedResources/ara-inference
doc/tpdb_trs/Haskell/basic_haskell/rangeSize_2.hs
mit
asAs :: MyBool -> MyBool -> MyBool; asAs MyFalse x = MyFalse
64
asAs :: MyBool -> MyBool -> MyBool asAs MyFalse x = MyFalse
63
asAs MyFalse x = MyFalse
24
false
true
0
6
15
25
13
12
null
null
GaloisInc/sk-dev-platform
libs/genLobster/Main.hs
bsd-3-clause
processPolicy :: Options -> Policy -> IO () processPolicy opts x = do f <- if isDir opts then do let dir = path opts createDirectoryIfMissing True dir return $ \fn s -> do writeFile fn s appendFile fn "\n" else do let fn = path opts writeFile fn "" return $ \_ s -> appendFile fn s mapM_ (processPolicyModule f opts) $ policyModules x
398
processPolicy :: Options -> Policy -> IO () processPolicy opts x = do f <- if isDir opts then do let dir = path opts createDirectoryIfMissing True dir return $ \fn s -> do writeFile fn s appendFile fn "\n" else do let fn = path opts writeFile fn "" return $ \_ s -> appendFile fn s mapM_ (processPolicyModule f opts) $ policyModules x
398
processPolicy opts x = do f <- if isDir opts then do let dir = path opts createDirectoryIfMissing True dir return $ \fn s -> do writeFile fn s appendFile fn "\n" else do let fn = path opts writeFile fn "" return $ \_ s -> appendFile fn s mapM_ (processPolicyModule f opts) $ policyModules x
354
false
true
0
15
128
157
70
87
null
null
hnfmr/beginning_haskell
DataBuilder.hs
mit
clientToText (Company i n p d) = "client(com," <> B.decimal i <> B.singleton ',' <> B.fromText (escapeString n) <> B.singleton ',' <> personToText p <> B.singleton ',' <> B.fromText (escapeString d) <> B.singleton ')'
235
clientToText (Company i n p d) = "client(com," <> B.decimal i <> B.singleton ',' <> B.fromText (escapeString n) <> B.singleton ',' <> personToText p <> B.singleton ',' <> B.fromText (escapeString d) <> B.singleton ')'
235
clientToText (Company i n p d) = "client(com," <> B.decimal i <> B.singleton ',' <> B.fromText (escapeString n) <> B.singleton ',' <> personToText p <> B.singleton ',' <> B.fromText (escapeString d) <> B.singleton ')'
235
false
false
4
9
51
106
47
59
null
null
nushio3/unittyped
src/UnitTyped/Type.hs
lgpl-2.1
u |- d = fmap (\x -> x - d) u
29
u |- d = fmap (\x -> x - d) u
29
u |- d = fmap (\x -> x - d) u
29
false
false
0
8
10
35
16
19
null
null
sapek/pandoc
src/Text/Pandoc/Readers/LaTeX.hs
gpl-2.0
inNote :: Inlines -> Inlines inNote ils = note $ para $ ils <> str "."
72
inNote :: Inlines -> Inlines inNote ils = note $ para $ ils <> str "."
72
inNote ils = note $ para $ ils <> str "."
43
false
true
0
7
17
33
16
17
null
null
knotman90/google-interview
haskell/wikibook.hs
gpl-3.0
mapIO :: (a -> IO b) -> [a] -> IO [b] mapIO f = sequenceIO . map f
66
mapIO :: (a -> IO b) -> [a] -> IO [b] mapIO f = sequenceIO . map f
66
mapIO f = sequenceIO . map f
28
false
true
1
9
17
54
25
29
null
null
beni55/openshake
tests/evan-hang/Shakefile.hs
bsd-3-clause
hs_of :: FilePath -> FilePath hs_of fn = FilePath.replaceExtension fn "hs"
74
hs_of :: FilePath -> FilePath hs_of fn = FilePath.replaceExtension fn "hs"
74
hs_of fn = FilePath.replaceExtension fn "hs"
44
false
true
0
7
10
30
13
17
null
null
PPitson/Deque
test/unit/HUnitTests.hs
bsd-3-clause
-- push back test37 = TestCase (assertEqual "push back" [1] (toListDEQ $ pushBackDEQ emptyDEQ 1) )
99
test37 = TestCase (assertEqual "push back" [1] (toListDEQ $ pushBackDEQ emptyDEQ 1) )
86
test37 = TestCase (assertEqual "push back" [1] (toListDEQ $ pushBackDEQ emptyDEQ 1) )
86
true
false
0
10
16
35
18
17
null
null
nevrenato/Hets_Fork
OWL2/Parse.hs
gpl-2.0
subPropertyKey :: CharParser st () subPropertyKey = pkeyword subPropertyOfC
75
subPropertyKey :: CharParser st () subPropertyKey = pkeyword subPropertyOfC
75
subPropertyKey = pkeyword subPropertyOfC
40
false
true
0
6
8
21
10
11
null
null
lueck/htcf
src/HTCF/ConfigParser.hs
gpl-3.0
-- | Test if one digit numbers are read as ordinals. singleDigitOrdinalP :: [Config] -> Bool singleDigitOrdinalP [] = defaultSingleDigitOrdinal
143
singleDigitOrdinalP :: [Config] -> Bool singleDigitOrdinalP [] = defaultSingleDigitOrdinal
90
singleDigitOrdinalP [] = defaultSingleDigitOrdinal
50
true
true
0
6
19
24
13
11
null
null
bennofs/cabal2nix
src/Distribution/Nixpkgs/Fetch.hs
bsd-3-clause
fetch :: forall a. (String -> MaybeT IO a) -- ^ This function is passed the output path name as an argument. -- It should return 'Nothing' if the file doesn't match the expected format. -- This is required, because we cannot always check if a download succeeded otherwise. -> Source -- ^ The source to fetch from. -> IO (Maybe (DerivationSource, a)) -- ^ The derivation source and the result of the processing function. Returns Nothing if the download failed. fetch f = runMaybeT . fetchers where fetchers :: Source -> MaybeT IO (DerivationSource, a) fetchers source = msum . (fetchLocal source :) $ map (\fetcher -> fetchWith fetcher source >>= process) [ (False, "url", []) , (True, "git", ["--fetch-submodules"]) , (True, "hg", []) , (True, "svn", []) , (True, "bzr", []) ] -- | Remove '/' from the end of the path. Nix doesn't accept paths that -- end in a slash. stripSlashSuffix :: String -> String stripSlashSuffix = reverse . dropWhile (== '/') . reverse fetchLocal :: Source -> MaybeT IO (DerivationSource, a) fetchLocal src = do let path = stripSlashSuffix $ stripPrefix "file://" $ sourceUrl src existsFile <- liftIO $ doesFileExist path existsDir <- liftIO $ doesDirectoryExist path guard $ existsDir || existsFile let path' | '/' `elem` path = path | otherwise = "./" ++ path process (DerivationSource "" path' "" "", path') <|> localArchive path' localArchive :: FilePath -> MaybeT IO (DerivationSource, a) localArchive path = do absolutePath <- liftIO $ canonicalizePath path unpacked <- snd <$> fetchWith (False, "zip", []) (Source ("file://" ++ absolutePath) "" UnknownHash) process (DerivationSource "" absolutePath "" "", unpacked) process :: (DerivationSource, FilePath) -> MaybeT IO (DerivationSource, a) process (derivSource, file) = (,) derivSource <$> f file -- | Like 'fetch', but allows to specify which script to use.
2,105
fetch :: forall a. (String -> MaybeT IO a) -- ^ This function is passed the output path name as an argument. -- It should return 'Nothing' if the file doesn't match the expected format. -- This is required, because we cannot always check if a download succeeded otherwise. -> Source -- ^ The source to fetch from. -> IO (Maybe (DerivationSource, a)) fetch f = runMaybeT . fetchers where fetchers :: Source -> MaybeT IO (DerivationSource, a) fetchers source = msum . (fetchLocal source :) $ map (\fetcher -> fetchWith fetcher source >>= process) [ (False, "url", []) , (True, "git", ["--fetch-submodules"]) , (True, "hg", []) , (True, "svn", []) , (True, "bzr", []) ] -- | Remove '/' from the end of the path. Nix doesn't accept paths that -- end in a slash. stripSlashSuffix :: String -> String stripSlashSuffix = reverse . dropWhile (== '/') . reverse fetchLocal :: Source -> MaybeT IO (DerivationSource, a) fetchLocal src = do let path = stripSlashSuffix $ stripPrefix "file://" $ sourceUrl src existsFile <- liftIO $ doesFileExist path existsDir <- liftIO $ doesDirectoryExist path guard $ existsDir || existsFile let path' | '/' `elem` path = path | otherwise = "./" ++ path process (DerivationSource "" path' "" "", path') <|> localArchive path' localArchive :: FilePath -> MaybeT IO (DerivationSource, a) localArchive path = do absolutePath <- liftIO $ canonicalizePath path unpacked <- snd <$> fetchWith (False, "zip", []) (Source ("file://" ++ absolutePath) "" UnknownHash) process (DerivationSource "" absolutePath "" "", unpacked) process :: (DerivationSource, FilePath) -> MaybeT IO (DerivationSource, a) process (derivSource, file) = (,) derivSource <$> f file -- | Like 'fetch', but allows to specify which script to use.
1,989
fetch f = runMaybeT . fetchers where fetchers :: Source -> MaybeT IO (DerivationSource, a) fetchers source = msum . (fetchLocal source :) $ map (\fetcher -> fetchWith fetcher source >>= process) [ (False, "url", []) , (True, "git", ["--fetch-submodules"]) , (True, "hg", []) , (True, "svn", []) , (True, "bzr", []) ] -- | Remove '/' from the end of the path. Nix doesn't accept paths that -- end in a slash. stripSlashSuffix :: String -> String stripSlashSuffix = reverse . dropWhile (== '/') . reverse fetchLocal :: Source -> MaybeT IO (DerivationSource, a) fetchLocal src = do let path = stripSlashSuffix $ stripPrefix "file://" $ sourceUrl src existsFile <- liftIO $ doesFileExist path existsDir <- liftIO $ doesDirectoryExist path guard $ existsDir || existsFile let path' | '/' `elem` path = path | otherwise = "./" ++ path process (DerivationSource "" path' "" "", path') <|> localArchive path' localArchive :: FilePath -> MaybeT IO (DerivationSource, a) localArchive path = do absolutePath <- liftIO $ canonicalizePath path unpacked <- snd <$> fetchWith (False, "zip", []) (Source ("file://" ++ absolutePath) "" UnknownHash) process (DerivationSource "" absolutePath "" "", unpacked) process :: (DerivationSource, FilePath) -> MaybeT IO (DerivationSource, a) process (derivSource, file) = (,) derivSource <$> f file -- | Like 'fetch', but allows to specify which script to use.
1,494
true
true
0
13
560
544
289
255
null
null
narurien/ganeti-ceph
src/Ganeti/DataCollectors/Lv.hs
gpl-2.0
-- | This function computes the JSON representation of the LV status. buildJsonReport :: Options -> IO J.JSValue buildJsonReport opts = do let inputFile = optInputFile opts lvInfo <- getLvInfo inputFile (prim, sec) <- getInstanceList opts return . J.showJSON $ addInstNameToLv (prim ++ sec) lvInfo -- | This function computes the DCReport for the logical volumes.
372
buildJsonReport :: Options -> IO J.JSValue buildJsonReport opts = do let inputFile = optInputFile opts lvInfo <- getLvInfo inputFile (prim, sec) <- getInstanceList opts return . J.showJSON $ addInstNameToLv (prim ++ sec) lvInfo -- | This function computes the DCReport for the logical volumes.
302
buildJsonReport opts = do let inputFile = optInputFile opts lvInfo <- getLvInfo inputFile (prim, sec) <- getInstanceList opts return . J.showJSON $ addInstNameToLv (prim ++ sec) lvInfo -- | This function computes the DCReport for the logical volumes.
259
true
true
0
11
64
93
43
50
null
null
srank/regexp
Tokenise.hs
gpl-3.0
tokenise xs = Text f:tokenise g where (f, g) = getFrontLiteral xs
67
tokenise xs = Text f:tokenise g where (f, g) = getFrontLiteral xs
67
tokenise xs = Text f:tokenise g where (f, g) = getFrontLiteral xs
67
false
false
0
6
13
37
17
20
null
null
alexander-at-github/eta
compiler/ETA/StgSyn/CoreToStg.hs
bsd-3-clause
check_eq_li TopLet TopLet = True
46
check_eq_li TopLet TopLet = True
46
check_eq_li TopLet TopLet = True
46
false
false
0
5
18
13
5
8
null
null
ZjMNZHgG5jMXw/privacy-option
Language/POL/Syntax.hs
bsd-3-clause
-- (R23) ifobs o c = If o c
47
ifobs o c = If o c
38
ifobs o c = If o c
38
true
false
1
5
28
23
8
15
null
null
jberthold/rts-serialisation
testExceptions.hs
bsd-3-clause
-- need a time-wasting function which allocates... nfib :: Integer -> Integer nfib 0 = 1
88
nfib :: Integer -> Integer nfib 0 = 1
37
nfib 0 = 1
10
true
true
0
7
15
25
11
14
null
null
travitch/dalvik
src/Dalvik/DebugInfo.hs
bsd-3-clause
startLocal :: DebugState -> Word32 -> Int32 -> Int32 -> Int32 -> DebugState startLocal s r nid tid sid = s { dbgLocals = Map.alter start r (dbgLocals s) , dbgSeqNo = n + 1 } where start (Just (LocalInfo 0 a' 0xFFFFFFFF nid' tid' sid' : ls)) = Just $ l' : LocalInfo n a' a nid' tid' sid' : ls start (Just ls) = Just $ l' : ls start Nothing = Just [l'] a = dbgAddr s n = dbgSeqNo s l' = LocalInfo 0 a 0xFFFFFFFF nid tid sid
497
startLocal :: DebugState -> Word32 -> Int32 -> Int32 -> Int32 -> DebugState startLocal s r nid tid sid = s { dbgLocals = Map.alter start r (dbgLocals s) , dbgSeqNo = n + 1 } where start (Just (LocalInfo 0 a' 0xFFFFFFFF nid' tid' sid' : ls)) = Just $ l' : LocalInfo n a' a nid' tid' sid' : ls start (Just ls) = Just $ l' : ls start Nothing = Just [l'] a = dbgAddr s n = dbgSeqNo s l' = LocalInfo 0 a 0xFFFFFFFF nid tid sid
497
startLocal s r nid tid sid = s { dbgLocals = Map.alter start r (dbgLocals s) , dbgSeqNo = n + 1 } where start (Just (LocalInfo 0 a' 0xFFFFFFFF nid' tid' sid' : ls)) = Just $ l' : LocalInfo n a' a nid' tid' sid' : ls start (Just ls) = Just $ l' : ls start Nothing = Just [l'] a = dbgAddr s n = dbgSeqNo s l' = LocalInfo 0 a 0xFFFFFFFF nid tid sid
410
false
true
5
10
168
210
105
105
null
null
frantisekfarka/ghc-dsi
compiler/nativeGen/PPC/Ppr.hs
bsd-3-clause
pprInstr (MULLW reg1 reg2 ri@(RIImm _)) = pprLogic (sLit "mull") reg1 reg2 ri
77
pprInstr (MULLW reg1 reg2 ri@(RIImm _)) = pprLogic (sLit "mull") reg1 reg2 ri
77
pprInstr (MULLW reg1 reg2 ri@(RIImm _)) = pprLogic (sLit "mull") reg1 reg2 ri
77
false
false
0
9
12
44
21
23
null
null
mitchellwrosen/inline-c
src/Language/C/Inline/Context.hs
mit
funPtrAntiQuoter :: AntiQuoter HaskellIdentifier funPtrAntiQuoter = AntiQuoter { aqParser = cDeclAqParser , aqMarshaller = \purity cTypes cTy cId -> do hsTy <- convertType_ "funCtx" purity cTypes cTy hsExp <- getHsVariable "funCtx" cId case hsTy of TH.AppT (TH.ConT n) hsTy' | n == ''FunPtr -> do hsExp' <- [| \cont -> do funPtr <- $(mkFunPtr (return hsTy')) $(return hsExp) x <- cont funPtr freeHaskellFunPtr funPtr return x |] return (hsTy, hsExp') _ -> fail "The `fun' marshaller captures function pointers only" }
645
funPtrAntiQuoter :: AntiQuoter HaskellIdentifier funPtrAntiQuoter = AntiQuoter { aqParser = cDeclAqParser , aqMarshaller = \purity cTypes cTy cId -> do hsTy <- convertType_ "funCtx" purity cTypes cTy hsExp <- getHsVariable "funCtx" cId case hsTy of TH.AppT (TH.ConT n) hsTy' | n == ''FunPtr -> do hsExp' <- [| \cont -> do funPtr <- $(mkFunPtr (return hsTy')) $(return hsExp) x <- cont funPtr freeHaskellFunPtr funPtr return x |] return (hsTy, hsExp') _ -> fail "The `fun' marshaller captures function pointers only" }
645
funPtrAntiQuoter = AntiQuoter { aqParser = cDeclAqParser , aqMarshaller = \purity cTypes cTy cId -> do hsTy <- convertType_ "funCtx" purity cTypes cTy hsExp <- getHsVariable "funCtx" cId case hsTy of TH.AppT (TH.ConT n) hsTy' | n == ''FunPtr -> do hsExp' <- [| \cont -> do funPtr <- $(mkFunPtr (return hsTy')) $(return hsExp) x <- cont funPtr freeHaskellFunPtr funPtr return x |] return (hsTy, hsExp') _ -> fail "The `fun' marshaller captures function pointers only" }
596
false
true
0
18
208
142
69
73
null
null
tomwadeson/adventofcode
02.hs
mit
smallestSide :: Box -> Int smallestSide = minimum . sides
57
smallestSide :: Box -> Int smallestSide = minimum . sides
57
smallestSide = minimum . sides
30
false
true
0
5
9
19
10
9
null
null
vaporware/carnival
SendMail.hs
mit
sendMail :: Mail -> Handler () sendMail m = send =<< liftIO (overrideRecipients m) where send = if appSendMail compileTimeAppSettings then sendViaSendGrid else sendToLog
192
sendMail :: Mail -> Handler () sendMail m = send =<< liftIO (overrideRecipients m) where send = if appSendMail compileTimeAppSettings then sendViaSendGrid else sendToLog
192
sendMail m = send =<< liftIO (overrideRecipients m) where send = if appSendMail compileTimeAppSettings then sendViaSendGrid else sendToLog
161
false
true
0
8
46
55
27
28
null
null
distillation/language-core
Language/Core/Test/TestSyntax.hs
gpl-3.0
testRebuildBangType = [(LHE.UnBangedTy (LHE.TyVar (LHE.Ident "name"))) ~=? (rebuildBangType (makeBangDataType "name" [])), (LHE.UnBangedTy (LHE.TyApp (LHE.TyCon (LHE.UnQual (LHE.Ident "name"))) (LHE.TyVar (LHE.Ident "var")))) ~=? (rebuildBangType (makeBangDataType "name" ["var"])), (LHE.UnBangedTy (LHE.TyApp (LHE.TyApp (LHE.TyCon (LHE.UnQual (LHE.Ident "name"))) (LHE.TyVar (LHE.Ident "var"))) (LHE.TyVar (LHE.Ident "var'")))) ~=? (rebuildBangType (makeBangDataType "name" ["var", "var'"]))]
539
testRebuildBangType = [(LHE.UnBangedTy (LHE.TyVar (LHE.Ident "name"))) ~=? (rebuildBangType (makeBangDataType "name" [])), (LHE.UnBangedTy (LHE.TyApp (LHE.TyCon (LHE.UnQual (LHE.Ident "name"))) (LHE.TyVar (LHE.Ident "var")))) ~=? (rebuildBangType (makeBangDataType "name" ["var"])), (LHE.UnBangedTy (LHE.TyApp (LHE.TyApp (LHE.TyCon (LHE.UnQual (LHE.Ident "name"))) (LHE.TyVar (LHE.Ident "var"))) (LHE.TyVar (LHE.Ident "var'")))) ~=? (rebuildBangType (makeBangDataType "name" ["var", "var'"]))]
539
testRebuildBangType = [(LHE.UnBangedTy (LHE.TyVar (LHE.Ident "name"))) ~=? (rebuildBangType (makeBangDataType "name" [])), (LHE.UnBangedTy (LHE.TyApp (LHE.TyCon (LHE.UnQual (LHE.Ident "name"))) (LHE.TyVar (LHE.Ident "var")))) ~=? (rebuildBangType (makeBangDataType "name" ["var"])), (LHE.UnBangedTy (LHE.TyApp (LHE.TyApp (LHE.TyCon (LHE.UnQual (LHE.Ident "name"))) (LHE.TyVar (LHE.Ident "var"))) (LHE.TyVar (LHE.Ident "var'")))) ~=? (rebuildBangType (makeBangDataType "name" ["var", "var'"]))]
539
false
false
0
19
89
246
126
120
null
null
phaazon/OpenGLRaw
src/Graphics/Rendering/OpenGL/Raw/Tokens.hs
bsd-3-clause
gl_OBJECT_TYPE_ARB :: GLenum gl_OBJECT_TYPE_ARB = 0x8B4E
56
gl_OBJECT_TYPE_ARB :: GLenum gl_OBJECT_TYPE_ARB = 0x8B4E
56
gl_OBJECT_TYPE_ARB = 0x8B4E
27
false
true
0
4
5
11
6
5
null
null
spechub/Hets
TPTP/Parser.hs
gpl-2.0
-- <atomic_word> ::= <lower_word> | <single_quoted> -- %----<single_quoted> tokens do not include their outer quotes, therefore the -- %----<lower_word> <atomic_word> cat and the <single_quoted> <atomic_word> 'cat' -- %----are the same. Quotes must be removed from a <single_quoted> <atomic_word> -- %----if doing so produces a <lower_word> <atomic_word>. Note that <numbers>s -- %----and <variable>s are not <lower_word>s, so '123' and 123, and 'X' and X, -- %----are different. atomic_word :: CharParser st Token atomic_word = parserTrace "atomic_word" ( pToken lower_word <|> do s <- single_quoted let sNoQuotes = removeQuotes $ tokStr s case runParser lower_word () "" sNoQuotes of Right _ -> return $ s { tokStr = sNoQuotes } Left _ -> return s <?> "atomic_word" ) where removeQuotes :: String -> String removeQuotes = init . tail -- <atomic_defined_word> ::= <dollar_word>
931
atomic_word :: CharParser st Token atomic_word = parserTrace "atomic_word" ( pToken lower_word <|> do s <- single_quoted let sNoQuotes = removeQuotes $ tokStr s case runParser lower_word () "" sNoQuotes of Right _ -> return $ s { tokStr = sNoQuotes } Left _ -> return s <?> "atomic_word" ) where removeQuotes :: String -> String removeQuotes = init . tail -- <atomic_defined_word> ::= <dollar_word>
442
atomic_word = parserTrace "atomic_word" ( pToken lower_word <|> do s <- single_quoted let sNoQuotes = removeQuotes $ tokStr s case runParser lower_word () "" sNoQuotes of Right _ -> return $ s { tokStr = sNoQuotes } Left _ -> return s <?> "atomic_word" ) where removeQuotes :: String -> String removeQuotes = init . tail -- <atomic_defined_word> ::= <dollar_word>
407
true
true
2
16
183
139
70
69
null
null
wuerges/vlsi_verification
test/TestBase.hs
bsd-3-clause
fileNames = concat [complete f | f <- files]
44
fileNames = concat [complete f | f <- files]
44
fileNames = concat [complete f | f <- files]
44
false
false
1
8
8
27
11
16
null
null
markus-git/co-feldspar
src/Feldspar/Software/Optimize.hs
bsd-3-clause
-- | projection with a stronger constraint to allow using it in -- bidirectional patterns. prjBi :: (sub :<: sup) => sup sig -> Maybe (sub sig) prjBi = prj
157
prjBi :: (sub :<: sup) => sup sig -> Maybe (sub sig) prjBi = prj
64
prjBi = prj
11
true
true
0
9
31
40
21
19
null
null
GaloisInc/halvm-ghc
compiler/basicTypes/BasicTypes.hs
bsd-3-clause
tupleParens :: TupleSort -> SDoc -> SDoc tupleParens BoxedTuple p = parens p
81
tupleParens :: TupleSort -> SDoc -> SDoc tupleParens BoxedTuple p = parens p
81
tupleParens BoxedTuple p = parens p
40
false
true
0
6
17
32
14
18
null
null
Wolfchase/Sniffer
dist/build/autogen/Paths_sniffer.hs
gpl-3.0
getBinDir, getLibDir, getDataDir, getLibexecDir, getSysconfDir :: IO FilePath getBinDir = catchIO (getEnv "sniffer_bindir") (\_ -> return bindir)
145
getBinDir, getLibDir, getDataDir, getLibexecDir, getSysconfDir :: IO FilePath getBinDir = catchIO (getEnv "sniffer_bindir") (\_ -> return bindir)
145
getBinDir = catchIO (getEnv "sniffer_bindir") (\_ -> return bindir)
67
false
true
0
8
16
44
26
18
null
null
ideas-edu/ideas
src/Ideas/Common/Strategy/Configuration.hs
apache-2.0
repeatDecl :: Decl Unary -- fix me: overlap with combinators repeatDecl = "repeat1" .=. Unary repeat1
102
repeatDecl :: Decl Unary repeatDecl = "repeat1" .=. Unary repeat1
65
repeatDecl = "repeat1" .=. Unary repeat1
40
true
true
0
6
16
22
11
11
null
null
plcplc/encapsulated-resources
src/System/EncapsulatedResources.hs
gpl-3.0
-- ^ Wildcard matching -- | Initialize the mechanics for interacting with resources in this process -- resource. runResourceM :: ResourcesPosixSettings -> String -> ResourceM a -> IO () runResourceM settings name act = do rootDir <- maybe (getProgName >>= mkdtemp) (pure) (rpsRootDir settings) rootChan <- atomically $ newTChan tId <- myThreadId rootRes <- atomically $ newRes name rootDir rootChan tId (return ()) catch (evalStateT act rootRes >> return ()) (\DestroyResourceException -> tryRmDirRec rootDir) -- | Just try to remove a dir, and disregard all errors.
594
runResourceM :: ResourcesPosixSettings -> String -> ResourceM a -> IO () runResourceM settings name act = do rootDir <- maybe (getProgName >>= mkdtemp) (pure) (rpsRootDir settings) rootChan <- atomically $ newTChan tId <- myThreadId rootRes <- atomically $ newRes name rootDir rootChan tId (return ()) catch (evalStateT act rootRes >> return ()) (\DestroyResourceException -> tryRmDirRec rootDir) -- | Just try to remove a dir, and disregard all errors.
480
runResourceM settings name act = do rootDir <- maybe (getProgName >>= mkdtemp) (pure) (rpsRootDir settings) rootChan <- atomically $ newTChan tId <- myThreadId rootRes <- atomically $ newRes name rootDir rootChan tId (return ()) catch (evalStateT act rootRes >> return ()) (\DestroyResourceException -> tryRmDirRec rootDir) -- | Just try to remove a dir, and disregard all errors.
407
true
true
0
13
113
162
77
85
null
null
phischu/fragnix
tests/packages/scotty/System.FilePath.Posix.hs
bsd-3-clause
-- | Delete the drive, if it exists. -- -- > dropDrive x == snd (splitDrive x) dropDrive :: FilePath -> FilePath dropDrive = snd . splitDrive
141
dropDrive :: FilePath -> FilePath dropDrive = snd . splitDrive
62
dropDrive = snd . splitDrive
28
true
true
0
5
26
22
13
9
null
null
sopvop/snap-core
test/Snap/Core/Tests.hs
bsd-3-clause
go :: Snap a -> IO (Request,Response) go m = do zomgRq <- mkZomgRq runSnap m dummy timeoutModifier zomgRq where dummy !x = return $! (show x `using` rdeepseq) `seq` () timeoutModifier !f = return $! f 0 `seq` () ------------------------------------------------------------------------------
310
go :: Snap a -> IO (Request,Response) go m = do zomgRq <- mkZomgRq runSnap m dummy timeoutModifier zomgRq where dummy !x = return $! (show x `using` rdeepseq) `seq` () timeoutModifier !f = return $! f 0 `seq` () ------------------------------------------------------------------------------
310
go m = do zomgRq <- mkZomgRq runSnap m dummy timeoutModifier zomgRq where dummy !x = return $! (show x `using` rdeepseq) `seq` () timeoutModifier !f = return $! f 0 `seq` () ------------------------------------------------------------------------------
272
false
true
0
9
60
114
56
58
null
null
AndreasPK/stack
src/Data/Maybe/Extra.hs
bsd-3-clause
-- | @'forMaybeA' '==' 'flip' 'mapMaybeA'@ forMaybeA :: Applicative f => [a] -> (a -> f (Maybe b)) -> f [b] forMaybeA = flip mapMaybeA
134
forMaybeA :: Applicative f => [a] -> (a -> f (Maybe b)) -> f [b] forMaybeA = flip mapMaybeA
91
forMaybeA = flip mapMaybeA
26
true
true
0
13
24
61
29
32
null
null
pgj/bead
src/Bead/Persistence/SQL/TestData.hs
bsd-3-clause
reg = UserRegistration "username" "email" "name" "token" time
61
reg = UserRegistration "username" "email" "name" "token" time
61
reg = UserRegistration "username" "email" "name" "token" time
61
false
false
1
5
7
20
8
12
null
null
vincenthz/hs-cryptohash
Tests/KAT.hs
bsd-3-clause
sha512Hash = HashFct { fctHash = SHA512.hash, fctInc = hashinc SHA512.init SHA512.update SHA512.finalize }
106
sha512Hash = HashFct { fctHash = SHA512.hash, fctInc = hashinc SHA512.init SHA512.update SHA512.finalize }
106
sha512Hash = HashFct { fctHash = SHA512.hash, fctInc = hashinc SHA512.init SHA512.update SHA512.finalize }
106
false
false
1
9
13
42
20
22
null
null
spechub/Hets
HasCASL/Morphism.hs
gpl-2.0
-- | only rename the kinds in a type mapKindsOfType :: IdMap -> TypeMap -> IdMap -> Type -> Type mapKindsOfType jm tm im = foldType mapTypeRec { foldTypeAbs = \ _ -> TypeAbs . mapTypeArg jm tm im , foldKindedType = \ _ t -> KindedType t . Set.map (mapKindI jm) }
270
mapKindsOfType :: IdMap -> TypeMap -> IdMap -> Type -> Type mapKindsOfType jm tm im = foldType mapTypeRec { foldTypeAbs = \ _ -> TypeAbs . mapTypeArg jm tm im , foldKindedType = \ _ t -> KindedType t . Set.map (mapKindI jm) }
233
mapKindsOfType jm tm im = foldType mapTypeRec { foldTypeAbs = \ _ -> TypeAbs . mapTypeArg jm tm im , foldKindedType = \ _ t -> KindedType t . Set.map (mapKindI jm) }
173
true
true
0
12
60
97
49
48
null
null
mrakgr/futhark
src/Futhark/Pass/ExtractKernels.hs
bsd-3-clause
isSegmentedOp :: KernelNest -> [Int] -> SubExp -> Out.Lambda -> [(SubExp, VName)] -> (Pattern -> Pattern -> SubExp -> SubExp -> [(SubExp, VName)] -> Binder Out.Kernels ()) -> KernelM (Maybe [Out.Binding]) isSegmentedOp nest perm segment_size lam scan_inps m = runMaybeT $ do -- We must verify that array inputs to the operation are inputs to -- the outermost loop nesting or free in the loop nest, and that -- none of the names bound by the loop nest are used in the lambda. -- Furthermore, the neutral elements must be free in the loop nest. let bound_by_nest = boundInKernelNest nest (pre_bnds, nesting_size, ispace, kernel_inps, _rets) <- flatKernel nest unless (HS.null $ freeInLambda lam `HS.intersection` bound_by_nest) $ fail "Lambda uses nest-bound parameters." let indices = map fst ispace prepareInput (ne, arr) = do case ne of Var v | v `HS.member` bound_by_nest -> fail "Neutral element bound in nest" _ -> return () case find ((==arr) . kernelInputName) kernel_inps of Just inp | kernelInputIndices inp == map Var indices -> return $ return (ne, kernelInputArray inp) Nothing | not (arr `HS.member` bound_by_nest) -> return $ do -- This input is something that is free outside -- the loop nesting. We will have to replicate -- it. arr' <- letExp (baseString arr ++ "_repd") $ PrimOp $ Replicate segment_size $ Var arr return (ne, arr') _ -> fail "Input not free or outermost." mk_inps <- mapM prepareInput scan_inps lift $ runBinder_ $ do mapM_ addBinding pre_bnds -- We must make sure all inputs are of size -- segment_size*nesting_size. total_num_elements <- letSubExp "total_num_elements" $ PrimOp $ BinOp (Mul Int32) segment_size nesting_size let flatten (ne, arr) = do ne_shape <- arrayShape <$> subExpType ne arr_shape <- arrayShape <$> lookupType arr let reshape = reshapeOuter [DimNew total_num_elements] (shapeRank arr_shape - shapeRank ne_shape) arr_shape arr_manifest <- letExp (baseString arr ++ "_manifest") $ PrimOp $ Copy arr arr' <- letExp (baseString arr ++ "_flat") $ PrimOp $ Reshape [] reshape arr_manifest return (ne, arr') op_inps' <- mapM flatten =<< sequence mk_inps let pat = Pattern [] $ rearrangeShape perm $ patternValueElements $ loopNestingPattern $ fst nest flatPatElem pat_elem t = do let t' = arrayOfRow t total_num_elements name <- newVName $ baseString (patElemName pat_elem) ++ "_flat" return $ PatElem name BindVar t' flat_pat <- Pattern [] <$> zipWithM flatPatElem (patternValueElements pat) (lambdaReturnType lam) m pat flat_pat nesting_size total_num_elements op_inps'
3,283
isSegmentedOp :: KernelNest -> [Int] -> SubExp -> Out.Lambda -> [(SubExp, VName)] -> (Pattern -> Pattern -> SubExp -> SubExp -> [(SubExp, VName)] -> Binder Out.Kernels ()) -> KernelM (Maybe [Out.Binding]) isSegmentedOp nest perm segment_size lam scan_inps m = runMaybeT $ do -- We must verify that array inputs to the operation are inputs to -- the outermost loop nesting or free in the loop nest, and that -- none of the names bound by the loop nest are used in the lambda. -- Furthermore, the neutral elements must be free in the loop nest. let bound_by_nest = boundInKernelNest nest (pre_bnds, nesting_size, ispace, kernel_inps, _rets) <- flatKernel nest unless (HS.null $ freeInLambda lam `HS.intersection` bound_by_nest) $ fail "Lambda uses nest-bound parameters." let indices = map fst ispace prepareInput (ne, arr) = do case ne of Var v | v `HS.member` bound_by_nest -> fail "Neutral element bound in nest" _ -> return () case find ((==arr) . kernelInputName) kernel_inps of Just inp | kernelInputIndices inp == map Var indices -> return $ return (ne, kernelInputArray inp) Nothing | not (arr `HS.member` bound_by_nest) -> return $ do -- This input is something that is free outside -- the loop nesting. We will have to replicate -- it. arr' <- letExp (baseString arr ++ "_repd") $ PrimOp $ Replicate segment_size $ Var arr return (ne, arr') _ -> fail "Input not free or outermost." mk_inps <- mapM prepareInput scan_inps lift $ runBinder_ $ do mapM_ addBinding pre_bnds -- We must make sure all inputs are of size -- segment_size*nesting_size. total_num_elements <- letSubExp "total_num_elements" $ PrimOp $ BinOp (Mul Int32) segment_size nesting_size let flatten (ne, arr) = do ne_shape <- arrayShape <$> subExpType ne arr_shape <- arrayShape <$> lookupType arr let reshape = reshapeOuter [DimNew total_num_elements] (shapeRank arr_shape - shapeRank ne_shape) arr_shape arr_manifest <- letExp (baseString arr ++ "_manifest") $ PrimOp $ Copy arr arr' <- letExp (baseString arr ++ "_flat") $ PrimOp $ Reshape [] reshape arr_manifest return (ne, arr') op_inps' <- mapM flatten =<< sequence mk_inps let pat = Pattern [] $ rearrangeShape perm $ patternValueElements $ loopNestingPattern $ fst nest flatPatElem pat_elem t = do let t' = arrayOfRow t total_num_elements name <- newVName $ baseString (patElemName pat_elem) ++ "_flat" return $ PatElem name BindVar t' flat_pat <- Pattern [] <$> zipWithM flatPatElem (patternValueElements pat) (lambdaReturnType lam) m pat flat_pat nesting_size total_num_elements op_inps'
3,283
isSegmentedOp nest perm segment_size lam scan_inps m = runMaybeT $ do -- We must verify that array inputs to the operation are inputs to -- the outermost loop nesting or free in the loop nest, and that -- none of the names bound by the loop nest are used in the lambda. -- Furthermore, the neutral elements must be free in the loop nest. let bound_by_nest = boundInKernelNest nest (pre_bnds, nesting_size, ispace, kernel_inps, _rets) <- flatKernel nest unless (HS.null $ freeInLambda lam `HS.intersection` bound_by_nest) $ fail "Lambda uses nest-bound parameters." let indices = map fst ispace prepareInput (ne, arr) = do case ne of Var v | v `HS.member` bound_by_nest -> fail "Neutral element bound in nest" _ -> return () case find ((==arr) . kernelInputName) kernel_inps of Just inp | kernelInputIndices inp == map Var indices -> return $ return (ne, kernelInputArray inp) Nothing | not (arr `HS.member` bound_by_nest) -> return $ do -- This input is something that is free outside -- the loop nesting. We will have to replicate -- it. arr' <- letExp (baseString arr ++ "_repd") $ PrimOp $ Replicate segment_size $ Var arr return (ne, arr') _ -> fail "Input not free or outermost." mk_inps <- mapM prepareInput scan_inps lift $ runBinder_ $ do mapM_ addBinding pre_bnds -- We must make sure all inputs are of size -- segment_size*nesting_size. total_num_elements <- letSubExp "total_num_elements" $ PrimOp $ BinOp (Mul Int32) segment_size nesting_size let flatten (ne, arr) = do ne_shape <- arrayShape <$> subExpType ne arr_shape <- arrayShape <$> lookupType arr let reshape = reshapeOuter [DimNew total_num_elements] (shapeRank arr_shape - shapeRank ne_shape) arr_shape arr_manifest <- letExp (baseString arr ++ "_manifest") $ PrimOp $ Copy arr arr' <- letExp (baseString arr ++ "_flat") $ PrimOp $ Reshape [] reshape arr_manifest return (ne, arr') op_inps' <- mapM flatten =<< sequence mk_inps let pat = Pattern [] $ rearrangeShape perm $ patternValueElements $ loopNestingPattern $ fst nest flatPatElem pat_elem t = do let t' = arrayOfRow t total_num_elements name <- newVName $ baseString (patElemName pat_elem) ++ "_flat" return $ PatElem name BindVar t' flat_pat <- Pattern [] <$> zipWithM flatPatElem (patternValueElements pat) (lambdaReturnType lam) m pat flat_pat nesting_size total_num_elements op_inps'
2,904
false
true
0
27
1,153
814
389
425
null
null
tjakway/ghcjvm
compiler/types/Coercion.hs
bsd-3-clause
seqCo (AppCo co1 co2) = seqCo co1 `seq` seqCo co2
59
seqCo (AppCo co1 co2) = seqCo co1 `seq` seqCo co2
59
seqCo (AppCo co1 co2) = seqCo co1 `seq` seqCo co2
59
false
false
0
6
19
30
14
16
null
null
githubkleon/ConvenientHDL
src/Language/Cynide/PrettyPrint.hs
bsd-3-clause
-- ----------------------------------------------------------------------------- -- Miscellaneous ppParamAssigns :: [ParamAssign] -> Doc ppParamAssigns paramAssigns = commasep (map ppParamAssign paramAssigns)
211
ppParamAssigns :: [ParamAssign] -> Doc ppParamAssigns paramAssigns = commasep (map ppParamAssign paramAssigns)
112
ppParamAssigns paramAssigns = commasep (map ppParamAssign paramAssigns)
73
true
true
0
7
18
40
19
21
null
null
axch/dysvunctional-language
haskell-fol/FOL/Language/Expression.hs
agpl-3.0
fringe (AnnVectorSh ss) = concatMap fringe ss
46
fringe (AnnVectorSh ss) = concatMap fringe ss
46
fringe (AnnVectorSh ss) = concatMap fringe ss
46
false
false
0
6
7
21
9
12
null
null
yihuang/cabal-install
Main.hs
bsd-3-clause
unpackAction :: UnpackFlags -> [String] -> GlobalFlags -> IO () unpackAction unpackFlags extraArgs globalFlags = do let verbosity = fromFlag (unpackVerbosity unpackFlags) targets <- readUserTargets verbosity extraArgs config <- loadConfig verbosity (globalConfigFile globalFlags) mempty let globalFlags' = savedGlobalFlags config `mappend` globalFlags unpack verbosity (globalRepos (savedGlobalFlags config)) globalFlags' unpackFlags targets
487
unpackAction :: UnpackFlags -> [String] -> GlobalFlags -> IO () unpackAction unpackFlags extraArgs globalFlags = do let verbosity = fromFlag (unpackVerbosity unpackFlags) targets <- readUserTargets verbosity extraArgs config <- loadConfig verbosity (globalConfigFile globalFlags) mempty let globalFlags' = savedGlobalFlags config `mappend` globalFlags unpack verbosity (globalRepos (savedGlobalFlags config)) globalFlags' unpackFlags targets
487
unpackAction unpackFlags extraArgs globalFlags = do let verbosity = fromFlag (unpackVerbosity unpackFlags) targets <- readUserTargets verbosity extraArgs config <- loadConfig verbosity (globalConfigFile globalFlags) mempty let globalFlags' = savedGlobalFlags config `mappend` globalFlags unpack verbosity (globalRepos (savedGlobalFlags config)) globalFlags' unpackFlags targets
423
false
true
0
12
94
132
62
70
null
null
seckcoder/vector
Data/Vector/Fusion/Bundle/Monadic.hs
bsd-3-clause
foldl f = foldlM (\a b -> return (f a b))
41
foldl f = foldlM (\a b -> return (f a b))
41
foldl f = foldlM (\a b -> return (f a b))
41
false
false
1
10
10
37
16
21
null
null
distrap/ivory-tower-canopen
src/CANOpen/Tower/NMT.hs
bsd-3-clause
nmtCmd Stop = 0x02
18
nmtCmd Stop = 0x02
18
nmtCmd Stop = 0x02
18
false
false
0
5
3
9
4
5
null
null
nickng/gong
GoTypes.hs
apache-2.0
unfoldTop :: Eqn -> M Eqn unfoldTop (EqnSys bnd) = do (r,body) <- unbind bnd let vars = unrec r let newbody = L.foldr (\(x,Embed rhs) body -> subst x rhs body) body vars bla <- unfoldType newbody return $ EqnSys (bind (rec vars) bla) ---- Fencing predicate for types ---- -- G ; ~y ; ~z |-t T -- G records previously encountered recursive calls -- ~y represents names that t can use if T is single-threaded -- ~z represents names that a sub-process of T can use if T is multi-threaded -- EqnSys (Bind (Rec [(EqnName , Embed GoType)]) GoType)
568
unfoldTop :: Eqn -> M Eqn unfoldTop (EqnSys bnd) = do (r,body) <- unbind bnd let vars = unrec r let newbody = L.foldr (\(x,Embed rhs) body -> subst x rhs body) body vars bla <- unfoldType newbody return $ EqnSys (bind (rec vars) bla) ---- Fencing predicate for types ---- -- G ; ~y ; ~z |-t T -- G records previously encountered recursive calls -- ~y represents names that t can use if T is single-threaded -- ~z represents names that a sub-process of T can use if T is multi-threaded -- EqnSys (Bind (Rec [(EqnName , Embed GoType)]) GoType)
568
unfoldTop (EqnSys bnd) = do (r,body) <- unbind bnd let vars = unrec r let newbody = L.foldr (\(x,Embed rhs) body -> subst x rhs body) body vars bla <- unfoldType newbody return $ EqnSys (bind (rec vars) bla) ---- Fencing predicate for types ---- -- G ; ~y ; ~z |-t T -- G records previously encountered recursive calls -- ~y represents names that t can use if T is single-threaded -- ~z represents names that a sub-process of T can use if T is multi-threaded -- EqnSys (Bind (Rec [(EqnName , Embed GoType)]) GoType)
542
false
true
0
14
128
139
69
70
null
null
jbddc/vf-verifier
src/VCGenerator.hs
gpl-3.0
replaceExp idents s expr (Addition e1 e2) = Addition (replaceExp idents s expr e1) (replaceExp idents s expr e2)
112
replaceExp idents s expr (Addition e1 e2) = Addition (replaceExp idents s expr e1) (replaceExp idents s expr e2)
112
replaceExp idents s expr (Addition e1 e2) = Addition (replaceExp idents s expr e1) (replaceExp idents s expr e2)
112
false
false
0
7
18
52
25
27
null
null
rkday/github-dashboard
github-dashboard.hs
mit
ain = do cfg <- load [Required "./githubissues.cfg"] lst <- require cfg "repoNames" user <- require cfg "repoOwner" oauthToken <- Data.Configurator.lookup cfg "oauthToken" let oauth = fmap GithubOAuth oauthToken ctd <- newIORef $ CrossThreadData (Right []) (Right []) (Right []) (-1) (-1) forkIO $ updateIssuesLoop user lst oauth ctd scotty 3005 $ do get "/prs" $ do openPRs <- liftIO $ fmap prs $ readIORef ctd scottyPRs openPRs (-1) (-1) get "/issues" $ do openIssues <- liftIO $ fmap issues $ readIORef ctd ro <- liftIO $ fmap recentlyOpenedCount $ readIORef ctd rc <- liftIO $ fmap recentlyClosedCount $ readIORef ctd scottyPRs openIssues ro rc get "/recentlyClosed" $ do issues <- liftIO $ fmap recentlyClosedIssues $ readIORef ctd scottyPRs issues 0 0 get "/dashboard" $ file "./dashboard.html" get "/dashboard.js" $ file "./dashboard.js"
1,113
main = do cfg <- load [Required "./githubissues.cfg"] lst <- require cfg "repoNames" user <- require cfg "repoOwner" oauthToken <- Data.Configurator.lookup cfg "oauthToken" let oauth = fmap GithubOAuth oauthToken ctd <- newIORef $ CrossThreadData (Right []) (Right []) (Right []) (-1) (-1) forkIO $ updateIssuesLoop user lst oauth ctd scotty 3005 $ do get "/prs" $ do openPRs <- liftIO $ fmap prs $ readIORef ctd scottyPRs openPRs (-1) (-1) get "/issues" $ do openIssues <- liftIO $ fmap issues $ readIORef ctd ro <- liftIO $ fmap recentlyOpenedCount $ readIORef ctd rc <- liftIO $ fmap recentlyClosedCount $ readIORef ctd scottyPRs openIssues ro rc get "/recentlyClosed" $ do issues <- liftIO $ fmap recentlyClosedIssues $ readIORef ctd scottyPRs issues 0 0 get "/dashboard" $ file "./dashboard.html" get "/dashboard.js" $ file "./dashboard.js"
1,113
main = do cfg <- load [Required "./githubissues.cfg"] lst <- require cfg "repoNames" user <- require cfg "repoOwner" oauthToken <- Data.Configurator.lookup cfg "oauthToken" let oauth = fmap GithubOAuth oauthToken ctd <- newIORef $ CrossThreadData (Right []) (Right []) (Right []) (-1) (-1) forkIO $ updateIssuesLoop user lst oauth ctd scotty 3005 $ do get "/prs" $ do openPRs <- liftIO $ fmap prs $ readIORef ctd scottyPRs openPRs (-1) (-1) get "/issues" $ do openIssues <- liftIO $ fmap issues $ readIORef ctd ro <- liftIO $ fmap recentlyOpenedCount $ readIORef ctd rc <- liftIO $ fmap recentlyClosedCount $ readIORef ctd scottyPRs openIssues ro rc get "/recentlyClosed" $ do issues <- liftIO $ fmap recentlyClosedIssues $ readIORef ctd scottyPRs issues 0 0 get "/dashboard" $ file "./dashboard.html" get "/dashboard.js" $ file "./dashboard.js"
1,113
false
false
0
16
400
358
157
201
null
null
nimia/bottle
codeedit/Editor/CodeEdit/ExpressionEdit.hs
gpl-3.0
expressionEventMap :: MonadF m => Ancestry.ExpressionAncestry m -> DataOps.ExpressionPtr m -> HoleResultPicker m -> CTransaction ViewTag m (EventHandlers (Transaction ViewTag m)) expressionEventMap ancestry exprPtr holePicker = do (addArgDoc, addArgHandler) <- transaction $ NextArg.makeAddArgHandler ancestry exprPtr return . mconcat $ [ moveUnlessOnHole . Widget.actionEventMapMovesCursor Config.giveAsArgumentKeys "Give as argument" . WidgetIds.diveIn $ DataOps.giveAsArg exprPtr , moveUnlessOnHole . Widget.actionEventMapMovesCursor Config.callWithArgumentKeys "Call with argument" . WidgetIds.diveIn $ DataOps.callWithArg exprPtr , pickResultFirst $ Widget.actionEventMapMovesCursor Config.addNextArgumentKeys addArgDoc addArgHandler , ifHole (const mempty) $ replaceEventMap ancestry exprPtr , Widget.actionEventMapMovesCursor Config.lambdaWrapKeys "Lambda wrap" . WidgetIds.diveIn $ DataOps.lambdaWrap exprPtr ] where moveUnlessOnHole = ifHole $ (const . fmap . liftM . Widget.atECursor . const) Nothing pickResultFirst = ifHole $ maybe id (fmap . joinEvents) ifHole whenHole = foldHolePicker id whenHole holePicker joinEvents x y = do r <- liftM Widget.eAnimIdMapping x (liftM . Widget.atEAnimIdMapping) (. r) y
1,351
expressionEventMap :: MonadF m => Ancestry.ExpressionAncestry m -> DataOps.ExpressionPtr m -> HoleResultPicker m -> CTransaction ViewTag m (EventHandlers (Transaction ViewTag m)) expressionEventMap ancestry exprPtr holePicker = do (addArgDoc, addArgHandler) <- transaction $ NextArg.makeAddArgHandler ancestry exprPtr return . mconcat $ [ moveUnlessOnHole . Widget.actionEventMapMovesCursor Config.giveAsArgumentKeys "Give as argument" . WidgetIds.diveIn $ DataOps.giveAsArg exprPtr , moveUnlessOnHole . Widget.actionEventMapMovesCursor Config.callWithArgumentKeys "Call with argument" . WidgetIds.diveIn $ DataOps.callWithArg exprPtr , pickResultFirst $ Widget.actionEventMapMovesCursor Config.addNextArgumentKeys addArgDoc addArgHandler , ifHole (const mempty) $ replaceEventMap ancestry exprPtr , Widget.actionEventMapMovesCursor Config.lambdaWrapKeys "Lambda wrap" . WidgetIds.diveIn $ DataOps.lambdaWrap exprPtr ] where moveUnlessOnHole = ifHole $ (const . fmap . liftM . Widget.atECursor . const) Nothing pickResultFirst = ifHole $ maybe id (fmap . joinEvents) ifHole whenHole = foldHolePicker id whenHole holePicker joinEvents x y = do r <- liftM Widget.eAnimIdMapping x (liftM . Widget.atEAnimIdMapping) (. r) y
1,351
expressionEventMap ancestry exprPtr holePicker = do (addArgDoc, addArgHandler) <- transaction $ NextArg.makeAddArgHandler ancestry exprPtr return . mconcat $ [ moveUnlessOnHole . Widget.actionEventMapMovesCursor Config.giveAsArgumentKeys "Give as argument" . WidgetIds.diveIn $ DataOps.giveAsArg exprPtr , moveUnlessOnHole . Widget.actionEventMapMovesCursor Config.callWithArgumentKeys "Call with argument" . WidgetIds.diveIn $ DataOps.callWithArg exprPtr , pickResultFirst $ Widget.actionEventMapMovesCursor Config.addNextArgumentKeys addArgDoc addArgHandler , ifHole (const mempty) $ replaceEventMap ancestry exprPtr , Widget.actionEventMapMovesCursor Config.lambdaWrapKeys "Lambda wrap" . WidgetIds.diveIn $ DataOps.lambdaWrap exprPtr ] where moveUnlessOnHole = ifHole $ (const . fmap . liftM . Widget.atECursor . const) Nothing pickResultFirst = ifHole $ maybe id (fmap . joinEvents) ifHole whenHole = foldHolePicker id whenHole holePicker joinEvents x y = do r <- liftM Widget.eAnimIdMapping x (liftM . Widget.atEAnimIdMapping) (. r) y
1,162
false
true
3
14
269
355
171
184
null
null
peterokagey/haskellOEIS
src/Helpers/GridPolytopes.hs
apache-2.0
-- Hexagons with side length k, all nonnegative coordinates, and touching the coordinate planes normalized :: Polygon -> Integer -> [VertexSet] normalized polygon k = nub $ map (\[v,u] -> makeShape polygon v u) $ adjacentSides polygon k
236
normalized :: Polygon -> Integer -> [VertexSet] normalized polygon k = nub $ map (\[v,u] -> makeShape polygon v u) $ adjacentSides polygon k
140
normalized polygon k = nub $ map (\[v,u] -> makeShape polygon v u) $ adjacentSides polygon k
92
true
true
2
9
37
71
35
36
null
null
codecurve/FieldML-Haskell-01
src/FieldML/Utility01.hs
bsd-2-clause
cardinality (Labels (StringLabels a)) = size a
46
cardinality (Labels (StringLabels a)) = size a
46
cardinality (Labels (StringLabels a)) = size a
46
false
false
0
8
6
25
11
14
null
null
TypeDB/keyvalue
Database/KeyValue/LogOperations.hs
gpl-3.0
addNewRecord :: FilePath -> IO (Handle, Handle) addNewRecord dir = do (hintFile, hintHandle) <- openNewBinaryFile dir hintExt recordHandle <- openBinaryFile (replaceExtension hintFile recordExt) ReadWriteMode hSetBuffering hintHandle NoBuffering hSetBuffering recordHandle NoBuffering return (hintHandle, recordHandle) -- | Get all the keys from the hint files -- In case of conflict, keep the copy with the latest timestamp
435
addNewRecord :: FilePath -> IO (Handle, Handle) addNewRecord dir = do (hintFile, hintHandle) <- openNewBinaryFile dir hintExt recordHandle <- openBinaryFile (replaceExtension hintFile recordExt) ReadWriteMode hSetBuffering hintHandle NoBuffering hSetBuffering recordHandle NoBuffering return (hintHandle, recordHandle) -- | Get all the keys from the hint files -- In case of conflict, keep the copy with the latest timestamp
435
addNewRecord dir = do (hintFile, hintHandle) <- openNewBinaryFile dir hintExt recordHandle <- openBinaryFile (replaceExtension hintFile recordExt) ReadWriteMode hSetBuffering hintHandle NoBuffering hSetBuffering recordHandle NoBuffering return (hintHandle, recordHandle) -- | Get all the keys from the hint files -- In case of conflict, keep the copy with the latest timestamp
387
false
true
0
10
65
95
46
49
null
null
Oblosys/webviews
src/lib/BlazeHtml.hs
mit
html !!! attrs = foldl (!) html attrs
37
html !!! attrs = foldl (!) html attrs
37
html !!! attrs = foldl (!) html attrs
37
false
false
3
5
7
23
10
13
null
null
ulricha/dsh
src/Database/DSH/SL/Opt/Properties/BottomUp.hs
bsd-3-clause
-- FIXME this is (almost) identical to its X100 counterpart -> merge inferWorker :: NodeMap (SLOp r e) -> SLOp r e -> AlgNode -> NodeMap BottomUpProps -> BottomUpProps inferWorker d op node pm = case op of TerOp vl c1 c2 c3 -> let c1Props = lookupUnsafe pm "no children properties" c1 c2Props = lookupUnsafe pm "no children properties" c2 c3Props = lookupUnsafe pm "no children properties" c3 in checkError d node [c1Props, c2Props, c3Props] pm $ inferTerOp vl c1Props c2Props c3Props BinOp vl c1 c2 -> let c1Props = lookupUnsafe pm "no children properties" c1 c2Props = lookupUnsafe pm "no children properties" c2 in checkError d node [c1Props, c2Props] pm $ inferBinOp vl c1Props c2Props UnOp vl c -> let cProps = lookupUnsafe pm "no children properties" c in checkError d node [cProps] pm $ inferUnOp vl cProps NullaryOp vl -> checkError d node [] pm $ inferNullOp vl
1,021
inferWorker :: NodeMap (SLOp r e) -> SLOp r e -> AlgNode -> NodeMap BottomUpProps -> BottomUpProps inferWorker d op node pm = case op of TerOp vl c1 c2 c3 -> let c1Props = lookupUnsafe pm "no children properties" c1 c2Props = lookupUnsafe pm "no children properties" c2 c3Props = lookupUnsafe pm "no children properties" c3 in checkError d node [c1Props, c2Props, c3Props] pm $ inferTerOp vl c1Props c2Props c3Props BinOp vl c1 c2 -> let c1Props = lookupUnsafe pm "no children properties" c1 c2Props = lookupUnsafe pm "no children properties" c2 in checkError d node [c1Props, c2Props] pm $ inferBinOp vl c1Props c2Props UnOp vl c -> let cProps = lookupUnsafe pm "no children properties" c in checkError d node [cProps] pm $ inferUnOp vl cProps NullaryOp vl -> checkError d node [] pm $ inferNullOp vl
952
inferWorker d op node pm = case op of TerOp vl c1 c2 c3 -> let c1Props = lookupUnsafe pm "no children properties" c1 c2Props = lookupUnsafe pm "no children properties" c2 c3Props = lookupUnsafe pm "no children properties" c3 in checkError d node [c1Props, c2Props, c3Props] pm $ inferTerOp vl c1Props c2Props c3Props BinOp vl c1 c2 -> let c1Props = lookupUnsafe pm "no children properties" c1 c2Props = lookupUnsafe pm "no children properties" c2 in checkError d node [c1Props, c2Props] pm $ inferBinOp vl c1Props c2Props UnOp vl c -> let cProps = lookupUnsafe pm "no children properties" c in checkError d node [cProps] pm $ inferUnOp vl cProps NullaryOp vl -> checkError d node [] pm $ inferNullOp vl
853
true
true
0
12
301
300
141
159
null
null
brendanhay/gogol
gogol-dfareporting/gen/Network/Google/Resource/DFAReporting/RemarketingLists/Patch.hs
mpl-2.0
-- | OAuth access token. rlpAccessToken :: Lens' RemarketingListsPatch (Maybe Text) rlpAccessToken = lens _rlpAccessToken (\ s a -> s{_rlpAccessToken = a})
163
rlpAccessToken :: Lens' RemarketingListsPatch (Maybe Text) rlpAccessToken = lens _rlpAccessToken (\ s a -> s{_rlpAccessToken = a})
138
rlpAccessToken = lens _rlpAccessToken (\ s a -> s{_rlpAccessToken = a})
79
true
true
1
9
29
51
25
26
null
null
jhickner/haskell-modbus
test/Data/ModbusSpec.hs
bsd-3-clause
singleEncodeResult :: [ByteString] singleEncodeResult = pack <$> [ [1,0,1,0,1] , [2,0,1,0,1] , [3,0,1,0,1] , [4,0,1,0,1] , [5,0,1,0,1] , [6,0,1,0,1] , [8,0,1,0,1] , [15,0,1,0,0,0,49,49,49,49] , [16,0,1,0,2,1,49,49,49,49] ]
492
singleEncodeResult :: [ByteString] singleEncodeResult = pack <$> [ [1,0,1,0,1] , [2,0,1,0,1] , [3,0,1,0,1] , [4,0,1,0,1] , [5,0,1,0,1] , [6,0,1,0,1] , [8,0,1,0,1] , [15,0,1,0,0,0,49,49,49,49] , [16,0,1,0,2,1,49,49,49,49] ]
492
singleEncodeResult = pack <$> [ [1,0,1,0,1] , [2,0,1,0,1] , [3,0,1,0,1] , [4,0,1,0,1] , [5,0,1,0,1] , [6,0,1,0,1] , [8,0,1,0,1] , [15,0,1,0,0,0,49,49,49,49] , [16,0,1,0,2,1,49,49,49,49] ]
457
false
true
0
8
295
217
139
78
null
null
rueshyna/gogol
gogol-dfareporting/gen/Network/Google/DFAReporting/Types/Product.hs
mpl-2.0
-- | Whether Flash assets associated with the creative need to be -- automatically converted to HTML5. This flag is enabled by default and -- users can choose to disable it if they don\'t want the system to -- generate and use HTML5 asset for this creative. Applicable to the -- following creative type: FLASH_INPAGE. Applicable to DISPLAY when the -- primary asset type is not HTML_IMAGE. creConvertFlashToHTML5 :: Lens' Creative (Maybe Bool) creConvertFlashToHTML5 = lens _creConvertFlashToHTML5 (\ s a -> s{_creConvertFlashToHTML5 = a})
547
creConvertFlashToHTML5 :: Lens' Creative (Maybe Bool) creConvertFlashToHTML5 = lens _creConvertFlashToHTML5 (\ s a -> s{_creConvertFlashToHTML5 = a})
157
creConvertFlashToHTML5 = lens _creConvertFlashToHTML5 (\ s a -> s{_creConvertFlashToHTML5 = a})
103
true
true
0
8
91
54
30
24
null
null
bos/text
tests/Tests/Properties/Basics.hs
bsd-2-clause
s_cons_s x = (x:) `eqP` (unpackS . S.unstream . S.cons x)
68
s_cons_s x = (x:) `eqP` (unpackS . S.unstream . S.cons x)
68
s_cons_s x = (x:) `eqP` (unpackS . S.unstream . S.cons x)
68
false
false
0
9
21
37
20
17
null
null
zhiyuanshi/fcore
frontend/simplify/SimplifyImpl.hs
bsd-2-clause
infer i j (FI.Data _ _ e) = infer i j e
47
infer i j (FI.Data _ _ e) = infer i j e
47
infer i j (FI.Data _ _ e) = infer i j e
47
false
false
0
8
19
32
15
17
null
null
spechub/Hets
CommonLogic/ClTests.hs
gpl-2.0
ct :: TERM ct = Name_term (Token "Cat" nullRange)
49
ct :: TERM ct = Name_term (Token "Cat" nullRange)
49
ct = Name_term (Token "Cat" nullRange)
38
false
true
0
7
8
22
11
11
null
null
mightymoose/liquidhaskell
benchmarks/text-0.11.2.3/Data/Text/Encoding/Fusion/Common.hs
bsd-3-clause
restreamUtf32BE :: Stream Char -> Stream Word8 restreamUtf32BE (Stream next0 s0 len) = Stream next (RS0 s0) (len * 2) where next (RS0 s) = case next0 s of Done -> Done Skip s' -> Skip (RS0 s') Yield x s' -> Yield c1 (RS3 s' c2 c3 c4) where n = ord x c1 = fromIntegral $ shiftR n 24 c2 = fromIntegral $ shiftR n 16 c3 = fromIntegral $ shiftR n 8 c4 = fromIntegral n next (RS1 s x2) = Yield x2 (RS0 s) next (RS2 s x2 x3) = Yield x2 (RS1 s x3) next (RS3 s x2 x3 x4) = Yield x2 (RS2 s x3 x4) {-# INLINE next #-}
643
restreamUtf32BE :: Stream Char -> Stream Word8 restreamUtf32BE (Stream next0 s0 len) = Stream next (RS0 s0) (len * 2) where next (RS0 s) = case next0 s of Done -> Done Skip s' -> Skip (RS0 s') Yield x s' -> Yield c1 (RS3 s' c2 c3 c4) where n = ord x c1 = fromIntegral $ shiftR n 24 c2 = fromIntegral $ shiftR n 16 c3 = fromIntegral $ shiftR n 8 c4 = fromIntegral n next (RS1 s x2) = Yield x2 (RS0 s) next (RS2 s x2 x3) = Yield x2 (RS1 s x3) next (RS3 s x2 x3 x4) = Yield x2 (RS2 s x3 x4) {-# INLINE next #-}
643
restreamUtf32BE (Stream next0 s0 len) = Stream next (RS0 s0) (len * 2) where next (RS0 s) = case next0 s of Done -> Done Skip s' -> Skip (RS0 s') Yield x s' -> Yield c1 (RS3 s' c2 c3 c4) where n = ord x c1 = fromIntegral $ shiftR n 24 c2 = fromIntegral $ shiftR n 16 c3 = fromIntegral $ shiftR n 8 c4 = fromIntegral n next (RS1 s x2) = Yield x2 (RS0 s) next (RS2 s x2 x3) = Yield x2 (RS1 s x3) next (RS3 s x2 x3 x4) = Yield x2 (RS2 s x3 x4) {-# INLINE next #-}
596
false
true
3
12
251
283
138
145
null
null
janschulz/pandoc
src/Text/Pandoc/Readers/OPML.hs
gpl-2.0
readOPML :: ReaderOptions -> String -> Either PandocError Pandoc readOPML _ inp = setTitle (opmlDocTitle st') . setAuthors (opmlDocAuthors st') . setDate (opmlDocDate st') . doc . mconcat <$> bs where (bs, st') = flip runState def . runExceptT $ (mapM parseBlock $ normalizeTree $ parseXML inp) -- normalize input, consolidating adjacent Text and CRef elements
421
readOPML :: ReaderOptions -> String -> Either PandocError Pandoc readOPML _ inp = setTitle (opmlDocTitle st') . setAuthors (opmlDocAuthors st') . setDate (opmlDocDate st') . doc . mconcat <$> bs where (bs, st') = flip runState def . runExceptT $ (mapM parseBlock $ normalizeTree $ parseXML inp) -- normalize input, consolidating adjacent Text and CRef elements
421
readOPML _ inp = setTitle (opmlDocTitle st') . setAuthors (opmlDocAuthors st') . setDate (opmlDocDate st') . doc . mconcat <$> bs where (bs, st') = flip runState def . runExceptT $ (mapM parseBlock $ normalizeTree $ parseXML inp) -- normalize input, consolidating adjacent Text and CRef elements
356
false
true
0
12
116
121
59
62
null
null
rodrigo-machado/verigraph
src/library/XML/XMLUtilities.hs
gpl-3.0
textAtTag :: ArrowXml cat => String -> cat (Data.Tree.NTree.TypeDefs.NTree XNode) String textAtTag tag = atTag tag >>> text
123
textAtTag :: ArrowXml cat => String -> cat (Data.Tree.NTree.TypeDefs.NTree XNode) String textAtTag tag = atTag tag >>> text
123
textAtTag tag = atTag tag >>> text
34
false
true
0
10
17
48
24
24
null
null
josefs/autosar
oldARSim/ARXML.hs
bsd-3-clause
toDest "PARAMETER-SW-COMPONENT-TYPE" = RSEParameterSwComponentType
66
toDest "PARAMETER-SW-COMPONENT-TYPE" = RSEParameterSwComponentType
66
toDest "PARAMETER-SW-COMPONENT-TYPE" = RSEParameterSwComponentType
66
false
false
0
5
3
9
4
5
null
null
vito/atomo
src/Atomo/Pretty.hs
bsd-3-clause
headlessKeywords'' _ _ _ = empty
32
headlessKeywords'' _ _ _ = empty
32
headlessKeywords'' _ _ _ = empty
32
false
false
0
5
5
13
6
7
null
null
coursestitch/coursestitch-api
lib/CourseStitch/Models/Queries.hs
apache-2.0
deleteSessions :: Token -> SqlPersistT IO () deleteSessions token = deleteWhere [SessionToken P.==. token]
106
deleteSessions :: Token -> SqlPersistT IO () deleteSessions token = deleteWhere [SessionToken P.==. token]
106
deleteSessions token = deleteWhere [SessionToken P.==. token]
61
false
true
0
7
13
37
18
19
null
null
d0kt0r0/Tidal
test/Sound/Tidal/ParseTest.hs
gpl-3.0
run :: Microspec () run = describe "Sound.Tidal.Parse" $ do describe "parseBP_E" $ do it "can parse strings" $ do compareP (Arc 0 12) ("a b c" :: Pattern String) (fastCat ["a", "b", "c"]) it "can parse ints" $ do compareP (Arc 0 2) ("0 1 2 3 4 5 6 7 8 0 10 20 30 40 50" :: Pattern Int) (fastCat $ map (pure . read) $ words "0 1 2 3 4 5 6 7 8 0 10 20 30 40 50") it "can alternate with <>" $ do compareP (Arc 0 2) ("a <b c>" :: Pattern String) (cat [fastCat ["a", "b"], fastCat ["a", "c"]]) it "can slow with /" $ do compareP (Arc 0 2) ("a/2" :: Pattern String) (slow 2 $ "a") it "can speed up with *" $ do compareP (Arc 0 2) ("a*8" :: Pattern String) (fast 8 "a") it "can elongate with _" $ do compareP (Arc 0 2) ("a _ _ b _" :: Pattern String) (timeCat [(3,"a"), (2,"b")]) it "can replicate with !" $ do compareP (Arc 0 2) ("a! b" :: Pattern String) (fastCat ["a", "a", "b"]) it "can replicate with ! inside {}" $ do compareP (Arc 0 2) ("{a a}%2" :: Pattern String) ("{a !}%2" :: Pattern String) it "can replicate with ! and number" $ do compareP (Arc 0 2) ("a!3 b" :: Pattern String) (fastCat ["a", "a", "a", "b"]) it "can degrade with ?" $ do compareP (Arc 0 1) ("a?" :: Pattern String) (degradeByDefault "a") it "can degrade with ? and number" $ do compareP (Arc 0 1) ("a?0.2" :: Pattern String) (_degradeBy 0.2 "a") it "can degrade with ? for double patterns" $ do compareP (Arc 0 1) ("0.4 0.5? 0.6" :: Pattern Double) (fastcat[0.4, degradeByDefault 0.5, 0.6]) it "can stretch with @" $ do comparePD (Arc 0 1) ("a@2 b" :: Pattern String) (timeCat [(2, "a"),(1,"b")]) it "can do polymeter with {}" $ do compareP (Arc 0 2) ("{a b, c d e}" :: Pattern String) (stack [fastcat [pure "a", pure "b"], slow 1.5 $ fastcat [pure "c", pure "d", pure "e"]]) it "can parse .. with ints" $ do compareP (Arc 0 2) ("0 .. 8" :: Pattern Int) ("0 1 2 3 4 5 6 7 8") it "can parse .. with rationals" $ do compareP (Arc 0 2) ("0 .. 8" :: Pattern Rational) ("0 1 2 3 4 5 6 7 8") it "can handle repeats (!) and durations (@) with <>" $ do compareP (Arc 0 31) ("<a!3 b ! c@5>" :: Pattern String) (slow 10 "[a a a b b] c") it "can handle repeats (!) and durations (@) with <> (with ints)" $ do compareP (Arc 0 31) ("<1!3 2 ! 3@5>" :: Pattern Int) (slow 10 "[1 1 1 2 2] 3") it "can handle fractional durations" $ do compareP (Arc 0 2) ("a@0.5 b@1%6 b@1%6 b@1%6" :: Pattern String) ("a b*3") it "can handle fractional durations (with rationals)" $ do compareP (Arc 0 2) ("1%3@0.5 3%4@1%6 3%4@1%6 3%4@1%6" :: Pattern Rational) ("1%3 0.75*3") it "can parse a chord" $ do compareP (Arc 0 2) ("'major" :: Pattern Int) ("[0,4,7]") it "can parse two chords" $ do compareP (Arc 0 2) ("'major 'minor" :: Pattern Int) ("[0,4,7] [0,3,7]") it "can parse c chords" $ do compareP (Arc 0 2) ("'major 'minor 'dim7" :: Pattern Int) ("c'major c'minor c'dim7") it "can parse various chords" $ do compareP (Arc 0 2) ("c'major e'minor f'dim7" :: Pattern Int) ("c e f" + "'major 'minor 'dim7") it "doesn't crash on zeroes (1)" $ do compareP (Arc 0 2) ("cp/0" :: Pattern String) (silence) it "doesn't crash on zeroes (2)" $ do compareP (Arc 0 2) ("cp(5,0)" :: Pattern String) (silence) it "doesn't crash on zeroes (3)" $ do compareP (Arc 0 2) ("cp(5,c)" :: Pattern String) (silence) where degradeByDefault = _degradeBy 0.5
4,206
run :: Microspec () run = describe "Sound.Tidal.Parse" $ do describe "parseBP_E" $ do it "can parse strings" $ do compareP (Arc 0 12) ("a b c" :: Pattern String) (fastCat ["a", "b", "c"]) it "can parse ints" $ do compareP (Arc 0 2) ("0 1 2 3 4 5 6 7 8 0 10 20 30 40 50" :: Pattern Int) (fastCat $ map (pure . read) $ words "0 1 2 3 4 5 6 7 8 0 10 20 30 40 50") it "can alternate with <>" $ do compareP (Arc 0 2) ("a <b c>" :: Pattern String) (cat [fastCat ["a", "b"], fastCat ["a", "c"]]) it "can slow with /" $ do compareP (Arc 0 2) ("a/2" :: Pattern String) (slow 2 $ "a") it "can speed up with *" $ do compareP (Arc 0 2) ("a*8" :: Pattern String) (fast 8 "a") it "can elongate with _" $ do compareP (Arc 0 2) ("a _ _ b _" :: Pattern String) (timeCat [(3,"a"), (2,"b")]) it "can replicate with !" $ do compareP (Arc 0 2) ("a! b" :: Pattern String) (fastCat ["a", "a", "b"]) it "can replicate with ! inside {}" $ do compareP (Arc 0 2) ("{a a}%2" :: Pattern String) ("{a !}%2" :: Pattern String) it "can replicate with ! and number" $ do compareP (Arc 0 2) ("a!3 b" :: Pattern String) (fastCat ["a", "a", "a", "b"]) it "can degrade with ?" $ do compareP (Arc 0 1) ("a?" :: Pattern String) (degradeByDefault "a") it "can degrade with ? and number" $ do compareP (Arc 0 1) ("a?0.2" :: Pattern String) (_degradeBy 0.2 "a") it "can degrade with ? for double patterns" $ do compareP (Arc 0 1) ("0.4 0.5? 0.6" :: Pattern Double) (fastcat[0.4, degradeByDefault 0.5, 0.6]) it "can stretch with @" $ do comparePD (Arc 0 1) ("a@2 b" :: Pattern String) (timeCat [(2, "a"),(1,"b")]) it "can do polymeter with {}" $ do compareP (Arc 0 2) ("{a b, c d e}" :: Pattern String) (stack [fastcat [pure "a", pure "b"], slow 1.5 $ fastcat [pure "c", pure "d", pure "e"]]) it "can parse .. with ints" $ do compareP (Arc 0 2) ("0 .. 8" :: Pattern Int) ("0 1 2 3 4 5 6 7 8") it "can parse .. with rationals" $ do compareP (Arc 0 2) ("0 .. 8" :: Pattern Rational) ("0 1 2 3 4 5 6 7 8") it "can handle repeats (!) and durations (@) with <>" $ do compareP (Arc 0 31) ("<a!3 b ! c@5>" :: Pattern String) (slow 10 "[a a a b b] c") it "can handle repeats (!) and durations (@) with <> (with ints)" $ do compareP (Arc 0 31) ("<1!3 2 ! 3@5>" :: Pattern Int) (slow 10 "[1 1 1 2 2] 3") it "can handle fractional durations" $ do compareP (Arc 0 2) ("a@0.5 b@1%6 b@1%6 b@1%6" :: Pattern String) ("a b*3") it "can handle fractional durations (with rationals)" $ do compareP (Arc 0 2) ("1%3@0.5 3%4@1%6 3%4@1%6 3%4@1%6" :: Pattern Rational) ("1%3 0.75*3") it "can parse a chord" $ do compareP (Arc 0 2) ("'major" :: Pattern Int) ("[0,4,7]") it "can parse two chords" $ do compareP (Arc 0 2) ("'major 'minor" :: Pattern Int) ("[0,4,7] [0,3,7]") it "can parse c chords" $ do compareP (Arc 0 2) ("'major 'minor 'dim7" :: Pattern Int) ("c'major c'minor c'dim7") it "can parse various chords" $ do compareP (Arc 0 2) ("c'major e'minor f'dim7" :: Pattern Int) ("c e f" + "'major 'minor 'dim7") it "doesn't crash on zeroes (1)" $ do compareP (Arc 0 2) ("cp/0" :: Pattern String) (silence) it "doesn't crash on zeroes (2)" $ do compareP (Arc 0 2) ("cp(5,0)" :: Pattern String) (silence) it "doesn't crash on zeroes (3)" $ do compareP (Arc 0 2) ("cp(5,c)" :: Pattern String) (silence) where degradeByDefault = _degradeBy 0.5
4,206
run = describe "Sound.Tidal.Parse" $ do describe "parseBP_E" $ do it "can parse strings" $ do compareP (Arc 0 12) ("a b c" :: Pattern String) (fastCat ["a", "b", "c"]) it "can parse ints" $ do compareP (Arc 0 2) ("0 1 2 3 4 5 6 7 8 0 10 20 30 40 50" :: Pattern Int) (fastCat $ map (pure . read) $ words "0 1 2 3 4 5 6 7 8 0 10 20 30 40 50") it "can alternate with <>" $ do compareP (Arc 0 2) ("a <b c>" :: Pattern String) (cat [fastCat ["a", "b"], fastCat ["a", "c"]]) it "can slow with /" $ do compareP (Arc 0 2) ("a/2" :: Pattern String) (slow 2 $ "a") it "can speed up with *" $ do compareP (Arc 0 2) ("a*8" :: Pattern String) (fast 8 "a") it "can elongate with _" $ do compareP (Arc 0 2) ("a _ _ b _" :: Pattern String) (timeCat [(3,"a"), (2,"b")]) it "can replicate with !" $ do compareP (Arc 0 2) ("a! b" :: Pattern String) (fastCat ["a", "a", "b"]) it "can replicate with ! inside {}" $ do compareP (Arc 0 2) ("{a a}%2" :: Pattern String) ("{a !}%2" :: Pattern String) it "can replicate with ! and number" $ do compareP (Arc 0 2) ("a!3 b" :: Pattern String) (fastCat ["a", "a", "a", "b"]) it "can degrade with ?" $ do compareP (Arc 0 1) ("a?" :: Pattern String) (degradeByDefault "a") it "can degrade with ? and number" $ do compareP (Arc 0 1) ("a?0.2" :: Pattern String) (_degradeBy 0.2 "a") it "can degrade with ? for double patterns" $ do compareP (Arc 0 1) ("0.4 0.5? 0.6" :: Pattern Double) (fastcat[0.4, degradeByDefault 0.5, 0.6]) it "can stretch with @" $ do comparePD (Arc 0 1) ("a@2 b" :: Pattern String) (timeCat [(2, "a"),(1,"b")]) it "can do polymeter with {}" $ do compareP (Arc 0 2) ("{a b, c d e}" :: Pattern String) (stack [fastcat [pure "a", pure "b"], slow 1.5 $ fastcat [pure "c", pure "d", pure "e"]]) it "can parse .. with ints" $ do compareP (Arc 0 2) ("0 .. 8" :: Pattern Int) ("0 1 2 3 4 5 6 7 8") it "can parse .. with rationals" $ do compareP (Arc 0 2) ("0 .. 8" :: Pattern Rational) ("0 1 2 3 4 5 6 7 8") it "can handle repeats (!) and durations (@) with <>" $ do compareP (Arc 0 31) ("<a!3 b ! c@5>" :: Pattern String) (slow 10 "[a a a b b] c") it "can handle repeats (!) and durations (@) with <> (with ints)" $ do compareP (Arc 0 31) ("<1!3 2 ! 3@5>" :: Pattern Int) (slow 10 "[1 1 1 2 2] 3") it "can handle fractional durations" $ do compareP (Arc 0 2) ("a@0.5 b@1%6 b@1%6 b@1%6" :: Pattern String) ("a b*3") it "can handle fractional durations (with rationals)" $ do compareP (Arc 0 2) ("1%3@0.5 3%4@1%6 3%4@1%6 3%4@1%6" :: Pattern Rational) ("1%3 0.75*3") it "can parse a chord" $ do compareP (Arc 0 2) ("'major" :: Pattern Int) ("[0,4,7]") it "can parse two chords" $ do compareP (Arc 0 2) ("'major 'minor" :: Pattern Int) ("[0,4,7] [0,3,7]") it "can parse c chords" $ do compareP (Arc 0 2) ("'major 'minor 'dim7" :: Pattern Int) ("c'major c'minor c'dim7") it "can parse various chords" $ do compareP (Arc 0 2) ("c'major e'minor f'dim7" :: Pattern Int) ("c e f" + "'major 'minor 'dim7") it "doesn't crash on zeroes (1)" $ do compareP (Arc 0 2) ("cp/0" :: Pattern String) (silence) it "doesn't crash on zeroes (2)" $ do compareP (Arc 0 2) ("cp(5,0)" :: Pattern String) (silence) it "doesn't crash on zeroes (3)" $ do compareP (Arc 0 2) ("cp(5,c)" :: Pattern String) (silence) where degradeByDefault = _degradeBy 0.5
4,186
false
true
0
21
1,574
1,365
658
707
null
null
deweyvm/starstats
src/StarStats/DB/Connection.hs
mit
close :: IConnection c => c -> IO () close con = do disconnect con
70
close :: IConnection c => c -> IO () close con = do disconnect con
70
close con = do disconnect con
33
false
true
0
9
18
41
17
24
null
null
kaoskorobase/arff
Text/ARFF.hs
bsd-2-clause
putReal _ MissingValue = putMissingValue
47
putReal _ MissingValue = putMissingValue
47
putReal _ MissingValue = putMissingValue
47
false
false
1
5
11
13
5
8
null
null
SergeyKrivohatskiy/fp_haskell
hw11/Parser/Main.hs
mit
main = fmap (const ()) $ runTestTT $ test $ label "pure" [ parserTestOK (pure 4) "qwerty" === (4, "qwerty") , parserTestOK (pure 'x') "" === ('x', "") ] ++ label "empty" [ parserTestFail (empty :: Parser Char ()) "qwerty" , parserTestFail (empty :: Parser Char ()) "" ] ++ label "satisfy" [ parserTestOK (satisfy (/= 'x')) "qwerty" === ('q', "werty") , parserTestFail (satisfy (/= 'x')) "xwerty" ] ++ label "<*>" [ parserTestOK (max <$> satisfy (== 'q') <*> satisfy (/= 'x')) "qwerty" === ('w', "erty") , parserTestOK ((+) <$> digit <*> digit) "5678" === (11, "78") , parserTestFail (undefined <$> satisfy (== 'q') <*> satisfy (== 'x') :: Parser Char ()) "qwerty" , parserTestFail (undefined <$> satisfy (== 'x') <*> satisfy (== 'w') :: Parser Char ()) "qwerty" ] ++ label "<|>" [ parserTestOK (satisfy (== 'q') <|> satisfy (== 'x')) "qwerty" === ('q', "werty") , parserTestOK (satisfy (== 'x') <|> satisfy (== 'q')) "qwerty" === ('q', "werty") , parserTestFail (satisfy (== 'x') <|> satisfy (== 'y')) "qwerty" ] ++ label "eof" [ parserTestFail eof "qwerty" , parserTestOK eof "" === ((), "") ] ++ label "symbol" [ parserTestOK (symbol 'q') "qwerty" === ((), "werty") , parserTestFail (symbol 'x') "qwerty" ] ++ label "anySymbol" [ parserTestOK anySymbol "qwerty" === ('q', "werty") , parserTestFail anySymbol "" ] ++ label "digit" [ parserTestFail digit "qwerty" , parserTestOK digit "123qwerty" === (1, "23qwerty") , parserTestFail digit "" ] ++ label "string" [ parserTestOK (string "qwerty") "qwerty" === ((), "") , parserTestOK (string "qwerty") "qwertyuiop" === ((), "uiop") , parserTestFail (string "qwerty") "qwerryuiop" , parserTestFail (string "qwerty") "qwert" ] ++ label "oneOf" [ parserTestFail (oneOf "xyz") "qwerty" , parserTestOK (oneOf "xyz") "xwerty" === ('x', "werty") , parserTestOK (oneOf "xyz") "ywerty" === ('y', "werty") , parserTestOK (oneOf "xyz") "zwerty" === ('z', "werty") ] ++ label "many" [ parserTestOK (many (symbol 'q')) "qwerty" === ([()], "werty") , parserTestOK (many (symbol 'q')) "qqqwerty" === ([(),(),()], "werty") , parserTestOK (many (symbol 'q')) "werty" === ([], "werty") , parserTestOK (many (symbol 'q')) "" === ([], "") ] ++ label "many1" [ parserTestOK (many1 (symbol 'q')) "qwerty" === ([()], "werty") , parserTestOK (many1 (symbol 'q')) "qqqwerty" === ([(),(),()], "werty") , parserTestFail (many1 (symbol 'q')) "werty" , parserTestFail (many1 (symbol 'q')) "" ] ++ label "natural" [ parserTestFail natural "qwerty" , parserTestOK natural "123qwerty" === (123, "qwerty") , parserTestFail natural "-123qwerty" , parserTestFail natural "" ] ++ label "integer" [ parserTestFail integer "qwerty" , parserTestOK integer "123qwerty" === (123, "qwerty") , parserTestOK integer "-123qwerty" === (-123, "qwerty") , parserTestFail integer "-qwerty" ] ++ label "spaces" [ parserTestOK spaces "qwerty" === ((), "qwerty") , parserTestOK spaces " qwerty" === ((), "qwerty") , parserTestOK spaces "" === ((), "") ] ++ label "try" [ parserTestOK (try natural) "123qwerty" === (Just 123, "qwerty") , parserTestOK (try natural) "qwerty" === (Nothing, "qwerty") , parserTestOK (try (symbol 'q')) "qwerty" === (Just (), "werty") , parserTestOK (try (symbol 'x')) "qwerty" === (Nothing, "qwerty") , parserTestOK (try (symbol 'x')) "" === (Nothing, "") , parserTestOK (try eof) "qwerty" === (Nothing, "qwerty") , parserTestOK (try eof) "" === (Just (), "") ] ++ label "endBy" [ parserTestOK (natural `endBy` symbol ';') "1;2;3;456;xyz;" === ([1,2,3,456], "xyz;") , parserTestOK (natural `endBy` symbol ';') "1;2;3;456" === ([1,2,3], "456") , parserTestOK (natural `endBy` spaces) "12 25 300" === ([12,25,300], "") , parserTestOK (natural `endBy` spaces) "qwerty" === ([], "qwerty") , parserTestOK (natural `endBy` spaces) "" === ([], "") ] ++ label "endBy1" [ parserTestOK (natural `endBy1` symbol ';') "1;2;3;456;xyz;" === ([1,2,3,456], "xyz;") , parserTestOK (natural `endBy1` symbol ';') "1;2;3;456" === ([1,2,3], "456") , parserTestOK (natural `endBy1` spaces) "12 25 300" === ([12,25,300], "") , parserTestFail (natural `endBy1` spaces) "qwerty" , parserTestFail (natural `endBy1` spaces) "" ] ++ label "sepBy" [ parserTestOK (natural `sepBy` symbol ';') "1;2;3;456;xyz;" === ([1,2,3,456], ";xyz;") , parserTestOK (natural `sepBy` symbol ';') "1;2;3;456" === ([1,2,3,456], "") , parserTestOK (natural `sepBy` spaces) "12 25 300" === ([12,25,300], "") , parserTestOK (natural `sepBy` spaces) "qwerty" === ([], "qwerty") , parserTestOK (natural `sepBy` spaces) "" === ([], "") ] ++ label "sepBy1" [ parserTestOK (natural `sepBy1` symbol ';') "1;2;3;456;xyz;" === ([1,2,3,456], ";xyz;") , parserTestOK (natural `sepBy1` symbol ';') "1;2;3;456" === ([1,2,3,456], "") , parserTestOK (natural `sepBy1` spaces) "12 25 300" === ([12,25,300], "") , parserTestFail (natural `sepBy1` spaces) "qwerty" , parserTestFail (natural `sepBy1` spaces) "" ] ++ label "between" [ parserTestFail (between (symbol 'a') (symbol 'b') (symbol 'c')) "abc" , parserTestOK (between (symbol 'a') (symbol 'b') (symbol 'c')) "acb" === ((), "") ] ++ label "brackets" [ parserTestOK (brackets (string "qwerty")) "[qwerty]uiop" === ((), "uiop") , parserTestFail (brackets (string "qwerty")) "[qwertyu]iop" ] ++ label "parens" [ parserTestOK (parens spaces) "( )qwerty" === ((), "qwerty") , parserTestFail (parens spaces) "(q)werty" ] ++ label "braces" [ parserTestOK (braces natural) "{123}" === (123, "") , parserTestFail (braces natural) "{}" ] ++ label "angles" [ parserTestOK (angles digit) "<1>" === (1, "") , parserTestFail (angles digit) "<1 >" ] ++ label "boolP" [ parserTestOK boolP "Trueqwerty" === (True, "qwerty") , parserTestOK boolP "False" === (False, "") , parserTestFail boolP "qwerty" ] ++ label "maybeP" [ parserTestOK (maybeP natural) "Nothingqwerty" === (Nothing, "qwerty") , parserTestOK (maybeP natural) "Just 123qwerty" === (Just 123, "qwerty") , parserTestFail (maybeP natural) "Just123qwerty" ] ++ label "listP" [ parserTestOK (listP integer) "[1,-23,25,347]" === ([1,-23,25,347], "") , parserTestFail (listP integer) "[1 , -23, 25 ,347]" ] ++ label "listP'" [ parserTestOK (listP' integer) "[1,-23,25,347]" === ([1,-23,25,347], "") , parserTestOK (listP' integer) "[1 , -23, 25 ,347]" === ([1,-23,25,347], "") ] ++ label "treeP" [ parserTestOK (treeP integer integer) "100" === (Leaf 100, "") , parserTestOK (treeP integer integer) "<1{2}3>" === (Node (Leaf 1) 2 (Leaf 3), "") , parserTestOK (treeP integer integer) "<1{2}<3{4}5>>>" === (Node (Leaf 1) 2 (Node (Leaf 3) 4 (Leaf 5)), ">") , parserTestFail (treeP integer integer) "<1{2}<3{4}5>" ] ++ label "foldl1P" [ parserTestOK (foldl1P (\a b c -> a ++ "[" ++ show b ++ "]" ++ c) (many $ satisfy $ not . isDigit) digit) "a1bcd5efg853h" === ("a[1]bcd[5]efg[8][5][3]h", "") , parserTestOK (foldl1P (\a b c -> "(" ++ a ++ [b] ++ c ++ ")") (fmap show natural) anySymbol) "12+34+45+56" === ("(((12+34)+45)+56)", "") ] ++ label "foldr1P" [ parserTestOK (foldr1P (\a b c -> a ++ "[" ++ show b ++ "]" ++ c) (many $ satisfy $ not . isDigit) digit) "a1bcd5efg853h" === ("a[1]bcd[5]efg[8][5][3]h", "") , parserTestOK (foldr1P (\a b c -> "(" ++ a ++ [b] ++ c ++ ")") (fmap show natural) anySymbol) "12+34+45+56" === ("(12+(34+(45+56)))", "") ] where label :: String -> [Test] -> [Test] label l = map (\(i,t) -> TestLabel (l ++ " [" ++ show i ++ "]") t) . zip [1..] (===) = id
8,445
main = fmap (const ()) $ runTestTT $ test $ label "pure" [ parserTestOK (pure 4) "qwerty" === (4, "qwerty") , parserTestOK (pure 'x') "" === ('x', "") ] ++ label "empty" [ parserTestFail (empty :: Parser Char ()) "qwerty" , parserTestFail (empty :: Parser Char ()) "" ] ++ label "satisfy" [ parserTestOK (satisfy (/= 'x')) "qwerty" === ('q', "werty") , parserTestFail (satisfy (/= 'x')) "xwerty" ] ++ label "<*>" [ parserTestOK (max <$> satisfy (== 'q') <*> satisfy (/= 'x')) "qwerty" === ('w', "erty") , parserTestOK ((+) <$> digit <*> digit) "5678" === (11, "78") , parserTestFail (undefined <$> satisfy (== 'q') <*> satisfy (== 'x') :: Parser Char ()) "qwerty" , parserTestFail (undefined <$> satisfy (== 'x') <*> satisfy (== 'w') :: Parser Char ()) "qwerty" ] ++ label "<|>" [ parserTestOK (satisfy (== 'q') <|> satisfy (== 'x')) "qwerty" === ('q', "werty") , parserTestOK (satisfy (== 'x') <|> satisfy (== 'q')) "qwerty" === ('q', "werty") , parserTestFail (satisfy (== 'x') <|> satisfy (== 'y')) "qwerty" ] ++ label "eof" [ parserTestFail eof "qwerty" , parserTestOK eof "" === ((), "") ] ++ label "symbol" [ parserTestOK (symbol 'q') "qwerty" === ((), "werty") , parserTestFail (symbol 'x') "qwerty" ] ++ label "anySymbol" [ parserTestOK anySymbol "qwerty" === ('q', "werty") , parserTestFail anySymbol "" ] ++ label "digit" [ parserTestFail digit "qwerty" , parserTestOK digit "123qwerty" === (1, "23qwerty") , parserTestFail digit "" ] ++ label "string" [ parserTestOK (string "qwerty") "qwerty" === ((), "") , parserTestOK (string "qwerty") "qwertyuiop" === ((), "uiop") , parserTestFail (string "qwerty") "qwerryuiop" , parserTestFail (string "qwerty") "qwert" ] ++ label "oneOf" [ parserTestFail (oneOf "xyz") "qwerty" , parserTestOK (oneOf "xyz") "xwerty" === ('x', "werty") , parserTestOK (oneOf "xyz") "ywerty" === ('y', "werty") , parserTestOK (oneOf "xyz") "zwerty" === ('z', "werty") ] ++ label "many" [ parserTestOK (many (symbol 'q')) "qwerty" === ([()], "werty") , parserTestOK (many (symbol 'q')) "qqqwerty" === ([(),(),()], "werty") , parserTestOK (many (symbol 'q')) "werty" === ([], "werty") , parserTestOK (many (symbol 'q')) "" === ([], "") ] ++ label "many1" [ parserTestOK (many1 (symbol 'q')) "qwerty" === ([()], "werty") , parserTestOK (many1 (symbol 'q')) "qqqwerty" === ([(),(),()], "werty") , parserTestFail (many1 (symbol 'q')) "werty" , parserTestFail (many1 (symbol 'q')) "" ] ++ label "natural" [ parserTestFail natural "qwerty" , parserTestOK natural "123qwerty" === (123, "qwerty") , parserTestFail natural "-123qwerty" , parserTestFail natural "" ] ++ label "integer" [ parserTestFail integer "qwerty" , parserTestOK integer "123qwerty" === (123, "qwerty") , parserTestOK integer "-123qwerty" === (-123, "qwerty") , parserTestFail integer "-qwerty" ] ++ label "spaces" [ parserTestOK spaces "qwerty" === ((), "qwerty") , parserTestOK spaces " qwerty" === ((), "qwerty") , parserTestOK spaces "" === ((), "") ] ++ label "try" [ parserTestOK (try natural) "123qwerty" === (Just 123, "qwerty") , parserTestOK (try natural) "qwerty" === (Nothing, "qwerty") , parserTestOK (try (symbol 'q')) "qwerty" === (Just (), "werty") , parserTestOK (try (symbol 'x')) "qwerty" === (Nothing, "qwerty") , parserTestOK (try (symbol 'x')) "" === (Nothing, "") , parserTestOK (try eof) "qwerty" === (Nothing, "qwerty") , parserTestOK (try eof) "" === (Just (), "") ] ++ label "endBy" [ parserTestOK (natural `endBy` symbol ';') "1;2;3;456;xyz;" === ([1,2,3,456], "xyz;") , parserTestOK (natural `endBy` symbol ';') "1;2;3;456" === ([1,2,3], "456") , parserTestOK (natural `endBy` spaces) "12 25 300" === ([12,25,300], "") , parserTestOK (natural `endBy` spaces) "qwerty" === ([], "qwerty") , parserTestOK (natural `endBy` spaces) "" === ([], "") ] ++ label "endBy1" [ parserTestOK (natural `endBy1` symbol ';') "1;2;3;456;xyz;" === ([1,2,3,456], "xyz;") , parserTestOK (natural `endBy1` symbol ';') "1;2;3;456" === ([1,2,3], "456") , parserTestOK (natural `endBy1` spaces) "12 25 300" === ([12,25,300], "") , parserTestFail (natural `endBy1` spaces) "qwerty" , parserTestFail (natural `endBy1` spaces) "" ] ++ label "sepBy" [ parserTestOK (natural `sepBy` symbol ';') "1;2;3;456;xyz;" === ([1,2,3,456], ";xyz;") , parserTestOK (natural `sepBy` symbol ';') "1;2;3;456" === ([1,2,3,456], "") , parserTestOK (natural `sepBy` spaces) "12 25 300" === ([12,25,300], "") , parserTestOK (natural `sepBy` spaces) "qwerty" === ([], "qwerty") , parserTestOK (natural `sepBy` spaces) "" === ([], "") ] ++ label "sepBy1" [ parserTestOK (natural `sepBy1` symbol ';') "1;2;3;456;xyz;" === ([1,2,3,456], ";xyz;") , parserTestOK (natural `sepBy1` symbol ';') "1;2;3;456" === ([1,2,3,456], "") , parserTestOK (natural `sepBy1` spaces) "12 25 300" === ([12,25,300], "") , parserTestFail (natural `sepBy1` spaces) "qwerty" , parserTestFail (natural `sepBy1` spaces) "" ] ++ label "between" [ parserTestFail (between (symbol 'a') (symbol 'b') (symbol 'c')) "abc" , parserTestOK (between (symbol 'a') (symbol 'b') (symbol 'c')) "acb" === ((), "") ] ++ label "brackets" [ parserTestOK (brackets (string "qwerty")) "[qwerty]uiop" === ((), "uiop") , parserTestFail (brackets (string "qwerty")) "[qwertyu]iop" ] ++ label "parens" [ parserTestOK (parens spaces) "( )qwerty" === ((), "qwerty") , parserTestFail (parens spaces) "(q)werty" ] ++ label "braces" [ parserTestOK (braces natural) "{123}" === (123, "") , parserTestFail (braces natural) "{}" ] ++ label "angles" [ parserTestOK (angles digit) "<1>" === (1, "") , parserTestFail (angles digit) "<1 >" ] ++ label "boolP" [ parserTestOK boolP "Trueqwerty" === (True, "qwerty") , parserTestOK boolP "False" === (False, "") , parserTestFail boolP "qwerty" ] ++ label "maybeP" [ parserTestOK (maybeP natural) "Nothingqwerty" === (Nothing, "qwerty") , parserTestOK (maybeP natural) "Just 123qwerty" === (Just 123, "qwerty") , parserTestFail (maybeP natural) "Just123qwerty" ] ++ label "listP" [ parserTestOK (listP integer) "[1,-23,25,347]" === ([1,-23,25,347], "") , parserTestFail (listP integer) "[1 , -23, 25 ,347]" ] ++ label "listP'" [ parserTestOK (listP' integer) "[1,-23,25,347]" === ([1,-23,25,347], "") , parserTestOK (listP' integer) "[1 , -23, 25 ,347]" === ([1,-23,25,347], "") ] ++ label "treeP" [ parserTestOK (treeP integer integer) "100" === (Leaf 100, "") , parserTestOK (treeP integer integer) "<1{2}3>" === (Node (Leaf 1) 2 (Leaf 3), "") , parserTestOK (treeP integer integer) "<1{2}<3{4}5>>>" === (Node (Leaf 1) 2 (Node (Leaf 3) 4 (Leaf 5)), ">") , parserTestFail (treeP integer integer) "<1{2}<3{4}5>" ] ++ label "foldl1P" [ parserTestOK (foldl1P (\a b c -> a ++ "[" ++ show b ++ "]" ++ c) (many $ satisfy $ not . isDigit) digit) "a1bcd5efg853h" === ("a[1]bcd[5]efg[8][5][3]h", "") , parserTestOK (foldl1P (\a b c -> "(" ++ a ++ [b] ++ c ++ ")") (fmap show natural) anySymbol) "12+34+45+56" === ("(((12+34)+45)+56)", "") ] ++ label "foldr1P" [ parserTestOK (foldr1P (\a b c -> a ++ "[" ++ show b ++ "]" ++ c) (many $ satisfy $ not . isDigit) digit) "a1bcd5efg853h" === ("a[1]bcd[5]efg[8][5][3]h", "") , parserTestOK (foldr1P (\a b c -> "(" ++ a ++ [b] ++ c ++ ")") (fmap show natural) anySymbol) "12+34+45+56" === ("(12+(34+(45+56)))", "") ] where label :: String -> [Test] -> [Test] label l = map (\(i,t) -> TestLabel (l ++ " [" ++ show i ++ "]") t) . zip [1..] (===) = id
8,445
main = fmap (const ()) $ runTestTT $ test $ label "pure" [ parserTestOK (pure 4) "qwerty" === (4, "qwerty") , parserTestOK (pure 'x') "" === ('x', "") ] ++ label "empty" [ parserTestFail (empty :: Parser Char ()) "qwerty" , parserTestFail (empty :: Parser Char ()) "" ] ++ label "satisfy" [ parserTestOK (satisfy (/= 'x')) "qwerty" === ('q', "werty") , parserTestFail (satisfy (/= 'x')) "xwerty" ] ++ label "<*>" [ parserTestOK (max <$> satisfy (== 'q') <*> satisfy (/= 'x')) "qwerty" === ('w', "erty") , parserTestOK ((+) <$> digit <*> digit) "5678" === (11, "78") , parserTestFail (undefined <$> satisfy (== 'q') <*> satisfy (== 'x') :: Parser Char ()) "qwerty" , parserTestFail (undefined <$> satisfy (== 'x') <*> satisfy (== 'w') :: Parser Char ()) "qwerty" ] ++ label "<|>" [ parserTestOK (satisfy (== 'q') <|> satisfy (== 'x')) "qwerty" === ('q', "werty") , parserTestOK (satisfy (== 'x') <|> satisfy (== 'q')) "qwerty" === ('q', "werty") , parserTestFail (satisfy (== 'x') <|> satisfy (== 'y')) "qwerty" ] ++ label "eof" [ parserTestFail eof "qwerty" , parserTestOK eof "" === ((), "") ] ++ label "symbol" [ parserTestOK (symbol 'q') "qwerty" === ((), "werty") , parserTestFail (symbol 'x') "qwerty" ] ++ label "anySymbol" [ parserTestOK anySymbol "qwerty" === ('q', "werty") , parserTestFail anySymbol "" ] ++ label "digit" [ parserTestFail digit "qwerty" , parserTestOK digit "123qwerty" === (1, "23qwerty") , parserTestFail digit "" ] ++ label "string" [ parserTestOK (string "qwerty") "qwerty" === ((), "") , parserTestOK (string "qwerty") "qwertyuiop" === ((), "uiop") , parserTestFail (string "qwerty") "qwerryuiop" , parserTestFail (string "qwerty") "qwert" ] ++ label "oneOf" [ parserTestFail (oneOf "xyz") "qwerty" , parserTestOK (oneOf "xyz") "xwerty" === ('x', "werty") , parserTestOK (oneOf "xyz") "ywerty" === ('y', "werty") , parserTestOK (oneOf "xyz") "zwerty" === ('z', "werty") ] ++ label "many" [ parserTestOK (many (symbol 'q')) "qwerty" === ([()], "werty") , parserTestOK (many (symbol 'q')) "qqqwerty" === ([(),(),()], "werty") , parserTestOK (many (symbol 'q')) "werty" === ([], "werty") , parserTestOK (many (symbol 'q')) "" === ([], "") ] ++ label "many1" [ parserTestOK (many1 (symbol 'q')) "qwerty" === ([()], "werty") , parserTestOK (many1 (symbol 'q')) "qqqwerty" === ([(),(),()], "werty") , parserTestFail (many1 (symbol 'q')) "werty" , parserTestFail (many1 (symbol 'q')) "" ] ++ label "natural" [ parserTestFail natural "qwerty" , parserTestOK natural "123qwerty" === (123, "qwerty") , parserTestFail natural "-123qwerty" , parserTestFail natural "" ] ++ label "integer" [ parserTestFail integer "qwerty" , parserTestOK integer "123qwerty" === (123, "qwerty") , parserTestOK integer "-123qwerty" === (-123, "qwerty") , parserTestFail integer "-qwerty" ] ++ label "spaces" [ parserTestOK spaces "qwerty" === ((), "qwerty") , parserTestOK spaces " qwerty" === ((), "qwerty") , parserTestOK spaces "" === ((), "") ] ++ label "try" [ parserTestOK (try natural) "123qwerty" === (Just 123, "qwerty") , parserTestOK (try natural) "qwerty" === (Nothing, "qwerty") , parserTestOK (try (symbol 'q')) "qwerty" === (Just (), "werty") , parserTestOK (try (symbol 'x')) "qwerty" === (Nothing, "qwerty") , parserTestOK (try (symbol 'x')) "" === (Nothing, "") , parserTestOK (try eof) "qwerty" === (Nothing, "qwerty") , parserTestOK (try eof) "" === (Just (), "") ] ++ label "endBy" [ parserTestOK (natural `endBy` symbol ';') "1;2;3;456;xyz;" === ([1,2,3,456], "xyz;") , parserTestOK (natural `endBy` symbol ';') "1;2;3;456" === ([1,2,3], "456") , parserTestOK (natural `endBy` spaces) "12 25 300" === ([12,25,300], "") , parserTestOK (natural `endBy` spaces) "qwerty" === ([], "qwerty") , parserTestOK (natural `endBy` spaces) "" === ([], "") ] ++ label "endBy1" [ parserTestOK (natural `endBy1` symbol ';') "1;2;3;456;xyz;" === ([1,2,3,456], "xyz;") , parserTestOK (natural `endBy1` symbol ';') "1;2;3;456" === ([1,2,3], "456") , parserTestOK (natural `endBy1` spaces) "12 25 300" === ([12,25,300], "") , parserTestFail (natural `endBy1` spaces) "qwerty" , parserTestFail (natural `endBy1` spaces) "" ] ++ label "sepBy" [ parserTestOK (natural `sepBy` symbol ';') "1;2;3;456;xyz;" === ([1,2,3,456], ";xyz;") , parserTestOK (natural `sepBy` symbol ';') "1;2;3;456" === ([1,2,3,456], "") , parserTestOK (natural `sepBy` spaces) "12 25 300" === ([12,25,300], "") , parserTestOK (natural `sepBy` spaces) "qwerty" === ([], "qwerty") , parserTestOK (natural `sepBy` spaces) "" === ([], "") ] ++ label "sepBy1" [ parserTestOK (natural `sepBy1` symbol ';') "1;2;3;456;xyz;" === ([1,2,3,456], ";xyz;") , parserTestOK (natural `sepBy1` symbol ';') "1;2;3;456" === ([1,2,3,456], "") , parserTestOK (natural `sepBy1` spaces) "12 25 300" === ([12,25,300], "") , parserTestFail (natural `sepBy1` spaces) "qwerty" , parserTestFail (natural `sepBy1` spaces) "" ] ++ label "between" [ parserTestFail (between (symbol 'a') (symbol 'b') (symbol 'c')) "abc" , parserTestOK (between (symbol 'a') (symbol 'b') (symbol 'c')) "acb" === ((), "") ] ++ label "brackets" [ parserTestOK (brackets (string "qwerty")) "[qwerty]uiop" === ((), "uiop") , parserTestFail (brackets (string "qwerty")) "[qwertyu]iop" ] ++ label "parens" [ parserTestOK (parens spaces) "( )qwerty" === ((), "qwerty") , parserTestFail (parens spaces) "(q)werty" ] ++ label "braces" [ parserTestOK (braces natural) "{123}" === (123, "") , parserTestFail (braces natural) "{}" ] ++ label "angles" [ parserTestOK (angles digit) "<1>" === (1, "") , parserTestFail (angles digit) "<1 >" ] ++ label "boolP" [ parserTestOK boolP "Trueqwerty" === (True, "qwerty") , parserTestOK boolP "False" === (False, "") , parserTestFail boolP "qwerty" ] ++ label "maybeP" [ parserTestOK (maybeP natural) "Nothingqwerty" === (Nothing, "qwerty") , parserTestOK (maybeP natural) "Just 123qwerty" === (Just 123, "qwerty") , parserTestFail (maybeP natural) "Just123qwerty" ] ++ label "listP" [ parserTestOK (listP integer) "[1,-23,25,347]" === ([1,-23,25,347], "") , parserTestFail (listP integer) "[1 , -23, 25 ,347]" ] ++ label "listP'" [ parserTestOK (listP' integer) "[1,-23,25,347]" === ([1,-23,25,347], "") , parserTestOK (listP' integer) "[1 , -23, 25 ,347]" === ([1,-23,25,347], "") ] ++ label "treeP" [ parserTestOK (treeP integer integer) "100" === (Leaf 100, "") , parserTestOK (treeP integer integer) "<1{2}3>" === (Node (Leaf 1) 2 (Leaf 3), "") , parserTestOK (treeP integer integer) "<1{2}<3{4}5>>>" === (Node (Leaf 1) 2 (Node (Leaf 3) 4 (Leaf 5)), ">") , parserTestFail (treeP integer integer) "<1{2}<3{4}5>" ] ++ label "foldl1P" [ parserTestOK (foldl1P (\a b c -> a ++ "[" ++ show b ++ "]" ++ c) (many $ satisfy $ not . isDigit) digit) "a1bcd5efg853h" === ("a[1]bcd[5]efg[8][5][3]h", "") , parserTestOK (foldl1P (\a b c -> "(" ++ a ++ [b] ++ c ++ ")") (fmap show natural) anySymbol) "12+34+45+56" === ("(((12+34)+45)+56)", "") ] ++ label "foldr1P" [ parserTestOK (foldr1P (\a b c -> a ++ "[" ++ show b ++ "]" ++ c) (many $ satisfy $ not . isDigit) digit) "a1bcd5efg853h" === ("a[1]bcd[5]efg[8][5][3]h", "") , parserTestOK (foldr1P (\a b c -> "(" ++ a ++ [b] ++ c ++ ")") (fmap show natural) anySymbol) "12+34+45+56" === ("(12+(34+(45+56)))", "") ] where label :: String -> [Test] -> [Test] label l = map (\(i,t) -> TestLabel (l ++ " [" ++ show i ++ "]") t) . zip [1..] (===) = id
8,445
false
false
2
16
2,208
3,340
1,781
1,559
null
null
TeensyPass/teensy_pass_haskell
Cli.hs
gpl-2.0
insertParser = InsertOptions <$> switch (long "echo" <> short 'e') <*> switch (long "multiline" <> short 'm') <*> forceParser <*> passNameParser
204
insertParser = InsertOptions <$> switch (long "echo" <> short 'e') <*> switch (long "multiline" <> short 'm') <*> forceParser <*> passNameParser
204
insertParser = InsertOptions <$> switch (long "echo" <> short 'e') <*> switch (long "multiline" <> short 'm') <*> forceParser <*> passNameParser
204
false
false
0
12
80
54
25
29
null
null
beni55/libmpd-haskell
tests/UtilSpec.hs
mit
prop_parseDate_simple :: YearString -> Bool prop_parseDate_simple (YS x) = isJust $ parseDate x
95
prop_parseDate_simple :: YearString -> Bool prop_parseDate_simple (YS x) = isJust $ parseDate x
95
prop_parseDate_simple (YS x) = isJust $ parseDate x
51
false
true
0
7
12
31
15
16
null
null
agremm/par-sched
src/Parallel/Graph.hs
gpl-2.0
buildGraph :: [Task a] -> IO (P.Gr (NLabel a) ELabel) buildGraph ts = do graphs <- mapM task2Graph ts let nodes = concat $ map labNodes graphs let edges = concat $ map labEdges graphs let graph = insEdges edges $ insNodes nodes empty -- remove roots and outgoing edges to increase -- components and thus exploitable parallelism. -- ... deleting the roots only seems to be sufficient let roots = map fst $ filter (not . isAction) $ rootsOf graph -- let rootsOut = concat $ map (out graph) roots let graph' = delNodes roots graph -- let graph'' = foldr delLEdge graph rootsOut return graph' where isAction (_, Action _) = True isAction (_, X) = False
707
buildGraph :: [Task a] -> IO (P.Gr (NLabel a) ELabel) buildGraph ts = do graphs <- mapM task2Graph ts let nodes = concat $ map labNodes graphs let edges = concat $ map labEdges graphs let graph = insEdges edges $ insNodes nodes empty -- remove roots and outgoing edges to increase -- components and thus exploitable parallelism. -- ... deleting the roots only seems to be sufficient let roots = map fst $ filter (not . isAction) $ rootsOf graph -- let rootsOut = concat $ map (out graph) roots let graph' = delNodes roots graph -- let graph'' = foldr delLEdge graph rootsOut return graph' where isAction (_, Action _) = True isAction (_, X) = False
707
buildGraph ts = do graphs <- mapM task2Graph ts let nodes = concat $ map labNodes graphs let edges = concat $ map labEdges graphs let graph = insEdges edges $ insNodes nodes empty -- remove roots and outgoing edges to increase -- components and thus exploitable parallelism. -- ... deleting the roots only seems to be sufficient let roots = map fst $ filter (not . isAction) $ rootsOf graph -- let rootsOut = concat $ map (out graph) roots let graph' = delNodes roots graph -- let graph'' = foldr delLEdge graph rootsOut return graph' where isAction (_, Action _) = True isAction (_, X) = False
653
false
true
0
14
177
198
97
101
null
null
ulricha/dsh-tpc-h
Queries/TPCH/Standard/Q6.hs
bsd-3-clause
-- | TPC-H Query Q6 q6 :: Day -> Decimal -> Decimal -> Q Decimal q6 startDate discount quantity = sum [ l_extendedpriceQ l * l_discountQ l | l <- lineitems , l_shipdateQ l >= toQ startDate , l_shipdateQ l < toQ (C.addDays 365 startDate) , between (l_discountQ l) lowerDiscount upperDiscount , l_quantityQ l < toQ quantity ] where lowerDiscount = toQ discount - 0.01 upperDiscount = toQ discount + 0.01
449
q6 :: Day -> Decimal -> Decimal -> Q Decimal q6 startDate discount quantity = sum [ l_extendedpriceQ l * l_discountQ l | l <- lineitems , l_shipdateQ l >= toQ startDate , l_shipdateQ l < toQ (C.addDays 365 startDate) , between (l_discountQ l) lowerDiscount upperDiscount , l_quantityQ l < toQ quantity ] where lowerDiscount = toQ discount - 0.01 upperDiscount = toQ discount + 0.01
429
q6 startDate discount quantity = sum [ l_extendedpriceQ l * l_discountQ l | l <- lineitems , l_shipdateQ l >= toQ startDate , l_shipdateQ l < toQ (C.addDays 365 startDate) , between (l_discountQ l) lowerDiscount upperDiscount , l_quantityQ l < toQ quantity ] where lowerDiscount = toQ discount - 0.01 upperDiscount = toQ discount + 0.01
384
true
true
2
11
118
164
73
91
null
null
fffej/HS-Poker
LookupPatternMatch.hs
bsd-3-clause
getValueFromProduct 675 = 309
29
getValueFromProduct 675 = 309
29
getValueFromProduct 675 = 309
29
false
false
0
5
3
9
4
5
null
null
sdiehl/ghc
compiler/basicTypes/Literal.hs
bsd-3-clause
litTag (LitLabel _ _ _) = 6
29
litTag (LitLabel _ _ _) = 6
29
litTag (LitLabel _ _ _) = 6
29
false
false
0
6
8
20
9
11
null
null
rzil/honours
LeavittPathAlgebras/WeightedLPA.hs
mit
nodify weightedGraph (NormalFormAtom c v (e:es)) | (weightings weightedGraph M.! normalFormEdge e < normalFormEdgeWeighting e) = 0 | otherwise = (convertEdge e) * (nodify weightedGraph (NormalFormAtom c u es)) where u = (if normalFormEdgeIsGhost e then fst else snd) (edges (graph weightedGraph) M.! normalFormEdge e)
324
nodify weightedGraph (NormalFormAtom c v (e:es)) | (weightings weightedGraph M.! normalFormEdge e < normalFormEdgeWeighting e) = 0 | otherwise = (convertEdge e) * (nodify weightedGraph (NormalFormAtom c u es)) where u = (if normalFormEdgeIsGhost e then fst else snd) (edges (graph weightedGraph) M.! normalFormEdge e)
324
nodify weightedGraph (NormalFormAtom c v (e:es)) | (weightings weightedGraph M.! normalFormEdge e < normalFormEdgeWeighting e) = 0 | otherwise = (convertEdge e) * (nodify weightedGraph (NormalFormAtom c u es)) where u = (if normalFormEdgeIsGhost e then fst else snd) (edges (graph weightedGraph) M.! normalFormEdge e)
324
false
false
2
11
51
147
68
79
null
null
cmc-haskell-2016/reversi
src/GameRecolorCells.hs
bsd-3-clause
-- recalculate of total changeCNT :: [Cell] -> CountBlackWhite -> CountBlackWhite changeCNT ((Cell _ (Player p)) : xs) (cntBlack, cntWhite) = case p of WhiteMove -> (changeCNT xs (cntBlack, cntWhite+1)) BlackMove -> (changeCNT xs (cntBlack+1, cntWhite))
262
changeCNT :: [Cell] -> CountBlackWhite -> CountBlackWhite changeCNT ((Cell _ (Player p)) : xs) (cntBlack, cntWhite) = case p of WhiteMove -> (changeCNT xs (cntBlack, cntWhite+1)) BlackMove -> (changeCNT xs (cntBlack+1, cntWhite))
238
changeCNT ((Cell _ (Player p)) : xs) (cntBlack, cntWhite) = case p of WhiteMove -> (changeCNT xs (cntBlack, cntWhite+1)) BlackMove -> (changeCNT xs (cntBlack+1, cntWhite))
180
true
true
0
11
44
107
58
49
null
null
Gabriel439/Haskell-Errors-Library
Control/Error/Script.hs
bsd-3-clause
scriptIO :: (MonadIO m) => IO a -> ExceptT Text m a scriptIO = ExceptT . liftIO . liftM (fmapL (Data.Text.pack . show)) . (try :: IO a -> IO (Either SomeException a))
193
scriptIO :: (MonadIO m) => IO a -> ExceptT Text m a scriptIO = ExceptT . liftIO . liftM (fmapL (Data.Text.pack . show)) . (try :: IO a -> IO (Either SomeException a))
193
scriptIO = ExceptT . liftIO . liftM (fmapL (Data.Text.pack . show)) . (try :: IO a -> IO (Either SomeException a))
141
false
true
0
12
59
89
45
44
null
null
forked-upstream-packages-for-ghcjs/ghc
compiler/hsSyn/HsExpr.hs
bsd-3-clause
-- We know the list must have at least one @Match@ in it. pprMatches :: (OutputableBndr idL, OutputableBndr idR, Outputable body) => HsMatchContext idL -> MatchGroup idR body -> SDoc pprMatches ctxt (MG { mg_alts = matches }) = vcat (map (pprMatch ctxt) (map unLoc matches))
290
pprMatches :: (OutputableBndr idL, OutputableBndr idR, Outputable body) => HsMatchContext idL -> MatchGroup idR body -> SDoc pprMatches ctxt (MG { mg_alts = matches }) = vcat (map (pprMatch ctxt) (map unLoc matches))
231
pprMatches ctxt (MG { mg_alts = matches }) = vcat (map (pprMatch ctxt) (map unLoc matches))
95
true
true
0
9
61
97
47
50
null
null