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
esmolanka/sexp-grammar
sexp-grammar/src/Language/Sexp/Encode.hs
bsd-3-clause
encode :: Fix SexpF -> ByteString encode = toLazyByteString . buildSexp
71
encode :: Fix SexpF -> ByteString encode = toLazyByteString . buildSexp
71
encode = toLazyByteString . buildSexp
37
false
true
1
7
10
30
12
18
null
null
keithodulaigh/Hets
Temporal/Ctl.hs
gpl-2.0
sat m (phi `AU` psi) = sat m (Not (Not psi `EU` (Not phi `And` Not psi) `Or` EG (Not psi)))
114
sat m (phi `AU` psi) = sat m (Not (Not psi `EU` (Not phi `And` Not psi) `Or` EG (Not psi)))
114
sat m (phi `AU` psi) = sat m (Not (Not psi `EU` (Not phi `And` Not psi) `Or` EG (Not psi)))
114
false
false
0
13
43
74
39
35
null
null
ctford/Idris-Elba-dev
src/Idris/Colours.hs
bsd-3-clause
mkColour :: Color -> IdrisColour mkColour c = IdrisColour (Just c) True False False False
89
mkColour :: Color -> IdrisColour mkColour c = IdrisColour (Just c) True False False False
89
mkColour c = IdrisColour (Just c) True False False False
56
false
true
0
7
14
35
17
18
null
null
PseudoPower/AFSM
examples/SM/HelloWorld.hs
mit
-- | y_n = (x_n + 1, x_n * 2) -- >>> smfmap ptSM test0 -- [(2,2),(3,4),(4,6),(5,8)] ptSM = plusOneSM &&&& timesTwoSM
116
ptSM = plusOneSM &&&& timesTwoSM
32
ptSM = plusOneSM &&&& timesTwoSM
32
true
false
0
5
21
13
8
5
null
null
andyarvanitis/Idris-dev
src/IRTS/CodegenC.hs
bsd-3-clause
doOp v (LTimes (ATInt (ITFixed ty))) [x, y] = bitOp v "Times" ty [x, y]
71
doOp v (LTimes (ATInt (ITFixed ty))) [x, y] = bitOp v "Times" ty [x, y]
71
doOp v (LTimes (ATInt (ITFixed ty))) [x, y] = bitOp v "Times" ty [x, y]
71
false
false
0
11
14
52
27
25
null
null
brendanhay/gogol
gogol-storage/gen/Network/Google/Storage/Types/Product.hs
mpl-2.0
-- | The content generation of the object, if applied to an object. oacaGeneration :: Lens' ObjectAccessControl (Maybe Int64) oacaGeneration = lens _oacaGeneration (\ s a -> s{_oacaGeneration = a}) . mapping _Coerce
229
oacaGeneration :: Lens' ObjectAccessControl (Maybe Int64) oacaGeneration = lens _oacaGeneration (\ s a -> s{_oacaGeneration = a}) . mapping _Coerce
161
oacaGeneration = lens _oacaGeneration (\ s a -> s{_oacaGeneration = a}) . mapping _Coerce
103
true
true
0
10
46
55
28
27
null
null
tonyfloatersu/solution-haskell-craft-of-FP
Chapter_14_my_note.hs
mit
leafNum :: GTree a -> Integer leafNum (Leaf _) = 1
58
leafNum :: GTree a -> Integer leafNum (Leaf _) = 1
58
leafNum (Leaf _) = 1
28
false
true
0
9
18
33
14
19
null
null
Hodapp87/atom
Language/Atom/Elaboration.hs
bsd-3-clause
{- -- | Checks that all array indices are not a function of array variables. checkArrayIndices :: [Rule] -> Rule -> IO Bool checkArrayIndices rules rule = where ues = allUEs rule arrayIndices' = concatMap arrayIndices ues [ (name, ) | (UA _ name _, index) <- concatMap arrayIndices ues, UV (Array (UA _ name' init)) <- allUVs rules index, length init /= 1 ] data UA = UA Int String [Const] deriving (Show, Eq, Ord) data UV = UV UVLocality deriving (Show, Eq, Ord) data UVLocality = Array UA UE | External String Type deriving (Show, Eq, Ord) allUVs :: [Rule] -> UE -> [UV] arrayIndices :: UE -> [(UA, UE)] , ruleEnable :: UE , ruleAssigns :: [(UV, UE)] , ruleActions :: [([String] -> String, [UE])] -} -- | Generic local variable declaration. var :: Expr a => Name -> a -> Atom (V a) var name init' = do name' <- addName name (st, (g, atom)) <- get let uv' = UV (gVarId g) name' c c = constant init' put (st, (g { gVarId = gVarId g + 1, gState = gState g ++ [StateVariable name c] }, atom)) return $ V uv' -- | Generic external variable declaration.
1,098
var :: Expr a => Name -> a -> Atom (V a) var name init' = do name' <- addName name (st, (g, atom)) <- get let uv' = UV (gVarId g) name' c c = constant init' put (st, (g { gVarId = gVarId g + 1, gState = gState g ++ [StateVariable name c] }, atom)) return $ V uv' -- | Generic external variable declaration.
323
var name init' = do name' <- addName name (st, (g, atom)) <- get let uv' = UV (gVarId g) name' c c = constant init' put (st, (g { gVarId = gVarId g + 1, gState = gState g ++ [StateVariable name c] }, atom)) return $ V uv' -- | Generic external variable declaration.
282
true
true
0
14
251
166
84
82
null
null
jcaldwell/monadserv
src/Test.hs
bsd-2-clause
--ppJSON x = renderStyle (style{mode=OneLineMode}) (toDoc x) wtfActionOp :: Srv ExampleAppState () wtfActionOp = putSrvSpecial $ String "wtf"
143
wtfActionOp :: Srv ExampleAppState () wtfActionOp = putSrvSpecial $ String "wtf"
80
wtfActionOp = putSrvSpecial $ String "wtf"
42
true
true
0
6
19
26
13
13
null
null
JacquesCarette/literate-scientific-software
code/drasil-example/Drasil/Projectile/Requirements.hs
bsd-2-clause
{--Nonfunctional Requirements--} nonfuncReqs :: [ConceptInstance] nonfuncReqs = [correct, verifiable, understandable, reusable, maintainable, portable]
152
nonfuncReqs :: [ConceptInstance] nonfuncReqs = [correct, verifiable, understandable, reusable, maintainable, portable]
118
nonfuncReqs = [correct, verifiable, understandable, reusable, maintainable, portable]
85
true
true
0
7
13
40
22
18
null
null
erantapaa/rakhana
Data/Rakhana/Tape.hs
bsd-3-clause
tapeDirection :: MonadIO m => TapeState -> Direction -> Tape m (TResp, TapeState) tapeDirection s o = return (Unit, s') where s' = s { tapeStateDirection = o } --------------------------------------------------------------------------------
251
tapeDirection :: MonadIO m => TapeState -> Direction -> Tape m (TResp, TapeState) tapeDirection s o = return (Unit, s') where s' = s { tapeStateDirection = o } --------------------------------------------------------------------------------
251
tapeDirection s o = return (Unit, s') where s' = s { tapeStateDirection = o } --------------------------------------------------------------------------------
169
false
true
0
9
40
68
36
32
null
null
abuiles/turbinado-blog
tmp/dependencies/hslogger-1.0.6/src/System/Log/Logger.hs
bsd-3-clause
{- | Log a message at 'CRITICAL' priority -} criticalM :: String -- ^ Logger name -> String -- ^ Log message -> IO () criticalM s = logM s CRITICAL
207
criticalM :: String -- ^ Logger name -> String -- ^ Log message -> IO () criticalM s = logM s CRITICAL
162
criticalM s = logM s CRITICAL
29
true
true
0
9
90
36
18
18
null
null
erochest/todotxt
Gtd/RDF.hs
apache-2.0
quickGraph :: NamespaceMap -> RDFArcSet -> RDFGraph quickGraph nss arcs = emptyRDFGraph { namespaces = nss , statements = arcs }
200
quickGraph :: NamespaceMap -> RDFArcSet -> RDFGraph quickGraph nss arcs = emptyRDFGraph { namespaces = nss , statements = arcs }
200
quickGraph nss arcs = emptyRDFGraph { namespaces = nss , statements = arcs }
148
false
true
0
6
92
38
21
17
null
null
bocuma/users-service
src/App.hs
mit
catchAny :: IO a -> (SomeException -> IO a) -> IO a catchAny = Control.Exception.catch
86
catchAny :: IO a -> (SomeException -> IO a) -> IO a catchAny = Control.Exception.catch
86
catchAny = Control.Exception.catch
34
false
true
0
9
14
38
19
19
null
null
sapek/pandoc
src/Text/Pandoc/Writers/RST.hs
gpl-2.0
refsToRST :: Refs -> State WriterState Doc refsToRST refs = mapM keyToRST refs >>= return . vcat
96
refsToRST :: Refs -> State WriterState Doc refsToRST refs = mapM keyToRST refs >>= return . vcat
96
refsToRST refs = mapM keyToRST refs >>= return . vcat
53
false
true
0
7
16
42
18
24
null
null
ony/hledger
hledger-lib/Hledger/Query.hs
gpl-3.0
inAccountQuery (QueryOptInAcctOnly a : _) = Just $ Acct $ accountNameToAccountOnlyRegex a
89
inAccountQuery (QueryOptInAcctOnly a : _) = Just $ Acct $ accountNameToAccountOnlyRegex a
89
inAccountQuery (QueryOptInAcctOnly a : _) = Just $ Acct $ accountNameToAccountOnlyRegex a
89
false
false
0
7
11
31
14
17
null
null
da-x/lamdu
test/InferWrappers.hs
gpl-3.0
loadInferDef :: Val a -> Infer (Val (Infer.Payload, a)) loadInferDef = loadInferScope Infer.emptyScope
102
loadInferDef :: Val a -> Infer (Val (Infer.Payload, a)) loadInferDef = loadInferScope Infer.emptyScope
102
loadInferDef = loadInferScope Infer.emptyScope
46
false
true
0
11
12
45
21
24
null
null
krakrjak/ImplicitCAD
Graphics/Implicit/Export/Render/GetLoops.hs
agpl-3.0
-- | The goal of getLoops is to extract loops from a list of segments. -- The input is a list of segments. -- The output a list of loops, where each loop is a list of -- segments, which each piece representing a "side". -- For example: -- Given points [[1,2],[5,1],[3,4,5], ... ] -- notice that there is a loop 1,2,3,4,5... <repeat> -- But we give the output [ [ [1,2], [3,4,5], [5,1] ], ... ] -- so that we have the loop, and also knowledge of how -- the list is built (the "sides" of it). getLoops :: [[ℝ3]] -> [[[ℝ3]]] getLoops a = getLoops' a []
559
getLoops :: [[ℝ3]] -> [[[ℝ3]]] getLoops a = getLoops' a []
58
getLoops a = getLoops' a []
27
true
true
0
10
118
57
33
24
null
null
gentoo-haskell/haskell-updater
Distribution/Gentoo/PkgManager.hs
gpl-3.0
defaultPMFlags PkgCore = [ "--deep" , "--oneshot" , "--ignore-failures" ]
172
defaultPMFlags PkgCore = [ "--deep" , "--oneshot" , "--ignore-failures" ]
172
defaultPMFlags PkgCore = [ "--deep" , "--oneshot" , "--ignore-failures" ]
172
false
false
0
5
108
18
10
8
null
null
rueshyna/gogol
gogol-dataproc/gen/Network/Google/Dataproc/Types/Product.hs
mpl-2.0
-- | Properties of the object. Contains field \'type with type URL. sdiAddtional :: Lens' StatusDetailsItem (HashMap Text JSONValue) sdiAddtional = lens _sdiAddtional (\ s a -> s{_sdiAddtional = a}) . _Coerce
216
sdiAddtional :: Lens' StatusDetailsItem (HashMap Text JSONValue) sdiAddtional = lens _sdiAddtional (\ s a -> s{_sdiAddtional = a}) . _Coerce
148
sdiAddtional = lens _sdiAddtional (\ s a -> s{_sdiAddtional = a}) . _Coerce
83
true
true
0
10
39
54
28
26
null
null
hengchu/tiger-haskell
src/tigersemant.hs
mit
isPointer (Record _) = return True
34
isPointer (Record _) = return True
34
isPointer (Record _) = return True
34
false
false
0
6
5
19
8
11
null
null
isomorphism/hackage2
Distribution/Server/Packages/State.hs
bsd-3-clause
initialDocumentation :: Documentation initialDocumentation = Documentation Map.empty
84
initialDocumentation :: Documentation initialDocumentation = Documentation Map.empty
84
initialDocumentation = Documentation Map.empty
46
false
true
0
6
6
16
8
8
null
null
green-haskell/ghc
compiler/cmm/CLabel.hs
bsd-3-clause
toEntryLbl (IdLabel n c ConInfoTable) = IdLabel n c ConEntry
63
toEntryLbl (IdLabel n c ConInfoTable) = IdLabel n c ConEntry
63
toEntryLbl (IdLabel n c ConInfoTable) = IdLabel n c ConEntry
63
false
false
0
7
12
26
12
14
null
null
zmthy/incidental-detail
src/Graphics/DetailGen/PointSelection.hs
mit
------------------------------------------------------------------------------ yAxis :: AxisSelection yAxis = AxisSelection False True False
140
yAxis :: AxisSelection yAxis = AxisSelection False True False
61
yAxis = AxisSelection False True False
38
true
true
0
5
9
19
10
9
null
null
codahale/hs-shamir
src/Shamir.hs
apache-2.0
gfDiv _ 0 = undefined
21
gfDiv _ 0 = undefined
21
gfDiv _ 0 = undefined
21
false
false
1
5
4
12
5
7
null
null
fffej/HS-Poker
LookupPatternMatch.hs
bsd-3-clause
getValueFromProduct 273325 = 2903
33
getValueFromProduct 273325 = 2903
33
getValueFromProduct 273325 = 2903
33
false
false
0
5
3
9
4
5
null
null
j-rock/tutte-your-stuff
src/Main.hs
mit
algoApp _ _ = error "Can't use Algo for construction"
61
algoApp _ _ = error "Can't use Algo for construction"
61
algoApp _ _ = error "Can't use Algo for construction"
61
false
false
0
5
17
14
6
8
null
null
arjantop/gifter
src/Gifter/Daemon/EnterTask.hs
bsd-3-clause
startEnterTask :: Config -> TChan GiveawayEntry -> TEVar Config -> TEVar SteamGames -> IO () startEnterTask cfg dc cv sgv = do tn <- getCurrentTime let te = addUTCTime (fromInteger $ -10) tn r = EnterTaskRead dc cv sgv s = EnterTaskState (tagValue te 0) emptySteamGames runTask cfg r s enterTask
383
startEnterTask :: Config -> TChan GiveawayEntry -> TEVar Config -> TEVar SteamGames -> IO () startEnterTask cfg dc cv sgv = do tn <- getCurrentTime let te = addUTCTime (fromInteger $ -10) tn r = EnterTaskRead dc cv sgv s = EnterTaskState (tagValue te 0) emptySteamGames runTask cfg r s enterTask
383
startEnterTask cfg dc cv sgv = do tn <- getCurrentTime let te = addUTCTime (fromInteger $ -10) tn r = EnterTaskRead dc cv sgv s = EnterTaskState (tagValue te 0) emptySteamGames runTask cfg r s enterTask
230
false
true
0
13
138
122
57
65
null
null
sdiehl/ghc
compiler/GHC/HsToCore/PmCheck.hs
bsd-3-clause
-- | All warning flags that need to run the pattern match checker. allPmCheckWarnings :: [WarningFlag] allPmCheckWarnings = [ Opt_WarnIncompletePatterns , Opt_WarnIncompleteUniPatterns , Opt_WarnIncompletePatternsRecUpd , Opt_WarnOverlappingPatterns ]
261
allPmCheckWarnings :: [WarningFlag] allPmCheckWarnings = [ Opt_WarnIncompletePatterns , Opt_WarnIncompleteUniPatterns , Opt_WarnIncompletePatternsRecUpd , Opt_WarnOverlappingPatterns ]
194
allPmCheckWarnings = [ Opt_WarnIncompletePatterns , Opt_WarnIncompleteUniPatterns , Opt_WarnIncompletePatternsRecUpd , Opt_WarnOverlappingPatterns ]
158
true
true
0
5
36
27
17
10
null
null
manyoo/ghcjs-dom
ghcjs-dom-webkit/src/GHCJS/DOM/EventM.hs
mit
getReturnValue :: IsEvent e => EventM t e Bool getReturnValue = event >>= Event.getReturnValue
94
getReturnValue :: IsEvent e => EventM t e Bool getReturnValue = event >>= Event.getReturnValue
94
getReturnValue = event >>= Event.getReturnValue
47
false
true
0
6
13
31
15
16
null
null
antalsz/hs-to-coq
examples/simple/Simple.hs
mit
not :: Bool -> Bool not True = False
37
not :: Bool -> Bool not True = False
37
not True = False
17
false
true
0
5
9
22
10
12
null
null
aslatter/xhb
build-utils/src/Generate/Functions.hs
bsd-3-clause
ensureLower (x:xs) = toLower x : xs
35
ensureLower (x:xs) = toLower x : xs
35
ensureLower (x:xs) = toLower x : xs
35
false
false
0
7
6
23
11
12
null
null
rblaze/haskell-dbus
lib/DBus/Internal/Types.hs
apache-2.0
typeCode TypeUnixFd = "h"
29
typeCode TypeUnixFd = "h"
29
typeCode TypeUnixFd = "h"
29
false
false
0
5
7
9
4
5
null
null
konn/presburger-dfa
src/Arithmetic/Presburger/Solver/DFA.hs
bsd-3-clause
bitToInt :: Bit -> Integer bitToInt O = 0
41
bitToInt :: Bit -> Integer bitToInt O = 0
41
bitToInt O = 0
14
false
true
0
7
8
24
10
14
null
null
oldmanmike/ghc
compiler/stgSyn/StgSyn.hs
bsd-3-clause
-- general case pprStgExpr (StgApp func args) = hang (ppr func) 4 (sep (map (ppr) args))
90
pprStgExpr (StgApp func args) = hang (ppr func) 4 (sep (map (ppr) args))
74
pprStgExpr (StgApp func args) = hang (ppr func) 4 (sep (map (ppr) args))
74
true
false
0
10
17
48
24
24
null
null
Vetii/SCFDMA
src/Model.hs
mit
blockPow :: UserPowerLimitF -> PeakPowF -> Block -> PowerF blockPow plf pkpf (Block b) = pow plf pkpf (Set.size b)
114
blockPow :: UserPowerLimitF -> PeakPowF -> Block -> PowerF blockPow plf pkpf (Block b) = pow plf pkpf (Set.size b)
114
blockPow plf pkpf (Block b) = pow plf pkpf (Set.size b)
55
false
true
0
8
19
57
26
31
null
null
ony/hledger
hledger-lib/Hledger/Data/Journal.hs
gpl-3.0
-- | Sets an account's balance to a given amount and returns the -- difference of new and old amount setBalance :: AccountName -> Amount -> CurrentBalancesModifier s MixedAmount setBalance acc amt = liftModifier $ \Env{ eBalances = bals } -> do old <- HT.lookup bals acc let new = Mixed $ (amt :) $ maybe [] (filter ((/= acommodity amt) . acommodity) . amounts) old HT.insert bals acc new return $ maybe new (new -) old -- | Adds an amount to an account's balance and returns the resulting -- balance
517
setBalance :: AccountName -> Amount -> CurrentBalancesModifier s MixedAmount setBalance acc amt = liftModifier $ \Env{ eBalances = bals } -> do old <- HT.lookup bals acc let new = Mixed $ (amt :) $ maybe [] (filter ((/= acommodity amt) . acommodity) . amounts) old HT.insert bals acc new return $ maybe new (new -) old -- | Adds an amount to an account's balance and returns the resulting -- balance
416
setBalance acc amt = liftModifier $ \Env{ eBalances = bals } -> do old <- HT.lookup bals acc let new = Mixed $ (amt :) $ maybe [] (filter ((/= acommodity amt) . acommodity) . amounts) old HT.insert bals acc new return $ maybe new (new -) old -- | Adds an amount to an account's balance and returns the resulting -- balance
339
true
true
0
20
108
149
76
73
null
null
forked-upstream-packages-for-ghcjs/ghc
compiler/main/HscMain.hs
bsd-3-clause
tcRnModule' :: HscEnv -> ModSummary -> Bool -> HsParsedModule -> Hsc TcGblEnv tcRnModule' hsc_env sum save_rn_syntax mod = do tcg_res <- {-# SCC "Typecheck-Rename" #-} ioMsgMaybe $ tcRnModule hsc_env (ms_hsc_src sum) save_rn_syntax mod tcSafeOK <- liftIO $ readIORef (tcg_safeInfer tcg_res) dflags <- getDynFlags let allSafeOK = safeInferred dflags && tcSafeOK -- end of the safe haskell line, how to respond to user? if not (safeHaskellOn dflags) || (safeInferOn dflags && not allSafeOK) -- if safe Haskell off or safe infer failed, mark unsafe then markUnsafeInfer tcg_res emptyBag -- module (could be) safe, throw warning if needed else do tcg_res' <- hscCheckSafeImports tcg_res safe <- liftIO $ readIORef (tcg_safeInfer tcg_res') when safe $ do case wopt Opt_WarnSafe dflags of True -> (logWarnings $ unitBag $ mkPlainWarnMsg dflags (warnSafeOnLoc dflags) $ errSafe tcg_res') False | safeHaskell dflags == Sf_Trustworthy && wopt Opt_WarnTrustworthySafe dflags -> (logWarnings $ unitBag $ mkPlainWarnMsg dflags (trustworthyOnLoc dflags) $ errTwthySafe tcg_res') False -> return () return tcg_res' where pprMod t = ppr $ moduleName $ tcg_mod t errSafe t = quotes (pprMod t) <+> text "has been inferred as safe!" errTwthySafe t = quotes (pprMod t) <+> text "is marked as Trustworthy but has been inferred as safe!" -- | Convert a typechecked module to Core
1,682
tcRnModule' :: HscEnv -> ModSummary -> Bool -> HsParsedModule -> Hsc TcGblEnv tcRnModule' hsc_env sum save_rn_syntax mod = do tcg_res <- {-# SCC "Typecheck-Rename" #-} ioMsgMaybe $ tcRnModule hsc_env (ms_hsc_src sum) save_rn_syntax mod tcSafeOK <- liftIO $ readIORef (tcg_safeInfer tcg_res) dflags <- getDynFlags let allSafeOK = safeInferred dflags && tcSafeOK -- end of the safe haskell line, how to respond to user? if not (safeHaskellOn dflags) || (safeInferOn dflags && not allSafeOK) -- if safe Haskell off or safe infer failed, mark unsafe then markUnsafeInfer tcg_res emptyBag -- module (could be) safe, throw warning if needed else do tcg_res' <- hscCheckSafeImports tcg_res safe <- liftIO $ readIORef (tcg_safeInfer tcg_res') when safe $ do case wopt Opt_WarnSafe dflags of True -> (logWarnings $ unitBag $ mkPlainWarnMsg dflags (warnSafeOnLoc dflags) $ errSafe tcg_res') False | safeHaskell dflags == Sf_Trustworthy && wopt Opt_WarnTrustworthySafe dflags -> (logWarnings $ unitBag $ mkPlainWarnMsg dflags (trustworthyOnLoc dflags) $ errTwthySafe tcg_res') False -> return () return tcg_res' where pprMod t = ppr $ moduleName $ tcg_mod t errSafe t = quotes (pprMod t) <+> text "has been inferred as safe!" errTwthySafe t = quotes (pprMod t) <+> text "is marked as Trustworthy but has been inferred as safe!" -- | Convert a typechecked module to Core
1,682
tcRnModule' hsc_env sum save_rn_syntax mod = do tcg_res <- {-# SCC "Typecheck-Rename" #-} ioMsgMaybe $ tcRnModule hsc_env (ms_hsc_src sum) save_rn_syntax mod tcSafeOK <- liftIO $ readIORef (tcg_safeInfer tcg_res) dflags <- getDynFlags let allSafeOK = safeInferred dflags && tcSafeOK -- end of the safe haskell line, how to respond to user? if not (safeHaskellOn dflags) || (safeInferOn dflags && not allSafeOK) -- if safe Haskell off or safe infer failed, mark unsafe then markUnsafeInfer tcg_res emptyBag -- module (could be) safe, throw warning if needed else do tcg_res' <- hscCheckSafeImports tcg_res safe <- liftIO $ readIORef (tcg_safeInfer tcg_res') when safe $ do case wopt Opt_WarnSafe dflags of True -> (logWarnings $ unitBag $ mkPlainWarnMsg dflags (warnSafeOnLoc dflags) $ errSafe tcg_res') False | safeHaskell dflags == Sf_Trustworthy && wopt Opt_WarnTrustworthySafe dflags -> (logWarnings $ unitBag $ mkPlainWarnMsg dflags (trustworthyOnLoc dflags) $ errTwthySafe tcg_res') False -> return () return tcg_res' where pprMod t = ppr $ moduleName $ tcg_mod t errSafe t = quotes (pprMod t) <+> text "has been inferred as safe!" errTwthySafe t = quotes (pprMod t) <+> text "is marked as Trustworthy but has been inferred as safe!" -- | Convert a typechecked module to Core
1,592
false
true
4
22
531
398
180
218
null
null
dimara/ganeti
src/Ganeti/Utils.hs
bsd-2-clause
isSubsequenceOf _ [] = False
50
isSubsequenceOf _ [] = False
50
isSubsequenceOf _ [] = False
50
false
false
0
6
26
13
6
7
null
null
DougBurke/swish
src/Swish/RDF/Vocabulary/DublinCore.hs
lgpl-2.1
-- | @dcterms:BibliographicResource@ from <http://dublincore.org/documents/dcmi-terms/#classes-BibliographicResource>. dctBibliographicResource :: ScopedName dctBibliographicResource = toDCT "BibliographicResource"
214
dctBibliographicResource :: ScopedName dctBibliographicResource = toDCT "BibliographicResource"
95
dctBibliographicResource = toDCT "BibliographicResource"
56
true
true
0
6
11
21
9
12
null
null
JohnLato/iteratee
bench/BenchBase.hs
bsd-3-clause
groupBenches = [group1,group2]
30
groupBenches = [group1,group2]
30
groupBenches = [group1,group2]
30
false
false
1
5
2
15
7
8
null
null
Bodigrim/katas
src/haskell/3-Escape-the-Mines-.hs
bsd-2-clause
rev :: Move -> Move rev U = D
29
rev :: Move -> Move rev U = D
29
rev U = D
9
false
true
0
5
8
18
9
9
null
null
itsbruce/hackerrank
alg/strings/anagram.hs
unlicense
changes' _ [] = 0
17
changes' _ [] = 0
17
changes' _ [] = 0
17
false
false
0
6
4
13
6
7
null
null
rahulmutt/ghcvm
compiler/Eta/Iface/IfaceEnv.hs
bsd-3-clause
newGlobalBinder :: Module -> OccName -> SrcSpan -> TcRnIf a b Name -- Used for source code and interface files, to make the -- Name for a thing, given its Module and OccName -- See Note [The Name Cache] -- -- The cache may already already have a binding for this thing, -- because we may have seen an occurrence before, but now is the -- moment when we know its Module and SrcLoc in their full glory newGlobalBinder mod occ loc = do mod `seq` occ `seq` return () -- See notes with lookupOrig -- traceIf (text "newGlobalBinder" <+> ppr mod <+> ppr occ <+> ppr loc) updNameCache $ \name_cache -> allocateGlobalBinder name_cache mod occ loc
663
newGlobalBinder :: Module -> OccName -> SrcSpan -> TcRnIf a b Name newGlobalBinder mod occ loc = do mod `seq` occ `seq` return () -- See notes with lookupOrig -- traceIf (text "newGlobalBinder" <+> ppr mod <+> ppr occ <+> ppr loc) updNameCache $ \name_cache -> allocateGlobalBinder name_cache mod occ loc
329
newGlobalBinder mod occ loc = do mod `seq` occ `seq` return () -- See notes with lookupOrig -- traceIf (text "newGlobalBinder" <+> ppr mod <+> ppr occ <+> ppr loc) updNameCache $ \name_cache -> allocateGlobalBinder name_cache mod occ loc
262
true
true
0
10
142
92
49
43
null
null
Cahu/krpc-hs
src/KRPCHS/InfernalRobotics.hs
gpl-3.0
getServoMinPositionStream :: KRPCHS.InfernalRobotics.Servo -> RPCContext (KRPCStream (Float)) getServoMinPositionStream thisArg = requestStream $ getServoMinPositionStreamReq thisArg
182
getServoMinPositionStream :: KRPCHS.InfernalRobotics.Servo -> RPCContext (KRPCStream (Float)) getServoMinPositionStream thisArg = requestStream $ getServoMinPositionStreamReq thisArg
182
getServoMinPositionStream thisArg = requestStream $ getServoMinPositionStreamReq thisArg
88
false
true
0
9
13
40
20
20
null
null
acowley/ghc
compiler/basicTypes/VarEnv.hs
bsd-3-clause
lookupInScope_Directly :: InScopeSet -> Unique -> Maybe Var lookupInScope_Directly (InScope in_scope _) uniq = lookupVarEnv_Directly in_scope uniq
148
lookupInScope_Directly :: InScopeSet -> Unique -> Maybe Var lookupInScope_Directly (InScope in_scope _) uniq = lookupVarEnv_Directly in_scope uniq
148
lookupInScope_Directly (InScope in_scope _) uniq = lookupVarEnv_Directly in_scope uniq
88
false
true
0
10
18
45
20
25
null
null
timthelion/fenfire
Fenfire/RDF.hs
gpl-2.0
predicate :: Triple -> Node predicate (_,p,_) = p
49
predicate :: Triple -> Node predicate (_,p,_) = p
49
predicate (_,p,_) = p
21
false
true
0
8
8
33
16
17
null
null
wangbj/haskell
venom.hs
bsd-2-clause
venom' (I h p a) = venom_ h p a
31
venom' (I h p a) = venom_ h p a
31
venom' (I h p a) = venom_ h p a
31
false
false
0
7
9
26
12
14
null
null
emaphis/Haskell-Practice
testing-project/test/FindIdentifier_Test.hs
bsd-3-clause
main = runTestTT $ TestList [ borderCases, simpleCases ]
56
main = runTestTT $ TestList [ borderCases, simpleCases ]
56
main = runTestTT $ TestList [ borderCases, simpleCases ]
56
false
false
1
7
8
22
10
12
null
null
binesiyu/ifl
examples/ch17/PCRE-compile.hs
mit
{-- /snippet compiletype --} {-- snippet compileReal --} compile :: ByteString -> [PCREOption] -> Either String Regex compile str flags = unsafePerformIO $ useAsCString str $ \pattern -> do alloca $ \errptr -> do alloca $ \erroffset -> do pcre_ptr <- c_pcre_compile pattern (combineOptions flags) errptr erroffset nullPtr if pcre_ptr == nullPtr then do err <- peekCString =<< peek errptr return (Left err) else do reg <- newForeignPtr finalizerFree pcre_ptr -- release with free() return (Right (Regex reg str)) {-- /snippet compileReal --}
664
compile :: ByteString -> [PCREOption] -> Either String Regex compile str flags = unsafePerformIO $ useAsCString str $ \pattern -> do alloca $ \errptr -> do alloca $ \erroffset -> do pcre_ptr <- c_pcre_compile pattern (combineOptions flags) errptr erroffset nullPtr if pcre_ptr == nullPtr then do err <- peekCString =<< peek errptr return (Left err) else do reg <- newForeignPtr finalizerFree pcre_ptr -- release with free() return (Right (Regex reg str)) {-- /snippet compileReal --}
606
compile str flags = unsafePerformIO $ useAsCString str $ \pattern -> do alloca $ \errptr -> do alloca $ \erroffset -> do pcre_ptr <- c_pcre_compile pattern (combineOptions flags) errptr erroffset nullPtr if pcre_ptr == nullPtr then do err <- peekCString =<< peek errptr return (Left err) else do reg <- newForeignPtr finalizerFree pcre_ptr -- release with free() return (Right (Regex reg str)) {-- /snippet compileReal --}
545
true
true
2
24
206
179
85
94
null
null
vTurbine/ghc
compiler/main/DynFlags.hs
bsd-3-clause
-- | Unset a 'LangExt.Extension' xopt_unset :: DynFlags -> LangExt.Extension -> DynFlags xopt_unset dfs f = let onoffs = Off f : extensions dfs in dfs { extensions = onoffs, extensionFlags = flattenExtensionFlags (language dfs) onoffs }
261
xopt_unset :: DynFlags -> LangExt.Extension -> DynFlags xopt_unset dfs f = let onoffs = Off f : extensions dfs in dfs { extensions = onoffs, extensionFlags = flattenExtensionFlags (language dfs) onoffs }
228
xopt_unset dfs f = let onoffs = Off f : extensions dfs in dfs { extensions = onoffs, extensionFlags = flattenExtensionFlags (language dfs) onoffs }
172
true
true
0
10
61
81
39
42
null
null
filopodia/open
stanhs/lib/Stan/Simulate.hs
mit
simDist d args _ = error $ "simDist: "++d++" "++show args
57
simDist d args _ = error $ "simDist: "++d++" "++show args
57
simDist d args _ = error $ "simDist: "++d++" "++show args
57
false
false
0
8
10
32
15
17
null
null
djeik/goto
libgoto/Language/X86/Lifetime.hs
mit
computeLifetimes :: VirtualAsm Int () -> M.Map SizedVirtualRegister LifetimeSpan computeLifetimes vasm = let start = LifetimeAnalysisState { _lifetimes = M.empty , _curLocation = 0 , _nextLabel = 0 , _labelLocations = M.empty } in _lifetimes $ runIdentity $ execStateT (runLifetimeAnalysisT $ createLifetimes vasm) start
376
computeLifetimes :: VirtualAsm Int () -> M.Map SizedVirtualRegister LifetimeSpan computeLifetimes vasm = let start = LifetimeAnalysisState { _lifetimes = M.empty , _curLocation = 0 , _nextLabel = 0 , _labelLocations = M.empty } in _lifetimes $ runIdentity $ execStateT (runLifetimeAnalysisT $ createLifetimes vasm) start
376
computeLifetimes vasm = let start = LifetimeAnalysisState { _lifetimes = M.empty , _curLocation = 0 , _nextLabel = 0 , _labelLocations = M.empty } in _lifetimes $ runIdentity $ execStateT (runLifetimeAnalysisT $ createLifetimes vasm) start
295
false
true
4
11
99
98
50
48
null
null
themoritz/cabal
cabal-install/tests/UnitTests/Distribution/Solver/Modular/Solver.hs
bsd-3-clause
{------------------------------------------------------------------------------- Simple databases for the illustrations for the backjumping blog post -------------------------------------------------------------------------------} -- | Motivate conflict sets dbBJ1a :: ExampleDb dbBJ1a = [ Right $ exAv "A" 1 [ExFix "B" 1] , Right $ exAv "A" 2 [ExFix "B" 2] , Right $ exAv "B" 1 [] ]
396
dbBJ1a :: ExampleDb dbBJ1a = [ Right $ exAv "A" 1 [ExFix "B" 1] , Right $ exAv "A" 2 [ExFix "B" 2] , Right $ exAv "B" 1 [] ]
134
dbBJ1a = [ Right $ exAv "A" 1 [ExFix "B" 1] , Right $ exAv "A" 2 [ExFix "B" 2] , Right $ exAv "B" 1 [] ]
114
true
true
0
9
60
73
38
35
null
null
tommiseppanen/game-of-life-hsqml
gol.hs
mit
listToBoard i (b:bs) | b == True = (getPos i) : listToBoard (i+1) bs | otherwise = listToBoard (i+1) bs
127
listToBoard i (b:bs) | b == True = (getPos i) : listToBoard (i+1) bs | otherwise = listToBoard (i+1) bs
127
listToBoard i (b:bs) | b == True = (getPos i) : listToBoard (i+1) bs | otherwise = listToBoard (i+1) bs
127
false
false
0
9
43
71
34
37
null
null
kaoskorobase/mescaline
resources/hugs/packages/base/Data/Map.hs
gpl-3.0
hedgeDiffWithKey f cmplo cmphi t (Bin _ kx x l r) = case found of Nothing -> merge tl tr Just (ky,y) -> case f ky y x of Nothing -> merge tl tr Just z -> join ky z tl tr where cmpkx k = compare kx k lt = trim cmplo cmpkx t (found,gt) = trimLookupLo kx cmphi t tl = hedgeDiffWithKey f cmplo cmpkx lt l tr = hedgeDiffWithKey f cmpkx cmphi gt r {-------------------------------------------------------------------- Intersection --------------------------------------------------------------------} -- | /O(n+m)/. Intersection of two maps. The values in the first -- map are returned, i.e. (@'intersection' m1 m2 == 'intersectionWith' 'const' m1 m2@).
760
hedgeDiffWithKey f cmplo cmphi t (Bin _ kx x l r) = case found of Nothing -> merge tl tr Just (ky,y) -> case f ky y x of Nothing -> merge tl tr Just z -> join ky z tl tr where cmpkx k = compare kx k lt = trim cmplo cmpkx t (found,gt) = trimLookupLo kx cmphi t tl = hedgeDiffWithKey f cmplo cmpkx lt l tr = hedgeDiffWithKey f cmpkx cmphi gt r {-------------------------------------------------------------------- Intersection --------------------------------------------------------------------} -- | /O(n+m)/. Intersection of two maps. The values in the first -- map are returned, i.e. (@'intersection' m1 m2 == 'intersectionWith' 'const' m1 m2@).
760
hedgeDiffWithKey f cmplo cmphi t (Bin _ kx x l r) = case found of Nothing -> merge tl tr Just (ky,y) -> case f ky y x of Nothing -> merge tl tr Just z -> join ky z tl tr where cmpkx k = compare kx k lt = trim cmplo cmpkx t (found,gt) = trimLookupLo kx cmphi t tl = hedgeDiffWithKey f cmplo cmpkx lt l tr = hedgeDiffWithKey f cmpkx cmphi gt r {-------------------------------------------------------------------- Intersection --------------------------------------------------------------------} -- | /O(n+m)/. Intersection of two maps. The values in the first -- map are returned, i.e. (@'intersection' m1 m2 == 'intersectionWith' 'const' m1 m2@).
760
false
false
2
8
217
184
90
94
null
null
awgn/ass
src/Ass/Cpp/Token.hs
gpl-2.0
isIdentifierChar' :: Char -> Bool isIdentifierChar' = ((listArray ('\0', '\255') (map (\c -> isAlphaNum c || c == '_' || c == '$') ['\0'..'\255']) :: UArray Char Bool) !)
170
isIdentifierChar' :: Char -> Bool isIdentifierChar' = ((listArray ('\0', '\255') (map (\c -> isAlphaNum c || c == '_' || c == '$') ['\0'..'\255']) :: UArray Char Bool) !)
170
isIdentifierChar' = ((listArray ('\0', '\255') (map (\c -> isAlphaNum c || c == '_' || c == '$') ['\0'..'\255']) :: UArray Char Bool) !)
136
false
true
0
16
28
79
43
36
null
null
timtylin/scholdoc-texmath
src/Text/TeXMath/Readers/TeX.hs
gpl-2.0
stdarray :: TP Exp stdarray = do mbaligns <- mbArrayAlignments lines' <- sepEndBy1 arrayLine endLine let aligns = fromMaybe (alignsFromRows AlignDefault lines') mbaligns return $ EArray aligns lines'
207
stdarray :: TP Exp stdarray = do mbaligns <- mbArrayAlignments lines' <- sepEndBy1 arrayLine endLine let aligns = fromMaybe (alignsFromRows AlignDefault lines') mbaligns return $ EArray aligns lines'
207
stdarray = do mbaligns <- mbArrayAlignments lines' <- sepEndBy1 arrayLine endLine let aligns = fromMaybe (alignsFromRows AlignDefault lines') mbaligns return $ EArray aligns lines'
188
false
true
0
12
35
67
30
37
null
null
yiannist/ganeti
src/Ganeti/Constants.hs
bsd-2-clause
syslogNo :: String syslogNo = Logging.syslogUsageToRaw SyslogNo
63
syslogNo :: String syslogNo = Logging.syslogUsageToRaw SyslogNo
63
syslogNo = Logging.syslogUsageToRaw SyslogNo
44
false
true
0
6
6
16
8
8
null
null
phischu/fragnix
tests/packages/scotty/Math.NumberTheory.Logarithms.hs
bsd-3-clause
-- | Calculate the integer logarithm for an arbitrary base. -- The base must be greater than 1, the second argument, the number -- whose logarithm is sought, must be positive, otherwise an error is thrown. -- If @base == 2@, the specialised version is called, which is more -- efficient than the general algorithm. -- -- Satisfies: -- -- > base ^ integerLogBase base m <= m < base ^ (integerLogBase base m + 1) -- -- for @base > 1@ and @m > 0@. integerLogBase :: Integer -> Integer -> Int integerLogBase b n | n < 1 = error "Math.NumberTheory.Logarithms.integerLogBase: argument must be positive." | n < b = 0 | b == 2 = integerLog2' n | b < 2 = error "Math.NumberTheory.Logarithms.integerLogBase: base must be greater than one." | otherwise = integerLogBase' b n
808
integerLogBase :: Integer -> Integer -> Int integerLogBase b n | n < 1 = error "Math.NumberTheory.Logarithms.integerLogBase: argument must be positive." | n < b = 0 | b == 2 = integerLog2' n | b < 2 = error "Math.NumberTheory.Logarithms.integerLogBase: base must be greater than one." | otherwise = integerLogBase' b n
353
integerLogBase b n | n < 1 = error "Math.NumberTheory.Logarithms.integerLogBase: argument must be positive." | n < b = 0 | b == 2 = integerLog2' n | b < 2 = error "Math.NumberTheory.Logarithms.integerLogBase: base must be greater than one." | otherwise = integerLogBase' b n
309
true
true
4
8
183
105
54
51
null
null
wxwxwwxxx/ghc
utils/hpc/HpcFlags.hs
bsd-3-clause
theMergeFun :: (Ord a) => MergeFun -> Set.Set a -> Set.Set a -> Set.Set a theMergeFun INTERSECTION = Set.intersection
117
theMergeFun :: (Ord a) => MergeFun -> Set.Set a -> Set.Set a -> Set.Set a theMergeFun INTERSECTION = Set.intersection
117
theMergeFun INTERSECTION = Set.intersection
43
false
true
0
10
18
56
26
30
null
null
ambiata/mafia
src/Mafia/Cabal/Dependencies.hs
bsd-3-clause
pPackageChange :: Parser PackageChange pPackageChange = let pkg = pPackageId arr = A.string " -> " ver = pVersion (\x -> x == ',' || x == ')') in PackageChange <$> pkg <*> (arr *> ver)
200
pPackageChange :: Parser PackageChange pPackageChange = let pkg = pPackageId arr = A.string " -> " ver = pVersion (\x -> x == ',' || x == ')') in PackageChange <$> pkg <*> (arr *> ver)
200
pPackageChange = let pkg = pPackageId arr = A.string " -> " ver = pVersion (\x -> x == ',' || x == ')') in PackageChange <$> pkg <*> (arr *> ver)
161
false
true
0
14
51
78
40
38
null
null
brendanhay/ede
src/Text/EDE/Internal/Eval.hs
mpl-2.0
eval (_ :< ELet k rhs bdy) = do q <- eval rhs v <- lift (unquote k 0 q) bind (Map.insert k v) (eval bdy) -- FIXME: We have to recompute c everytime due to the predicate ..
184
eval (_ :< ELet k rhs bdy) = do q <- eval rhs v <- lift (unquote k 0 q) bind (Map.insert k v) (eval bdy) -- FIXME: We have to recompute c everytime due to the predicate ..
184
eval (_ :< ELet k rhs bdy) = do q <- eval rhs v <- lift (unquote k 0 q) bind (Map.insert k v) (eval bdy) -- FIXME: We have to recompute c everytime due to the predicate ..
184
false
false
0
10
51
79
36
43
null
null
pawel-n/fingertree-tf
Data/FingerTree.hs
bsd-3-clause
mapNode :: (Measured a, Measured b) => (a -> b) -> Node a -> Node b mapNode f (Node2 _ a b) = node2 (f a) (f b)
119
mapNode :: (Measured a, Measured b) => (a -> b) -> Node a -> Node b mapNode f (Node2 _ a b) = node2 (f a) (f b)
119
mapNode f (Node2 _ a b) = node2 (f a) (f b)
43
false
true
0
8
35
79
39
40
null
null
michaelbeaumont/pandoc
src/Text/Pandoc/Writers/Man.hs
gpl-2.0
-- not supported inlineToMan opts (Quoted SingleQuote lst) = do contents <- inlineListToMan opts lst return $ char '`' <> contents <> char '\''
147
inlineToMan opts (Quoted SingleQuote lst) = do contents <- inlineListToMan opts lst return $ char '`' <> contents <> char '\''
130
inlineToMan opts (Quoted SingleQuote lst) = do contents <- inlineListToMan opts lst return $ char '`' <> contents <> char '\''
130
true
false
0
10
27
55
24
31
null
null
olsner/ghc
compiler/simplCore/SimplEnv.hs
bsd-3-clause
setSubstEnv :: SimplEnv -> TvSubstEnv -> CvSubstEnv -> SimplIdSubst -> SimplEnv setSubstEnv env tvs cvs ids = env { seTvSubst = tvs, seCvSubst = cvs, seIdSubst = ids }
167
setSubstEnv :: SimplEnv -> TvSubstEnv -> CvSubstEnv -> SimplIdSubst -> SimplEnv setSubstEnv env tvs cvs ids = env { seTvSubst = tvs, seCvSubst = cvs, seIdSubst = ids }
167
setSubstEnv env tvs cvs ids = env { seTvSubst = tvs, seCvSubst = cvs, seIdSubst = ids }
87
false
true
0
8
28
56
31
25
null
null
bitemyapp/ghc
compiler/basicTypes/DataCon.hs
bsd-3-clause
-- | Finds the instantiated types of the arguments required to construct a 'DataCon' representation -- NB: these INCLUDE any dictionary args -- but EXCLUDE the data-declaration context, which is discarded -- It's all post-flattening etc; this is a representation type dataConInstArgTys :: DataCon -- ^ A datacon with no existentials or equality constraints -- However, it can have a dcTheta (notably it can be a -- class dictionary, with superclasses) -> [Type] -- ^ Instantiated at these types -> [Type] dataConInstArgTys dc@(MkData {dcUnivTyVars = univ_tvs, dcEqSpec = eq_spec, dcExTyVars = ex_tvs}) inst_tys = ASSERT2( length univ_tvs == length inst_tys , ptext (sLit "dataConInstArgTys") <+> ppr dc $$ ppr univ_tvs $$ ppr inst_tys) ASSERT2( null ex_tvs && null eq_spec, ppr dc ) map (substTyWith univ_tvs inst_tys) (dataConRepArgTys dc)
998
dataConInstArgTys :: DataCon -- ^ A datacon with no existentials or equality constraints -- However, it can have a dcTheta (notably it can be a -- class dictionary, with superclasses) -> [Type] -- ^ Instantiated at these types -> [Type] dataConInstArgTys dc@(MkData {dcUnivTyVars = univ_tvs, dcEqSpec = eq_spec, dcExTyVars = ex_tvs}) inst_tys = ASSERT2( length univ_tvs == length inst_tys , ptext (sLit "dataConInstArgTys") <+> ppr dc $$ ppr univ_tvs $$ ppr inst_tys) ASSERT2( null ex_tvs && null eq_spec, ppr dc ) map (substTyWith univ_tvs inst_tys) (dataConRepArgTys dc)
726
dataConInstArgTys dc@(MkData {dcUnivTyVars = univ_tvs, dcEqSpec = eq_spec, dcExTyVars = ex_tvs}) inst_tys = ASSERT2( length univ_tvs == length inst_tys , ptext (sLit "dataConInstArgTys") <+> ppr dc $$ ppr univ_tvs $$ ppr inst_tys) ASSERT2( null ex_tvs && null eq_spec, ppr dc ) map (substTyWith univ_tvs inst_tys) (dataConRepArgTys dc)
382
true
true
8
11
285
175
85
90
null
null
rodrigogribeiro/mptc
test/Data/Full/PreludeList.hs
bsd-3-clause
length :: [a] -> Int length [] = 0
34
length :: [a] -> Int length [] = 0
34
length [] = 0
13
false
true
0
6
8
23
12
11
null
null
beni55/haste-compiler
libraries/ghc-7.10/base/GHC/IO/Handle/Internals.hs
bsd-3-clause
mkFileHandle :: (IODevice dev, BufferedIO dev, Typeable dev) => dev -- ^ the underlying IO device, which must support -- 'IODevice', 'BufferedIO' and 'Typeable' -> FilePath -- ^ a string describing the 'Handle', e.g. the file -- path for a file. Used in error messages. -> IOMode -- The mode in which the 'Handle' is to be used -> Maybe TextEncoding -- Create the 'Handle' with no text encoding? -> NewlineMode -- Translate newlines? -> IO Handle mkFileHandle dev filepath iomode mb_codec tr_newlines = do mkHandle dev filepath (ioModeToHandleType iomode) True{-buffered-} mb_codec tr_newlines (Just handleFinalizer) Nothing{-other_side-} -- | like 'mkFileHandle', except that a 'Handle' is created with two -- independent buffers, one for reading and one for writing. Used for -- full-duplex streams, such as network sockets.
1,054
mkFileHandle :: (IODevice dev, BufferedIO dev, Typeable dev) => dev -- ^ the underlying IO device, which must support -- 'IODevice', 'BufferedIO' and 'Typeable' -> FilePath -- ^ a string describing the 'Handle', e.g. the file -- path for a file. Used in error messages. -> IOMode -- The mode in which the 'Handle' is to be used -> Maybe TextEncoding -- Create the 'Handle' with no text encoding? -> NewlineMode -- Translate newlines? -> IO Handle mkFileHandle dev filepath iomode mb_codec tr_newlines = do mkHandle dev filepath (ioModeToHandleType iomode) True{-buffered-} mb_codec tr_newlines (Just handleFinalizer) Nothing{-other_side-} -- | like 'mkFileHandle', except that a 'Handle' is created with two -- independent buffers, one for reading and one for writing. Used for -- full-duplex streams, such as network sockets.
1,054
mkFileHandle dev filepath iomode mb_codec tr_newlines = do mkHandle dev filepath (ioModeToHandleType iomode) True{-buffered-} mb_codec tr_newlines (Just handleFinalizer) Nothing{-other_side-} -- | like 'mkFileHandle', except that a 'Handle' is created with two -- independent buffers, one for reading and one for writing. Used for -- full-duplex streams, such as network sockets.
408
false
true
0
11
354
113
61
52
null
null
jgm/pandoc-citeproc
compat/Text/CSL/Compat/Pandoc.hs
bsd-3-clause
pipeProcess :: Maybe [(String, String)] -> FilePath -> [String] -> BL.ByteString -> IO (ExitCode,BL.ByteString) pipeProcess = Text.Pandoc.Process.pipeProcess
169
pipeProcess :: Maybe [(String, String)] -> FilePath -> [String] -> BL.ByteString -> IO (ExitCode,BL.ByteString) pipeProcess = Text.Pandoc.Process.pipeProcess
169
pipeProcess = Text.Pandoc.Process.pipeProcess
45
false
true
0
12
28
65
34
31
null
null
michalkonecny/polypaver
src/Numeric/ER/Misc.hs
bsd-3-clause
{-| eg > countDuplicates "aaba" = [(2,"a"),(1,"b"),(1,"a")] -} countDuplicates :: Eq a => [a] -> [(Int,a)] countDuplicates list = map (\ g -> (length g, head g)) $ group list
203
countDuplicates :: Eq a => [a] -> [(Int,a)] countDuplicates list = map (\ g -> (length g, head g)) $ group list
130
countDuplicates list = map (\ g -> (length g, head g)) $ group list
71
true
true
0
10
58
70
36
34
null
null
sapek/pandoc
src/Text/Pandoc/Writers/LaTeX.hs
gpl-2.0
blockToLaTeX (Plain lst) = inlineListToLaTeX $ dropWhile isLineBreakOrSpace lst
81
blockToLaTeX (Plain lst) = inlineListToLaTeX $ dropWhile isLineBreakOrSpace lst
81
blockToLaTeX (Plain lst) = inlineListToLaTeX $ dropWhile isLineBreakOrSpace lst
81
false
false
0
7
10
24
11
13
null
null
kallisti-dev/hs-webdriver
src/Test/WebDriver/Commands.hs
bsd-3-clause
-- |Determine if the element is displayed. isDisplayed :: (HasCallStack, WebDriver wd) => Element -> wd Bool isDisplayed e = doElemCommand methodGet e "/displayed" Null
168
isDisplayed :: (HasCallStack, WebDriver wd) => Element -> wd Bool isDisplayed e = doElemCommand methodGet e "/displayed" Null
125
isDisplayed e = doElemCommand methodGet e "/displayed" Null
59
true
true
0
7
24
44
22
22
null
null
pjones/byline
src/Byline/Menu.hs
bsd-2-clause
-- | Change the 'FromChoice' function. The function should -- compare the user's input to the menu items and their assigned -- prefix values and return a 'Choice'. -- -- @since 1.0.0.0 menuFromChoiceFunc :: FromChoice a -> Menu a -> Menu a menuFromChoiceFunc f m = m {_menuItemFromChoiceFunc = f}
297
menuFromChoiceFunc :: FromChoice a -> Menu a -> Menu a menuFromChoiceFunc f m = m {_menuItemFromChoiceFunc = f}
111
menuFromChoiceFunc f m = m {_menuItemFromChoiceFunc = f}
56
true
true
0
7
50
46
25
21
null
null
isovector/rpg-gen
src/RPG/Machine.hs
bsd-3-clause
newMachineScheduler :: Clock -> Now ( B Prop , Machine () -> IO () ) newMachineScheduler clock = do (b, mb) <- foldmp [] runMachine return ( fmap group . join . flip fmap b $ sequence . join . fmap (view _3) , \a -> mb ((a, Wait 0, []) :) ) where foo :: [B Prop] -> Action -> [B Prop] foo _ ClearSpawns = [] foo xs (Spawn x) = x : xs runMachine :: [(Machine (), MachineState, [B Prop])] -> N [(Machine (), MachineState, [B Prop])] runMachine [] = return [] runMachine ((Machine m, waiting, props) : xs) | Wait time <- waiting, time <= 0 = do (cont, actions) <- runWriterT $ resume m let props' = foldl' foo props actions case cont of Right () -> return xs Left (Yield w c) -> do return $ (Machine c, w, props') : xs | Wait time <- waiting = do dt <- sample $ deltaTime clock return $ (Machine m, Wait $ time - dt, props) : xs ----
1,077
newMachineScheduler :: Clock -> Now ( B Prop , Machine () -> IO () ) newMachineScheduler clock = do (b, mb) <- foldmp [] runMachine return ( fmap group . join . flip fmap b $ sequence . join . fmap (view _3) , \a -> mb ((a, Wait 0, []) :) ) where foo :: [B Prop] -> Action -> [B Prop] foo _ ClearSpawns = [] foo xs (Spawn x) = x : xs runMachine :: [(Machine (), MachineState, [B Prop])] -> N [(Machine (), MachineState, [B Prop])] runMachine [] = return [] runMachine ((Machine m, waiting, props) : xs) | Wait time <- waiting, time <= 0 = do (cont, actions) <- runWriterT $ resume m let props' = foldl' foo props actions case cont of Right () -> return xs Left (Yield w c) -> do return $ (Machine c, w, props') : xs | Wait time <- waiting = do dt <- sample $ deltaTime clock return $ (Machine m, Wait $ time - dt, props) : xs ----
1,077
newMachineScheduler clock = do (b, mb) <- foldmp [] runMachine return ( fmap group . join . flip fmap b $ sequence . join . fmap (view _3) , \a -> mb ((a, Wait 0, []) :) ) where foo :: [B Prop] -> Action -> [B Prop] foo _ ClearSpawns = [] foo xs (Spawn x) = x : xs runMachine :: [(Machine (), MachineState, [B Prop])] -> N [(Machine (), MachineState, [B Prop])] runMachine [] = return [] runMachine ((Machine m, waiting, props) : xs) | Wait time <- waiting, time <= 0 = do (cont, actions) <- runWriterT $ resume m let props' = foldl' foo props actions case cont of Right () -> return xs Left (Yield w c) -> do return $ (Machine c, w, props') : xs | Wait time <- waiting = do dt <- sample $ deltaTime clock return $ (Machine m, Wait $ time - dt, props) : xs ----
934
false
true
0
18
420
484
239
245
null
null
Proclivis/wxHaskell
wxcore/src/haskell/Graphics/UI/WXCore/WxcDefs.hs
lgpl-2.1
wxSTC_AU3_COMOBJ :: Int wxSTC_AU3_COMOBJ = 14
45
wxSTC_AU3_COMOBJ :: Int wxSTC_AU3_COMOBJ = 14
45
wxSTC_AU3_COMOBJ = 14
21
false
true
0
4
5
11
6
5
null
null
stevezhee/pec
Language/C/Abs.hs
bsd-3-clause
ppSwitchAlt x = case x of SwitchAlt v1 v2 -> text "case" <+> ppLit v1 <> text ":" <+> ppStmtList v2 DefaultAlt v1 -> text "default:" <+> ppStmtList v1
156
ppSwitchAlt x = case x of SwitchAlt v1 v2 -> text "case" <+> ppLit v1 <> text ":" <+> ppStmtList v2 DefaultAlt v1 -> text "default:" <+> ppStmtList v1
156
ppSwitchAlt x = case x of SwitchAlt v1 v2 -> text "case" <+> ppLit v1 <> text ":" <+> ppStmtList v2 DefaultAlt v1 -> text "default:" <+> ppStmtList v1
156
false
false
1
11
34
70
29
41
null
null
yliu120/K3
src/Language/K3/Codegen/CPP/Types.hs
apache-2.0
-- | Run C++ code generation action using a given initial state. runCPPGenM :: CPPGenS -> CPPGenM a -> (Either CPPGenE a, CPPGenS) runCPPGenM s = flip runState s . runEitherT
174
runCPPGenM :: CPPGenS -> CPPGenM a -> (Either CPPGenE a, CPPGenS) runCPPGenM s = flip runState s . runEitherT
109
runCPPGenM s = flip runState s . runEitherT
43
true
true
0
8
30
46
23
23
null
null
CulpaBS/wbBach
src/Futhark/Representation/AST/Attributes/Types.hs
bsd-3-clause
diet :: TypeBase shape Uniqueness -> Diet diet (Prim _) = Observe
65
diet :: TypeBase shape Uniqueness -> Diet diet (Prim _) = Observe
65
diet (Prim _) = Observe
23
false
true
2
7
11
32
14
18
null
null
a143753/AOJ
0327.hs
apache-2.0
sel i l = if (l!!i) == -1 then [1..9] \\ l else [(l!!i)]
62
sel i l = if (l!!i) == -1 then [1..9] \\ l else [(l!!i)]
62
sel i l = if (l!!i) == -1 then [1..9] \\ l else [(l!!i)]
62
false
false
1
9
19
56
28
28
null
null
NorfairKing/the-notes
src/Cryptography/ComputationalProblems/Games/Terms.hs
gpl-2.0
xyDDG :: Note -> Note -> Note xyDDG x y = m (tuple x y) <> "-" <> deterministicDiscreteGame
91
xyDDG :: Note -> Note -> Note xyDDG x y = m (tuple x y) <> "-" <> deterministicDiscreteGame
91
xyDDG x y = m (tuple x y) <> "-" <> deterministicDiscreteGame
61
false
true
0
9
18
49
22
27
null
null
ihc/futhark
src/Futhark/Optimise/Simplifier/Engine.hs
isc
isOp _ _ = False
16
isOp _ _ = False
16
isOp _ _ = False
16
false
false
1
5
4
12
5
7
null
null
luisgepeto/HaskellLearning
06 Higher Order Functions/06_function_application_with_$.hs
mit
app3 = sum (filter (> 10) (map (*2) [2..10]))
45
app3 = sum (filter (> 10) (map (*2) [2..10]))
45
app3 = sum (filter (> 10) (map (*2) [2..10]))
45
false
false
0
10
8
38
21
17
null
null
allanderek/ipclib
examples/PepaTimed.hs
gpl-2.0
formatResult False (Right (_, timedSystem)) = formatTimedSystem timedSystem
83
formatResult False (Right (_, timedSystem)) = formatTimedSystem timedSystem
83
formatResult False (Right (_, timedSystem)) = formatTimedSystem timedSystem
83
false
false
0
8
15
26
13
13
null
null
jfischoff/simple-poly
src/Language/SimplePoly/Infer.hs
bsd-3-clause
extendVars n e = subs <>= unit n e
34
extendVars n e = subs <>= unit n e
34
extendVars n e = subs <>= unit n e
34
false
false
0
6
8
20
9
11
null
null
sdiehl/ghc
compiler/typecheck/TcType.hs
bsd-3-clause
isFFIExternalTy :: Type -> Validity -- Types that are allowed as arguments of a 'foreign export' isFFIExternalTy ty = checkRepTyCon legalFEArgTyCon ty
150
isFFIExternalTy :: Type -> Validity isFFIExternalTy ty = checkRepTyCon legalFEArgTyCon ty
89
isFFIExternalTy ty = checkRepTyCon legalFEArgTyCon ty
53
true
true
0
7
21
29
13
16
null
null
da-x/ghc
compiler/hsSyn/HsExpr.hs
bsd-3-clause
ppr_expr (NegApp e _) = char '-' <+> pprDebugParendExpr e
57
ppr_expr (NegApp e _) = char '-' <+> pprDebugParendExpr e
57
ppr_expr (NegApp e _) = char '-' <+> pprDebugParendExpr e
57
false
false
0
6
9
28
12
16
null
null
bredelings/BAli-Phy
haskell/PopGen/Deploid.hs
gpl-2.0
haplotype01_from_panel_probability (p_sites,p_haps) switch_rate flip_prob hap = builtin_haplotype01_from_panel_probability p_haps' p_sites' switch_rate flip_prob hap where p_haps' = list_to_vector p_haps p_sites' = list_to_vector p_sites
251
haplotype01_from_panel_probability (p_sites,p_haps) switch_rate flip_prob hap = builtin_haplotype01_from_panel_probability p_haps' p_sites' switch_rate flip_prob hap where p_haps' = list_to_vector p_haps p_sites' = list_to_vector p_sites
251
haplotype01_from_panel_probability (p_sites,p_haps) switch_rate flip_prob hap = builtin_haplotype01_from_panel_probability p_haps' p_sites' switch_rate flip_prob hap where p_haps' = list_to_vector p_haps p_sites' = list_to_vector p_sites
251
false
false
3
6
34
60
25
35
null
null
romanb/amazonka
amazonka-ec2/gen/Network/AWS/EC2/DescribeSpotFleetInstances.hs
mpl-2.0
-- | Checks whether you have the required permissions for the action, without -- actually making the request, and provides an error response. If you have the -- required permissions, the error response is 'DryRunOperation'. Otherwise, it is 'UnauthorizedOperation'. dsfiDryRun :: Lens' DescribeSpotFleetInstances (Maybe Bool) dsfiDryRun = lens _dsfiDryRun (\s a -> s { _dsfiDryRun = a })
387
dsfiDryRun :: Lens' DescribeSpotFleetInstances (Maybe Bool) dsfiDryRun = lens _dsfiDryRun (\s a -> s { _dsfiDryRun = a })
121
dsfiDryRun = lens _dsfiDryRun (\s a -> s { _dsfiDryRun = a })
61
true
true
1
9
57
52
27
25
null
null
termite2/simple-abstractor
SimpleAbstractor/Resolve.hs
bsd-3-clause
log2 :: Int -> Int log2 0 = 0
29
log2 :: Int -> Int log2 0 = 0
29
log2 0 = 0
10
false
true
0
5
8
18
9
9
null
null
erantapaa/haskell-platform
hptool/src/HaddockMaster.hs
bsd-3-clause
hpInfo :: Package -> Action HaddockPkgLoc hpInfo pkg = do p <- getFromConfFile fieldHtml $ packageTargetConf pkg i <- getFromConfFile fieldIntf $ packageInplaceConf pkg return $ HaddockPkgLoc p i where getFromConfFile field file = readFile' file >>= either error return . extractField field
316
hpInfo :: Package -> Action HaddockPkgLoc hpInfo pkg = do p <- getFromConfFile fieldHtml $ packageTargetConf pkg i <- getFromConfFile fieldIntf $ packageInplaceConf pkg return $ HaddockPkgLoc p i where getFromConfFile field file = readFile' file >>= either error return . extractField field
316
hpInfo pkg = do p <- getFromConfFile fieldHtml $ packageTargetConf pkg i <- getFromConfFile fieldIntf $ packageInplaceConf pkg return $ HaddockPkgLoc p i where getFromConfFile field file = readFile' file >>= either error return . extractField field
274
false
true
0
9
68
99
43
56
null
null
mfine/wai
warp/Network/Wai/Handler/Warp/HTTP2/Types.hs
mit
clearContext :: Context -> IO () clearContext ctx = void $ reaperStop $ streamTable ctx
87
clearContext :: Context -> IO () clearContext ctx = void $ reaperStop $ streamTable ctx
87
clearContext ctx = void $ reaperStop $ streamTable ctx
54
false
true
0
7
14
34
16
18
null
null
gbataille/halray
src/GB2/Color.hs
mit
readColor (Just c) = c
22
readColor (Just c) = c
22
readColor (Just c) = c
22
false
false
0
6
4
16
7
9
null
null
abbradar/aeson
benchmarks/AesonCompareAutoInstances.hs
bsd-3-clause
bigProduct = BigProduct 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
194
bigProduct = BigProduct 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
194
bigProduct = BigProduct 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
194
false
false
0
5
132
57
28
29
null
null
mattdonnelly/CS4012-Minesweeper
src/Minesweeper/Board.hs
mit
addMines :: Int -> StdGen -> [(Int, Int)] -> Board -> Board addMines 0 _ _ board = board
88
addMines :: Int -> StdGen -> [(Int, Int)] -> Board -> Board addMines 0 _ _ board = board
88
addMines 0 _ _ board = board
28
false
true
0
10
18
51
25
26
null
null
ethercrow/yi
yi-core/src/Yi/Editor.hs
gpl-2.0
-- | Swap focused window with the previous one moveWinPrevE :: EditorM () moveWinPrevE = windowsA %= swapFocus PL.previous
122
moveWinPrevE :: EditorM () moveWinPrevE = windowsA %= swapFocus PL.previous
75
moveWinPrevE = windowsA %= swapFocus PL.previous
48
true
true
0
7
18
26
13
13
null
null
yuttie/ghc-mod
Language/Haskell/GhcMod/CabalApi.hs
bsd-3-clause
getGHC :: IO Version getGHC = do mv <- programFindVersion ghcProgram silent (programName ghcProgram) case mv of Nothing -> throwIO $ userError "ghc not found" Just v -> return $ v ---------------------------------------------------------------- -- | Extracting all 'Module' 'FilePath's for libraries, executables, -- tests and benchmarks.
365
getGHC :: IO Version getGHC = do mv <- programFindVersion ghcProgram silent (programName ghcProgram) case mv of Nothing -> throwIO $ userError "ghc not found" Just v -> return $ v ---------------------------------------------------------------- -- | Extracting all 'Module' 'FilePath's for libraries, executables, -- tests and benchmarks.
365
getGHC = do mv <- programFindVersion ghcProgram silent (programName ghcProgram) case mv of Nothing -> throwIO $ userError "ghc not found" Just v -> return $ v ---------------------------------------------------------------- -- | Extracting all 'Module' 'FilePath's for libraries, executables, -- tests and benchmarks.
344
false
true
0
11
71
70
34
36
null
null
xmonad/xmonad-contrib
XMonad/Layout/DecorationMadness.hs
bsd-3-clause
-- | A 'Tall' layout with the xmonad default decoration, default -- theme and default shrinker, but with the possibility of moving -- windows with the mouse, and resize\/move them with the keyboard. -- -- Here you can find a screen shot: -- -- <http://code.haskell.org/~arossato/xmonadShots/tallSimpleDefaultResizable.png> tallSimpleDefaultResizable :: ModifiedLayout (Decoration DefaultDecoration DefaultShrinker) (ModifiedLayout MouseResize (ModifiedLayout WindowArranger Tall)) Window tallSimpleDefaultResizable = decoration shrinkText def DefaultDecoration (mouseResize $ windowArrange tall)
625
tallSimpleDefaultResizable :: ModifiedLayout (Decoration DefaultDecoration DefaultShrinker) (ModifiedLayout MouseResize (ModifiedLayout WindowArranger Tall)) Window tallSimpleDefaultResizable = decoration shrinkText def DefaultDecoration (mouseResize $ windowArrange tall)
302
tallSimpleDefaultResizable = decoration shrinkText def DefaultDecoration (mouseResize $ windowArrange tall)
107
true
true
0
9
96
68
37
31
null
null
urbanslug/ghc
compiler/deSugar/Check.hs
bsd-3-clause
all_vars :: [Pat Id] -> Bool all_vars [] = True
59
all_vars :: [Pat Id] -> Bool all_vars [] = True
59
all_vars [] = True
30
false
true
0
8
21
32
14
18
null
null
phischu/fragnix
builtins/ghc-prim/GHC.Prim.hs
bsd-3-clause
-- | Insert a scalar at the given position in a vector. insertWord8X32# :: Word8X32# -> Word# -> Int# -> Word8X32# insertWord8X32# = insertWord8X32#
150
insertWord8X32# :: Word8X32# -> Word# -> Int# -> Word8X32# insertWord8X32# = insertWord8X32#
92
insertWord8X32# = insertWord8X32#
33
true
true
0
9
25
31
14
17
null
null