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
alterapraxisptyltd/serialterm
src/Main.hs
isc
-- -- .. appName :: T.Text appName = "HardTerm"
47
appName :: T.Text appName = "HardTerm"
38
appName = "HardTerm"
20
true
true
0
5
8
15
9
6
null
null
cutsea110/aop
src/ENat.hs
bsd-3-clause
unfoldn psi = u where u x = case psi x of Nothing -> 0 Just x' -> succ (u x')
95
unfoldn psi = u where u x = case psi x of Nothing -> 0 Just x' -> succ (u x')
95
unfoldn psi = u where u x = case psi x of Nothing -> 0 Just x' -> succ (u x')
95
false
false
2
10
38
57
23
34
null
null
dsalisbury/xmobar
src/Plugins/Monitors/Mem.hs
bsd-3-clause
options :: [OptDescr (MemOpts -> MemOpts)] options = [ Option "" ["used-icon-pattern"] (ReqArg (\x o -> o { usedIconPattern = Just $ parseIconPattern x }) "") "" , Option "" ["free-icon-pattern"] (ReqArg (\x o -> o { freeIconPattern = Just $ parseIconPattern x }) "") "" , Option "" ["available-icon-pattern"] (ReqArg (\x o -> o { availableIconPattern = Just $ parseIconPattern x }) "") "" ]
414
options :: [OptDescr (MemOpts -> MemOpts)] options = [ Option "" ["used-icon-pattern"] (ReqArg (\x o -> o { usedIconPattern = Just $ parseIconPattern x }) "") "" , Option "" ["free-icon-pattern"] (ReqArg (\x o -> o { freeIconPattern = Just $ parseIconPattern x }) "") "" , Option "" ["available-icon-pattern"] (ReqArg (\x o -> o { availableIconPattern = Just $ parseIconPattern x }) "") "" ]
414
options = [ Option "" ["used-icon-pattern"] (ReqArg (\x o -> o { usedIconPattern = Just $ parseIconPattern x }) "") "" , Option "" ["free-icon-pattern"] (ReqArg (\x o -> o { freeIconPattern = Just $ parseIconPattern x }) "") "" , Option "" ["available-icon-pattern"] (ReqArg (\x o -> o { availableIconPattern = Just $ parseIconPattern x }) "") "" ]
371
false
true
0
15
88
175
92
83
null
null
dglmoore/genea
src/examples/ExprGen.hs
gpl-3.0
eval expr = error "** Expr.eval: invalid expression"
52
eval expr = error "** Expr.eval: invalid expression"
52
eval expr = error "** Expr.eval: invalid expression"
52
false
false
1
5
7
16
5
11
null
null
alexliew/learn_you_a_haskell
code/maps.hs
unlicense
string2digits :: String -> [Int] string2digits = map digitToInt . filter isDigit
80
string2digits :: String -> [Int] string2digits = map digitToInt . filter isDigit
80
string2digits = map digitToInt . filter isDigit
47
false
true
0
8
11
34
15
19
null
null
GaloisInc/halvm-ghc
compiler/basicTypes/UniqSupply.hs
bsd-3-clause
listSplitUniqSupply (MkSplitUniqSupply _ s1 s2) = s1 : listSplitUniqSupply s2
78
listSplitUniqSupply (MkSplitUniqSupply _ s1 s2) = s1 : listSplitUniqSupply s2
78
listSplitUniqSupply (MkSplitUniqSupply _ s1 s2) = s1 : listSplitUniqSupply s2
78
false
false
0
7
10
26
12
14
null
null
Proclivis/wxHaskell
wxcore/src/haskell/Graphics/UI/WXCore/WxcDefs.hs
lgpl-2.1
wxSTC_FOLDFLAG_LINEAFTER_CONTRACTED :: Int wxSTC_FOLDFLAG_LINEAFTER_CONTRACTED = 16
83
wxSTC_FOLDFLAG_LINEAFTER_CONTRACTED :: Int wxSTC_FOLDFLAG_LINEAFTER_CONTRACTED = 16
83
wxSTC_FOLDFLAG_LINEAFTER_CONTRACTED = 16
40
false
true
0
4
5
11
6
5
null
null
c19/Exercism-Haskell
scrabble-score/.stack-work/dist/x86_64-osx/Cabal-1.24.2.0/build/autogen/Paths_scrabble_score.hs
mit
bindir, libdir, dynlibdir, datadir, libexecdir, sysconfdir :: FilePath bindir = "/Users/c19/Documents/projects/exercism/haskell/haskell/scrabble-score/.stack-work/install/x86_64-osx/lts-8.21/8.0.2/bin"
206
bindir, libdir, dynlibdir, datadir, libexecdir, sysconfdir :: FilePath bindir = "/Users/c19/Documents/projects/exercism/haskell/haskell/scrabble-score/.stack-work/install/x86_64-osx/lts-8.21/8.0.2/bin"
205
bindir = "/Users/c19/Documents/projects/exercism/haskell/haskell/scrabble-score/.stack-work/install/x86_64-osx/lts-8.21/8.0.2/bin"
134
false
true
0
4
15
21
16
5
null
null
AndrewBrinker/scheme
src/Scheme/Types.hs
mit
showVal (DottedList head' tail') = "(" ++ unwordsList head' ++ " . " ++ showVal tail' ++ ")"
92
showVal (DottedList head' tail') = "(" ++ unwordsList head' ++ " . " ++ showVal tail' ++ ")"
92
showVal (DottedList head' tail') = "(" ++ unwordsList head' ++ " . " ++ showVal tail' ++ ")"
92
false
false
0
9
17
39
18
21
null
null
acowley/ghc
ghc/Main.hs
bsd-3-clause
-- True if we are going to attempt to link in this mode. -- (we might not actually link, depending on the GhcLink flag) isLinkMode :: PostLoadMode -> Bool isLinkMode (StopBefore StopLn) = True
192
isLinkMode :: PostLoadMode -> Bool isLinkMode (StopBefore StopLn) = True
72
isLinkMode (StopBefore StopLn) = True
37
true
true
0
7
33
26
14
12
null
null
LambdaHack/LambdaHack
engine-src/Game/LambdaHack/Client/AI/ConditionM.hs
bsd-3-clause
condFloorWeaponM :: MonadStateRead m => ActorId -> m Bool condFloorWeaponM aid = any (IA.checkFlag Ability.Meleeable . aspectRecordFull . snd) <$> getsState (fullAssocs aid [CGround])
189
condFloorWeaponM :: MonadStateRead m => ActorId -> m Bool condFloorWeaponM aid = any (IA.checkFlag Ability.Meleeable . aspectRecordFull . snd) <$> getsState (fullAssocs aid [CGround])
189
condFloorWeaponM aid = any (IA.checkFlag Ability.Meleeable . aspectRecordFull . snd) <$> getsState (fullAssocs aid [CGround])
131
false
true
0
11
29
67
32
35
null
null
infotroph/pandoc
src/Text/Pandoc/Writers/Custom.hs
gpl-2.0
inlineToCustom lua (Link attr txt (src,tit)) = callfunc lua "Link" txt src tit (attrToMap attr)
97
inlineToCustom lua (Link attr txt (src,tit)) = callfunc lua "Link" txt src tit (attrToMap attr)
97
inlineToCustom lua (Link attr txt (src,tit)) = callfunc lua "Link" txt src tit (attrToMap attr)
97
false
false
0
8
16
46
23
23
null
null
thoughtpolice/binary-serialise-cbor
Data/Binary/Serialise/CBOR/Term.hs
bsd-3-clause
decodeStringIndefLen :: [T.Text] -> Decoder Term decodeStringIndefLen acc = do stop <- decodeBreakOr if stop then return $! TStringI (LT.fromChunks (reverse acc)) else do !str <- decodeString decodeStringIndefLen (str : acc)
264
decodeStringIndefLen :: [T.Text] -> Decoder Term decodeStringIndefLen acc = do stop <- decodeBreakOr if stop then return $! TStringI (LT.fromChunks (reverse acc)) else do !str <- decodeString decodeStringIndefLen (str : acc)
264
decodeStringIndefLen acc = do stop <- decodeBreakOr if stop then return $! TStringI (LT.fromChunks (reverse acc)) else do !str <- decodeString decodeStringIndefLen (str : acc)
215
false
true
0
13
70
86
41
45
null
null
markflorisson/hpack
testrepo/program-0.1/Program.hs
bsd-3-clause
h2 = P.foo . R.foo
18
h2 = P.foo . R.foo
18
h2 = P.foo . R.foo
18
false
false
0
6
4
14
7
7
null
null
GaloisInc/halvm-ghc
libraries/template-haskell/Language/Haskell/TH/PprLib.hs
bsd-3-clause
double = return . HPJ.double
28
double = return . HPJ.double
28
double = return . HPJ.double
28
false
false
2
6
4
17
6
11
null
null
jwvg0425/free-game
FreeGame/Class.hs
bsd-3-clause
mouseUp :: Mouse f => Int -> f Bool mouseUp k = isUp <$> (Map.! k) <$> mouseButtons_
85
mouseUp :: Mouse f => Int -> f Bool mouseUp k = isUp <$> (Map.! k) <$> mouseButtons_
84
mouseUp k = isUp <$> (Map.! k) <$> mouseButtons_
48
false
true
0
7
18
42
21
21
null
null
JacquesCarette/literate-scientific-software
code/drasil-data/Data/Drasil/Quantities/Physics.hs
bsd-2-clause
iVel = uc CP.iVel (sup (vec lV) initial) velU
45
iVel = uc CP.iVel (sup (vec lV) initial) velU
45
iVel = uc CP.iVel (sup (vec lV) initial) velU
45
false
false
1
9
8
34
14
20
null
null
koengit/induction-examples
List.hs
mit
pairs _ = []
19
pairs _ = []
19
pairs _ = []
19
false
false
0
5
10
11
5
6
null
null
rueshyna/gogol
gogol-youtube-analytics/gen/Network/Google/Resource/YouTubeAnalytics/Groups/List.hs
mpl-2.0
-- | Creates a value of 'GroupsList' with the minimum fields required to make a request. -- -- Use one of the following lenses to modify other fields as desired: -- -- * 'glMine' -- -- * 'glOnBehalfOfContentOwner' -- -- * 'glId' -- -- * 'glPageToken' groupsList :: GroupsList groupsList = GroupsList' { _glMine = Nothing , _glOnBehalfOfContentOwner = Nothing , _glId = Nothing , _glPageToken = Nothing }
431
groupsList :: GroupsList groupsList = GroupsList' { _glMine = Nothing , _glOnBehalfOfContentOwner = Nothing , _glId = Nothing , _glPageToken = Nothing }
180
groupsList = GroupsList' { _glMine = Nothing , _glOnBehalfOfContentOwner = Nothing , _glId = Nothing , _glPageToken = Nothing }
151
true
true
0
6
96
48
34
14
null
null
chrisdone/haskelldb-demo
lib/haskelldb/test/TestCases.hs
bsd-3-clause
testUnique tbl r = dbtest name $ \db -> do insert db tbl (constantRecord r) insert db tbl (constantRecord r) rs <- query db $ do { t <- table tbl; unique; return t; } assertEqual "Bad result length" 1 (length rs) where name = "unique " ++ tableName tbl
279
testUnique tbl r = dbtest name $ \db -> do insert db tbl (constantRecord r) insert db tbl (constantRecord r) rs <- query db $ do { t <- table tbl; unique; return t; } assertEqual "Bad result length" 1 (length rs) where name = "unique " ++ tableName tbl
279
testUnique tbl r = dbtest name $ \db -> do insert db tbl (constantRecord r) insert db tbl (constantRecord r) rs <- query db $ do { t <- table tbl; unique; return t; } assertEqual "Bad result length" 1 (length rs) where name = "unique " ++ tableName tbl
279
false
false
0
14
76
124
57
67
null
null
joelburget/daily-typecheckers
src/Day3.hs
bsd-3-clause
check :: Ctx -> (CExpr :<: Val) -> Either String () check ctx (tm :<: ty) = case tm of Lam expr -> case ty of VPi specDomTy codomTy -> -- just check that the body returns the codomain given an input of the -- domain check (specDomTy <:: ctx) (expr :<: codomTy specDomTy) _ -> Left "this lambda is not that other thing" CheckI expr -> do -- TODO I'm not a fan of quoting then evaling iTy <- quoteInfer =<< infer ctx expr let iTy' = cEval (extractTypes ctx) iTy when (ty /= iTy') $ Left "failed checking"
548
check :: Ctx -> (CExpr :<: Val) -> Either String () check ctx (tm :<: ty) = case tm of Lam expr -> case ty of VPi specDomTy codomTy -> -- just check that the body returns the codomain given an input of the -- domain check (specDomTy <:: ctx) (expr :<: codomTy specDomTy) _ -> Left "this lambda is not that other thing" CheckI expr -> do -- TODO I'm not a fan of quoting then evaling iTy <- quoteInfer =<< infer ctx expr let iTy' = cEval (extractTypes ctx) iTy when (ty /= iTy') $ Left "failed checking"
548
check ctx (tm :<: ty) = case tm of Lam expr -> case ty of VPi specDomTy codomTy -> -- just check that the body returns the codomain given an input of the -- domain check (specDomTy <:: ctx) (expr :<: codomTy specDomTy) _ -> Left "this lambda is not that other thing" CheckI expr -> do -- TODO I'm not a fan of quoting then evaling iTy <- quoteInfer =<< infer ctx expr let iTy' = cEval (extractTypes ctx) iTy when (ty /= iTy') $ Left "failed checking"
496
false
true
0
16
145
177
84
93
null
null
ysukhoverkhov/taplic4
src/06_UntypedLambda_Naive/Contextifier.hs
mit
contextify' :: TermContexts -> Term -> Term contextify' contexts term = case term of Variable (Name name _) -> Variable (Name name (Just $ valueForName contexts name)) Application t1 t2 -> Application (contextify' contexts t1) (contextify' contexts t2) Abstraction (Name name _) term -> let newContexts = shiftContextsForName contexts name nameContext = valueForName newContexts name in Abstraction (Name name (Just nameContext)) (contextify' newContexts term)
491
contextify' :: TermContexts -> Term -> Term contextify' contexts term = case term of Variable (Name name _) -> Variable (Name name (Just $ valueForName contexts name)) Application t1 t2 -> Application (contextify' contexts t1) (contextify' contexts t2) Abstraction (Name name _) term -> let newContexts = shiftContextsForName contexts name nameContext = valueForName newContexts name in Abstraction (Name name (Just nameContext)) (contextify' newContexts term)
491
contextify' contexts term = case term of Variable (Name name _) -> Variable (Name name (Just $ valueForName contexts name)) Application t1 t2 -> Application (contextify' contexts t1) (contextify' contexts t2) Abstraction (Name name _) term -> let newContexts = shiftContextsForName contexts name nameContext = valueForName newContexts name in Abstraction (Name name (Just nameContext)) (contextify' newContexts term)
447
false
true
7
12
94
170
82
88
null
null
pgj/bead
src/Bead/View/Pagelets.hs
bsd-3-clause
selectionWithDefAndAttr :: (Show a, Data a) => String -> [Attribute] -> (a -> Bool) -> [(a, String)] -> Html selectionWithDefAndAttr name attrs def = foldl (!) (selection' name) attrs . mapM_ option' where option' (v,t) = option (encodeToFay' "selection" v) t (def v) where
281
selectionWithDefAndAttr :: (Show a, Data a) => String -> [Attribute] -> (a -> Bool) -> [(a, String)] -> Html selectionWithDefAndAttr name attrs def = foldl (!) (selection' name) attrs . mapM_ option' where option' (v,t) = option (encodeToFay' "selection" v) t (def v) where
281
selectionWithDefAndAttr name attrs def = foldl (!) (selection' name) attrs . mapM_ option' where option' (v,t) = option (encodeToFay' "selection" v) t (def v) where
170
false
true
0
11
51
129
68
61
null
null
Philonous/d-bus
src/DBus/Scaffold.hs
mit
promoteDBusType TypeUnit = [t| 'TypeUnit |]
43
promoteDBusType TypeUnit = [t| 'TypeUnit |]
43
promoteDBusType TypeUnit = [t| 'TypeUnit |]
43
false
false
0
5
5
13
8
5
null
null
Shou/Tombot
Tombot/IRC.hs
gpl-2.0
nNick :: IrcAST -> (IrcAST -> Mind IRC ()) -> Decide IRC () () onNick j@(Nick nick name host text) mind = lift (mind j) >> throwError ()
137
onNick :: IrcAST -> (IrcAST -> Mind IRC ()) -> Decide IRC () () onNick j@(Nick nick name host text) mind = lift (mind j) >> throwError ()
137
onNick j@(Nick nick name host text) mind = lift (mind j) >> throwError ()
73
false
true
0
10
28
82
40
42
null
null
chreekat/snowdrift
Model/Notification.hs
agpl-3.0
archiveProjectNotificationDB :: ProjectNotificationId -> DB () archiveProjectNotificationDB = updateProjectNotificationArchived True
132
archiveProjectNotificationDB :: ProjectNotificationId -> DB () archiveProjectNotificationDB = updateProjectNotificationArchived True
132
archiveProjectNotificationDB = updateProjectNotificationArchived True
69
false
true
0
7
9
23
11
12
null
null
vdweegen/UvA-Software_Testing
Lab3/Cas/Exercises.hs
gpl-3.0
-- logical entailment :: check entails :: Form -> Form -> Bool entails x y = entailment (allResults x) (allResults y)
117
entails :: Form -> Form -> Bool entails x y = entailment (allResults x) (allResults y)
86
entails x y = entailment (allResults x) (allResults y)
54
true
true
0
8
20
47
22
25
null
null
bmillwood/pointfree
Main.hs
mit
getQuery :: [Flag] -> [String] -> IO String getQuery flags nonOptions | StdIn `elem` flags = getLine | otherwise = return $ unwords nonOptions
155
getQuery :: [Flag] -> [String] -> IO String getQuery flags nonOptions | StdIn `elem` flags = getLine | otherwise = return $ unwords nonOptions
155
getQuery flags nonOptions | StdIn `elem` flags = getLine | otherwise = return $ unwords nonOptions
111
false
true
1
8
36
63
31
32
null
null
olsner/ghc
libraries/base/Data/Functor/Classes.hs
bsd-3-clause
showsUnaryWith :: (Int -> a -> ShowS) -> String -> Int -> a -> ShowS showsUnaryWith sp name d x = showParen (d > 10) $ showString name . showChar ' ' . sp 11 x
163
showsUnaryWith :: (Int -> a -> ShowS) -> String -> Int -> a -> ShowS showsUnaryWith sp name d x = showParen (d > 10) $ showString name . showChar ' ' . sp 11 x
163
showsUnaryWith sp name d x = showParen (d > 10) $ showString name . showChar ' ' . sp 11 x
94
false
true
0
10
39
80
39
41
null
null
haroldcarr/learn-haskell-coq-ml-etc
haskell/playpen/hcpn/src/SimpleHCPN.hs
unlicense
runT :: Show m => String -> Net i m -> m -> IO () runT traceFile net marking = do t <- openFile traceFile WriteMode runWithTrace t net marking hClose t where runWithTrace t net marking = do hPutStrLn t $ show marking if null enabledTs then hPutStrLn t "no more enabled transitions!" else do trans <- choose enabledTs hPutStrLn t (fst $ fst trans) runWithTrace t net (snd trans) where enabledTs = enabled net marking
511
runT :: Show m => String -> Net i m -> m -> IO () runT traceFile net marking = do t <- openFile traceFile WriteMode runWithTrace t net marking hClose t where runWithTrace t net marking = do hPutStrLn t $ show marking if null enabledTs then hPutStrLn t "no more enabled transitions!" else do trans <- choose enabledTs hPutStrLn t (fst $ fst trans) runWithTrace t net (snd trans) where enabledTs = enabled net marking
510
runT traceFile net marking = do t <- openFile traceFile WriteMode runWithTrace t net marking hClose t where runWithTrace t net marking = do hPutStrLn t $ show marking if null enabledTs then hPutStrLn t "no more enabled transitions!" else do trans <- choose enabledTs hPutStrLn t (fst $ fst trans) runWithTrace t net (snd trans) where enabledTs = enabled net marking
460
false
true
1
13
172
188
80
108
null
null
geraldus/yesod
yesod-form/Yesod/Form/Functions.hs
mit
mhelper :: (site ~ HandlerSite m, MonadHandler m) => Field m a -> FieldSettings site -> Maybe a -> (site -> [Text] -> FormResult b) -- ^ on missing -> (a -> FormResult b) -- ^ on success -> Bool -- ^ is it required? -> MForm m (FormResult b, FieldView site) mhelper Field {..} FieldSettings {..} mdef onMissing onFound isReq = do tell fieldEnctype mp <- askParams name <- maybe newFormIdent return fsName theId <- lift $ maybe newIdent return fsId (_, site, langs) <- ask let mr2 = renderMessage site langs (res, val) <- case mp of Nothing -> return (FormMissing, maybe (Left "") Right mdef) Just p -> do mfs <- askFiles let mvals = fromMaybe [] $ Map.lookup name p files = fromMaybe [] $ mfs >>= Map.lookup name emx <- lift $ fieldParse mvals files return $ case emx of Left (SomeMessage e) -> (FormFailure [renderMessage site langs e], maybe (Left "") Left (listToMaybe mvals)) Right mx -> case mx of Nothing -> (onMissing site langs, Left "") Just x -> (onFound x, Right x) return (res, FieldView { fvLabel = toHtml $ mr2 fsLabel , fvTooltip = fmap toHtml $ fmap mr2 fsTooltip , fvId = theId , fvInput = fieldView theId name fsAttrs val isReq , fvErrors = case res of FormFailure [e] -> Just $ toHtml e _ -> Nothing , fvRequired = isReq }) -- | Applicative equivalent of 'mreq'.
1,707
mhelper :: (site ~ HandlerSite m, MonadHandler m) => Field m a -> FieldSettings site -> Maybe a -> (site -> [Text] -> FormResult b) -- ^ on missing -> (a -> FormResult b) -- ^ on success -> Bool -- ^ is it required? -> MForm m (FormResult b, FieldView site) mhelper Field {..} FieldSettings {..} mdef onMissing onFound isReq = do tell fieldEnctype mp <- askParams name <- maybe newFormIdent return fsName theId <- lift $ maybe newIdent return fsId (_, site, langs) <- ask let mr2 = renderMessage site langs (res, val) <- case mp of Nothing -> return (FormMissing, maybe (Left "") Right mdef) Just p -> do mfs <- askFiles let mvals = fromMaybe [] $ Map.lookup name p files = fromMaybe [] $ mfs >>= Map.lookup name emx <- lift $ fieldParse mvals files return $ case emx of Left (SomeMessage e) -> (FormFailure [renderMessage site langs e], maybe (Left "") Left (listToMaybe mvals)) Right mx -> case mx of Nothing -> (onMissing site langs, Left "") Just x -> (onFound x, Right x) return (res, FieldView { fvLabel = toHtml $ mr2 fsLabel , fvTooltip = fmap toHtml $ fmap mr2 fsTooltip , fvId = theId , fvInput = fieldView theId name fsAttrs val isReq , fvErrors = case res of FormFailure [e] -> Just $ toHtml e _ -> Nothing , fvRequired = isReq }) -- | Applicative equivalent of 'mreq'.
1,706
mhelper Field {..} FieldSettings {..} mdef onMissing onFound isReq = do tell fieldEnctype mp <- askParams name <- maybe newFormIdent return fsName theId <- lift $ maybe newIdent return fsId (_, site, langs) <- ask let mr2 = renderMessage site langs (res, val) <- case mp of Nothing -> return (FormMissing, maybe (Left "") Right mdef) Just p -> do mfs <- askFiles let mvals = fromMaybe [] $ Map.lookup name p files = fromMaybe [] $ mfs >>= Map.lookup name emx <- lift $ fieldParse mvals files return $ case emx of Left (SomeMessage e) -> (FormFailure [renderMessage site langs e], maybe (Left "") Left (listToMaybe mvals)) Right mx -> case mx of Nothing -> (onMissing site langs, Left "") Just x -> (onFound x, Right x) return (res, FieldView { fvLabel = toHtml $ mr2 fsLabel , fvTooltip = fmap toHtml $ fmap mr2 fsTooltip , fvId = theId , fvInput = fieldView theId name fsAttrs val isReq , fvErrors = case res of FormFailure [e] -> Just $ toHtml e _ -> Nothing , fvRequired = isReq }) -- | Applicative equivalent of 'mreq'.
1,392
false
true
58
8
664
528
278
250
null
null
ddssff/lens
src/Control/Lens/Fold.hs
bsd-3-clause
-- | Extract a 'NonEmpty' of the targets of 'Fold1'. -- -- >>> toNonEmptyOf both1 ("hello", "world") -- "hello" :| ["world"] -- -- @ -- 'toNonEmptyOf' :: 'Getter' s a -> s -> NonEmpty a -- 'toNonEmptyOf' :: 'Fold1' s a -> s -> NonEmpty a -- 'toNonEmptyOf' :: 'Lens'' s a -> s -> NonEmpty a -- 'toNonEmptyOf' :: 'Iso'' s a -> s -> NonEmpty a -- 'toNonEmptyOf' :: 'Traversal1'' s a -> s -> NonEmpty a -- 'toNonEmptyOf' :: 'Prism'' s a -> s -> NonEmpty a -- @ toNonEmptyOf :: Getting (NonEmptyDList a) s a -> s -> NonEmpty a toNonEmptyOf l = flip getNonEmptyDList [] . foldMapOf l (NonEmptyDList #. (:|))
630
toNonEmptyOf :: Getting (NonEmptyDList a) s a -> s -> NonEmpty a toNonEmptyOf l = flip getNonEmptyDList [] . foldMapOf l (NonEmptyDList #. (:|))
144
toNonEmptyOf l = flip getNonEmptyDList [] . foldMapOf l (NonEmptyDList #. (:|))
79
true
true
0
8
144
76
44
32
null
null
jclee/cartparse
parse.hs
bsd-2-clause
getFiles :: FilePath -> IO [FilePath] getFiles p = filterM doesFileExist =<< getRelDirectoryContents p
102
getFiles :: FilePath -> IO [FilePath] getFiles p = filterM doesFileExist =<< getRelDirectoryContents p
102
getFiles p = filterM doesFileExist =<< getRelDirectoryContents p
64
false
true
0
7
13
34
16
18
null
null
alekar/hugs
packages/base/Data/ByteString/Base.hs
bsd-3-clause
-- | /O(1)/ 'unsafePackAddress' provides constant-time construction of -- 'ByteStrings' -- which is ideal for string literals. It packs a -- null-terminated sequence of bytes into a 'ByteString', given a raw -- 'Addr\#' to the string, and the length of the string. Make sure the -- length is correct, otherwise use the safer 'packAddress' (where the -- length will be calculated once at runtime). unsafePackAddress :: Int -> Addr# -> ByteString unsafePackAddress len addr# = inlinePerformIO $ do p <- newForeignPtr_ cstr return $ PS p 0 len where cstr = Ptr addr# -- | /O(1)/ Construct a 'ByteString' given a C Ptr Word8 buffer, a -- length, and an IO action representing a finalizer. This function is -- not available on Hugs. --
743
unsafePackAddress :: Int -> Addr# -> ByteString unsafePackAddress len addr# = inlinePerformIO $ do p <- newForeignPtr_ cstr return $ PS p 0 len where cstr = Ptr addr# -- | /O(1)/ Construct a 'ByteString' given a C Ptr Word8 buffer, a -- length, and an IO action representing a finalizer. This function is -- not available on Hugs. --
346
unsafePackAddress len addr# = inlinePerformIO $ do p <- newForeignPtr_ cstr return $ PS p 0 len where cstr = Ptr addr# -- | /O(1)/ Construct a 'ByteString' given a C Ptr Word8 buffer, a -- length, and an IO action representing a finalizer. This function is -- not available on Hugs. --
298
true
true
0
9
136
72
39
33
null
null
CindyLinz/Haskell.js
trans/src/Desugar/CaseReorder.hs
mit
deCaseReorderExp a1 (BracketExp l bracket) = BracketExp (id l) (deCaseReorderBracket a1 bracket)
96
deCaseReorderExp a1 (BracketExp l bracket) = BracketExp (id l) (deCaseReorderBracket a1 bracket)
96
deCaseReorderExp a1 (BracketExp l bracket) = BracketExp (id l) (deCaseReorderBracket a1 bracket)
96
false
false
0
7
11
38
18
20
null
null
wilbowma/accelerate
Data/Array/Accelerate/Interpreter.hs
bsd-3-clause
evalOpenExp (Cond c t e) env aenv = if evalOpenExp c env aenv then evalOpenExp t env aenv else evalOpenExp e env aenv
128
evalOpenExp (Cond c t e) env aenv = if evalOpenExp c env aenv then evalOpenExp t env aenv else evalOpenExp e env aenv
128
evalOpenExp (Cond c t e) env aenv = if evalOpenExp c env aenv then evalOpenExp t env aenv else evalOpenExp e env aenv
128
false
false
0
7
33
52
25
27
null
null
harendra-kumar/stack
src/Stack/Build/Haddock.hs
bsd-3-clause
generateSnapHaddockIndex :: (MonadIO m, MonadCatch m, MonadThrow m, MonadLogger m, MonadBaseControl IO m) => EnvOverride -> WhichCompiler -> BaseConfigOpts -> Map GhcPkgId (DumpPackage () ()) -- ^ Global package dump -> Map GhcPkgId (DumpPackage () ()) -- ^ Snapshot package dump -> m () generateSnapHaddockIndex envOverride wc bco globalDumpPkgs snapshotDumpPkgs = generateHaddockIndex "snapshot packages" envOverride wc (Map.elems snapshotDumpPkgs ++ Map.elems globalDumpPkgs) "." (snapDocDir bco)
581
generateSnapHaddockIndex :: (MonadIO m, MonadCatch m, MonadThrow m, MonadLogger m, MonadBaseControl IO m) => EnvOverride -> WhichCompiler -> BaseConfigOpts -> Map GhcPkgId (DumpPackage () ()) -- ^ Global package dump -> Map GhcPkgId (DumpPackage () ()) -- ^ Snapshot package dump -> m () generateSnapHaddockIndex envOverride wc bco globalDumpPkgs snapshotDumpPkgs = generateHaddockIndex "snapshot packages" envOverride wc (Map.elems snapshotDumpPkgs ++ Map.elems globalDumpPkgs) "." (snapDocDir bco)
581
generateSnapHaddockIndex envOverride wc bco globalDumpPkgs snapshotDumpPkgs = generateHaddockIndex "snapshot packages" envOverride wc (Map.elems snapshotDumpPkgs ++ Map.elems globalDumpPkgs) "." (snapDocDir bco)
263
false
true
0
15
145
164
77
87
null
null
fatuhoku/haskell-ball-mosaic
src/Main.hs
mit
-- The LoopControl variable is a carried state of the mainLoop! -- The only thing we care is dragging. -- 1) When the user clicks, we record the mouse position. This is the relative -- movement's origin. We express whether we are in a drag motion or not by a -- Maybe DragMotion data type. -- 2) Every time we move the mouse with the button down, we calculate the relative -- movement from the relative origin, and update the position the circle -- accordingly. Positions are in world coordinates. -- - The positions of the Circles are stored in a simple 'Scene' data -- structure, which is just a list of objects for now. -- - Checking this list for collision isn't exactly difficult. we can think -- of efficient space partitioning later! -- - Whenever a circle is being moved, be sure to only update that circle! -- No other circle's positions should be updated. -- 3) Whenever c is pressed, we create another circle where the mouse is if it -- doesn't overlap with any other circle. -- 4) When the user releases, the object should remain still where it is. -- -- The main loop does the following: -- - inspect any incoming inputs: mouse clicks and mouse movements. -- - instantaneous update of the scene (statically insert objects) -- - delta-tee update of the scene -- - draw the updated scene -- - repeat. mainLoop :: Vars -> IO () mainLoop refs = do waitEvents -- 1) Calls all callbacks -- 2) Callbacks are aware of the state of the scene scn <- readIORef (scene refs) -- instantaneouslyUpdateScene scn -- deltaTeeUpdateScene scn renderScene scn threadDelay 100 -- Wait a millisecond breakOrCont <- readIORef (loop refs) case breakOrCont of Continue -> mainLoop refs Break -> return () -- Renders the scene. Enable calls are made at every loop!
1,887
mainLoop :: Vars -> IO () mainLoop refs = do waitEvents -- 1) Calls all callbacks -- 2) Callbacks are aware of the state of the scene scn <- readIORef (scene refs) -- instantaneouslyUpdateScene scn -- deltaTeeUpdateScene scn renderScene scn threadDelay 100 -- Wait a millisecond breakOrCont <- readIORef (loop refs) case breakOrCont of Continue -> mainLoop refs Break -> return () -- Renders the scene. Enable calls are made at every loop!
531
mainLoop refs = do waitEvents -- 1) Calls all callbacks -- 2) Callbacks are aware of the state of the scene scn <- readIORef (scene refs) -- instantaneouslyUpdateScene scn -- deltaTeeUpdateScene scn renderScene scn threadDelay 100 -- Wait a millisecond breakOrCont <- readIORef (loop refs) case breakOrCont of Continue -> mainLoop refs Break -> return () -- Renders the scene. Enable calls are made at every loop!
505
true
true
0
11
447
127
72
55
null
null
avh4/elm-format
elm-format-lib/src/Reporting/Result.hs
bsd-3-clause
toMaybe :: Result w x a -> Maybe a toMaybe (Result _ (Ok a)) = Just a
69
toMaybe :: Result w x a -> Maybe a toMaybe (Result _ (Ok a)) = Just a
69
toMaybe (Result _ (Ok a)) = Just a
34
false
true
0
9
16
45
21
24
null
null
lukexi/cabal
cabal-install/Distribution/Client/Install.hs
bsd-3-clause
printBuildFailures :: InstallPlan -> IO () printBuildFailures plan = case [ (pkg, reason) | InstallPlan.Failed pkg reason <- InstallPlan.toList plan ] of [] -> return () failed -> die . unlines $ "Error: some packages failed to install:" : [ display (packageId pkg) ++ printFailureReason reason | (pkg, reason) <- failed ] where printFailureReason reason = case reason of DependentFailed pkgid -> " depends on " ++ display pkgid ++ " which failed to install." DownloadFailed e -> " failed while downloading the package." ++ showException e UnpackFailed e -> " failed while unpacking the package." ++ showException e ConfigureFailed e -> " failed during the configure step." ++ showException e BuildFailed e -> " failed during the building phase." ++ showException e TestsFailed e -> " failed during the tests phase." ++ showException e InstallFailed e -> " failed during the final install step." ++ showException e -- This will never happen, but we include it for completeness PlanningFailed -> " failed during the planning phase." showException e = " The exception was:\n " ++ show e ++ maybeOOM e #ifdef mingw32_HOST_OS maybeOOM _ = "" #else maybeOOM e = maybe "" onExitFailure (fromException e) onExitFailure (ExitFailure n) | n == 9 || n == -9 = "\nThis may be due to an out-of-memory condition." onExitFailure _ = "" #endif -- | If we're working inside a sandbox and some add-source deps were installed, -- update the timestamps of those deps.
1,860
printBuildFailures :: InstallPlan -> IO () printBuildFailures plan = case [ (pkg, reason) | InstallPlan.Failed pkg reason <- InstallPlan.toList plan ] of [] -> return () failed -> die . unlines $ "Error: some packages failed to install:" : [ display (packageId pkg) ++ printFailureReason reason | (pkg, reason) <- failed ] where printFailureReason reason = case reason of DependentFailed pkgid -> " depends on " ++ display pkgid ++ " which failed to install." DownloadFailed e -> " failed while downloading the package." ++ showException e UnpackFailed e -> " failed while unpacking the package." ++ showException e ConfigureFailed e -> " failed during the configure step." ++ showException e BuildFailed e -> " failed during the building phase." ++ showException e TestsFailed e -> " failed during the tests phase." ++ showException e InstallFailed e -> " failed during the final install step." ++ showException e -- This will never happen, but we include it for completeness PlanningFailed -> " failed during the planning phase." showException e = " The exception was:\n " ++ show e ++ maybeOOM e #ifdef mingw32_HOST_OS maybeOOM _ = "" #else maybeOOM e = maybe "" onExitFailure (fromException e) onExitFailure (ExitFailure n) | n == 9 || n == -9 = "\nThis may be due to an out-of-memory condition." onExitFailure _ = "" #endif -- | If we're working inside a sandbox and some add-source deps were installed, -- update the timestamps of those deps.
1,860
printBuildFailures plan = case [ (pkg, reason) | InstallPlan.Failed pkg reason <- InstallPlan.toList plan ] of [] -> return () failed -> die . unlines $ "Error: some packages failed to install:" : [ display (packageId pkg) ++ printFailureReason reason | (pkg, reason) <- failed ] where printFailureReason reason = case reason of DependentFailed pkgid -> " depends on " ++ display pkgid ++ " which failed to install." DownloadFailed e -> " failed while downloading the package." ++ showException e UnpackFailed e -> " failed while unpacking the package." ++ showException e ConfigureFailed e -> " failed during the configure step." ++ showException e BuildFailed e -> " failed during the building phase." ++ showException e TestsFailed e -> " failed during the tests phase." ++ showException e InstallFailed e -> " failed during the final install step." ++ showException e -- This will never happen, but we include it for completeness PlanningFailed -> " failed during the planning phase." showException e = " The exception was:\n " ++ show e ++ maybeOOM e #ifdef mingw32_HOST_OS maybeOOM _ = "" #else maybeOOM e = maybe "" onExitFailure (fromException e) onExitFailure (ExitFailure n) | n == 9 || n == -9 = "\nThis may be due to an out-of-memory condition." onExitFailure _ = "" #endif -- | If we're working inside a sandbox and some add-source deps were installed, -- update the timestamps of those deps.
1,798
false
true
2
10
653
296
141
155
null
null
bendmorris/scotch
Scotch/Parse/ParseBase.hs
gpl-3.0
-- { } angles = Token.angles lexer
48
angles = Token.angles lexer
41
angles = Token.angles lexer
41
true
false
0
6
20
12
6
6
null
null
fimad/scalpel
scalpel-core/benchmarks/Main.hs
apache-2.0
manySelects :: Int -> [TagSoup.Tag T.Text] -> Maybe () manySelects i testData = flip scrape testData $ replicateM_ i $ sum <$> chroots "tag" (return 1)
197
manySelects :: Int -> [TagSoup.Tag T.Text] -> Maybe () manySelects i testData = flip scrape testData $ replicateM_ i $ sum <$> chroots "tag" (return 1)
197
manySelects i testData = flip scrape testData $ replicateM_ i $ sum <$> chroots "tag" (return 1)
142
false
true
4
10
71
76
34
42
null
null
shtukas/Gaia
src/Gaia/SystemIntegrity.hs
mit
aionTreeFsckCASKey :: String -> IO Bool aionTreeFsckCASKey caskey = do string' <- XP1.getAionJSONStringForCASKey3 caskey case string' of Nothing -> return False Just string -> do case (XP1.convertJSONStringIntoAesonValue string) of Nothing -> return False Just avalue -> aionTreeFsckAesonValue (ExtendedAesonValue avalue caskey)
400
aionTreeFsckCASKey :: String -> IO Bool aionTreeFsckCASKey caskey = do string' <- XP1.getAionJSONStringForCASKey3 caskey case string' of Nothing -> return False Just string -> do case (XP1.convertJSONStringIntoAesonValue string) of Nothing -> return False Just avalue -> aionTreeFsckAesonValue (ExtendedAesonValue avalue caskey)
400
aionTreeFsckCASKey caskey = do string' <- XP1.getAionJSONStringForCASKey3 caskey case string' of Nothing -> return False Just string -> do case (XP1.convertJSONStringIntoAesonValue string) of Nothing -> return False Just avalue -> aionTreeFsckAesonValue (ExtendedAesonValue avalue caskey)
360
false
true
0
17
111
102
46
56
null
null
changlinli/nikki
src/linuxDeploy.hs
lgpl-3.0
main = do setLibraryPath prepareDeploymentDir copy nikkiExe copy coreExe copy (".." </> "data") Foldable.mapM_ copy =<< getDynamicDependencies let deploymentIndicator = deploymentDir </> "yes_nikki_is_deployed" copyDeploymentLicenses fiddleInStartScript putStrLn ("touching " ++ deploymentIndicator) writeFile deploymentIndicator ""
377
main = do setLibraryPath prepareDeploymentDir copy nikkiExe copy coreExe copy (".." </> "data") Foldable.mapM_ copy =<< getDynamicDependencies let deploymentIndicator = deploymentDir </> "yes_nikki_is_deployed" copyDeploymentLicenses fiddleInStartScript putStrLn ("touching " ++ deploymentIndicator) writeFile deploymentIndicator ""
377
main = do setLibraryPath prepareDeploymentDir copy nikkiExe copy coreExe copy (".." </> "data") Foldable.mapM_ copy =<< getDynamicDependencies let deploymentIndicator = deploymentDir </> "yes_nikki_is_deployed" copyDeploymentLicenses fiddleInStartScript putStrLn ("touching " ++ deploymentIndicator) writeFile deploymentIndicator ""
377
false
false
0
10
77
89
37
52
null
null
dpieroux/euler
0137c.hs
mit
line n = concat [show n, "th golden nugget: ", show $ euler !! (n-1)]
69
line n = concat [show n, "th golden nugget: ", show $ euler !! (n-1)]
69
line n = concat [show n, "th golden nugget: ", show $ euler !! (n-1)]
69
false
false
1
9
14
42
20
22
null
null
elbrujohalcon/hPage
src/HPage/Test/Server.hs
bsd-3-clause
prop_reload_modules :: HPS.ServerHandle -> HS.ServerHandle -> String -> Bool prop_reload_modules hps hs txt' = unsafePerformIO $ do let txt = show $ length txt' let expr = "test = show \"" ++ txt ++ "\"" Right hpsr <- HPS.runIn hps $ do _ <- HP.setPageText expr 0 HP.savePageAs $ testDir </> "test.hs" _ <- HP.setPageText "test" 0 _ <- HP.loadModules [testDir </> "test.hs"] _ <- HP.reloadModules HP.interpret Right hsr <- HS.runIn hs $ do Hint.loadModules [testDir </> "test.hs"] Hint.getLoadedModules >>= Hint.setTopLevelModules Hint.eval "test" return $ HP.intValue hpsr == hsr
1,161
prop_reload_modules :: HPS.ServerHandle -> HS.ServerHandle -> String -> Bool prop_reload_modules hps hs txt' = unsafePerformIO $ do let txt = show $ length txt' let expr = "test = show \"" ++ txt ++ "\"" Right hpsr <- HPS.runIn hps $ do _ <- HP.setPageText expr 0 HP.savePageAs $ testDir </> "test.hs" _ <- HP.setPageText "test" 0 _ <- HP.loadModules [testDir </> "test.hs"] _ <- HP.reloadModules HP.interpret Right hsr <- HS.runIn hs $ do Hint.loadModules [testDir </> "test.hs"] Hint.getLoadedModules >>= Hint.setTopLevelModules Hint.eval "test" return $ HP.intValue hpsr == hsr
1,161
prop_reload_modules hps hs txt' = unsafePerformIO $ do let txt = show $ length txt' let expr = "test = show \"" ++ txt ++ "\"" Right hpsr <- HPS.runIn hps $ do _ <- HP.setPageText expr 0 HP.savePageAs $ testDir </> "test.hs" _ <- HP.setPageText "test" 0 _ <- HP.loadModules [testDir </> "test.hs"] _ <- HP.reloadModules HP.interpret Right hsr <- HS.runIn hs $ do Hint.loadModules [testDir </> "test.hs"] Hint.getLoadedModules >>= Hint.setTopLevelModules Hint.eval "test" return $ HP.intValue hpsr == hsr
1,084
false
true
0
15
669
233
105
128
null
null
plumlife/cabal
Cabal/Distribution/Simple/BuildTarget.hs
bsd-3-clause
orNoSuchThing :: String -> String -> Match a -> Match a orNoSuchThing thing got (NoMatch 0 _) = matchErrorNoSuch thing got
122
orNoSuchThing :: String -> String -> Match a -> Match a orNoSuchThing thing got (NoMatch 0 _) = matchErrorNoSuch thing got
122
orNoSuchThing thing got (NoMatch 0 _) = matchErrorNoSuch thing got
66
false
true
0
8
20
49
23
26
null
null
rgleichman/roshask
src/executable/Parse.hs
bsd-3-clause
sanitize "class" = "_class"
27
sanitize "class" = "_class"
27
sanitize "class" = "_class"
27
false
false
1
5
3
13
4
9
null
null
lkitching/PScheme
src/PScheme/Eval.hs
bsd-3-clause
quoteInner :: Value -> Eval Value quoteInner (Cons (Symbol "unquote") l) = unquote l
84
quoteInner :: Value -> Eval Value quoteInner (Cons (Symbol "unquote") l) = unquote l
84
quoteInner (Cons (Symbol "unquote") l) = unquote l
50
false
true
0
9
13
38
18
20
null
null
aaronc/Idris-dev
src/Idris/AbsSyntaxTree.hs
bsd-3-clause
expl = Exp [] Dynamic False
27
expl = Exp [] Dynamic False
27
expl = Exp [] Dynamic False
27
false
false
0
6
5
15
7
8
null
null
agentm/project-m36
src/lib/ProjectM36/AtomType.hs
unlicense
validateDataConstructorDefArg (DataConstructorDefTypeConstructorArg (TypeVariable _)) _ _ = Right ()
100
validateDataConstructorDefArg (DataConstructorDefTypeConstructorArg (TypeVariable _)) _ _ = Right ()
100
validateDataConstructorDefArg (DataConstructorDefTypeConstructorArg (TypeVariable _)) _ _ = Right ()
100
false
false
0
9
8
30
14
16
null
null
GaloisInc/ivory-tower-stm32
tower-freertos-stm32/src/Ivory/OS/FreeRTOS/Tower/Monitor.hs
bsd-3-clause
monitorLock :: AST.Monitor -> Mutex.MutexHandle monitorLock mon = addrOf (monitorLockArea mon)
94
monitorLock :: AST.Monitor -> Mutex.MutexHandle monitorLock mon = addrOf (monitorLockArea mon)
94
monitorLock mon = addrOf (monitorLockArea mon)
46
false
true
0
7
10
31
15
16
null
null
haskell-opengl/OpenGLRaw
src/Graphics/GL/Functions/F28.hs
bsd-3-clause
ptr_glUniformMatrix2x4fv :: FunPtr (GLint -> GLsizei -> GLboolean -> Ptr GLfloat -> IO ()) ptr_glUniformMatrix2x4fv = unsafePerformIO $ getCommand "glUniformMatrix2x4fv"
169
ptr_glUniformMatrix2x4fv :: FunPtr (GLint -> GLsizei -> GLboolean -> Ptr GLfloat -> IO ()) ptr_glUniformMatrix2x4fv = unsafePerformIO $ getCommand "glUniformMatrix2x4fv"
169
ptr_glUniformMatrix2x4fv = unsafePerformIO $ getCommand "glUniformMatrix2x4fv"
78
false
true
0
12
19
48
23
25
null
null
martinvlk/cis194-homeworks
src/HW07/JoinList.hs
gpl-3.0
_ !!? i | i < 0 = Nothing
25
_ !!? i | i < 0 = Nothing
25
_ !!? i | i < 0 = Nothing
25
false
false
0
8
8
22
9
13
null
null
JoelHoskin/99HaskellProblems
Lists.hs
mit
yReverse l = last l : myReverse (init l)
41
myReverse l = last l : myReverse (init l)
41
myReverse l = last l : myReverse (init l)
41
false
false
0
8
9
25
11
14
null
null
dillonhuff/AFL
src/Lexer.hs
bsd-3-clause
nameVal (DataConstructorName n _) = n
37
nameVal (DataConstructorName n _) = n
37
nameVal (DataConstructorName n _) = n
37
false
false
0
6
5
18
8
10
null
null
AmkG/merchants-race
Merch/Race/Ruleset/Parser.hs
gpl-3.0
keyword :: String -> Parser () keyword s = try $ do string s notFollowedBy (satisfy (\c -> isAlphaNum c || c == '_')) return ()
133
keyword :: String -> Parser () keyword s = try $ do string s notFollowedBy (satisfy (\c -> isAlphaNum c || c == '_')) return ()
133
keyword s = try $ do string s notFollowedBy (satisfy (\c -> isAlphaNum c || c == '_')) return ()
102
false
true
2
15
31
78
34
44
null
null
spinda/liquidhaskell
src/Language/Haskell/Liquid/Spec/Expand.hs
bsd-3-clause
expandRRType l (RAllT tv ty) = RAllT tv <$> expandRRType l ty
63
expandRRType l (RAllT tv ty) = RAllT tv <$> expandRRType l ty
63
expandRRType l (RAllT tv ty) = RAllT tv <$> expandRRType l ty
63
false
false
0
7
13
31
14
17
null
null
CarstenKoenig/AdventOfCode2016
Day21/Main.hs
mit
apply (SwapLetter a b) input = map swap input where swap c | c == a = b | c == b = a | otherwise = c
134
apply (SwapLetter a b) input = map swap input where swap c | c == a = b | c == b = a | otherwise = c
134
apply (SwapLetter a b) input = map swap input where swap c | c == a = b | c == b = a | otherwise = c
134
false
false
1
8
61
80
33
47
null
null
Verites/verigraph
tests/Category/TypedGraph/CocompleteSpec.hs
apache-2.0
typedGraphAEight = buildGraphMorphism graphAEight typeGraphEight [(10,1),(20,1)] [(100,1)]
90
typedGraphAEight = buildGraphMorphism graphAEight typeGraphEight [(10,1),(20,1)] [(100,1)]
90
typedGraphAEight = buildGraphMorphism graphAEight typeGraphEight [(10,1),(20,1)] [(100,1)]
90
false
false
0
7
6
42
25
17
null
null
k0001/pipes-http-message
src/Pipes/HTTP/Message/Attoparsec/FastSet.hs
bsd-3-clause
charClass :: String -> FastSet charClass = set . B8.pack . go where go (a:'-':b:xs) = [a..b] ++ go xs go (x:xs) = x : go xs go _ = ""
157
charClass :: String -> FastSet charClass = set . B8.pack . go where go (a:'-':b:xs) = [a..b] ++ go xs go (x:xs) = x : go xs go _ = ""
157
charClass = set . B8.pack . go where go (a:'-':b:xs) = [a..b] ++ go xs go (x:xs) = x : go xs go _ = ""
126
false
true
2
9
54
92
47
45
null
null
isomorphism/csound-expression
examples/Events.hs
bsd-3-clause
e51 :: Evt (D, D) e51 = mappend (repeatE (0.7, 220) (metro (2/7))) (cycleE [(0.5, 440), (0.5, 330)] (metro 2))
127
e51 :: Evt (D, D) e51 = mappend (repeatE (0.7, 220) (metro (2/7))) (cycleE [(0.5, 440), (0.5, 330)] (metro 2))
127
e51 = mappend (repeatE (0.7, 220) (metro (2/7))) (cycleE [(0.5, 440), (0.5, 330)] (metro 2))
109
false
true
0
11
36
84
47
37
null
null
diminishedprime/.org
programmey_stuff/write_yourself_a_scheme/ch_06/wyas/app/Eval.hs
mit
cond ((List a) : _) = throwError $ NumArgs 2 a
46
cond ((List a) : _) = throwError $ NumArgs 2 a
46
cond ((List a) : _) = throwError $ NumArgs 2 a
46
false
false
0
8
10
32
15
17
null
null
rahulmutt/ghcvm
compiler/Eta/Iface/IfaceType.hs
bsd-3-clause
---------------- toIfaceTyCon :: TyCon -> IfaceTyCon toIfaceTyCon tc | isPromotedDataCon tc = IfacePromotedDataCon tc_name | isPromotedTyCon tc = IfacePromotedTyCon tc_name | otherwise = IfaceTc tc_name where tc_name = tyConName tc
254
toIfaceTyCon :: TyCon -> IfaceTyCon toIfaceTyCon tc | isPromotedDataCon tc = IfacePromotedDataCon tc_name | isPromotedTyCon tc = IfacePromotedTyCon tc_name | otherwise = IfaceTc tc_name where tc_name = tyConName tc
237
toIfaceTyCon tc | isPromotedDataCon tc = IfacePromotedDataCon tc_name | isPromotedTyCon tc = IfacePromotedTyCon tc_name | otherwise = IfaceTc tc_name where tc_name = tyConName tc
201
true
true
2
8
52
64
30
34
null
null
candu/haskellbook
ch11/vehicles.hs
mit
isCar _ = False
15
isCar _ = False
15
isCar _ = False
15
false
false
0
4
3
10
4
6
null
null
phile314/chunky
src/lib/Codec/Chunky/Internal.hs
lgpl-3.0
readStrPadded :: Int64 -> Get T.Text readStrPadded n = T.stripEnd <$> readStr n
79
readStrPadded :: Int64 -> Get T.Text readStrPadded n = T.stripEnd <$> readStr n
79
readStrPadded n = T.stripEnd <$> readStr n
42
false
true
2
8
12
37
16
21
null
null
david-caro/shellcheck
ShellCheck/Analytics.hs
gpl-3.0
determineShell (T_Script _ shebang _) = fromMaybe Bash . shellForExecutable $ shellFor shebang where shellFor s | "/env " `isInfixOf` s = head (drop 1 (words s)++[""]) shellFor s | ' ' `elem` s = shellFor $ takeWhile (/= ' ') s shellFor s = reverse . takeWhile (/= '/') . reverse $ s -- Checks that are run on each node in the AST
355
determineShell (T_Script _ shebang _) = fromMaybe Bash . shellForExecutable $ shellFor shebang where shellFor s | "/env " `isInfixOf` s = head (drop 1 (words s)++[""]) shellFor s | ' ' `elem` s = shellFor $ takeWhile (/= ' ') s shellFor s = reverse . takeWhile (/= '/') . reverse $ s -- Checks that are run on each node in the AST
355
determineShell (T_Script _ shebang _) = fromMaybe Bash . shellForExecutable $ shellFor shebang where shellFor s | "/env " `isInfixOf` s = head (drop 1 (words s)++[""]) shellFor s | ' ' `elem` s = shellFor $ takeWhile (/= ' ') s shellFor s = reverse . takeWhile (/= '/') . reverse $ s -- Checks that are run on each node in the AST
355
false
false
0
13
89
140
70
70
null
null
oisdk/SSystemOpt
src/Numeric/Search.hs
mit
search :: Search () search = loop where loop = do prev <- use bestScore oneRound changed <- uses bestScore (prev/=) when changed loop
151
search :: Search () search = loop where loop = do prev <- use bestScore oneRound changed <- uses bestScore (prev/=) when changed loop
151
search = loop where loop = do prev <- use bestScore oneRound changed <- uses bestScore (prev/=) when changed loop
131
false
true
0
9
41
59
28
31
null
null
ganeti-github-testing/ganeti-test-1
src/Ganeti/Constants.hs
bsd-2-clause
defaultDiskResync :: Bool defaultDiskResync = False
51
defaultDiskResync :: Bool defaultDiskResync = False
51
defaultDiskResync = False
25
false
true
0
4
5
11
6
5
null
null
kimolas/causal-haskell
app/Adjacency.hs
bsd-3-clause
-- Spanning tree counter; uses Kirchhoff's Theorem. spanTreeCount :: (Ord a, Eq a) => Graph a -> Integer spanTreeCount gr@(Graph ns es) = round . det . takeBoth n' $ laplacian gr where n' = length ns - 1 -- spectralCluster performs spectral clustering to estimate group membership.
290
spanTreeCount :: (Ord a, Eq a) => Graph a -> Integer spanTreeCount gr@(Graph ns es) = round . det . takeBoth n' $ laplacian gr where n' = length ns - 1 -- spectralCluster performs spectral clustering to estimate group membership.
237
spanTreeCount gr@(Graph ns es) = round . det . takeBoth n' $ laplacian gr where n' = length ns - 1 -- spectralCluster performs spectral clustering to estimate group membership.
184
true
true
0
8
56
82
41
41
null
null
lagleki/tersmu-0.2
Morph.hs
gpl-3.0
morph :: String -> Either Int String morph s = let Parsed words d _ = morphologywords $ morphologyParse "words" $ stripPunc s ++ " " p = posCol (dvPos d) - 1 in if p < length s then Left p else Right $ map toLower $ unwords $ words
267
morph :: String -> Either Int String morph s = let Parsed words d _ = morphologywords $ morphologyParse "words" $ stripPunc s ++ " " p = posCol (dvPos d) - 1 in if p < length s then Left p else Right $ map toLower $ unwords $ words
267
morph s = let Parsed words d _ = morphologywords $ morphologyParse "words" $ stripPunc s ++ " " p = posCol (dvPos d) - 1 in if p < length s then Left p else Right $ map toLower $ unwords $ words
230
false
true
0
12
86
116
53
63
null
null
spechub/Hets
Syntax/Print_AS_Library.hs
gpl-2.0
printCorrespondence (Single_correspondence mcid eRef toer mrRef mconf) = sep $ concat [[indexed $ show eRef], map printRelationRef $ maybeToList mrRef, map printConfidence $ maybeToList mconf, [pretty toer], map pretty $ maybeToList mcid]
254
printCorrespondence (Single_correspondence mcid eRef toer mrRef mconf) = sep $ concat [[indexed $ show eRef], map printRelationRef $ maybeToList mrRef, map printConfidence $ maybeToList mconf, [pretty toer], map pretty $ maybeToList mcid]
254
printCorrespondence (Single_correspondence mcid eRef toer mrRef mconf) = sep $ concat [[indexed $ show eRef], map printRelationRef $ maybeToList mrRef, map printConfidence $ maybeToList mconf, [pretty toer], map pretty $ maybeToList mcid]
254
false
false
0
8
47
91
44
47
null
null
tonyfischetti/graph
TopoSort.hs
mit
-------------------------------------------- ---------------------------------- ---- Topo Sort Algorithms ---- ---------------------------------- topoSort :: Graph -> Path topoSort = reverse . gatherChildless
215
topoSort :: Graph -> Path topoSort = reverse . gatherChildless
62
topoSort = reverse . gatherChildless
36
true
true
1
7
24
31
15
16
null
null
literate-unitb/literate-unitb
src/Documentation/SummaryGen.hs
mit
act_sum :: EventId -> EventMerging' -> M () act_sum lbl e = section kw $ do when show_removals $ local (const True) $ put_all_expr' put_assign lbl $ e^.deleted' actions -- del_acts e put_all_expr' put_assign lbl $ M.toAscList $ e^.actions where kw = "\\textbf{begin}" put_assign (Assign v e) = [s|%s \\bcmeq %s|] (render $ v^.name) (prettyPrint e) put_assign (BcmSuchThat vs e) = [s|%s \\bcmsuch %s|] (intercalate "," $ L.map (render . view name) vs :: String) (prettyPrint e) put_assign (BcmIn v e) = [s|%s \\bcmin %s|] (render $ v^.name) (prettyPrint e)
774
act_sum :: EventId -> EventMerging' -> M () act_sum lbl e = section kw $ do when show_removals $ local (const True) $ put_all_expr' put_assign lbl $ e^.deleted' actions -- del_acts e put_all_expr' put_assign lbl $ M.toAscList $ e^.actions where kw = "\\textbf{begin}" put_assign (Assign v e) = [s|%s \\bcmeq %s|] (render $ v^.name) (prettyPrint e) put_assign (BcmSuchThat vs e) = [s|%s \\bcmsuch %s|] (intercalate "," $ L.map (render . view name) vs :: String) (prettyPrint e) put_assign (BcmIn v e) = [s|%s \\bcmin %s|] (render $ v^.name) (prettyPrint e)
774
act_sum lbl e = section kw $ do when show_removals $ local (const True) $ put_all_expr' put_assign lbl $ e^.deleted' actions -- del_acts e put_all_expr' put_assign lbl $ M.toAscList $ e^.actions where kw = "\\textbf{begin}" put_assign (Assign v e) = [s|%s \\bcmeq %s|] (render $ v^.name) (prettyPrint e) put_assign (BcmSuchThat vs e) = [s|%s \\bcmsuch %s|] (intercalate "," $ L.map (render . view name) vs :: String) (prettyPrint e) put_assign (BcmIn v e) = [s|%s \\bcmin %s|] (render $ v^.name) (prettyPrint e)
730
false
true
3
13
308
266
128
138
null
null
rfranek/duckling
Duckling/Time/Types.hs
bsd-3-clause
timeValue tzSeries (TimeObject s g (Just e)) = IntervalValue ( instantValue tzSeries s g , instantValue tzSeries e g )
124
timeValue tzSeries (TimeObject s g (Just e)) = IntervalValue ( instantValue tzSeries s g , instantValue tzSeries e g )
124
timeValue tzSeries (TimeObject s g (Just e)) = IntervalValue ( instantValue tzSeries s g , instantValue tzSeries e g )
124
false
false
0
9
25
50
24
26
null
null
lexml/lexml-linker
src/main/haskell/LinkerServer.hs
gpl-2.0
main = traplogging "LexML.Errors" ERROR "" $ do serverOpts <- SM.parseServerCommandLine normal <- isNormal when normal $ updateGlobalLogger rootLoggerName (setLevel INFO) loud <- isLoud when loud $ updateGlobalLogger rootLoggerName (setLevel DEBUG) noticeM "LexML.Server" $ "starting LinkerServer version " ++ version log $ "options : " ++ show serverOpts baseHandlers <- if not (null (SM.logfile serverOpts)) then return [] else verboseStreamHandler stderr DEBUG >>= \l -> return [l] updateGlobalLogger rootLoggerName $ setHandlers baseHandlers log $ "handlers updated" when (SM.syslog serverOpts) $ do s <- openlog "LinkerServer" [PID] DAEMON DEBUG updateGlobalLogger rootLoggerName (addHandler s) noticeM "LexML.Server" $ "starting LinkerServer log on syslog" case SM.logfile serverOpts of "" -> return () lf -> do lh <- openFile lf WriteMode h <- verboseStreamHandler lh DEBUG updateGlobalLogger rootLoggerName $ addHandler h case SM.pidfile serverOpts of "" -> return () pf -> do pid <- getProcessID writeFile pf (show pid) log "LinkerServer starting" udomains <- case SM.uncacheableDomainsFile serverOpts of "" -> return [] fp -> fmap lines $ readFile fp cacheFunc <- case SM.cacheDir serverOpts of "" -> noticeM "LexML.Server" "Not using cache" >> return noCache cdir -> noticeM "LexML.Server" ("Using cache at " ++ cdir) >> initCache cdir udomains >>= return . cached serve (show $ SM.port serverOpts) cacheFunc linkerHandler
1,599
main = traplogging "LexML.Errors" ERROR "" $ do serverOpts <- SM.parseServerCommandLine normal <- isNormal when normal $ updateGlobalLogger rootLoggerName (setLevel INFO) loud <- isLoud when loud $ updateGlobalLogger rootLoggerName (setLevel DEBUG) noticeM "LexML.Server" $ "starting LinkerServer version " ++ version log $ "options : " ++ show serverOpts baseHandlers <- if not (null (SM.logfile serverOpts)) then return [] else verboseStreamHandler stderr DEBUG >>= \l -> return [l] updateGlobalLogger rootLoggerName $ setHandlers baseHandlers log $ "handlers updated" when (SM.syslog serverOpts) $ do s <- openlog "LinkerServer" [PID] DAEMON DEBUG updateGlobalLogger rootLoggerName (addHandler s) noticeM "LexML.Server" $ "starting LinkerServer log on syslog" case SM.logfile serverOpts of "" -> return () lf -> do lh <- openFile lf WriteMode h <- verboseStreamHandler lh DEBUG updateGlobalLogger rootLoggerName $ addHandler h case SM.pidfile serverOpts of "" -> return () pf -> do pid <- getProcessID writeFile pf (show pid) log "LinkerServer starting" udomains <- case SM.uncacheableDomainsFile serverOpts of "" -> return [] fp -> fmap lines $ readFile fp cacheFunc <- case SM.cacheDir serverOpts of "" -> noticeM "LexML.Server" "Not using cache" >> return noCache cdir -> noticeM "LexML.Server" ("Using cache at " ++ cdir) >> initCache cdir udomains >>= return . cached serve (show $ SM.port serverOpts) cacheFunc linkerHandler
1,599
main = traplogging "LexML.Errors" ERROR "" $ do serverOpts <- SM.parseServerCommandLine normal <- isNormal when normal $ updateGlobalLogger rootLoggerName (setLevel INFO) loud <- isLoud when loud $ updateGlobalLogger rootLoggerName (setLevel DEBUG) noticeM "LexML.Server" $ "starting LinkerServer version " ++ version log $ "options : " ++ show serverOpts baseHandlers <- if not (null (SM.logfile serverOpts)) then return [] else verboseStreamHandler stderr DEBUG >>= \l -> return [l] updateGlobalLogger rootLoggerName $ setHandlers baseHandlers log $ "handlers updated" when (SM.syslog serverOpts) $ do s <- openlog "LinkerServer" [PID] DAEMON DEBUG updateGlobalLogger rootLoggerName (addHandler s) noticeM "LexML.Server" $ "starting LinkerServer log on syslog" case SM.logfile serverOpts of "" -> return () lf -> do lh <- openFile lf WriteMode h <- verboseStreamHandler lh DEBUG updateGlobalLogger rootLoggerName $ addHandler h case SM.pidfile serverOpts of "" -> return () pf -> do pid <- getProcessID writeFile pf (show pid) log "LinkerServer starting" udomains <- case SM.uncacheableDomainsFile serverOpts of "" -> return [] fp -> fmap lines $ readFile fp cacheFunc <- case SM.cacheDir serverOpts of "" -> noticeM "LexML.Server" "Not using cache" >> return noCache cdir -> noticeM "LexML.Server" ("Using cache at " ++ cdir) >> initCache cdir udomains >>= return . cached serve (show $ SM.port serverOpts) cacheFunc linkerHandler
1,599
false
false
1
18
370
509
224
285
null
null
gennady-em/haskel
src/PF_Probability.hs
gpl-2.0
-- conditional probability -- (|||) :: Dist a -> Event a -> Dist a (|||) = flip filterD
88
(|||) :: Dist a -> Event a -> Dist a (|||) = flip filterD
57
(|||) = flip filterD
20
true
true
0
8
18
43
21
22
null
null
DavidAlphaFox/ghc
utils/haddock/haddock-api/src/Haddock/Interface/LexParseRn.hs
bsd-3-clause
processModuleHeader :: DynFlags -> GlobalRdrEnv -> SafeHaskellMode -> Maybe LHsDocString -> ErrMsgM (HaddockModInfo Name, Maybe (MDoc Name)) processModuleHeader dflags gre safety mayStr = do (hmi, doc) <- case mayStr of Nothing -> return failure Just (L _ (HsDocString fs)) -> do let str = unpackFS fs (hmi, doc) = parseModuleHeader dflags str !descr = rename dflags gre <$> hmi_description hmi hmi' = hmi { hmi_description = descr } doc' = overDoc (rename dflags gre) doc return (hmi', Just doc') let flags :: [ExtensionFlag] -- We remove the flags implied by the language setting and we display the language instead flags = map toEnum (toList $ extensionFlags dflags) \\ languageExtensions (language dflags) return (hmi { hmi_safety = Just $ showPpr dflags safety , hmi_language = language dflags , hmi_extensions = flags } , doc) where failure = (emptyHaddockModInfo, Nothing)
1,046
processModuleHeader :: DynFlags -> GlobalRdrEnv -> SafeHaskellMode -> Maybe LHsDocString -> ErrMsgM (HaddockModInfo Name, Maybe (MDoc Name)) processModuleHeader dflags gre safety mayStr = do (hmi, doc) <- case mayStr of Nothing -> return failure Just (L _ (HsDocString fs)) -> do let str = unpackFS fs (hmi, doc) = parseModuleHeader dflags str !descr = rename dflags gre <$> hmi_description hmi hmi' = hmi { hmi_description = descr } doc' = overDoc (rename dflags gre) doc return (hmi', Just doc') let flags :: [ExtensionFlag] -- We remove the flags implied by the language setting and we display the language instead flags = map toEnum (toList $ extensionFlags dflags) \\ languageExtensions (language dflags) return (hmi { hmi_safety = Just $ showPpr dflags safety , hmi_language = language dflags , hmi_extensions = flags } , doc) where failure = (emptyHaddockModInfo, Nothing)
1,046
processModuleHeader dflags gre safety mayStr = do (hmi, doc) <- case mayStr of Nothing -> return failure Just (L _ (HsDocString fs)) -> do let str = unpackFS fs (hmi, doc) = parseModuleHeader dflags str !descr = rename dflags gre <$> hmi_description hmi hmi' = hmi { hmi_description = descr } doc' = overDoc (rename dflags gre) doc return (hmi', Just doc') let flags :: [ExtensionFlag] -- We remove the flags implied by the language setting and we display the language instead flags = map toEnum (toList $ extensionFlags dflags) \\ languageExtensions (language dflags) return (hmi { hmi_safety = Just $ showPpr dflags safety , hmi_language = language dflags , hmi_extensions = flags } , doc) where failure = (emptyHaddockModInfo, Nothing)
885
false
true
0
18
304
307
154
153
null
null
spechub/Hets
Persistence/Reasoning.hs
gpl-2.0
setupReasoning :: HetcatsOpts -> ReasoningCacheGoal -> IO (Maybe ReasonerConfigurationId) setupReasoning opts reasoningCacheGoal | rceUseDatabase reasoningCacheGoal = onDatabase (databaseConfig opts) $ fmap Just $ createReasonerConfiguration reasoningCacheGoal | otherwise = return Nothing
329
setupReasoning :: HetcatsOpts -> ReasoningCacheGoal -> IO (Maybe ReasonerConfigurationId) setupReasoning opts reasoningCacheGoal | rceUseDatabase reasoningCacheGoal = onDatabase (databaseConfig opts) $ fmap Just $ createReasonerConfiguration reasoningCacheGoal | otherwise = return Nothing
329
setupReasoning opts reasoningCacheGoal | rceUseDatabase reasoningCacheGoal = onDatabase (databaseConfig opts) $ fmap Just $ createReasonerConfiguration reasoningCacheGoal | otherwise = return Nothing
209
false
true
1
10
69
75
34
41
null
null
yoo-e/weixin-mp-sdk
WeiXin/PublicPlatform/Types.hs
mit
-------------------------------------------------------------------------------- wxppLogSource :: IsString a => a wxppLogSource = "WXPP"
137
wxppLogSource :: IsString a => a wxppLogSource = "WXPP"
55
wxppLogSource = "WXPP"
22
true
true
0
7
10
26
11
15
null
null
dashea/bdcs
importer/BDCS/CS.hs
lgpl-2.1
commitContents :: IsRepo a => a -> T.Text -> StateT ChecksumMap IO () commitContents repo commit = do (root, _) <- repoReadCommit repo commit noCancellable file <- fileResolveRelativePath root "/" info <- fileQueryInfo file "*" [FileQueryInfoFlagsNofollowSymlinks] noCancellable walk file info where walk :: File -> FileInfo -> StateT ChecksumMap IO () walk f i = lift (fileInfoGetFileType i) >>= \case FileTypeDirectory -> do getPathAndChecksum FileTypeDirectory f >>= addPathAndChecksum -- Grab the info for everything in this directory. dirEnum <- fileEnumerateChildren f "*" [FileQueryInfoFlagsNofollowSymlinks] noCancellable childrenInfo <- getAllChildren dirEnum [] -- Examine the contents of this directory recursively - this results in all -- the files being added by the other branch of the case, and other directories -- being handled recusrively. Thus, we do this depth-first. forM_ childrenInfo $ \childInfo -> do child <- fileInfoGetName childInfo >>= fileGetChild f walk child childInfo ty -> getPathAndChecksum ty f >>= addPathAndChecksum addPathAndChecksum :: (Maybe T.Text, T.Text) -> StateT ChecksumMap IO () addPathAndChecksum (Just p, c) = modify (++ [(p, c)]) addPathAndChecksum _ = return () getAllChildren :: FileEnumerator -> [FileInfo] -> StateT ChecksumMap IO [FileInfo] getAllChildren enum accum = fileEnumeratorNextFile enum noCancellable >>= \case Just next -> getAllChildren enum (accum ++ [next]) Nothing -> return accum getPathAndChecksum :: FileType -> File -> StateT ChecksumMap IO (Maybe T.Text, T.Text) getPathAndChecksum ty f = lift $ unsafeCastTo RepoFile f >>= \repoFile -> do checksum <- case ty of FileTypeDirectory -> do -- this needs to be called before repoFileTreeGetMetadataChecksum to populate the data repoFileEnsureResolved repoFile repoFileTreeGetMetadataChecksum repoFile _ -> repoFileGetChecksum repoFile path <- fileGetPath f return (fmap T.pack path, checksum) -- Open the named ostree repo. If the repo does not already exist, it will first be created. -- It is created in Z2 mode because that can be modified without being root.
2,702
commitContents :: IsRepo a => a -> T.Text -> StateT ChecksumMap IO () commitContents repo commit = do (root, _) <- repoReadCommit repo commit noCancellable file <- fileResolveRelativePath root "/" info <- fileQueryInfo file "*" [FileQueryInfoFlagsNofollowSymlinks] noCancellable walk file info where walk :: File -> FileInfo -> StateT ChecksumMap IO () walk f i = lift (fileInfoGetFileType i) >>= \case FileTypeDirectory -> do getPathAndChecksum FileTypeDirectory f >>= addPathAndChecksum -- Grab the info for everything in this directory. dirEnum <- fileEnumerateChildren f "*" [FileQueryInfoFlagsNofollowSymlinks] noCancellable childrenInfo <- getAllChildren dirEnum [] -- Examine the contents of this directory recursively - this results in all -- the files being added by the other branch of the case, and other directories -- being handled recusrively. Thus, we do this depth-first. forM_ childrenInfo $ \childInfo -> do child <- fileInfoGetName childInfo >>= fileGetChild f walk child childInfo ty -> getPathAndChecksum ty f >>= addPathAndChecksum addPathAndChecksum :: (Maybe T.Text, T.Text) -> StateT ChecksumMap IO () addPathAndChecksum (Just p, c) = modify (++ [(p, c)]) addPathAndChecksum _ = return () getAllChildren :: FileEnumerator -> [FileInfo] -> StateT ChecksumMap IO [FileInfo] getAllChildren enum accum = fileEnumeratorNextFile enum noCancellable >>= \case Just next -> getAllChildren enum (accum ++ [next]) Nothing -> return accum getPathAndChecksum :: FileType -> File -> StateT ChecksumMap IO (Maybe T.Text, T.Text) getPathAndChecksum ty f = lift $ unsafeCastTo RepoFile f >>= \repoFile -> do checksum <- case ty of FileTypeDirectory -> do -- this needs to be called before repoFileTreeGetMetadataChecksum to populate the data repoFileEnsureResolved repoFile repoFileTreeGetMetadataChecksum repoFile _ -> repoFileGetChecksum repoFile path <- fileGetPath f return (fmap T.pack path, checksum) -- Open the named ostree repo. If the repo does not already exist, it will first be created. -- It is created in Z2 mode because that can be modified without being root.
2,702
commitContents repo commit = do (root, _) <- repoReadCommit repo commit noCancellable file <- fileResolveRelativePath root "/" info <- fileQueryInfo file "*" [FileQueryInfoFlagsNofollowSymlinks] noCancellable walk file info where walk :: File -> FileInfo -> StateT ChecksumMap IO () walk f i = lift (fileInfoGetFileType i) >>= \case FileTypeDirectory -> do getPathAndChecksum FileTypeDirectory f >>= addPathAndChecksum -- Grab the info for everything in this directory. dirEnum <- fileEnumerateChildren f "*" [FileQueryInfoFlagsNofollowSymlinks] noCancellable childrenInfo <- getAllChildren dirEnum [] -- Examine the contents of this directory recursively - this results in all -- the files being added by the other branch of the case, and other directories -- being handled recusrively. Thus, we do this depth-first. forM_ childrenInfo $ \childInfo -> do child <- fileInfoGetName childInfo >>= fileGetChild f walk child childInfo ty -> getPathAndChecksum ty f >>= addPathAndChecksum addPathAndChecksum :: (Maybe T.Text, T.Text) -> StateT ChecksumMap IO () addPathAndChecksum (Just p, c) = modify (++ [(p, c)]) addPathAndChecksum _ = return () getAllChildren :: FileEnumerator -> [FileInfo] -> StateT ChecksumMap IO [FileInfo] getAllChildren enum accum = fileEnumeratorNextFile enum noCancellable >>= \case Just next -> getAllChildren enum (accum ++ [next]) Nothing -> return accum getPathAndChecksum :: FileType -> File -> StateT ChecksumMap IO (Maybe T.Text, T.Text) getPathAndChecksum ty f = lift $ unsafeCastTo RepoFile f >>= \repoFile -> do checksum <- case ty of FileTypeDirectory -> do -- this needs to be called before repoFileTreeGetMetadataChecksum to populate the data repoFileEnsureResolved repoFile repoFileTreeGetMetadataChecksum repoFile _ -> repoFileGetChecksum repoFile path <- fileGetPath f return (fmap T.pack path, checksum) -- Open the named ostree repo. If the repo does not already exist, it will first be created. -- It is created in Z2 mode because that can be modified without being root.
2,632
false
true
0
17
916
554
267
287
null
null
bgamari/reftrack
PDFScrape.hs
bsd-3-clause
findPdfIds :: FilePath -> IO [ExternalRef] findPdfIds file = do (code, contents, err) <- readProcessWithExitCode "pdftotext" [file, "-"] "" return $ findIds contents
173
findPdfIds :: FilePath -> IO [ExternalRef] findPdfIds file = do (code, contents, err) <- readProcessWithExitCode "pdftotext" [file, "-"] "" return $ findIds contents
173
findPdfIds file = do (code, contents, err) <- readProcessWithExitCode "pdftotext" [file, "-"] "" return $ findIds contents
130
false
true
0
9
30
63
32
31
null
null
alephcloud/hs-aws-kinesis-reshard
src/Aws/Kinesis/Reshard/Shards.hs
apache-2.0
shardIsOpen ∷ Shard → Bool shardIsOpen = isNothing ∘ view _2 ∘ shardSequenceNumberRange
101
shardIsOpen ∷ Shard → Bool shardIsOpen = isNothing ∘ view _2 ∘ shardSequenceNumberRange
101
shardIsOpen = isNothing ∘ view _2 ∘ shardSequenceNumberRange
70
false
true
4
7
26
35
14
21
null
null
JacquesCarette/literate-scientific-software
code/drasil-example/Drasil/SSP/GenDefs.hs
bsd-2-clause
momEqlDerivMomentSentence = [S "Considering one dimension, with", plural genericM, S "in the clockwise direction as positive and", plural genericM, S "in the counterclockwise direction as negative" `sC` S "and replacing the", phrase torque, S "symbol with the", phrase genericM, S "symbol, the", phrase equation, S "simplifies to"]
341
momEqlDerivMomentSentence = [S "Considering one dimension, with", plural genericM, S "in the clockwise direction as positive and", plural genericM, S "in the counterclockwise direction as negative" `sC` S "and replacing the", phrase torque, S "symbol with the", phrase genericM, S "symbol, the", phrase equation, S "simplifies to"]
341
momEqlDerivMomentSentence = [S "Considering one dimension, with", plural genericM, S "in the clockwise direction as positive and", plural genericM, S "in the counterclockwise direction as negative" `sC` S "and replacing the", phrase torque, S "symbol with the", phrase genericM, S "symbol, the", phrase equation, S "simplifies to"]
341
false
false
0
7
56
81
41
40
null
null
sampou-org/pfad
Code/Code09.hs
bsd-3-clause
member p ps cs = and [x `knows` p && (p `knows` x =>> x `elem` cs) | x <- ps ]
81
member p ps cs = and [x `knows` p && (p `knows` x =>> x `elem` cs) | x <- ps ]
81
member p ps cs = and [x `knows` p && (p `knows` x =>> x `elem` cs) | x <- ps ]
81
false
false
0
11
24
56
31
25
null
null
bmh10/haskell-tetris
Block.hs
bsd-3-clause
-- Render functions renderBlock :: Block -> Picture renderBlock b = pictures $ renderTiles (tiles b) (col b)
108
renderBlock :: Block -> Picture renderBlock b = pictures $ renderTiles (tiles b) (col b)
88
renderBlock b = pictures $ renderTiles (tiles b) (col b)
56
true
true
2
7
17
46
21
25
null
null
JenniferWang/incremental-haskell
src/Types.hs
mit
initStatusInfo :: StatusInfo initStatusInfo = StatusInfo initStatus initStbNum initScope initDebugInfo
102
initStatusInfo :: StatusInfo initStatusInfo = StatusInfo initStatus initStbNum initScope initDebugInfo
102
initStatusInfo = StatusInfo initStatus initStbNum initScope initDebugInfo
73
false
true
0
5
9
20
10
10
null
null
ezyang/ghc
compiler/prelude/THNames.hs
bsd-3-clause
-- data FamFlavour = ... typeFamName, dataFamName :: Name typeFamName = libFun (fsLit "typeFam") typeFamIdKey
109
typeFamName, dataFamName :: Name typeFamName = libFun (fsLit "typeFam") typeFamIdKey
84
typeFamName = libFun (fsLit "typeFam") typeFamIdKey
51
true
true
0
7
14
25
14
11
null
null
nfjinjing/mps
src/MPS/Math/Six.hs
bsd-3-clause
-- induced actions of an elt of S6 on duads, synthemes and pentads duad -^ g = sort [pt .^ g | pt <- duad]
107
duad -^ g = sort [pt .^ g | pt <- duad]
39
duad -^ g = sort [pt .^ g | pt <- duad]
39
true
false
3
8
25
36
16
20
null
null
OlegTheCat/eight-x-eight
src/Game.hs
mit
setNoneCellAtCursorPosition :: Game -> Game setNoneCellAtCursorPosition = setCellAtCursorPosition None
102
setNoneCellAtCursorPosition :: Game -> Game setNoneCellAtCursorPosition = setCellAtCursorPosition None
102
setNoneCellAtCursorPosition = setCellAtCursorPosition None
58
false
true
0
5
8
18
9
9
null
null
olsner/ghc
compiler/stgSyn/StgSyn.hs
bsd-3-clause
pprStgExpr (StgLet bind expr@(StgLet _ _)) = ($$) (sep [hang (text "let {") 2 (hsep [pprGenStgBinding bind, text "} in"])]) (ppr expr)
164
pprStgExpr (StgLet bind expr@(StgLet _ _)) = ($$) (sep [hang (text "let {") 2 (hsep [pprGenStgBinding bind, text "} in"])]) (ppr expr)
164
pprStgExpr (StgLet bind expr@(StgLet _ _)) = ($$) (sep [hang (text "let {") 2 (hsep [pprGenStgBinding bind, text "} in"])]) (ppr expr)
164
false
false
0
13
51
81
41
40
null
null
siddhanathan/ghc
compiler/main/HscTypes.hs
bsd-3-clause
metaRequestP :: Functor f => MetaHook f -> LHsExpr Id -> f (LPat RdrName) metaRequestP h = fmap unMetaResP . h (MetaP MetaResP)
127
metaRequestP :: Functor f => MetaHook f -> LHsExpr Id -> f (LPat RdrName) metaRequestP h = fmap unMetaResP . h (MetaP MetaResP)
127
metaRequestP h = fmap unMetaResP . h (MetaP MetaResP)
53
false
true
0
10
22
60
27
33
null
null
c19/Exercism-Haskell
list-ops/src/ListOps.hs
mit
foldl' :: (b -> a -> b) -> b -> [a] -> b foldl' f z [] = z
58
foldl' :: (b -> a -> b) -> b -> [a] -> b foldl' f z [] = z
58
foldl' f z [] = z
17
false
true
0
8
18
46
24
22
null
null
amccausl/Swish
Swish/HaskellRDF/RDFDatatypeXsdIntegerTest.hs
lgpl-2.1
le02inp = "_:a a xsd_integer:Le ; " +++ " rdf:_1 \"21\"^^xsd:integer ; " +++ " rdf:_2 \"22\"^^xsd:integer . "
130
le02inp = "_:a a xsd_integer:Le ; " +++ " rdf:_1 \"21\"^^xsd:integer ; " +++ " rdf:_2 \"22\"^^xsd:integer . "
130
le02inp = "_:a a xsd_integer:Le ; " +++ " rdf:_1 \"21\"^^xsd:integer ; " +++ " rdf:_2 \"22\"^^xsd:integer . "
130
false
false
0
6
39
14
7
7
null
null
amccausl/Swish
Swish/HaskellUtils/ParseTest.hs
lgpl-2.1
testIsValid5 = testIsValid "testIsValid5" parseExprParser False "D5 := 5 + 55 ;//yyy"
85
testIsValid5 = testIsValid "testIsValid5" parseExprParser False "D5 := 5 + 55 ;//yyy"
85
testIsValid5 = testIsValid "testIsValid5" parseExprParser False "D5 := 5 + 55 ;//yyy"
85
false
false
0
5
11
15
7
8
null
null
AlexeyRaga/eta
compiler/ETA/Prelude/PrelNames.hs
bsd-3-clause
choiceAIdKey = mkPreludeMiscIdUnique 184
43
choiceAIdKey = mkPreludeMiscIdUnique 184
43
choiceAIdKey = mkPreludeMiscIdUnique 184
43
false
false
0
5
6
9
4
5
null
null
nomeata/sat-britney
IndexSet.hs
gpl-2.0
intersection :: Set a -> Set a -> Set a IndexSet m1 `intersection` IndexSet m2 = IndexSet (m1 `S.intersection` m2)
114
intersection :: Set a -> Set a -> Set a IndexSet m1 `intersection` IndexSet m2 = IndexSet (m1 `S.intersection` m2)
114
IndexSet m1 `intersection` IndexSet m2 = IndexSet (m1 `S.intersection` m2)
74
false
true
0
7
19
56
27
29
null
null
clarissalittler/pi-calculus
PureLam.hs
mit
ppLam (App l1 l2) = parens $ ppLam l1 <+> ppLam l2
51
ppLam (App l1 l2) = parens $ ppLam l1 <+> ppLam l2
51
ppLam (App l1 l2) = parens $ ppLam l1 <+> ppLam l2
51
false
false
0
7
12
32
14
18
null
null
khanage/mongoweb
src/Data/BsonAesonBridge.hs
apache-2.0
convertArray :: V.Vector A.Value -> Maybe [B.Value] convertArray as = sequence $ convertArrayMembers as
103
convertArray :: V.Vector A.Value -> Maybe [B.Value] convertArray as = sequence $ convertArrayMembers as
103
convertArray as = sequence $ convertArrayMembers as
51
false
true
0
9
13
44
20
24
null
null
FranklinChen/hugs98-plus-Sep2006
packages/OpenAL/Sound/OpenAL/Constants.hs
bsd-3-clause
alc_FREQUENCY, alc_REFRESH, alc_SYNC, alc_MONO_SOURCES, alc_STEREO_SOURCES :: ALCint alc_FREQUENCY = CONST_ALC_FREQUENCY
145
alc_FREQUENCY, alc_REFRESH, alc_SYNC, alc_MONO_SOURCES, alc_STEREO_SOURCES :: ALCint alc_FREQUENCY = CONST_ALC_FREQUENCY
145
alc_FREQUENCY = CONST_ALC_FREQUENCY
57
false
true
0
4
34
19
14
5
null
null