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
lukexi/ghc-7.8-arm64
compiler/utils/Encoding.hs
bsd-3-clause
decode_upper ch = {-pprTrace "decode_upper" (char ch)-} ch
59
decode_upper ch = {-pprTrace "decode_upper" (char ch)-} ch
59
decode_upper ch = {-pprTrace "decode_upper" (char ch)-} ch
59
false
false
0
5
8
10
5
5
null
null
forste/haReFork
tools/hs2isabelle/AST/IsabelleTerm.hs
bsd-3-clause
head_of_HMatch :: HMatch -> String head_of_HMatch (HMatch lhs rhs) = head_of_Term lhs
85
head_of_HMatch :: HMatch -> String head_of_HMatch (HMatch lhs rhs) = head_of_Term lhs
85
head_of_HMatch (HMatch lhs rhs) = head_of_Term lhs
50
false
true
0
7
11
29
14
15
null
null
diminishedprime/.org
programmey_stuff/write_yourself_a_scheme/ch_03/hello.hs
mit
readExpr :: String -> LispVal readExpr input = case parse parseExpr "lisp" input of Left err -> String $ "No match: " ++ show err Right val -> val
154
readExpr :: String -> LispVal readExpr input = case parse parseExpr "lisp" input of Left err -> String $ "No match: " ++ show err Right val -> val
154
readExpr input = case parse parseExpr "lisp" input of Left err -> String $ "No match: " ++ show err Right val -> val
124
false
true
0
9
36
58
27
31
null
null
fffej/HS-Poker
LookupPatternMatch.hs
bsd-3-clause
getValueFromProduct 318565 = 2107
33
getValueFromProduct 318565 = 2107
33
getValueFromProduct 318565 = 2107
33
false
false
0
5
3
9
4
5
null
null
xkollar/handy-haskell
other/pt-2012-03/fasttree.hs
gpl-3.0
uniq :: Eq a => [a] -> [a] uniq (x:s) = x : uniq (dropWhile (x==) s)
68
uniq :: Eq a => [a] -> [a] uniq (x:s) = x : uniq (dropWhile (x==) s)
68
uniq (x:s) = x : uniq (dropWhile (x==) s)
41
false
true
2
10
16
64
31
33
null
null
dblia/nosql-ganeti
src/Ganeti/HTools/Program/Hbal.hs
gpl-2.0
main :: Options -> [String] -> IO () main opts args = do unless (null args) $ exitErr "This program doesn't take any arguments." let verbose = optVerbose opts shownodes = optShowNodes opts showinsts = optShowInsts opts ini_cdata@(ClusterData gl fixed_nl ilf ctags ipol) <- loadExternalData opts when (verbose > 1) $ do putStrLn $ "Loaded cluster tags: " ++ intercalate "," ctags putStrLn $ "Loaded cluster ipolicy: " ++ show ipol nlf <- setNodeStatus opts fixed_nl checkCluster verbose nlf ilf maybeSaveData (optSaveCluster opts) "original" "before balancing" ini_cdata (gname, (nl, il)) <- selectGroup opts gl nlf ilf checkGroup verbose gname nl il maybePrintInsts showinsts "Initial" (Cluster.printInsts nl il) maybePrintNodes shownodes "Initial cluster" (Cluster.printNodes nl) let ini_cv = Cluster.compCV nl ini_tbl = Cluster.Table nl il ini_cv [] min_cv = optMinScore opts checkNeedRebalance opts ini_cv if verbose > 2 then printf "Initial coefficients: overall %.8f\n%s" ini_cv (Cluster.printStats " " nl)::IO () else printf "Initial score: %.8f\n" ini_cv putStrLn "Trying to minimize the CV..." let imlen = maximum . map (length . Instance.alias) $ Container.elems il nmlen = maximum . map (length . Node.alias) $ Container.elems nl (fin_tbl, cmd_strs) <- iterateDepth True ini_tbl (optMaxLength opts) (optDiskMoves opts) (optInstMoves opts) nmlen imlen [] min_cv (optMinGainLim opts) (optMinGain opts) (optEvacMode opts) let (Cluster.Table fin_nl fin_il fin_cv fin_plc) = fin_tbl ord_plc = reverse fin_plc sol_msg = case () of _ | null fin_plc -> printf "No solution found\n" | verbose > 2 -> printf "Final coefficients: overall %.8f\n%s" fin_cv (Cluster.printStats " " fin_nl) | otherwise -> printf "Cluster score improved from %.8f to %.8f\n" ini_cv fin_cv ::String putStr sol_msg unless (verbose < 1) $ printf "Solution length=%d\n" (length ord_plc) let cmd_jobs = Cluster.splitJobs cmd_strs when (isJust $ optShowCmds opts) . saveBalanceCommands opts $ Cluster.formatCmds cmd_jobs maybeSaveData (optSaveCluster opts) "balanced" "after balancing" ini_cdata { cdNodes = fin_nl, cdInstances = fin_il } maybePrintInsts showinsts "Final" (Cluster.printInsts fin_nl fin_il) maybePrintNodes shownodes "Final cluster" (Cluster.printNodes fin_nl) when (verbose > 3) $ printStats nl fin_nl exitIfBad "hbal" =<< maybeExecJobs opts ord_plc fin_nl il cmd_jobs
2,825
main :: Options -> [String] -> IO () main opts args = do unless (null args) $ exitErr "This program doesn't take any arguments." let verbose = optVerbose opts shownodes = optShowNodes opts showinsts = optShowInsts opts ini_cdata@(ClusterData gl fixed_nl ilf ctags ipol) <- loadExternalData opts when (verbose > 1) $ do putStrLn $ "Loaded cluster tags: " ++ intercalate "," ctags putStrLn $ "Loaded cluster ipolicy: " ++ show ipol nlf <- setNodeStatus opts fixed_nl checkCluster verbose nlf ilf maybeSaveData (optSaveCluster opts) "original" "before balancing" ini_cdata (gname, (nl, il)) <- selectGroup opts gl nlf ilf checkGroup verbose gname nl il maybePrintInsts showinsts "Initial" (Cluster.printInsts nl il) maybePrintNodes shownodes "Initial cluster" (Cluster.printNodes nl) let ini_cv = Cluster.compCV nl ini_tbl = Cluster.Table nl il ini_cv [] min_cv = optMinScore opts checkNeedRebalance opts ini_cv if verbose > 2 then printf "Initial coefficients: overall %.8f\n%s" ini_cv (Cluster.printStats " " nl)::IO () else printf "Initial score: %.8f\n" ini_cv putStrLn "Trying to minimize the CV..." let imlen = maximum . map (length . Instance.alias) $ Container.elems il nmlen = maximum . map (length . Node.alias) $ Container.elems nl (fin_tbl, cmd_strs) <- iterateDepth True ini_tbl (optMaxLength opts) (optDiskMoves opts) (optInstMoves opts) nmlen imlen [] min_cv (optMinGainLim opts) (optMinGain opts) (optEvacMode opts) let (Cluster.Table fin_nl fin_il fin_cv fin_plc) = fin_tbl ord_plc = reverse fin_plc sol_msg = case () of _ | null fin_plc -> printf "No solution found\n" | verbose > 2 -> printf "Final coefficients: overall %.8f\n%s" fin_cv (Cluster.printStats " " fin_nl) | otherwise -> printf "Cluster score improved from %.8f to %.8f\n" ini_cv fin_cv ::String putStr sol_msg unless (verbose < 1) $ printf "Solution length=%d\n" (length ord_plc) let cmd_jobs = Cluster.splitJobs cmd_strs when (isJust $ optShowCmds opts) . saveBalanceCommands opts $ Cluster.formatCmds cmd_jobs maybeSaveData (optSaveCluster opts) "balanced" "after balancing" ini_cdata { cdNodes = fin_nl, cdInstances = fin_il } maybePrintInsts showinsts "Final" (Cluster.printInsts fin_nl fin_il) maybePrintNodes shownodes "Final cluster" (Cluster.printNodes fin_nl) when (verbose > 3) $ printStats nl fin_nl exitIfBad "hbal" =<< maybeExecJobs opts ord_plc fin_nl il cmd_jobs
2,825
main opts args = do unless (null args) $ exitErr "This program doesn't take any arguments." let verbose = optVerbose opts shownodes = optShowNodes opts showinsts = optShowInsts opts ini_cdata@(ClusterData gl fixed_nl ilf ctags ipol) <- loadExternalData opts when (verbose > 1) $ do putStrLn $ "Loaded cluster tags: " ++ intercalate "," ctags putStrLn $ "Loaded cluster ipolicy: " ++ show ipol nlf <- setNodeStatus opts fixed_nl checkCluster verbose nlf ilf maybeSaveData (optSaveCluster opts) "original" "before balancing" ini_cdata (gname, (nl, il)) <- selectGroup opts gl nlf ilf checkGroup verbose gname nl il maybePrintInsts showinsts "Initial" (Cluster.printInsts nl il) maybePrintNodes shownodes "Initial cluster" (Cluster.printNodes nl) let ini_cv = Cluster.compCV nl ini_tbl = Cluster.Table nl il ini_cv [] min_cv = optMinScore opts checkNeedRebalance opts ini_cv if verbose > 2 then printf "Initial coefficients: overall %.8f\n%s" ini_cv (Cluster.printStats " " nl)::IO () else printf "Initial score: %.8f\n" ini_cv putStrLn "Trying to minimize the CV..." let imlen = maximum . map (length . Instance.alias) $ Container.elems il nmlen = maximum . map (length . Node.alias) $ Container.elems nl (fin_tbl, cmd_strs) <- iterateDepth True ini_tbl (optMaxLength opts) (optDiskMoves opts) (optInstMoves opts) nmlen imlen [] min_cv (optMinGainLim opts) (optMinGain opts) (optEvacMode opts) let (Cluster.Table fin_nl fin_il fin_cv fin_plc) = fin_tbl ord_plc = reverse fin_plc sol_msg = case () of _ | null fin_plc -> printf "No solution found\n" | verbose > 2 -> printf "Final coefficients: overall %.8f\n%s" fin_cv (Cluster.printStats " " fin_nl) | otherwise -> printf "Cluster score improved from %.8f to %.8f\n" ini_cv fin_cv ::String putStr sol_msg unless (verbose < 1) $ printf "Solution length=%d\n" (length ord_plc) let cmd_jobs = Cluster.splitJobs cmd_strs when (isJust $ optShowCmds opts) . saveBalanceCommands opts $ Cluster.formatCmds cmd_jobs maybeSaveData (optSaveCluster opts) "balanced" "after balancing" ini_cdata { cdNodes = fin_nl, cdInstances = fin_il } maybePrintInsts showinsts "Final" (Cluster.printInsts fin_nl fin_il) maybePrintNodes shownodes "Final cluster" (Cluster.printNodes fin_nl) when (verbose > 3) $ printStats nl fin_nl exitIfBad "hbal" =<< maybeExecJobs opts ord_plc fin_nl il cmd_jobs
2,788
false
true
0
17
798
813
379
434
null
null
vigoos/Farrago-OS
aura-master/aura-master/src/Bash/Parser.hs
gpl-2.0
function :: Parser Field function = Function <$> name <*> body <?> "valid function definition" where name = spaces *> many1 (noneOf " =(}\n") body = string "() {" *> spaces *> manyTill field (char '}') -- | A variable looks like: `name=string`, `name=(string string string)` -- or even `name=`
308
function :: Parser Field function = Function <$> name <*> body <?> "valid function definition" where name = spaces *> many1 (noneOf " =(}\n") body = string "() {" *> spaces *> manyTill field (char '}') -- | A variable looks like: `name=string`, `name=(string string string)` -- or even `name=`
308
function = Function <$> name <*> body <?> "valid function definition" where name = spaces *> many1 (noneOf " =(}\n") body = string "() {" *> spaces *> manyTill field (char '}') -- | A variable looks like: `name=string`, `name=(string string string)` -- or even `name=`
283
false
true
0
10
64
75
38
37
null
null
brendanhay/pagerduty
src/Network/PagerDuty/REST/MaintenanceWindows.hs
mpl-2.0
-- | Description for this maintenance window. Can only be updated on ongoing -- and future maintenance windows. uwDescription :: Lens' (Request UpdateWindow s b) (Maybe Text) uwDescription = upd.uwDescription'
209
uwDescription :: Lens' (Request UpdateWindow s b) (Maybe Text) uwDescription = upd.uwDescription'
97
uwDescription = upd.uwDescription'
34
true
true
0
7
29
36
19
17
null
null
mwotton/PerfectHash
test/Data/PerfectHashSpec.hs
bsd-3-clause
main = hspec spec
17
main = hspec spec
17
main = hspec spec
17
false
false
0
5
3
9
4
5
null
null
twesterhout/NWI-I00032-2017-Assignments
Exercise_4/dist/build/autogen/Paths_Exercise4.hs
mit
dynlibdir = "/home/tom/.cabal/lib/x86_64-linux-ghc-8.0.2"
58
dynlibdir = "/home/tom/.cabal/lib/x86_64-linux-ghc-8.0.2"
58
dynlibdir = "/home/tom/.cabal/lib/x86_64-linux-ghc-8.0.2"
58
false
false
0
4
3
6
3
3
null
null
pbrisbin/toml-parse
src/Text/Toml/Parser.hs
bsd-3-clause
allDatetime _ = False
21
allDatetime _ = False
21
allDatetime _ = False
21
false
false
0
4
3
10
4
6
null
null
mpickering/hackage-server
Distribution/Server/Features/DownloadCount.hs
bsd-3-clause
getToday :: IO Day getToday = utctDay <$> getCurrentTime
56
getToday :: IO Day getToday = utctDay <$> getCurrentTime
56
getToday = utctDay <$> getCurrentTime
37
false
true
0
5
8
18
9
9
null
null
snoyberg/yesod-js
Yesod/Javascript.hs
bsd-2-clause
jsfor :: JSValue [a] -> (JSValue a -> JSValue b) -> JSValue [b] jsfor (JSValue expr deps) f = JSValue expr' deps' where expr' = "_.map(" <> expr <> ", function(x){return " <> fexpr <> "})" deps' = deps <> fdeps JSValue fexpr fdeps = f a a = JSValue "x" mempty
281
jsfor :: JSValue [a] -> (JSValue a -> JSValue b) -> JSValue [b] jsfor (JSValue expr deps) f = JSValue expr' deps' where expr' = "_.map(" <> expr <> ", function(x){return " <> fexpr <> "})" deps' = deps <> fdeps JSValue fexpr fdeps = f a a = JSValue "x" mempty
281
jsfor (JSValue expr deps) f = JSValue expr' deps' where expr' = "_.map(" <> expr <> ", function(x){return " <> fexpr <> "})" deps' = deps <> fdeps JSValue fexpr fdeps = f a a = JSValue "x" mempty
217
false
true
0
9
73
119
58
61
null
null
isomorphism/Delineate
Control/Delineate/Expon.hs
bsd-3-clause
ofCourse :: a -> (Unit ⊢ Bang (Var a)) ofCourse x = Lin $ \(Not k) -> Not $ \Unit -> k $ mkBang x
97
ofCourse :: a -> (Unit ⊢ Bang (Var a)) ofCourse x = Lin $ \(Not k) -> Not $ \Unit -> k $ mkBang x
97
ofCourse x = Lin $ \(Not k) -> Not $ \Unit -> k $ mkBang x
58
false
true
0
10
24
68
34
34
null
null
nfjinjing/miku
src/Network/Miku/DSL.hs
bsd-3-clause
captures :: AppMonad [(ByteString, ByteString)] captures = namespace mikuCaptures <$> ask
89
captures :: AppMonad [(ByteString, ByteString)] captures = namespace mikuCaptures <$> ask
89
captures = namespace mikuCaptures <$> ask
41
false
true
0
8
10
35
17
18
null
null
peter-fogg/pardoc
src/Text/Pandoc/Readers/Org.hs
gpl-2.0
setAligns :: [Alignment] -> OrgTable -> F OrgTable setAligns aligns t = return $ t{ orgTableAlignments = aligns }
133
setAligns :: [Alignment] -> OrgTable -> F OrgTable setAligns aligns t = return $ t{ orgTableAlignments = aligns }
133
setAligns aligns t = return $ t{ orgTableAlignments = aligns }
62
false
true
0
7
38
42
22
20
null
null
fimad/scalpel
scalpel-core/tests/TestMain.hs
apache-2.0
exit n = exitWith $ ExitFailure n
33
exit n = exitWith $ ExitFailure n
33
exit n = exitWith $ ExitFailure n
33
false
false
0
6
6
16
7
9
null
null
diekmann/Iptables_Semantics
haskell_tool/lib/Network/IPTables/Parser.hs
bsd-2-clause
initRState = RState mkRuleset Nothing
37
initRState = RState mkRuleset Nothing
37
initRState = RState mkRuleset Nothing
37
false
false
0
5
4
11
5
6
null
null
Alasdair/Mella
Lang/Tactic/Waldmeister.hs
bsd-3-clause
rcAxiom :: WMEquation -> TCMT IO Term rcAxiom wmEq = do (ty, t1, t2, vars) <- rcWMEquation wmEq ctx@(Ctx bs _) <- getCtx let ax = piBinders vars (Id ty t1 t2) axV <- findAxiom 0 ax return $ fixNames ctx axV --OK where findAxiom n ax = do ty <- tnf =<< getUnnamedVar n if ax == ty then return (Unnamed (DB n "!")) else findAxiom (n + 1) ax
380
rcAxiom :: WMEquation -> TCMT IO Term rcAxiom wmEq = do (ty, t1, t2, vars) <- rcWMEquation wmEq ctx@(Ctx bs _) <- getCtx let ax = piBinders vars (Id ty t1 t2) axV <- findAxiom 0 ax return $ fixNames ctx axV --OK where findAxiom n ax = do ty <- tnf =<< getUnnamedVar n if ax == ty then return (Unnamed (DB n "!")) else findAxiom (n + 1) ax
380
rcAxiom wmEq = do (ty, t1, t2, vars) <- rcWMEquation wmEq ctx@(Ctx bs _) <- getCtx let ax = piBinders vars (Id ty t1 t2) axV <- findAxiom 0 ax return $ fixNames ctx axV --OK where findAxiom n ax = do ty <- tnf =<< getUnnamedVar n if ax == ty then return (Unnamed (DB n "!")) else findAxiom (n + 1) ax
342
false
true
0
12
112
183
88
95
null
null
dragosboca/xmobar
src/Plugins/Monitors/CoreCommon.hs
bsd-3-clause
-- | Function to turn a list of of strings into a list of path components pathComponents :: [String] -> [Comp] pathComponents = joinComps . drop 2 . intercalate [Space] . map splitParts where splitParts p | (l, _:r) <- break (== '/') p = Comp l : Slash : splitParts r | otherwise = [Comp p] joinComps = uncurry joinComps' . partition isComp isComp (Comp _) = True isComp _ = False fromComp (Comp s) = s fromComp _ = error "fromComp applied to value other than (Comp _)" joinComps' cs [] = [Fix $ fromComp $ head cs] -- cs should have only one element here, -- but this keeps the pattern matching -- exhaustive joinComps' cs (p:ps) = let (ss, ps') = span (== p) ps ct = if null ps' || (p == Space) then length ss + 1 else length ss (ls, rs) = splitAt (ct+1) cs c = case p of Space -> Var $ map fromComp ls Slash -> Fix $ intercalate "/" $ map fromComp ls _ -> error "Should not happen" in if null ps' then [c] else c:joinComps' rs (drop ct ps) -- | Function to find all files matching the given path and possible label file. -- The path must be absolute (start with a leading slash).
1,673
pathComponents :: [String] -> [Comp] pathComponents = joinComps . drop 2 . intercalate [Space] . map splitParts where splitParts p | (l, _:r) <- break (== '/') p = Comp l : Slash : splitParts r | otherwise = [Comp p] joinComps = uncurry joinComps' . partition isComp isComp (Comp _) = True isComp _ = False fromComp (Comp s) = s fromComp _ = error "fromComp applied to value other than (Comp _)" joinComps' cs [] = [Fix $ fromComp $ head cs] -- cs should have only one element here, -- but this keeps the pattern matching -- exhaustive joinComps' cs (p:ps) = let (ss, ps') = span (== p) ps ct = if null ps' || (p == Space) then length ss + 1 else length ss (ls, rs) = splitAt (ct+1) cs c = case p of Space -> Var $ map fromComp ls Slash -> Fix $ intercalate "/" $ map fromComp ls _ -> error "Should not happen" in if null ps' then [c] else c:joinComps' rs (drop ct ps) -- | Function to find all files matching the given path and possible label file. -- The path must be absolute (start with a leading slash).
1,599
pathComponents = joinComps . drop 2 . intercalate [Space] . map splitParts where splitParts p | (l, _:r) <- break (== '/') p = Comp l : Slash : splitParts r | otherwise = [Comp p] joinComps = uncurry joinComps' . partition isComp isComp (Comp _) = True isComp _ = False fromComp (Comp s) = s fromComp _ = error "fromComp applied to value other than (Comp _)" joinComps' cs [] = [Fix $ fromComp $ head cs] -- cs should have only one element here, -- but this keeps the pattern matching -- exhaustive joinComps' cs (p:ps) = let (ss, ps') = span (== p) ps ct = if null ps' || (p == Space) then length ss + 1 else length ss (ls, rs) = splitAt (ct+1) cs c = case p of Space -> Var $ map fromComp ls Slash -> Fix $ intercalate "/" $ map fromComp ls _ -> error "Should not happen" in if null ps' then [c] else c:joinComps' rs (drop ct ps) -- | Function to find all files matching the given path and possible label file. -- The path must be absolute (start with a leading slash).
1,562
true
true
4
14
808
420
204
216
null
null
spacekitteh/smcghc
libraries/base/GHC/Foreign.hs
bsd-3-clause
newEncodedCString :: TextEncoding -- ^ Encoding of CString to create -> Bool -- ^ Null-terminate? -> String -- ^ String to encode -> IO CStringLen newEncodedCString (TextEncoding { mkTextEncoder = mk_encoder }) null_terminate s = bracket mk_encoder close $ \encoder -> withArrayLen s $ \sz p -> do from <- fmap (\fp -> bufferAdd sz (emptyBuffer fp sz ReadBuffer)) $ newForeignPtr_ p let go iteration to_p to_sz_bytes = do putDebugMsg ("newEncodedCString: " ++ show iteration) mb_res <- tryFillBufferAndCall encoder null_terminate from to_p to_sz_bytes return case mb_res of Nothing -> do let to_sz_bytes' = to_sz_bytes * 2 to_p' <- reallocBytes to_p to_sz_bytes' go (iteration + 1) to_p' to_sz_bytes' Just res -> return res -- If the input string is ASCII, this value will ensure we only allocate once let to_sz_bytes = cCharSize * (sz + 1) to_p <- mallocBytes to_sz_bytes go (0 :: Int) to_p to_sz_bytes
1,125
newEncodedCString :: TextEncoding -- ^ Encoding of CString to create -> Bool -- ^ Null-terminate? -> String -- ^ String to encode -> IO CStringLen newEncodedCString (TextEncoding { mkTextEncoder = mk_encoder }) null_terminate s = bracket mk_encoder close $ \encoder -> withArrayLen s $ \sz p -> do from <- fmap (\fp -> bufferAdd sz (emptyBuffer fp sz ReadBuffer)) $ newForeignPtr_ p let go iteration to_p to_sz_bytes = do putDebugMsg ("newEncodedCString: " ++ show iteration) mb_res <- tryFillBufferAndCall encoder null_terminate from to_p to_sz_bytes return case mb_res of Nothing -> do let to_sz_bytes' = to_sz_bytes * 2 to_p' <- reallocBytes to_p to_sz_bytes' go (iteration + 1) to_p' to_sz_bytes' Just res -> return res -- If the input string is ASCII, this value will ensure we only allocate once let to_sz_bytes = cCharSize * (sz + 1) to_p <- mallocBytes to_sz_bytes go (0 :: Int) to_p to_sz_bytes
1,125
newEncodedCString (TextEncoding { mkTextEncoder = mk_encoder }) null_terminate s = bracket mk_encoder close $ \encoder -> withArrayLen s $ \sz p -> do from <- fmap (\fp -> bufferAdd sz (emptyBuffer fp sz ReadBuffer)) $ newForeignPtr_ p let go iteration to_p to_sz_bytes = do putDebugMsg ("newEncodedCString: " ++ show iteration) mb_res <- tryFillBufferAndCall encoder null_terminate from to_p to_sz_bytes return case mb_res of Nothing -> do let to_sz_bytes' = to_sz_bytes * 2 to_p' <- reallocBytes to_p to_sz_bytes' go (iteration + 1) to_p' to_sz_bytes' Just res -> return res -- If the input string is ASCII, this value will ensure we only allocate once let to_sz_bytes = cCharSize * (sz + 1) to_p <- mallocBytes to_sz_bytes go (0 :: Int) to_p to_sz_bytes
907
false
true
3
25
366
285
134
151
null
null
tjakway/ghcjvm
compiler/nativeGen/X86/CodeGen.hs
bsd-3-clause
assignReg_FltCode :: Format -> CmmReg -> CmmExpr -> NatM InstrBlock -- integer assignment to memory -- specific case of adding/subtracting an integer to a particular address. -- ToDo: catch other cases where we can use an operation directly on a memory -- address. assignMem_IntCode pk addr (CmmMachOp op [CmmLoad addr2 _, CmmLit (CmmInt i _)]) | addr == addr2, pk /= II64 || is32BitInteger i, Just instr <- check op = do Amode amode code_addr <- getAmode addr let code = code_addr `snocOL` instr pk (OpImm (ImmInt (fromIntegral i))) (OpAddr amode) return code where check (MO_Add _) = Just ADD check (MO_Sub _) = Just SUB check _ = Nothing -- ToDo: more? -- general case
806
assignReg_FltCode :: Format -> CmmReg -> CmmExpr -> NatM InstrBlock assignMem_IntCode pk addr (CmmMachOp op [CmmLoad addr2 _, CmmLit (CmmInt i _)]) | addr == addr2, pk /= II64 || is32BitInteger i, Just instr <- check op = do Amode amode code_addr <- getAmode addr let code = code_addr `snocOL` instr pk (OpImm (ImmInt (fromIntegral i))) (OpAddr amode) return code where check (MO_Add _) = Just ADD check (MO_Sub _) = Just SUB check _ = Nothing -- ToDo: more? -- general case
606
assignMem_IntCode pk addr (CmmMachOp op [CmmLoad addr2 _, CmmLit (CmmInt i _)]) | addr == addr2, pk /= II64 || is32BitInteger i, Just instr <- check op = do Amode amode code_addr <- getAmode addr let code = code_addr `snocOL` instr pk (OpImm (ImmInt (fromIntegral i))) (OpAddr amode) return code where check (MO_Add _) = Just ADD check (MO_Sub _) = Just SUB check _ = Nothing -- ToDo: more? -- general case
537
true
true
0
18
250
228
107
121
null
null
EchoTeam/harlson
Main.hs
bsd-2-clause
main :: IO () main = progOpts >>= runHarlson
44
main :: IO () main = progOpts >>= runHarlson
44
main = progOpts >>= runHarlson
30
false
true
0
6
8
20
10
10
null
null
DanielG/cabal-helper
src/CabalHelper/Compiletime/Program/CabalInstall.hs
apache-2.0
installCabalLibV2 :: Env => GhcVersion -> UnpackedCabalVersion -> PackageEnvFile -> IO () installCabalLibV2 _ghcVer cv (PackageEnvFile env_file) = do exists <- doesFileExist env_file if exists then return () else do installingMessage cv (target, cwd) <- case cv of CabalVersion cabalVer -> do return $ ("Cabal-"++showVersion cabalVer, "/") CabalHEAD (_commitid, CabalSourceDir srcdir) -> do return (".", srcdir) cabalInstallVer <- getCabalInstallVersion cabal_opts <- return $ concat [ if cabalInstallVer >= Version [1,20] [] then ["--no-require-sandbox"] else [] , [ if cabalInstallVer >= Version [2,4] [] then "v2-install" else "new-install" ] , cabalV2WithGHCProgOpts , [ "--package-env=" ++ env_file , "--lib" , target ] , if | ?verbose 3 -> ["-v2"] | ?verbose 4 -> ["-v3"] | otherwise -> [] ] callProcessStderr (Just cwd) [] (cabalProgram ?progs) cabal_opts hPutStrLn stderr "done"
1,118
installCabalLibV2 :: Env => GhcVersion -> UnpackedCabalVersion -> PackageEnvFile -> IO () installCabalLibV2 _ghcVer cv (PackageEnvFile env_file) = do exists <- doesFileExist env_file if exists then return () else do installingMessage cv (target, cwd) <- case cv of CabalVersion cabalVer -> do return $ ("Cabal-"++showVersion cabalVer, "/") CabalHEAD (_commitid, CabalSourceDir srcdir) -> do return (".", srcdir) cabalInstallVer <- getCabalInstallVersion cabal_opts <- return $ concat [ if cabalInstallVer >= Version [1,20] [] then ["--no-require-sandbox"] else [] , [ if cabalInstallVer >= Version [2,4] [] then "v2-install" else "new-install" ] , cabalV2WithGHCProgOpts , [ "--package-env=" ++ env_file , "--lib" , target ] , if | ?verbose 3 -> ["-v2"] | ?verbose 4 -> ["-v3"] | otherwise -> [] ] callProcessStderr (Just cwd) [] (cabalProgram ?progs) cabal_opts hPutStrLn stderr "done"
1,118
installCabalLibV2 _ghcVer cv (PackageEnvFile env_file) = do exists <- doesFileExist env_file if exists then return () else do installingMessage cv (target, cwd) <- case cv of CabalVersion cabalVer -> do return $ ("Cabal-"++showVersion cabalVer, "/") CabalHEAD (_commitid, CabalSourceDir srcdir) -> do return (".", srcdir) cabalInstallVer <- getCabalInstallVersion cabal_opts <- return $ concat [ if cabalInstallVer >= Version [1,20] [] then ["--no-require-sandbox"] else [] , [ if cabalInstallVer >= Version [2,4] [] then "v2-install" else "new-install" ] , cabalV2WithGHCProgOpts , [ "--package-env=" ++ env_file , "--lib" , target ] , if | ?verbose 3 -> ["-v2"] | ?verbose 4 -> ["-v3"] | otherwise -> [] ] callProcessStderr (Just cwd) [] (cabalProgram ?progs) cabal_opts hPutStrLn stderr "done"
1,028
false
true
0
20
358
337
168
169
null
null
arianvp/binary-serialise-cbor
tests/Tests/Reference.hs
bsd-3-clause
encodedRoundtrip :: String -> [Word8] -> Assertion encodedRoundtrip expectedDiagnostic encoded = do let Just (term, []) = runDecoder decodeTerm encoded reencoded = encodeTerm term assertEqual ("for CBOR: " ++ expectedDiagnostic) encoded reencoded -- | The examples from the CBOR spec RFC7049 Appendix A. -- The diagnostic notation and encoded bytes. --
372
encodedRoundtrip :: String -> [Word8] -> Assertion encodedRoundtrip expectedDiagnostic encoded = do let Just (term, []) = runDecoder decodeTerm encoded reencoded = encodeTerm term assertEqual ("for CBOR: " ++ expectedDiagnostic) encoded reencoded -- | The examples from the CBOR spec RFC7049 Appendix A. -- The diagnostic notation and encoded bytes. --
372
encodedRoundtrip expectedDiagnostic encoded = do let Just (term, []) = runDecoder decodeTerm encoded reencoded = encodeTerm term assertEqual ("for CBOR: " ++ expectedDiagnostic) encoded reencoded -- | The examples from the CBOR spec RFC7049 Appendix A. -- The diagnostic notation and encoded bytes. --
321
false
true
0
12
70
81
41
40
null
null
PelleJuul/popl
src/Parser/Statement.hs
mit
cCallStmt :: Parser Stmt cCallStmt = do string "c:" c <- call semicolon return $ CCallStmt c
100
cCallStmt :: Parser Stmt cCallStmt = do string "c:" c <- call semicolon return $ CCallStmt c
100
cCallStmt = do string "c:" c <- call semicolon return $ CCallStmt c
75
false
true
0
8
24
40
17
23
null
null
paf31/language-typescript
src/Language/TypeScript/Parser.hs
mit
commentPlaceholder = fmap toOffset getPosition where toOffset pos = Left $ (sourceLine pos, sourceColumn pos)
111
commentPlaceholder = fmap toOffset getPosition where toOffset pos = Left $ (sourceLine pos, sourceColumn pos)
111
commentPlaceholder = fmap toOffset getPosition where toOffset pos = Left $ (sourceLine pos, sourceColumn pos)
111
false
false
0
7
16
36
18
18
null
null
vikraman/ghc
libraries/template-haskell/Language/Haskell/TH/Syntax.hs
bsd-3-clause
mkPkgName :: String -> PkgName mkPkgName s = PkgName s
54
mkPkgName :: String -> PkgName mkPkgName s = PkgName s
54
mkPkgName s = PkgName s
23
false
true
0
7
9
27
11
16
null
null
romanb/amazonka
amazonka-ec2/gen/Network/AWS/EC2/DescribeAccountAttributes.hs
mpl-2.0
-- | Information about one or more account attributes. daarAccountAttributes :: Lens' DescribeAccountAttributesResponse [AccountAttribute] daarAccountAttributes = lens _daarAccountAttributes (\s a -> s { _daarAccountAttributes = a }) . _List
253
daarAccountAttributes :: Lens' DescribeAccountAttributesResponse [AccountAttribute] daarAccountAttributes = lens _daarAccountAttributes (\s a -> s { _daarAccountAttributes = a }) . _List
198
daarAccountAttributes = lens _daarAccountAttributes (\s a -> s { _daarAccountAttributes = a }) . _List
114
true
true
1
9
40
49
26
23
null
null
glutamate/probably
Math/Probably/Sampler.hs
bsd-3-clause
oneOf :: [a] -> Sampler a oneOf xs = do idx <- floor `fmap` uniform (0::Double) (realToFrac $ length xs ) return $ xs !! idx
138
oneOf :: [a] -> Sampler a oneOf xs = do idx <- floor `fmap` uniform (0::Double) (realToFrac $ length xs ) return $ xs !! idx
138
oneOf xs = do idx <- floor `fmap` uniform (0::Double) (realToFrac $ length xs ) return $ xs !! idx
112
false
true
0
12
39
73
36
37
null
null
duairc/gitit-maps
src/Network/Gitit/Handlers/Map.hs
gpl-2.0
assignDefaultIcons :: Config -> Map String (String, Maybe FilePath, Bool) -> IO Categories assignDefaultIcons cfg tuples = do let static = staticDir cfg tuples' <- sequence . flip mapWithKey tuples $ \k (n, i, c) -> do exists <- doesFileExist $ static </> "img" </> "icons" </> k <.> "png" let i' = guard exists >> return ("/img/icons/" ++ k ++ ".png") return (n, mplus i i', c) let noIcons = length $ filter (\(_, i, _) -> isNothing i) (elems tuples') let j = if noIcons > 12 then 1 else 12 / fromIntegral noIcons let go x (n, Nothing, c) = (x + j, Category n (generic x) c) go x (n, Just i, c) = (x, Category n i c) return $ snd $ mapAccum go (0 :: Double) tuples' where generic i = concat [ "/img/icons/generic-" , show ((round i `mod` 12 :: Int) + 1) , ".png" ] ------------------------------------------------------------------------------
952
assignDefaultIcons :: Config -> Map String (String, Maybe FilePath, Bool) -> IO Categories assignDefaultIcons cfg tuples = do let static = staticDir cfg tuples' <- sequence . flip mapWithKey tuples $ \k (n, i, c) -> do exists <- doesFileExist $ static </> "img" </> "icons" </> k <.> "png" let i' = guard exists >> return ("/img/icons/" ++ k ++ ".png") return (n, mplus i i', c) let noIcons = length $ filter (\(_, i, _) -> isNothing i) (elems tuples') let j = if noIcons > 12 then 1 else 12 / fromIntegral noIcons let go x (n, Nothing, c) = (x + j, Category n (generic x) c) go x (n, Just i, c) = (x, Category n i c) return $ snd $ mapAccum go (0 :: Double) tuples' where generic i = concat [ "/img/icons/generic-" , show ((round i `mod` 12 :: Int) + 1) , ".png" ] ------------------------------------------------------------------------------
952
assignDefaultIcons cfg tuples = do let static = staticDir cfg tuples' <- sequence . flip mapWithKey tuples $ \k (n, i, c) -> do exists <- doesFileExist $ static </> "img" </> "icons" </> k <.> "png" let i' = guard exists >> return ("/img/icons/" ++ k ++ ".png") return (n, mplus i i', c) let noIcons = length $ filter (\(_, i, _) -> isNothing i) (elems tuples') let j = if noIcons > 12 then 1 else 12 / fromIntegral noIcons let go x (n, Nothing, c) = (x + j, Category n (generic x) c) go x (n, Just i, c) = (x, Category n i c) return $ snd $ mapAccum go (0 :: Double) tuples' where generic i = concat [ "/img/icons/generic-" , show ((round i `mod` 12 :: Int) + 1) , ".png" ] ------------------------------------------------------------------------------
849
false
true
0
19
261
399
203
196
null
null
lubomir/dot-race
fay/Constants.hs
bsd-3-clause
initialZoom :: Double initialZoom = 20
38
initialZoom :: Double initialZoom = 20
38
initialZoom = 20
16
false
true
0
4
5
11
6
5
null
null
atodorov/bdcs
src/BDCS/Files.hs
lgpl-2.1
filesC :: MonadResource m => Source (SqlPersistT m) Files filesC = do let source = selectSource $ from $ \file -> do orderBy [asc (file ^. FilesPath)] return file source .| CL.map entityVal
242
filesC :: MonadResource m => Source (SqlPersistT m) Files filesC = do let source = selectSource $ from $ \file -> do orderBy [asc (file ^. FilesPath)] return file source .| CL.map entityVal
242
filesC = do let source = selectSource $ from $ \file -> do orderBy [asc (file ^. FilesPath)] return file source .| CL.map entityVal
184
false
true
0
18
85
88
41
47
null
null
fmthoma/ghc
compiler/types/TyCon.hs
bsd-3-clause
isClosedSynFamilyTyConWithAxiom_maybe _ = Nothing
63
isClosedSynFamilyTyConWithAxiom_maybe _ = Nothing
63
isClosedSynFamilyTyConWithAxiom_maybe _ = Nothing
63
false
false
0
5
17
9
4
5
null
null
goromlagche/gli
src/gli/gitlab.hs
bsd-3-clause
printBuild :: T.Text -> Int -> Build -> IO () printBuild u i b = do c <- utcToLocalZonedTime $ created_at (b :: Build) f <- finished_time (finished_at b) putStrLn (unlines (lines (show b) ++ [ " Url: " ++ bUrl , " Created At: " ++ show c , " Finished At: " ++ f])) where bUrl = T.unpack (T.replace (T.pack("/merge_requests/" ++ show i)) (T.pack "") u) ++ "/builds/" ++ show (id (b :: Build)) finished_time fa = case fa of Just fa -> do lf <- utcToLocalZonedTime fa return (show $ lf) Nothing -> return "Pending"
769
printBuild :: T.Text -> Int -> Build -> IO () printBuild u i b = do c <- utcToLocalZonedTime $ created_at (b :: Build) f <- finished_time (finished_at b) putStrLn (unlines (lines (show b) ++ [ " Url: " ++ bUrl , " Created At: " ++ show c , " Finished At: " ++ f])) where bUrl = T.unpack (T.replace (T.pack("/merge_requests/" ++ show i)) (T.pack "") u) ++ "/builds/" ++ show (id (b :: Build)) finished_time fa = case fa of Just fa -> do lf <- utcToLocalZonedTime fa return (show $ lf) Nothing -> return "Pending"
769
printBuild u i b = do c <- utcToLocalZonedTime $ created_at (b :: Build) f <- finished_time (finished_at b) putStrLn (unlines (lines (show b) ++ [ " Url: " ++ bUrl , " Created At: " ++ show c , " Finished At: " ++ f])) where bUrl = T.unpack (T.replace (T.pack("/merge_requests/" ++ show i)) (T.pack "") u) ++ "/builds/" ++ show (id (b :: Build)) finished_time fa = case fa of Just fa -> do lf <- utcToLocalZonedTime fa return (show $ lf) Nothing -> return "Pending"
723
false
true
6
14
355
264
123
141
null
null
bos/filemanip
System/FilePath/Find.hs
bsd-3-clause
-- | Return the canonical path of the file being visited. -- -- See `canonicalizePath` for details of what canonical path means. canonicalPath :: FindClause FilePath canonicalPath = (unsafePerformIO . canonicalizePath) `liftM` filePath
235
canonicalPath :: FindClause FilePath canonicalPath = (unsafePerformIO . canonicalizePath) `liftM` filePath
106
canonicalPath = (unsafePerformIO . canonicalizePath) `liftM` filePath
69
true
true
0
7
32
30
18
12
null
null
fmapfmapfmap/amazonka
amazonka-ec2/gen/Network/AWS/EC2/Types/Product.hs
mpl-2.0
-- | The AWS account ID to add to the list of launch permissions for the AMI. lpmAdd :: Lens' LaunchPermissionModifications [LaunchPermission] lpmAdd = lens _lpmAdd (\ s a -> s{_lpmAdd = a}) . _Default . _Coerce
211
lpmAdd :: Lens' LaunchPermissionModifications [LaunchPermission] lpmAdd = lens _lpmAdd (\ s a -> s{_lpmAdd = a}) . _Default . _Coerce
133
lpmAdd = lens _lpmAdd (\ s a -> s{_lpmAdd = a}) . _Default . _Coerce
68
true
true
0
11
36
51
28
23
null
null
akrzemi1/Mach7
code/msvc/Versity/test/peep.hs
bsd-3-clause
peep2 [] = []
13
peep2 [] = []
13
peep2 [] = []
13
false
false
0
6
3
13
6
7
null
null
hpacheco/HAAP
examples/plab/svn/2017li1g180/src/Tarefa1_2017li1g180.hs
mit
atNote2 str xys x y = atNote str (atNote str xys x) y
53
atNote2 str xys x y = atNote str (atNote str xys x) y
53
atNote2 str xys x y = atNote str (atNote str xys x) y
53
false
false
0
7
12
35
15
20
null
null
yav/allegro
src/Allegro/Primitives.hs
bsd-3-clause
-------------------------------------------------------------------------------- f :: Float -> CFloat f = realToFrac
117
f :: Float -> CFloat f = realToFrac
35
f = realToFrac
14
true
true
0
7
9
23
10
13
null
null
castaway/pandoc
src/Text/Pandoc/Readers/RST.hs
gpl-2.0
simpleReferenceName :: GenParser Char st [Inline] simpleReferenceName = do raw <- simpleReferenceName' return [Str raw]
123
simpleReferenceName :: GenParser Char st [Inline] simpleReferenceName = do raw <- simpleReferenceName' return [Str raw]
123
simpleReferenceName = do raw <- simpleReferenceName' return [Str raw]
73
false
true
1
10
18
45
19
26
null
null
apyrgio/snf-ganeti
src/Ganeti/HTools/Program/Hbal.hs
bsd-2-clause
-- | Signal handler for graceful termination. handleSigInt :: IORef Int -> IO () handleSigInt cref = do writeIORef cref 1 putStrLn ("Cancel request registered, will exit at" ++ " the end of the current job set...") -- | Signal handler for immediate termination.
278
handleSigInt :: IORef Int -> IO () handleSigInt cref = do writeIORef cref 1 putStrLn ("Cancel request registered, will exit at" ++ " the end of the current job set...") -- | Signal handler for immediate termination.
232
handleSigInt cref = do writeIORef cref 1 putStrLn ("Cancel request registered, will exit at" ++ " the end of the current job set...") -- | Signal handler for immediate termination.
197
true
true
0
9
60
49
23
26
null
null
agremm/Seismic
accelerate/imaginary_gpu_update/Seismic.hs
gpl-3.0
dt = h/(5.0*2000.0)
19
dt = h/(5.0*2000.0)
19
dt = h/(5.0*2000.0)
19
false
false
3
7
2
23
9
14
null
null
tokiwoousaka/NovelMonad
dist/build/autogen/Paths_NovelMonad.hs
mit
getLibDir = catchIO (getEnv "NovelMonad_libdir") (\_ -> return libdir)
70
getLibDir = catchIO (getEnv "NovelMonad_libdir") (\_ -> return libdir)
70
getLibDir = catchIO (getEnv "NovelMonad_libdir") (\_ -> return libdir)
70
false
false
0
8
8
28
14
14
null
null
nmk/Spock
examples/Simple.hs
bsd-3-clause
main = runSpock 3000 $ spockT id $ do get ("echo" <//> ":something") $ do Just something <- param "something" text $ T.concat ["Echo: ", something] get ("regex" <//> "{number:^[0-9]+$}") $ do Just number <- param "number" text $ T.concat ["Just a number: ", number]
318
main = runSpock 3000 $ spockT id $ do get ("echo" <//> ":something") $ do Just something <- param "something" text $ T.concat ["Echo: ", something] get ("regex" <//> "{number:^[0-9]+$}") $ do Just number <- param "number" text $ T.concat ["Just a number: ", number]
318
main = runSpock 3000 $ spockT id $ do get ("echo" <//> ":something") $ do Just something <- param "something" text $ T.concat ["Echo: ", something] get ("regex" <//> "{number:^[0-9]+$}") $ do Just number <- param "number" text $ T.concat ["Just a number: ", number]
318
false
false
0
13
97
116
53
63
null
null
shepheb/go10c
Compiler.hs
bsd-3-clause
compile (StmtFunction name args ret (Just [])) = do addSymbol name (TypeFunction (map snd args) ret) prefix <- mkLabel name return $ [LabelDef prefix, SET PC POP]
174
compile (StmtFunction name args ret (Just [])) = do addSymbol name (TypeFunction (map snd args) ret) prefix <- mkLabel name return $ [LabelDef prefix, SET PC POP]
174
compile (StmtFunction name args ret (Just [])) = do addSymbol name (TypeFunction (map snd args) ret) prefix <- mkLabel name return $ [LabelDef prefix, SET PC POP]
174
false
false
0
11
38
84
39
45
null
null
tonyday567/chart-svg
src/Chart/Primitive.hs
bsd-3-clause
projectWith new old (TextChart s a) = TextChart (projectX s) (second (projectOnP new old) <$> a) where projectX :: TextStyle -> TextStyle projectX s' = case view #scalex s' of NoScaleX -> s' & over #hsize (* (width ox / width nx)) & over #vsize (* (width ox / width nx)) ScaleX -> s' & over #size (* (width nx / width ox)) (Ranges nx _) = new (Ranges ox _) = old
392
projectWith new old (TextChart s a) = TextChart (projectX s) (second (projectOnP new old) <$> a) where projectX :: TextStyle -> TextStyle projectX s' = case view #scalex s' of NoScaleX -> s' & over #hsize (* (width ox / width nx)) & over #vsize (* (width ox / width nx)) ScaleX -> s' & over #size (* (width nx / width ox)) (Ranges nx _) = new (Ranges ox _) = old
392
projectWith new old (TextChart s a) = TextChart (projectX s) (second (projectOnP new old) <$> a) where projectX :: TextStyle -> TextStyle projectX s' = case view #scalex s' of NoScaleX -> s' & over #hsize (* (width ox / width nx)) & over #vsize (* (width ox / width nx)) ScaleX -> s' & over #size (* (width nx / width ox)) (Ranges nx _) = new (Ranges ox _) = old
392
false
false
4
15
102
200
98
102
null
null
mfolnovic/puh-hash
Parsing/HashParser.hs
gpl-2.0
-- Removes all space after parsed. lexeme :: Parser a -> Parser a lexeme p = p <* space
87
lexeme :: Parser a -> Parser a lexeme p = p <* space
52
lexeme p = p <* space
21
true
true
2
7
18
36
16
20
null
null
alexander-at-github/eta
compiler/ETA/Prelude/PrelNames.hs
bsd-3-clause
ioDataConName = conName gHC_TYPES (fsLit "IO") ioDataConKey
69
ioDataConName = conName gHC_TYPES (fsLit "IO") ioDataConKey
69
ioDataConName = conName gHC_TYPES (fsLit "IO") ioDataConKey
69
false
false
1
7
16
22
9
13
null
null
pjones/xmonad-test
vendor/xmonad-contrib/XMonad/Config/Gnome.hs
bsd-2-clause
-- | Launch the "Run Application" dialog. gnome-panel must be running for this -- to work. gnomeRun :: X () gnomeRun = withDisplay $ \dpy -> do rw <- asks theRoot gnome_panel <- getAtom "_GNOME_PANEL_ACTION" panel_run <- getAtom "_GNOME_PANEL_ACTION_RUN_DIALOG" io $ allocaXEvent $ \e -> do setEventType e clientMessage setClientMessageEvent e rw gnome_panel 32 panel_run 0 sendEvent dpy rw False structureNotifyMask e sync dpy False -- | Register xmonad with gnome. 'dbus-send' must be in the $PATH with which -- xmonad is started. -- -- This action reduces a delay on startup only only if you have configured -- gnome-session>=2.26: to start xmonad with a command as such: -- -- > gconftool-2 -s /desktop/gnome/session/required_components/windowmanager xmonad --type string
828
gnomeRun :: X () gnomeRun = withDisplay $ \dpy -> do rw <- asks theRoot gnome_panel <- getAtom "_GNOME_PANEL_ACTION" panel_run <- getAtom "_GNOME_PANEL_ACTION_RUN_DIALOG" io $ allocaXEvent $ \e -> do setEventType e clientMessage setClientMessageEvent e rw gnome_panel 32 panel_run 0 sendEvent dpy rw False structureNotifyMask e sync dpy False -- | Register xmonad with gnome. 'dbus-send' must be in the $PATH with which -- xmonad is started. -- -- This action reduces a delay on startup only only if you have configured -- gnome-session>=2.26: to start xmonad with a command as such: -- -- > gconftool-2 -s /desktop/gnome/session/required_components/windowmanager xmonad --type string
736
gnomeRun = withDisplay $ \dpy -> do rw <- asks theRoot gnome_panel <- getAtom "_GNOME_PANEL_ACTION" panel_run <- getAtom "_GNOME_PANEL_ACTION_RUN_DIALOG" io $ allocaXEvent $ \e -> do setEventType e clientMessage setClientMessageEvent e rw gnome_panel 32 panel_run 0 sendEvent dpy rw False structureNotifyMask e sync dpy False -- | Register xmonad with gnome. 'dbus-send' must be in the $PATH with which -- xmonad is started. -- -- This action reduces a delay on startup only only if you have configured -- gnome-session>=2.26: to start xmonad with a command as such: -- -- > gconftool-2 -s /desktop/gnome/session/required_components/windowmanager xmonad --type string
719
true
true
2
13
169
133
62
71
null
null
mettekou/ghc
compiler/typecheck/TcBinds.hs
bsd-3-clause
tcExtendTyVarEnvForRhs :: Maybe TcIdSigInst -> TcM a -> TcM a tcExtendTyVarEnvForRhs Nothing thing_inside = thing_inside
122
tcExtendTyVarEnvForRhs :: Maybe TcIdSigInst -> TcM a -> TcM a tcExtendTyVarEnvForRhs Nothing thing_inside = thing_inside
122
tcExtendTyVarEnvForRhs Nothing thing_inside = thing_inside
60
false
true
0
7
16
33
15
18
null
null
arianvp/binary-serialise-cbor
bench/Macro/Load.hs
bsd-3-clause
parseBuildToolNameQ :: ReadP PackageName parseBuildToolNameQ = parseQuoted parseBuildToolName <++ parseBuildToolName
116
parseBuildToolNameQ :: ReadP PackageName parseBuildToolNameQ = parseQuoted parseBuildToolName <++ parseBuildToolName
116
parseBuildToolNameQ = parseQuoted parseBuildToolName <++ parseBuildToolName
75
false
true
1
6
9
25
10
15
null
null
antalsz/hs-to-coq
examples/ghc/gen-files/Lexer.hs
mit
pop :: Action pop _span _buf _len = do _ <- popLexState lexToken
89
pop :: Action pop _span _buf _len = do _ <- popLexState lexToken
89
pop _span _buf _len = do _ <- popLexState lexToken
75
false
true
0
7
37
34
14
20
null
null
bergmark/hlint
src/Hint/Structure.hs
bsd-3-clause
hints :: (String -> Pattern -> Idea) -> Pattern -> [Idea] hints gen (Pattern pat (UnGuardedRhs d bod) bind) | length guards > 2 = [gen "Use guards" $ Pattern pat (GuardedRhss d guards) bind] where guards = asGuards bod {- -- Do not suggest view patterns, they aren't something everyone likes sufficiently hints gen (Pattern pats (GuardedRhss _ [GuardedRhs _ [Generator _ pat (App _ op (view -> Var_ p))] bod]) bind) | Just i <- findIndex (=~= (toNamed p :: Pat_)) pats , p `notElem` (vars bod ++ vars bind) , vars op `disjoint` decsBind, pvars pats `disjoint` vars op, pvars pat `disjoint` pvars pats = [gen "Use view patterns" $ Pattern (take i pats ++ [PParen an $ PViewPat an op pat] ++ drop (i+1) pats) (UnGuardedRhs an bod) bind] where decsBind = nub $ concatMap declBind $ childrenBi bind -}
841
hints :: (String -> Pattern -> Idea) -> Pattern -> [Idea] hints gen (Pattern pat (UnGuardedRhs d bod) bind) | length guards > 2 = [gen "Use guards" $ Pattern pat (GuardedRhss d guards) bind] where guards = asGuards bod {- -- Do not suggest view patterns, they aren't something everyone likes sufficiently hints gen (Pattern pats (GuardedRhss _ [GuardedRhs _ [Generator _ pat (App _ op (view -> Var_ p))] bod]) bind) | Just i <- findIndex (=~= (toNamed p :: Pat_)) pats , p `notElem` (vars bod ++ vars bind) , vars op `disjoint` decsBind, pvars pats `disjoint` vars op, pvars pat `disjoint` pvars pats = [gen "Use view patterns" $ Pattern (take i pats ++ [PParen an $ PViewPat an op pat] ++ drop (i+1) pats) (UnGuardedRhs an bod) bind] where decsBind = nub $ concatMap declBind $ childrenBi bind -}
841
hints gen (Pattern pat (UnGuardedRhs d bod) bind) | length guards > 2 = [gen "Use guards" $ Pattern pat (GuardedRhss d guards) bind] where guards = asGuards bod {- -- Do not suggest view patterns, they aren't something everyone likes sufficiently hints gen (Pattern pats (GuardedRhss _ [GuardedRhs _ [Generator _ pat (App _ op (view -> Var_ p))] bod]) bind) | Just i <- findIndex (=~= (toNamed p :: Pat_)) pats , p `notElem` (vars bod ++ vars bind) , vars op `disjoint` decsBind, pvars pats `disjoint` vars op, pvars pat `disjoint` pvars pats = [gen "Use view patterns" $ Pattern (take i pats ++ [PParen an $ PViewPat an op pat] ++ drop (i+1) pats) (UnGuardedRhs an bod) bind] where decsBind = nub $ concatMap declBind $ childrenBi bind -}
783
false
true
0
10
187
110
53
57
null
null
mrkkrp/stack
src/Stack/Types/Config.hs
bsd-3-clause
-- | Perform defaulting of peExtraDepMaybe peExtraDepDef :: PackageEntry -> TreatLikeExtraDep peExtraDepDef = fromMaybe False . peExtraDepMaybe
143
peExtraDepDef :: PackageEntry -> TreatLikeExtraDep peExtraDepDef = fromMaybe False . peExtraDepMaybe
100
peExtraDepDef = fromMaybe False . peExtraDepMaybe
49
true
true
1
7
16
31
13
18
null
null
josuf107/xioqbot
src/Messages.hs
bsd-3-clause
streamerNotOnATeamLossMsg :: Msg_ streamerNotOnATeamLossMsg = msg "The streamer is not on a team so I can't mark a loss"
120
streamerNotOnATeamLossMsg :: Msg_ streamerNotOnATeamLossMsg = msg "The streamer is not on a team so I can't mark a loss"
120
streamerNotOnATeamLossMsg = msg "The streamer is not on a team so I can't mark a loss"
86
false
true
0
5
18
14
7
7
null
null
leshchevds/ganeti
src/Ganeti/UDSServer.hs
bsd-2-clause
logMsg handler req (Ok result) = do -- only log the first 2,000 chars of the result logDebug $ "Result (truncated): " ++ take 2000 (J.encode result) logDebug $ "Successfully handled " ++ hInputLogShort handler req -- | Prepares an outgoing message.
255
logMsg handler req (Ok result) = do -- only log the first 2,000 chars of the result logDebug $ "Result (truncated): " ++ take 2000 (J.encode result) logDebug $ "Successfully handled " ++ hInputLogShort handler req -- | Prepares an outgoing message.
255
logMsg handler req (Ok result) = do -- only log the first 2,000 chars of the result logDebug $ "Result (truncated): " ++ take 2000 (J.encode result) logDebug $ "Successfully handled " ++ hInputLogShort handler req -- | Prepares an outgoing message.
255
false
false
0
11
48
61
29
32
null
null
snoyberg/ghc
compiler/cmm/CmmUtils.hs
bsd-3-clause
toBlockListEntryFirstFalseFallthrough :: CmmGraph -> [CmmBlock] toBlockListEntryFirstFalseFallthrough g | mapNull m = [] | otherwise = dfs setEmpty [entry_block] where m = toBlockMap g entry_id = g_entry g Just entry_block = mapLookup entry_id m dfs :: LabelSet -> [CmmBlock] -> [CmmBlock] dfs _ [] = [] dfs visited (block:bs) | id `setMember` visited = dfs visited bs | otherwise = block : dfs (setInsert id visited) bs' where id = entryLabel block bs' = foldr add_id bs (successors block) add_id id bs = case mapLookup id m of Just b -> b : bs Nothing -> bs
708
toBlockListEntryFirstFalseFallthrough :: CmmGraph -> [CmmBlock] toBlockListEntryFirstFalseFallthrough g | mapNull m = [] | otherwise = dfs setEmpty [entry_block] where m = toBlockMap g entry_id = g_entry g Just entry_block = mapLookup entry_id m dfs :: LabelSet -> [CmmBlock] -> [CmmBlock] dfs _ [] = [] dfs visited (block:bs) | id `setMember` visited = dfs visited bs | otherwise = block : dfs (setInsert id visited) bs' where id = entryLabel block bs' = foldr add_id bs (successors block) add_id id bs = case mapLookup id m of Just b -> b : bs Nothing -> bs
708
toBlockListEntryFirstFalseFallthrough g | mapNull m = [] | otherwise = dfs setEmpty [entry_block] where m = toBlockMap g entry_id = g_entry g Just entry_block = mapLookup entry_id m dfs :: LabelSet -> [CmmBlock] -> [CmmBlock] dfs _ [] = [] dfs visited (block:bs) | id `setMember` visited = dfs visited bs | otherwise = block : dfs (setInsert id visited) bs' where id = entryLabel block bs' = foldr add_id bs (successors block) add_id id bs = case mapLookup id m of Just b -> b : bs Nothing -> bs
644
false
true
5
10
244
226
113
113
null
null
sdiehl/ghc
libraries/template-haskell/Language/Haskell/TH/Lib/Internal.hs
bsd-3-clause
unboxedTupE :: Quote m => [Maybe (m Exp)] -> m Exp unboxedTupE es = do { es1 <- traverse sequenceA es; pure (UnboxedTupE es1)}
126
unboxedTupE :: Quote m => [Maybe (m Exp)] -> m Exp unboxedTupE es = do { es1 <- traverse sequenceA es; pure (UnboxedTupE es1)}
126
unboxedTupE es = do { es1 <- traverse sequenceA es; pure (UnboxedTupE es1)}
75
false
true
0
11
23
72
33
39
null
null
mrkkrp/stack
src/Stack/Types/BuildPlan.hs
bsd-3-clause
renderSnapName (Nightly d) = T.pack $ "nightly-" ++ show d
58
renderSnapName (Nightly d) = T.pack $ "nightly-" ++ show d
58
renderSnapName (Nightly d) = T.pack $ "nightly-" ++ show d
58
false
false
0
7
9
28
13
15
null
null
GaloisInc/pads-haskell
Language/Pads/Library/BigEndian.hs
bsd-3-clause
i8Tobsbh (i,md) = (B.singleton (fromIntegral i), md)
52
i8Tobsbh (i,md) = (B.singleton (fromIntegral i), md)
52
i8Tobsbh (i,md) = (B.singleton (fromIntegral i), md)
52
false
false
0
8
6
33
17
16
null
null
zhiyuanshi/fcore
frontend/Desugar.hs
bsd-2-clause
transType _ Unit = F.Unit
33
transType _ Unit = F.Unit
33
transType _ Unit = F.Unit
33
false
false
0
5
12
13
6
7
null
null
lueck/htcf
testsuite/Test/HTCF/ConfigParser.hs
gpl-3.0
test_getTcfIdBase = do results <- runConfigParser configFile assertEqual 16 (getTcfIdBase results)
110
test_getTcfIdBase = do results <- runConfigParser configFile assertEqual 16 (getTcfIdBase results)
110
test_getTcfIdBase = do results <- runConfigParser configFile assertEqual 16 (getTcfIdBase results)
110
false
false
0
9
22
30
13
17
null
null
examachine/bitdrill
src/haskell/Graph.hs
agpl-3.0
adjacent g v = map fst (g!v)
31
adjacent g v = map fst (g!v)
31
adjacent g v = map fst (g!v)
31
false
false
0
7
9
23
11
12
null
null
chrisbloecker/Hive
src/Hive/Master/Messaging.hs
gpl-3.0
requestLatestTicket :: Master -> Process Ticket requestLatestTicket (Master master) = do self <- getSelfPid send master (RequestLatestTicket self) ReplyLatestTicket ticket <- expect return ticket
203
requestLatestTicket :: Master -> Process Ticket requestLatestTicket (Master master) = do self <- getSelfPid send master (RequestLatestTicket self) ReplyLatestTicket ticket <- expect return ticket
203
requestLatestTicket (Master master) = do self <- getSelfPid send master (RequestLatestTicket self) ReplyLatestTicket ticket <- expect return ticket
155
false
true
0
9
31
68
29
39
null
null
jepst/Cielhs
Ciel.hs
bsd-3-clause
-- tailSpawn (map showJSON refs) >> cmdExit False tailSpawn :: [JSValue] -> Ciel () tailSpawn deps = do state <- liftIO archiveState ts <- getCielState cmdSpawn True False deps [JSString $ toJSString "___",fromJust $ csClosure ts, JSString $ toJSString $ fromJust $ csWFName ts] (Just state) (fromJust $ csWFName ts) return ()
381
tailSpawn :: [JSValue] -> Ciel () tailSpawn deps = do state <- liftIO archiveState ts <- getCielState cmdSpawn True False deps [JSString $ toJSString "___",fromJust $ csClosure ts, JSString $ toJSString $ fromJust $ csWFName ts] (Just state) (fromJust $ csWFName ts) return ()
330
tailSpawn deps = do state <- liftIO archiveState ts <- getCielState cmdSpawn True False deps [JSString $ toJSString "___",fromJust $ csClosure ts, JSString $ toJSString $ fromJust $ csWFName ts] (Just state) (fromJust $ csWFName ts) return ()
296
true
true
0
11
106
122
58
64
null
null
ghc-android/ghc
testsuite/tests/ghci/should_run/ghcirun004.hs
bsd-3-clause
1359 = 1358
11
1359 = 1358
11
1359 = 1358
11
false
false
1
5
2
10
3
7
null
null
deciduously/Haskell-First-Principles-Exercises
3-Getting serious/12-Signaling Adversity/code/myMaybe.hs
mit
catMaybes :: [Maybe a] -> [a] catMaybes = concat . map maybeToList
66
catMaybes :: [Maybe a] -> [a] catMaybes = concat . map maybeToList
66
catMaybes = concat . map maybeToList
36
false
true
0
7
11
31
16
15
null
null
ardumont/haskell-lab
src/io/capslock.hs
gpl-2.0
-- interact :: (String -> String) -> IO () main :: IO () main = interact $ map toUpper
87
main :: IO () main = interact $ map toUpper
43
main = interact $ map toUpper
29
true
true
1
6
19
27
12
15
null
null
vektordev/GP
src/GRPPool.hs
gpl-2.0
poolSummary :: Pool -> IO () poolSummary p = do let genP = flatten $ genomes p putStrLn "pool Summary:" putStrLn $ drawTree $ fmap show $ genomes p putStrLn "-+-+-+-+-+-+-+-+-+-+-+-+-+-" print $ filter (\i -> case i of ActiveI id (Compilation, f) p -> True; InactiveI id (Compilation, f) p -> True; _ -> False) genP --(\i -> case i of JunkI _ -> False; InactiveI _ _ -> False; ActiveI Compilatio p -> ) genP putStrLn "---\n" --TODO: timestamp each iteration start.
490
poolSummary :: Pool -> IO () poolSummary p = do let genP = flatten $ genomes p putStrLn "pool Summary:" putStrLn $ drawTree $ fmap show $ genomes p putStrLn "-+-+-+-+-+-+-+-+-+-+-+-+-+-" print $ filter (\i -> case i of ActiveI id (Compilation, f) p -> True; InactiveI id (Compilation, f) p -> True; _ -> False) genP --(\i -> case i of JunkI _ -> False; InactiveI _ _ -> False; ActiveI Compilatio p -> ) genP putStrLn "---\n" --TODO: timestamp each iteration start.
490
poolSummary p = do let genP = flatten $ genomes p putStrLn "pool Summary:" putStrLn $ drawTree $ fmap show $ genomes p putStrLn "-+-+-+-+-+-+-+-+-+-+-+-+-+-" print $ filter (\i -> case i of ActiveI id (Compilation, f) p -> True; InactiveI id (Compilation, f) p -> True; _ -> False) genP --(\i -> case i of JunkI _ -> False; InactiveI _ _ -> False; ActiveI Compilatio p -> ) genP putStrLn "---\n" --TODO: timestamp each iteration start.
461
false
true
0
16
109
155
73
82
null
null
lukexi/rumpus
src/Rumpus/Systems/KeyPads.hs
bsd-3-clause
showKey _ HandKeyBlank = ""
44
showKey _ HandKeyBlank = ""
44
showKey _ HandKeyBlank = ""
44
false
false
0
5
21
11
5
6
null
null
shayan-najd/MiniLava
Lava/Library/Arithmetic.hs
bsd-3-clause
numBreak :: Signal Int -> (Signal Bool, Signal Int) numBreak num = (bit, num') where digit = imod num 2 bit = int2bit digit num' = idiv num 2
158
numBreak :: Signal Int -> (Signal Bool, Signal Int) numBreak num = (bit, num') where digit = imod num 2 bit = int2bit digit num' = idiv num 2
158
numBreak num = (bit, num') where digit = imod num 2 bit = int2bit digit num' = idiv num 2
106
false
true
0
7
45
70
35
35
null
null
dylanmc/Haskell-PDF-Parsing-Library
Main.hs
bsd-3-clause
buildAndWriteFile :: String -> Int -> IO () buildAndWriteFile outName numPages = do let firstDoc = (buildDoc numPages) let flattened = flattenDocument (unDigestDocument firstDoc) outFile <- openFile outName WriteMode _ <- printFlatTree outFile flattened hClose outFile return ()
313
buildAndWriteFile :: String -> Int -> IO () buildAndWriteFile outName numPages = do let firstDoc = (buildDoc numPages) let flattened = flattenDocument (unDigestDocument firstDoc) outFile <- openFile outName WriteMode _ <- printFlatTree outFile flattened hClose outFile return ()
312
buildAndWriteFile outName numPages = do let firstDoc = (buildDoc numPages) let flattened = flattenDocument (unDigestDocument firstDoc) outFile <- openFile outName WriteMode _ <- printFlatTree outFile flattened hClose outFile return ()
268
false
true
0
12
72
100
44
56
null
null
uduki/hsQt
Qtc/Enums/Gui/QPainter.hs
bsd-2-clause
eCompositionMode_ColorDodge :: CompositionMode eCompositionMode_ColorDodge = ieCompositionMode $ 18
101
eCompositionMode_ColorDodge :: CompositionMode eCompositionMode_ColorDodge = ieCompositionMode $ 18
101
eCompositionMode_ColorDodge = ieCompositionMode $ 18
54
false
true
0
6
9
18
8
10
null
null
erantapaa/haskell-pentago
genRotations.hs
mit
compareRow xs ys = zipWith go xs ys where go x y = if x == y then " . " else show y
87
compareRow xs ys = zipWith go xs ys where go x y = if x == y then " . " else show y
87
compareRow xs ys = zipWith go xs ys where go x y = if x == y then " . " else show y
87
false
false
0
6
27
45
22
23
null
null
JoeyEremondi/utrecht-apa-p1
src/Optimize/Reachability.hs
bsd-3-clause
--TODO, causes problems? defVars :: Canon.Def -> [Var.Canonical] defVars (Canon.Definition p _ _) = getPatternVars p
117
defVars :: Canon.Def -> [Var.Canonical] defVars (Canon.Definition p _ _) = getPatternVars p
91
defVars (Canon.Definition p _ _) = getPatternVars p
51
true
true
0
8
16
41
21
20
null
null
pparkkin/eta
compiler/ETA/DeSugar/DsUtils.hs
bsd-3-clause
mkBigLHsPatTup :: [LPat Id] -> LPat Id mkBigLHsPatTup = mkChunkified mkLHsPatTup
80
mkBigLHsPatTup :: [LPat Id] -> LPat Id mkBigLHsPatTup = mkChunkified mkLHsPatTup
80
mkBigLHsPatTup = mkChunkified mkLHsPatTup
41
false
true
0
8
10
33
14
19
null
null
andreasabel/helf
src/Stream.hs
mit
consF :: Monad m => a -> Front m a -> Front m a consF a tl = return $ Just (a, Stream tl)
89
consF :: Monad m => a -> Front m a -> Front m a consF a tl = return $ Just (a, Stream tl)
89
consF a tl = return $ Just (a, Stream tl)
41
false
true
2
9
23
62
28
34
null
null
da-x/Algorithm-W-Step-By-Step
src/Test.hs
gpl-3.0
foldrTest :: Val () foldrTest = lambda "nil" $ \nil -> lambda "cons" $ \cons -> lambda "list" $ \l -> ( P._case "[]" (lambda "_" (const nil)) $ P._case ":" (lambdaRecord ["head", "tail"] $ \ [head_, tail_] -> let rest = recurse $$ nil $$ cons $$ tail_ in cons $$: [("head", head_), ("rest", rest)]) $ P.absurd ) $$ P.fromNom (fst listTypePair) l
434
foldrTest :: Val () foldrTest = lambda "nil" $ \nil -> lambda "cons" $ \cons -> lambda "list" $ \l -> ( P._case "[]" (lambda "_" (const nil)) $ P._case ":" (lambdaRecord ["head", "tail"] $ \ [head_, tail_] -> let rest = recurse $$ nil $$ cons $$ tail_ in cons $$: [("head", head_), ("rest", rest)]) $ P.absurd ) $$ P.fromNom (fst listTypePair) l
434
foldrTest = lambda "nil" $ \nil -> lambda "cons" $ \cons -> lambda "list" $ \l -> ( P._case "[]" (lambda "_" (const nil)) $ P._case ":" (lambdaRecord ["head", "tail"] $ \ [head_, tail_] -> let rest = recurse $$ nil $$ cons $$ tail_ in cons $$: [("head", head_), ("rest", rest)]) $ P.absurd ) $$ P.fromNom (fst listTypePair) l
414
false
true
0
25
152
182
95
87
null
null
ambiata/mismi
mismi-ec2-core/src/Mismi/EC2/Core/Device.hs
bsd-3-clause
instanceStorage F1_2XLarge = NoStorage
38
instanceStorage F1_2XLarge = NoStorage
38
instanceStorage F1_2XLarge = NoStorage
38
false
false
0
5
3
9
4
5
null
null
mrd/camfort
src/Camfort/Specification/Units/Monad.hs
apache-2.0
modifyGivenVarSet :: (GivenVarSet -> GivenVarSet) -> UnitSolver () modifyGivenVarSet f = modify (\ s -> s { usGivenVarSet = f (usGivenVarSet s) })
146
modifyGivenVarSet :: (GivenVarSet -> GivenVarSet) -> UnitSolver () modifyGivenVarSet f = modify (\ s -> s { usGivenVarSet = f (usGivenVarSet s) })
146
modifyGivenVarSet f = modify (\ s -> s { usGivenVarSet = f (usGivenVarSet s) })
79
false
true
0
12
22
58
30
28
null
null
noteed/aeson-streams
Network/Aeson/Client.hs
bsd-3-clause
apiDelete :: FromJSON a => Maybe (B.ByteString, B.ByteString) -> B.ByteString -> B.ByteString -> [(B.ByteString, Maybe B.ByteString)] -> IO (Result a) apiDelete mbasic base uri parameters = withOpenSSL $ do let url = B.concat [uri, queryString parameters] q <- buildRequest $ do http DELETE url maybe (return ()) (uncurry setAuthorizationBasic) mbasic c <- establishConnection base -- debug q sendRequest c q emptyBody -- TODO assert 204 for upcloud r <- receiveResponse c $ \p' i -> do case getStatusCode p' of 204 -> return Ok _ -> do x <- Streams.read i let more = Streams.read i >>= return . fromMaybe "" p <- parseWith more json $ fromMaybe "" x case p of Done _ value -> do -- debug value case fromJSON value of Success value' -> do return $ Value value' _ -> return JsonFailure _ -> return ParseFailure closeConnection c return r
1,008
apiDelete :: FromJSON a => Maybe (B.ByteString, B.ByteString) -> B.ByteString -> B.ByteString -> [(B.ByteString, Maybe B.ByteString)] -> IO (Result a) apiDelete mbasic base uri parameters = withOpenSSL $ do let url = B.concat [uri, queryString parameters] q <- buildRequest $ do http DELETE url maybe (return ()) (uncurry setAuthorizationBasic) mbasic c <- establishConnection base -- debug q sendRequest c q emptyBody -- TODO assert 204 for upcloud r <- receiveResponse c $ \p' i -> do case getStatusCode p' of 204 -> return Ok _ -> do x <- Streams.read i let more = Streams.read i >>= return . fromMaybe "" p <- parseWith more json $ fromMaybe "" x case p of Done _ value -> do -- debug value case fromJSON value of Success value' -> do return $ Value value' _ -> return JsonFailure _ -> return ParseFailure closeConnection c return r
1,008
apiDelete mbasic base uri parameters = withOpenSSL $ do let url = B.concat [uri, queryString parameters] q <- buildRequest $ do http DELETE url maybe (return ()) (uncurry setAuthorizationBasic) mbasic c <- establishConnection base -- debug q sendRequest c q emptyBody -- TODO assert 204 for upcloud r <- receiveResponse c $ \p' i -> do case getStatusCode p' of 204 -> return Ok _ -> do x <- Streams.read i let more = Streams.read i >>= return . fromMaybe "" p <- parseWith more json $ fromMaybe "" x case p of Done _ value -> do -- debug value case fromJSON value of Success value' -> do return $ Value value' _ -> return JsonFailure _ -> return ParseFailure closeConnection c return r
849
false
true
0
29
316
360
164
196
null
null
yiannist/ganeti
src/Ganeti/OpParams.hs
bsd-2-clause
pJQueueNotifyExec :: Field pJQueueNotifyExec = withDoc "'OpTestJQueue' notify_exec" $ defaultFalse "notify_exec"
116
pJQueueNotifyExec :: Field pJQueueNotifyExec = withDoc "'OpTestJQueue' notify_exec" $ defaultFalse "notify_exec"
116
pJQueueNotifyExec = withDoc "'OpTestJQueue' notify_exec" $ defaultFalse "notify_exec"
89
false
true
0
6
14
21
10
11
null
null
Oscarzhao/haskell
functional_program_design/ch05/sudoku_v1.hs
apache-2.0
sampleFinal = until (\(x,y) -> x==y) (\(x,y)->(y, simplifyGrid y)) (sample, simplifyGrid sample)
96
sampleFinal = until (\(x,y) -> x==y) (\(x,y)->(y, simplifyGrid y)) (sample, simplifyGrid sample)
96
sampleFinal = until (\(x,y) -> x==y) (\(x,y)->(y, simplifyGrid y)) (sample, simplifyGrid sample)
96
false
false
1
9
11
68
36
32
null
null
dmcclean/dimensional-dk-linalg
src/Numeric/LinearAlgebra/Dimensional/DK/QuasiQuotes.hs
bsd-3-clause
vec = QuasiQuoter { quoteExp = parseVectorExp, quotePat = error "vec", quoteDec = error "vec", quoteType = parseVectorType }
132
vec = QuasiQuoter { quoteExp = parseVectorExp, quotePat = error "vec", quoteDec = error "vec", quoteType = parseVectorType }
132
vec = QuasiQuoter { quoteExp = parseVectorExp, quotePat = error "vec", quoteDec = error "vec", quoteType = parseVectorType }
132
false
false
1
8
26
42
22
20
null
null
music-suite/music-preludes
examples/duo.hs
bsd-3-clause
toLydian :: Music -> Music toLydian = pitches' %~ (\p -> if p == c then cs else p)
82
toLydian :: Music -> Music toLydian = pitches' %~ (\p -> if p == c then cs else p)
82
toLydian = pitches' %~ (\p -> if p == c then cs else p)
55
false
true
0
9
18
39
22
17
null
null
bartavelle/manglingrules
Mangling.hs
gpl-3.0
showRule' _ (LowerCase ) = return "l"
63
showRule' _ (LowerCase ) = return "l"
63
showRule' _ (LowerCase ) = return "l"
63
false
false
1
5
32
19
8
11
null
null
spinda/liquidhaskell
src/Language/Haskell/Liquid/Desugar710/Check.hs
bsd-3-clause
tidy_pat (LazyPat p) = WildPat (hsLPatType p)
50
tidy_pat (LazyPat p) = WildPat (hsLPatType p)
50
tidy_pat (LazyPat p) = WildPat (hsLPatType p)
50
false
false
0
7
11
24
11
13
null
null
esengie/fpl-exploration-tool
src/langGenerator/Lang.hs
bsd-3-clause
swap1'2 x = pure x
18
swap1'2 x = pure x
18
swap1'2 x = pure x
18
false
false
0
5
4
12
5
7
null
null
elginer/snm
Manual/Reader.hs
gpl-3.0
-- | Try to read a string from yaml ystr :: Yaml -> Maybe String ystr y = case y of YStr s -> Just s _ -> Nothing -- | Try to map with yaml
160
ystr :: Yaml -> Maybe String ystr y = case y of YStr s -> Just s _ -> Nothing -- | Try to map with yaml
124
ystr y = case y of YStr s -> Just s _ -> Nothing -- | Try to map with yaml
95
true
true
0
8
56
50
23
27
null
null
haskell-opengl/OpenGLRaw
src/Graphics/GL/Functions/F20.hs
bsd-3-clause
ptr_glPopAttrib :: FunPtr (IO ()) ptr_glPopAttrib = unsafePerformIO $ getCommand "glPopAttrib"
94
ptr_glPopAttrib :: FunPtr (IO ()) ptr_glPopAttrib = unsafePerformIO $ getCommand "glPopAttrib"
94
ptr_glPopAttrib = unsafePerformIO $ getCommand "glPopAttrib"
60
false
true
0
8
10
29
14
15
null
null
daleooo/barrelfish
tools/flounder/CAbsSyntax.hs
mit
pp_unit (Define n [] v) = [ printf "#define %s %s" n v ]
57
pp_unit (Define n [] v) = [ printf "#define %s %s" n v ]
57
pp_unit (Define n [] v) = [ printf "#define %s %s" n v ]
57
false
false
0
8
14
31
15
16
null
null
tekul/cryptonite
Crypto/Cipher/AES/Primitive.hs
bsd-3-clause
-- | Create an AES AEAD implementation for OCB ocbMode :: AES -> AEADModeImpl AESOCB ocbMode aes = AEADModeImpl { aeadImplAppendHeader = ocbAppendAAD aes , aeadImplEncrypt = ocbAppendEncrypt aes , aeadImplDecrypt = ocbAppendDecrypt aes , aeadImplFinalize = ocbFinish aes }
306
ocbMode :: AES -> AEADModeImpl AESOCB ocbMode aes = AEADModeImpl { aeadImplAppendHeader = ocbAppendAAD aes , aeadImplEncrypt = ocbAppendEncrypt aes , aeadImplDecrypt = ocbAppendDecrypt aes , aeadImplFinalize = ocbFinish aes }
259
ocbMode aes = AEADModeImpl { aeadImplAppendHeader = ocbAppendAAD aes , aeadImplEncrypt = ocbAppendEncrypt aes , aeadImplDecrypt = ocbAppendDecrypt aes , aeadImplFinalize = ocbFinish aes }
221
true
true
0
8
73
68
34
34
null
null
norm2782/uuagc
tools/Haskell2Ag.hs
bsd-3-clause
showCons :: QualConDecl -> IO () showCons (QualConDecl _ _ _ (ConDecl (Ident name) children)) = do putStrLn $ " | " ++ name mapM_ showChild $ zip [Ident $ "ch" ++ show n | n <- [1..]] children
197
showCons :: QualConDecl -> IO () showCons (QualConDecl _ _ _ (ConDecl (Ident name) children)) = do putStrLn $ " | " ++ name mapM_ showChild $ zip [Ident $ "ch" ++ show n | n <- [1..]] children
197
showCons (QualConDecl _ _ _ (ConDecl (Ident name) children)) = do putStrLn $ " | " ++ name mapM_ showChild $ zip [Ident $ "ch" ++ show n | n <- [1..]] children
164
false
true
0
13
43
105
49
56
null
null
sdiehl/ghc
libraries/base/Foreign/C/Error.hs
bsd-3-clause
eTOOMANYREFS = Errno (CONST_ETOOMANYREFS)
44
eTOOMANYREFS = Errno (CONST_ETOOMANYREFS)
44
eTOOMANYREFS = Errno (CONST_ETOOMANYREFS)
44
false
false
1
5
6
15
6
9
null
null
splondike/samesame
samesame.hs
gpl-2.0
printResults results = if allResultsSame then success else fail where allResultsSame = all ((firstResult==) . snd) results success = putStrLn "OK" >> putStrLn (snd (head results)) >> return True fail = putStrLn "FAIL" >> putStrLn allResultsStr >> return False firstResult = snd (head results) allResultsStr = concat (map (\(n, r) -> n ++ ": " ++ r) results)
391
printResults results = if allResultsSame then success else fail where allResultsSame = all ((firstResult==) . snd) results success = putStrLn "OK" >> putStrLn (snd (head results)) >> return True fail = putStrLn "FAIL" >> putStrLn allResultsStr >> return False firstResult = snd (head results) allResultsStr = concat (map (\(n, r) -> n ++ ": " ++ r) results)
391
printResults results = if allResultsSame then success else fail where allResultsSame = all ((firstResult==) . snd) results success = putStrLn "OK" >> putStrLn (snd (head results)) >> return True fail = putStrLn "FAIL" >> putStrLn allResultsStr >> return False firstResult = snd (head results) allResultsStr = concat (map (\(n, r) -> n ++ ": " ++ r) results)
391
false
false
6
11
91
167
76
91
null
null
ezyang/ghc
compiler/llvmGen/Llvm/PpLlvm.hs
bsd-3-clause
-------------------------------------------------------------------------------- -- * Top Level Print functions -------------------------------------------------------------------------------- -- | Print out a whole LLVM module. ppLlvmModule :: LlvmModule -> SDoc ppLlvmModule (LlvmModule comments aliases meta globals decls funcs) = ppLlvmComments comments $+$ newLine $+$ ppLlvmAliases aliases $+$ newLine $+$ ppLlvmMetas meta $+$ newLine $+$ ppLlvmGlobals globals $+$ newLine $+$ ppLlvmFunctionDecls decls $+$ newLine $+$ ppLlvmFunctions funcs
569
ppLlvmModule :: LlvmModule -> SDoc ppLlvmModule (LlvmModule comments aliases meta globals decls funcs) = ppLlvmComments comments $+$ newLine $+$ ppLlvmAliases aliases $+$ newLine $+$ ppLlvmMetas meta $+$ newLine $+$ ppLlvmGlobals globals $+$ newLine $+$ ppLlvmFunctionDecls decls $+$ newLine $+$ ppLlvmFunctions funcs
339
ppLlvmModule (LlvmModule comments aliases meta globals decls funcs) = ppLlvmComments comments $+$ newLine $+$ ppLlvmAliases aliases $+$ newLine $+$ ppLlvmMetas meta $+$ newLine $+$ ppLlvmGlobals globals $+$ newLine $+$ ppLlvmFunctionDecls decls $+$ newLine $+$ ppLlvmFunctions funcs
304
true
true
10
7
79
101
47
54
null
null
xenog/haskoin
test/bitcoin/Network/Haskoin/Crypto/ExtendedKeys/Tests.hs
unlicense
tests :: [Test] tests = [ testGroup "HDW Extended Keys" [ testProperty "prvSubKey(k,c)*G = pubSubKey(k*G,c)" $ forAll arbitraryXPrvKey pubKeyOfSubKeyIsSubKeyOfPubKey , testProperty "fromB58 . toB58 prvKey" $ forAll arbitraryXPrvKey $ \k -> xPrvImport (xPrvExport k) == Just k , testProperty "fromB58 . toB58 pubKey" $ forAll arbitraryXPubKey $ \(_, k) -> xPubImport (xPubExport k) == Just k ] , testGroup "From/To strings" [ testProperty "Read/Show extended public key" $ forAll arbitraryXPubKey $ \(_, k) -> fromString (show k) == k , testProperty "Read/Show extended private key" $ forAll arbitraryXPrvKey $ \k -> fromString (show k) == k , testProperty "From string extended public key" $ forAll arbitraryXPubKey $ \(_, k) -> fromString (cs $ xPubExport k) == k , testProperty "From string extended private key" $ forAll arbitraryXPrvKey $ \k -> fromString (cs $ xPrvExport k) == k , testProperty "Read/Show derivation path" $ forAll arbitraryDerivPath $ \p -> fromString (show p) == p , testProperty "Read/Show hard derivation path" $ forAll arbitraryHardPath $ \p -> fromString (show p) == p , testProperty "Read/Show soft derivation path" $ forAll arbitrarySoftPath $ \p -> fromString (show p) == p , testProperty "From string derivation path" $ forAll arbitraryDerivPath $ \p -> fromString (cs $ pathToStr p) == p , testProperty "From string hard derivation path" $ forAll arbitraryHardPath $ \p -> fromString (cs $ pathToStr p) == p , testProperty "From string soft derivation path" $ forAll arbitrarySoftPath $ \p -> fromString (cs $ pathToStr p) == p , testProperty "listToPath . pathToList == id" $ forAll arbitraryDerivPath $ \p -> listToPath (pathToList p) == p , testProperty "listToPath . pathToList == id (Hard)" $ forAll arbitraryHardPath $ \p -> toHard (listToPath $ pathToList p) == Just p , testProperty "listToPath . pathToList == id (Soft)" $ forAll arbitrarySoftPath $ \p -> toSoft (listToPath $ pathToList p) == Just p , testProperty "parsePath . show == id (ParsedPath)" $ forAll arbitraryParsedPath $ \p -> parsePath (show p) == Just p ] ]
2,491
tests :: [Test] tests = [ testGroup "HDW Extended Keys" [ testProperty "prvSubKey(k,c)*G = pubSubKey(k*G,c)" $ forAll arbitraryXPrvKey pubKeyOfSubKeyIsSubKeyOfPubKey , testProperty "fromB58 . toB58 prvKey" $ forAll arbitraryXPrvKey $ \k -> xPrvImport (xPrvExport k) == Just k , testProperty "fromB58 . toB58 pubKey" $ forAll arbitraryXPubKey $ \(_, k) -> xPubImport (xPubExport k) == Just k ] , testGroup "From/To strings" [ testProperty "Read/Show extended public key" $ forAll arbitraryXPubKey $ \(_, k) -> fromString (show k) == k , testProperty "Read/Show extended private key" $ forAll arbitraryXPrvKey $ \k -> fromString (show k) == k , testProperty "From string extended public key" $ forAll arbitraryXPubKey $ \(_, k) -> fromString (cs $ xPubExport k) == k , testProperty "From string extended private key" $ forAll arbitraryXPrvKey $ \k -> fromString (cs $ xPrvExport k) == k , testProperty "Read/Show derivation path" $ forAll arbitraryDerivPath $ \p -> fromString (show p) == p , testProperty "Read/Show hard derivation path" $ forAll arbitraryHardPath $ \p -> fromString (show p) == p , testProperty "Read/Show soft derivation path" $ forAll arbitrarySoftPath $ \p -> fromString (show p) == p , testProperty "From string derivation path" $ forAll arbitraryDerivPath $ \p -> fromString (cs $ pathToStr p) == p , testProperty "From string hard derivation path" $ forAll arbitraryHardPath $ \p -> fromString (cs $ pathToStr p) == p , testProperty "From string soft derivation path" $ forAll arbitrarySoftPath $ \p -> fromString (cs $ pathToStr p) == p , testProperty "listToPath . pathToList == id" $ forAll arbitraryDerivPath $ \p -> listToPath (pathToList p) == p , testProperty "listToPath . pathToList == id (Hard)" $ forAll arbitraryHardPath $ \p -> toHard (listToPath $ pathToList p) == Just p , testProperty "listToPath . pathToList == id (Soft)" $ forAll arbitrarySoftPath $ \p -> toSoft (listToPath $ pathToList p) == Just p , testProperty "parsePath . show == id (ParsedPath)" $ forAll arbitraryParsedPath $ \p -> parsePath (show p) == Just p ] ]
2,491
tests = [ testGroup "HDW Extended Keys" [ testProperty "prvSubKey(k,c)*G = pubSubKey(k*G,c)" $ forAll arbitraryXPrvKey pubKeyOfSubKeyIsSubKeyOfPubKey , testProperty "fromB58 . toB58 prvKey" $ forAll arbitraryXPrvKey $ \k -> xPrvImport (xPrvExport k) == Just k , testProperty "fromB58 . toB58 pubKey" $ forAll arbitraryXPubKey $ \(_, k) -> xPubImport (xPubExport k) == Just k ] , testGroup "From/To strings" [ testProperty "Read/Show extended public key" $ forAll arbitraryXPubKey $ \(_, k) -> fromString (show k) == k , testProperty "Read/Show extended private key" $ forAll arbitraryXPrvKey $ \k -> fromString (show k) == k , testProperty "From string extended public key" $ forAll arbitraryXPubKey $ \(_, k) -> fromString (cs $ xPubExport k) == k , testProperty "From string extended private key" $ forAll arbitraryXPrvKey $ \k -> fromString (cs $ xPrvExport k) == k , testProperty "Read/Show derivation path" $ forAll arbitraryDerivPath $ \p -> fromString (show p) == p , testProperty "Read/Show hard derivation path" $ forAll arbitraryHardPath $ \p -> fromString (show p) == p , testProperty "Read/Show soft derivation path" $ forAll arbitrarySoftPath $ \p -> fromString (show p) == p , testProperty "From string derivation path" $ forAll arbitraryDerivPath $ \p -> fromString (cs $ pathToStr p) == p , testProperty "From string hard derivation path" $ forAll arbitraryHardPath $ \p -> fromString (cs $ pathToStr p) == p , testProperty "From string soft derivation path" $ forAll arbitrarySoftPath $ \p -> fromString (cs $ pathToStr p) == p , testProperty "listToPath . pathToList == id" $ forAll arbitraryDerivPath $ \p -> listToPath (pathToList p) == p , testProperty "listToPath . pathToList == id (Hard)" $ forAll arbitraryHardPath $ \p -> toHard (listToPath $ pathToList p) == Just p , testProperty "listToPath . pathToList == id (Soft)" $ forAll arbitrarySoftPath $ \p -> toSoft (listToPath $ pathToList p) == Just p , testProperty "parsePath . show == id (ParsedPath)" $ forAll arbitraryParsedPath $ \p -> parsePath (show p) == Just p ] ]
2,475
false
true
0
14
755
666
326
340
null
null
conal/hermit
examples/map/Map.hs
bsd-2-clause
unwrap :: ([a] -> [b]) -> (List2 a -> List2 b) unwrap f = rep . f . abs
71
unwrap :: ([a] -> [b]) -> (List2 a -> List2 b) unwrap f = rep . f . abs
71
unwrap f = rep . f . abs
24
false
true
0
8
18
56
28
28
null
null
mightymoose/liquidhaskell
tests/neg/risers.hs
bsd-3-clause
{-@ LIQUID "--totality" @-} {-@ predicate NonNull X = ((len X) > 0) @-} {- risers :: (Ord a) => zs:[a] -> {v: [[a]] | ((NonNull zs) => (NonNull v)) } @-} risers [] = []
181
risers [] = []
24
risers [] = []
24
true
false
0
6
48
16
9
7
null
null