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
wouwouwou/module_8
src/main/haskell/series6/Tokenizer.hs
apache-2.0
resWords' (Vrbl, b, c) | elem b res = (Rswrd, b, c) | otherwise = (Vrbl, b, c) where res = ["if", "then", "repeat", "else", "assign"]
190
resWords' (Vrbl, b, c) | elem b res = (Rswrd, b, c) | otherwise = (Vrbl, b, c) where res = ["if", "then", "repeat", "else", "assign"]
190
resWords' (Vrbl, b, c) | elem b res = (Rswrd, b, c) | otherwise = (Vrbl, b, c) where res = ["if", "then", "repeat", "else", "assign"]
190
false
false
0
8
82
78
44
34
null
null
SWP-Ubau-SoSe2014-Haskell/SWPSoSe14
src/RailCompiler/FunctionDeclarations.hs
mit
-- |Function declaration for 'streq' streq :: Definition streq = GlobalDefinition $ Global.functionDefaults { Global.name = Name "streq", Global.returnType = bytePointerType, Global.parameters = ([], False) }
214
streq :: Definition streq = GlobalDefinition $ Global.functionDefaults { Global.name = Name "streq", Global.returnType = bytePointerType, Global.parameters = ([], False) }
177
streq = GlobalDefinition $ Global.functionDefaults { Global.name = Name "streq", Global.returnType = bytePointerType, Global.parameters = ([], False) }
157
true
true
0
10
31
62
33
29
null
null
traeger/fol-solver
Folsolver/Tableau.hs
gpl-3.0
proofSATTableau t forms | closed = let witTPTP = head $ filter ((==) $ fromJust witness) $ value t tillWit = takeWhile ((/=) $ fromJust witness) $ value t wName = let (AtomicWord x) = name witTPTP in drop 12 x cond = head $ filter (((==) (noDoubleNeg ((.~.) $ formula witTPTP))).formula) ((S.toList forms)++(value t)) term = wrapF (BinOp (formula cond) (:&:) (formula witTPTP)) contradict = AFormula (AtomicWord $ "contradict_"++wName) (Role "theorem") term (Annotations (GTerm (GApp (AtomicWord "plain") [GTerm (GWord (name cond)), GTerm (GWord $ name witTPTP)])) NoUsefulInfo) in mkNSATProof $ leaf $ tillWit ++ [witTPTP,contradict] | isSATProof proofLeft = proofLeft | isSATProof proofRight = proofRight | otherwise = mkNSATProof $ fromNSATProofT proofLeft <# value t #> fromNSATProofT proofRight where (closed, nForms, witness) = isClosedWithWitness (value t) forms proofLeft = proofSATTableau (left t) nForms proofRight = proofSATTableau (right t) nForms
1,164
proofSATTableau t forms | closed = let witTPTP = head $ filter ((==) $ fromJust witness) $ value t tillWit = takeWhile ((/=) $ fromJust witness) $ value t wName = let (AtomicWord x) = name witTPTP in drop 12 x cond = head $ filter (((==) (noDoubleNeg ((.~.) $ formula witTPTP))).formula) ((S.toList forms)++(value t)) term = wrapF (BinOp (formula cond) (:&:) (formula witTPTP)) contradict = AFormula (AtomicWord $ "contradict_"++wName) (Role "theorem") term (Annotations (GTerm (GApp (AtomicWord "plain") [GTerm (GWord (name cond)), GTerm (GWord $ name witTPTP)])) NoUsefulInfo) in mkNSATProof $ leaf $ tillWit ++ [witTPTP,contradict] | isSATProof proofLeft = proofLeft | isSATProof proofRight = proofRight | otherwise = mkNSATProof $ fromNSATProofT proofLeft <# value t #> fromNSATProofT proofRight where (closed, nForms, witness) = isClosedWithWitness (value t) forms proofLeft = proofSATTableau (left t) nForms proofRight = proofSATTableau (right t) nForms
1,164
proofSATTableau t forms | closed = let witTPTP = head $ filter ((==) $ fromJust witness) $ value t tillWit = takeWhile ((/=) $ fromJust witness) $ value t wName = let (AtomicWord x) = name witTPTP in drop 12 x cond = head $ filter (((==) (noDoubleNeg ((.~.) $ formula witTPTP))).formula) ((S.toList forms)++(value t)) term = wrapF (BinOp (formula cond) (:&:) (formula witTPTP)) contradict = AFormula (AtomicWord $ "contradict_"++wName) (Role "theorem") term (Annotations (GTerm (GApp (AtomicWord "plain") [GTerm (GWord (name cond)), GTerm (GWord $ name witTPTP)])) NoUsefulInfo) in mkNSATProof $ leaf $ tillWit ++ [witTPTP,contradict] | isSATProof proofLeft = proofLeft | isSATProof proofRight = proofRight | otherwise = mkNSATProof $ fromNSATProofT proofLeft <# value t #> fromNSATProofT proofRight where (closed, nForms, witness) = isClosedWithWitness (value t) forms proofLeft = proofSATTableau (left t) nForms proofRight = proofSATTableau (right t) nForms
1,164
false
false
4
22
344
453
221
232
null
null
kmate/HaRe
old/testing/unfoldAsPatterns/B7_TokOut.hs
bsd-3-clause
main :: IO () main = do (a, n@(T val Empty Empty)) <- buildtree [3, 1, 2] let val = 42 putStrLn $ (show n)
139
main :: IO () main = do (a, n@(T val Empty Empty)) <- buildtree [3, 1, 2] let val = 42 putStrLn $ (show n)
139
main = do (a, n@(T val Empty Empty)) <- buildtree [3, 1, 2] let val = 42 putStrLn $ (show n)
125
false
true
0
11
57
82
40
42
null
null
DougBurke/swish
tests/RDFProofTest.hs
lgpl-2.1
bwd43d :: RDFGraph bwd43d = mkGr2 [ "pers:Ro4 rel:son pers:Ro4 . \n" , "pers:Gr3 rel:daughter pers:Rh4 . \n" ]
142
bwd43d :: RDFGraph bwd43d = mkGr2 [ "pers:Ro4 rel:son pers:Ro4 . \n" , "pers:Gr3 rel:daughter pers:Rh4 . \n" ]
142
bwd43d = mkGr2 [ "pers:Ro4 rel:son pers:Ro4 . \n" , "pers:Gr3 rel:daughter pers:Rh4 . \n" ]
123
false
true
0
6
50
20
11
9
null
null
rueshyna/gogol
gen/src/Gen/AST/Flatten.hs
mpl-2.0
method :: Map Local (Param Global) -> Suffix -> Method (Fix Schema) -> AST (Method Global) method qs suf m@Method {..} = do ps <- Map.traverseWithKey (localParam (abbreviate _mId)) _mParameters cn <- use sCanonicalName let (_, typ', _) = mname cn suf _mId typ <- reserveType typ' b <- body typ let params = ps <> qs fields' = Map.delete "alt" $ b (Map.map _pParam params) void $ insert typ (SObj schemaInfo (Obj Nothing fields')) pure $! m { _mParameters = params } where schemaInfo = emptyInfo { _iDescription = _mDescription } bodyInfo = requiredInfo { _iDescription = Just "Multipart request metadata." } body p = case _mRequest of Nothing -> pure id Just x -> do let f = "payload" -- localise (ref x) g <- localSchema p f (Fix (SRef bodyInfo x)) pure (Map.insert f g)
909
method :: Map Local (Param Global) -> Suffix -> Method (Fix Schema) -> AST (Method Global) method qs suf m@Method {..} = do ps <- Map.traverseWithKey (localParam (abbreviate _mId)) _mParameters cn <- use sCanonicalName let (_, typ', _) = mname cn suf _mId typ <- reserveType typ' b <- body typ let params = ps <> qs fields' = Map.delete "alt" $ b (Map.map _pParam params) void $ insert typ (SObj schemaInfo (Obj Nothing fields')) pure $! m { _mParameters = params } where schemaInfo = emptyInfo { _iDescription = _mDescription } bodyInfo = requiredInfo { _iDescription = Just "Multipart request metadata." } body p = case _mRequest of Nothing -> pure id Just x -> do let f = "payload" -- localise (ref x) g <- localSchema p f (Fix (SRef bodyInfo x)) pure (Map.insert f g)
909
method qs suf m@Method {..} = do ps <- Map.traverseWithKey (localParam (abbreviate _mId)) _mParameters cn <- use sCanonicalName let (_, typ', _) = mname cn suf _mId typ <- reserveType typ' b <- body typ let params = ps <> qs fields' = Map.delete "alt" $ b (Map.map _pParam params) void $ insert typ (SObj schemaInfo (Obj Nothing fields')) pure $! m { _mParameters = params } where schemaInfo = emptyInfo { _iDescription = _mDescription } bodyInfo = requiredInfo { _iDescription = Just "Multipart request metadata." } body p = case _mRequest of Nothing -> pure id Just x -> do let f = "payload" -- localise (ref x) g <- localSchema p f (Fix (SRef bodyInfo x)) pure (Map.insert f g)
797
false
true
8
16
275
375
168
207
null
null
np/ling
Ling/Fmt/Albert/Layout.hs
bsd-3-clause
-- | Create a symbol token. sToken :: Position -> String -> Token sToken p s = PT p (TS s i) where i = case s of "!" -> 1 "(" -> 2 ")" -> 3 "**" -> 4 "," -> 5 "->" -> 6 "-o" -> 7 "." -> 8 ":" -> 9 ":]" -> 10 ";" -> 11 "<" -> 12 "<-" -> 13 "<=" -> 14 "=" -> 15 ">" -> 16 "?" -> 17 "@" -> 18 "Type" -> 19 "[" -> 20 "[:" -> 21 "\\" -> 22 "]" -> 23 "^" -> 24 "`" -> 25 "as" -> 26 "assert" -> 27 "case" -> 28 "data" -> 29 "end" -> 30 "fwd" -> 31 "in" -> 32 "let" -> 33 "new" -> 34 "new/" -> 35 "of" -> 36 "proc" -> 37 "recv" -> 38 "send" -> 39 "slice" -> 40 "{" -> 41 "|" -> 42 "}" -> 43 "~" -> 44 _ -> error $ "not a reserved word: " ++ show s -- | Get the position of a token.
950
sToken :: Position -> String -> Token sToken p s = PT p (TS s i) where i = case s of "!" -> 1 "(" -> 2 ")" -> 3 "**" -> 4 "," -> 5 "->" -> 6 "-o" -> 7 "." -> 8 ":" -> 9 ":]" -> 10 ";" -> 11 "<" -> 12 "<-" -> 13 "<=" -> 14 "=" -> 15 ">" -> 16 "?" -> 17 "@" -> 18 "Type" -> 19 "[" -> 20 "[:" -> 21 "\\" -> 22 "]" -> 23 "^" -> 24 "`" -> 25 "as" -> 26 "assert" -> 27 "case" -> 28 "data" -> 29 "end" -> 30 "fwd" -> 31 "in" -> 32 "let" -> 33 "new" -> 34 "new/" -> 35 "of" -> 36 "proc" -> 37 "recv" -> 38 "send" -> 39 "slice" -> 40 "{" -> 41 "|" -> 42 "}" -> 43 "~" -> 44 _ -> error $ "not a reserved word: " ++ show s -- | Get the position of a token.
922
sToken p s = PT p (TS s i) where i = case s of "!" -> 1 "(" -> 2 ")" -> 3 "**" -> 4 "," -> 5 "->" -> 6 "-o" -> 7 "." -> 8 ":" -> 9 ":]" -> 10 ";" -> 11 "<" -> 12 "<-" -> 13 "<=" -> 14 "=" -> 15 ">" -> 16 "?" -> 17 "@" -> 18 "Type" -> 19 "[" -> 20 "[:" -> 21 "\\" -> 22 "]" -> 23 "^" -> 24 "`" -> 25 "as" -> 26 "assert" -> 27 "case" -> 28 "data" -> 29 "end" -> 30 "fwd" -> 31 "in" -> 32 "let" -> 33 "new" -> 34 "new/" -> 35 "of" -> 36 "proc" -> 37 "recv" -> 38 "send" -> 39 "slice" -> 40 "{" -> 41 "|" -> 42 "}" -> 43 "~" -> 44 _ -> error $ "not a reserved word: " ++ show s -- | Get the position of a token.
884
true
true
0
9
456
332
166
166
null
null
erochest/todotxt
Gtd.hs
apache-2.0
gtdArgs :: GtdArgs gtdArgs = modes [ TodoTxt { n = def &= help "The number to begin indexing the items with." , pending = False &= help "Set all active items to pending." , archive = False &= help "Archive all completed items as they're read." } &= auto , Turtle { n = def &= help "The number to begin indexing the items with." , prefix = def &= help "The prefix for IRIs generated." , pending = False &= help "Set all active items to pending." , archive = False &= help "Archive all completed items as they're read." } , Raw { n = def &= help "The number to begin indexing the items with." , pending = False &= help "Set all active items to pending." , archive = False &= help "Archive all completed items as they're read." } ] &= program "gtd" &= summary "Parse a todotxt file into RDF turtle, Haskell data, etc."
1,126
gtdArgs :: GtdArgs gtdArgs = modes [ TodoTxt { n = def &= help "The number to begin indexing the items with." , pending = False &= help "Set all active items to pending." , archive = False &= help "Archive all completed items as they're read." } &= auto , Turtle { n = def &= help "The number to begin indexing the items with." , prefix = def &= help "The prefix for IRIs generated." , pending = False &= help "Set all active items to pending." , archive = False &= help "Archive all completed items as they're read." } , Raw { n = def &= help "The number to begin indexing the items with." , pending = False &= help "Set all active items to pending." , archive = False &= help "Archive all completed items as they're read." } ] &= program "gtd" &= summary "Parse a todotxt file into RDF turtle, Haskell data, etc."
1,126
gtdArgs = modes [ TodoTxt { n = def &= help "The number to begin indexing the items with." , pending = False &= help "Set all active items to pending." , archive = False &= help "Archive all completed items as they're read." } &= auto , Turtle { n = def &= help "The number to begin indexing the items with." , prefix = def &= help "The prefix for IRIs generated." , pending = False &= help "Set all active items to pending." , archive = False &= help "Archive all completed items as they're read." } , Raw { n = def &= help "The number to begin indexing the items with." , pending = False &= help "Set all active items to pending." , archive = False &= help "Archive all completed items as they're read." } ] &= program "gtd" &= summary "Parse a todotxt file into RDF turtle, Haskell data, etc."
1,107
false
true
0
13
471
177
94
83
null
null
juhp/stack
src/Stack/Ghci.hs
bsd-3-clause
-- | Figure out the main-is file to load based on the targets. Asks the -- user for input if there is more than one candidate main-is file. figureOutMainFile :: HasRunner env => BuildOpts -> Maybe (Map PackageName Target) -> [(PackageName, (Path Abs File, Target))] -> [GhciPkgInfo] -> RIO env (Maybe (Path Abs File)) figureOutMainFile bopts mainIsTargets targets0 packages = do case candidates of [] -> return Nothing [c@(_,_,fp)] -> do logInfo ("Using main module: " <> RIO.display (renderCandidate c)) return (Just fp) candidate:_ -> do borderedWarning $ do logWarn "The main module to load is ambiguous. Candidates are: " forM_ (map renderCandidate candidates) (logWarn . RIO.display) logWarn "You can specify which one to pick by: " logWarn (" * Specifying targets to stack ghci e.g. stack ghci " <> RIO.display ( sampleTargetArg candidate)) logWarn (" * Specifying what the main is e.g. stack ghci " <> RIO.display (sampleMainIsArg candidate)) logWarn (" * Choosing from the candidate above [1.." <> RIO.display (length candidates) <> "]") liftIO userOption where targets = fromMaybe (M.fromList $ map (\(k, (_, x)) -> (k, x)) targets0) mainIsTargets candidates = do pkg <- packages case M.lookup (ghciPkgName pkg) targets of Nothing -> [] Just target -> do (component,mains) <- M.toList $ M.filterWithKey (\k _ -> k `S.member` wantedComponents) (ghciPkgMainIs pkg) main <- mains return (ghciPkgName pkg, component, main) where wantedComponents = wantedPackageComponents bopts target (ghciPkgPackage pkg) renderCandidate c@(pkgName,namedComponent,mainIs) = let candidateIndex = T.pack . show . (+1) . fromMaybe 0 . elemIndex c pkgNameText = T.pack (packageNameString pkgName) in candidateIndex candidates <> ". Package `" <> pkgNameText <> "' component " <> -- This is the format that can be directly copy-pasted as -- an argument to `stack ghci`. pkgNameText <> ":" <> renderComp namedComponent <> " with main-is file: " <> T.pack (toFilePath mainIs) candidateIndices = take (length candidates) [1 :: Int ..] userOption = do option <- prompt "Specify main module to use (press enter to load none): " let selected = fromMaybe ((+1) $ length candidateIndices) (readMaybe (T.unpack option) :: Maybe Int) case elemIndex selected candidateIndices of Nothing -> do putStrLn "Not loading any main modules, as no valid module selected" putStrLn "" return Nothing Just op -> do let (_,_,fp) = candidates !! op putStrLn ("Loading main module from candidate " <> show (op + 1) <> ", --main-is " <> toFilePath fp) putStrLn "" return $ Just fp renderComp c = case c of CLib -> "lib" CInternalLib name -> "internal-lib:" <> name CExe name -> "exe:" <> name CTest name -> "test:" <> name CBench name -> "bench:" <> name sampleTargetArg (pkg,comp,_) = T.pack (packageNameString pkg) <> ":" <> renderComp comp sampleMainIsArg (pkg,comp,_) = "--main-is " <> T.pack (packageNameString pkg) <> ":" <> renderComp comp
3,875
figureOutMainFile :: HasRunner env => BuildOpts -> Maybe (Map PackageName Target) -> [(PackageName, (Path Abs File, Target))] -> [GhciPkgInfo] -> RIO env (Maybe (Path Abs File)) figureOutMainFile bopts mainIsTargets targets0 packages = do case candidates of [] -> return Nothing [c@(_,_,fp)] -> do logInfo ("Using main module: " <> RIO.display (renderCandidate c)) return (Just fp) candidate:_ -> do borderedWarning $ do logWarn "The main module to load is ambiguous. Candidates are: " forM_ (map renderCandidate candidates) (logWarn . RIO.display) logWarn "You can specify which one to pick by: " logWarn (" * Specifying targets to stack ghci e.g. stack ghci " <> RIO.display ( sampleTargetArg candidate)) logWarn (" * Specifying what the main is e.g. stack ghci " <> RIO.display (sampleMainIsArg candidate)) logWarn (" * Choosing from the candidate above [1.." <> RIO.display (length candidates) <> "]") liftIO userOption where targets = fromMaybe (M.fromList $ map (\(k, (_, x)) -> (k, x)) targets0) mainIsTargets candidates = do pkg <- packages case M.lookup (ghciPkgName pkg) targets of Nothing -> [] Just target -> do (component,mains) <- M.toList $ M.filterWithKey (\k _ -> k `S.member` wantedComponents) (ghciPkgMainIs pkg) main <- mains return (ghciPkgName pkg, component, main) where wantedComponents = wantedPackageComponents bopts target (ghciPkgPackage pkg) renderCandidate c@(pkgName,namedComponent,mainIs) = let candidateIndex = T.pack . show . (+1) . fromMaybe 0 . elemIndex c pkgNameText = T.pack (packageNameString pkgName) in candidateIndex candidates <> ". Package `" <> pkgNameText <> "' component " <> -- This is the format that can be directly copy-pasted as -- an argument to `stack ghci`. pkgNameText <> ":" <> renderComp namedComponent <> " with main-is file: " <> T.pack (toFilePath mainIs) candidateIndices = take (length candidates) [1 :: Int ..] userOption = do option <- prompt "Specify main module to use (press enter to load none): " let selected = fromMaybe ((+1) $ length candidateIndices) (readMaybe (T.unpack option) :: Maybe Int) case elemIndex selected candidateIndices of Nothing -> do putStrLn "Not loading any main modules, as no valid module selected" putStrLn "" return Nothing Just op -> do let (_,_,fp) = candidates !! op putStrLn ("Loading main module from candidate " <> show (op + 1) <> ", --main-is " <> toFilePath fp) putStrLn "" return $ Just fp renderComp c = case c of CLib -> "lib" CInternalLib name -> "internal-lib:" <> name CExe name -> "exe:" <> name CTest name -> "test:" <> name CBench name -> "bench:" <> name sampleTargetArg (pkg,comp,_) = T.pack (packageNameString pkg) <> ":" <> renderComp comp sampleMainIsArg (pkg,comp,_) = "--main-is " <> T.pack (packageNameString pkg) <> ":" <> renderComp comp
3,735
figureOutMainFile bopts mainIsTargets targets0 packages = do case candidates of [] -> return Nothing [c@(_,_,fp)] -> do logInfo ("Using main module: " <> RIO.display (renderCandidate c)) return (Just fp) candidate:_ -> do borderedWarning $ do logWarn "The main module to load is ambiguous. Candidates are: " forM_ (map renderCandidate candidates) (logWarn . RIO.display) logWarn "You can specify which one to pick by: " logWarn (" * Specifying targets to stack ghci e.g. stack ghci " <> RIO.display ( sampleTargetArg candidate)) logWarn (" * Specifying what the main is e.g. stack ghci " <> RIO.display (sampleMainIsArg candidate)) logWarn (" * Choosing from the candidate above [1.." <> RIO.display (length candidates) <> "]") liftIO userOption where targets = fromMaybe (M.fromList $ map (\(k, (_, x)) -> (k, x)) targets0) mainIsTargets candidates = do pkg <- packages case M.lookup (ghciPkgName pkg) targets of Nothing -> [] Just target -> do (component,mains) <- M.toList $ M.filterWithKey (\k _ -> k `S.member` wantedComponents) (ghciPkgMainIs pkg) main <- mains return (ghciPkgName pkg, component, main) where wantedComponents = wantedPackageComponents bopts target (ghciPkgPackage pkg) renderCandidate c@(pkgName,namedComponent,mainIs) = let candidateIndex = T.pack . show . (+1) . fromMaybe 0 . elemIndex c pkgNameText = T.pack (packageNameString pkgName) in candidateIndex candidates <> ". Package `" <> pkgNameText <> "' component " <> -- This is the format that can be directly copy-pasted as -- an argument to `stack ghci`. pkgNameText <> ":" <> renderComp namedComponent <> " with main-is file: " <> T.pack (toFilePath mainIs) candidateIndices = take (length candidates) [1 :: Int ..] userOption = do option <- prompt "Specify main module to use (press enter to load none): " let selected = fromMaybe ((+1) $ length candidateIndices) (readMaybe (T.unpack option) :: Maybe Int) case elemIndex selected candidateIndices of Nothing -> do putStrLn "Not loading any main modules, as no valid module selected" putStrLn "" return Nothing Just op -> do let (_,_,fp) = candidates !! op putStrLn ("Loading main module from candidate " <> show (op + 1) <> ", --main-is " <> toFilePath fp) putStrLn "" return $ Just fp renderComp c = case c of CLib -> "lib" CInternalLib name -> "internal-lib:" <> name CExe name -> "exe:" <> name CTest name -> "test:" <> name CBench name -> "bench:" <> name sampleTargetArg (pkg,comp,_) = T.pack (packageNameString pkg) <> ":" <> renderComp comp sampleMainIsArg (pkg,comp,_) = "--main-is " <> T.pack (packageNameString pkg) <> ":" <> renderComp comp
3,533
true
true
0
22
1,426
993
487
506
null
null
christiaanb/ghc
compiler/types/InstEnv.hs
bsd-3-clause
isOrphan _ = False
18
isOrphan _ = False
18
isOrphan _ = False
18
false
false
0
4
3
10
4
6
null
null
ulikoehler/ProjectEuler
Euler22.hs
apache-2.0
main = do names <- readFile "names.txt" let sortedNames = sort $ map fixName $ splitOn "," names let nameScores = map nameScore sortedNames print $ sum $ multiplyByIndex nameScores
196
main = do names <- readFile "names.txt" let sortedNames = sort $ map fixName $ splitOn "," names let nameScores = map nameScore sortedNames print $ sum $ multiplyByIndex nameScores
196
main = do names <- readFile "names.txt" let sortedNames = sort $ map fixName $ splitOn "," names let nameScores = map nameScore sortedNames print $ sum $ multiplyByIndex nameScores
196
false
false
2
10
45
58
28
30
null
null
bgamari/pandoc
src/Text/Pandoc/Readers/LaTeX.hs
gpl-2.0
addTableCaption :: Blocks -> LP Blocks addTableCaption = walkM go where go (Table c als ws hs rs) = do mbcapt <- stateCaption <$> getState case mbcapt of Just ils -> return (Table (toList ils) als ws hs rs) Nothing -> return (Table c als ws hs rs) go x = return x
324
addTableCaption :: Blocks -> LP Blocks addTableCaption = walkM go where go (Table c als ws hs rs) = do mbcapt <- stateCaption <$> getState case mbcapt of Just ils -> return (Table (toList ils) als ws hs rs) Nothing -> return (Table c als ws hs rs) go x = return x
324
addTableCaption = walkM go where go (Table c als ws hs rs) = do mbcapt <- stateCaption <$> getState case mbcapt of Just ils -> return (Table (toList ils) als ws hs rs) Nothing -> return (Table c als ws hs rs) go x = return x
285
false
true
1
14
113
140
62
78
null
null
bergmark/http2
Network/HTTP2/Types.hs
bsd-3-clause
toErrorCodeId 0x4 = SettingsTimeout
35
toErrorCodeId 0x4 = SettingsTimeout
35
toErrorCodeId 0x4 = SettingsTimeout
35
false
false
1
5
3
13
4
9
null
null
scott-fleischman/greek-grammar
haskell/greek-grammar/src/Text/Greek/Script/Abstract.hs
mit
toLetterCaseFinal Concrete.C_Ε = (L_ε, Uppercase, FinalNotSupported)
68
toLetterCaseFinal Concrete.C_Ε = (L_ε, Uppercase, FinalNotSupported)
68
toLetterCaseFinal Concrete.C_Ε = (L_ε, Uppercase, FinalNotSupported)
68
false
false
0
6
5
25
13
12
null
null
alexander-at-github/eta
compiler/ETA/SimplCore/SimplUtils.hs
bsd-3-clause
pushSimplifiedArgs env (arg : args) k = case arg of TyArg { as_arg_ty = arg_ty, as_hole_ty = hole_ty } -> ApplyToTy { sc_arg_ty = arg_ty, sc_hole_ty = hole_ty, sc_cont = rest } ValArg e -> ApplyToVal { sc_arg = e, sc_env = env, sc_dup = Simplified, sc_cont = rest } CastBy c -> CastIt c rest where rest = pushSimplifiedArgs env args k -- The env has an empty SubstEnv
421
pushSimplifiedArgs env (arg : args) k = case arg of TyArg { as_arg_ty = arg_ty, as_hole_ty = hole_ty } -> ApplyToTy { sc_arg_ty = arg_ty, sc_hole_ty = hole_ty, sc_cont = rest } ValArg e -> ApplyToVal { sc_arg = e, sc_env = env, sc_dup = Simplified, sc_cont = rest } CastBy c -> CastIt c rest where rest = pushSimplifiedArgs env args k -- The env has an empty SubstEnv
421
pushSimplifiedArgs env (arg : args) k = case arg of TyArg { as_arg_ty = arg_ty, as_hole_ty = hole_ty } -> ApplyToTy { sc_arg_ty = arg_ty, sc_hole_ty = hole_ty, sc_cont = rest } ValArg e -> ApplyToVal { sc_arg = e, sc_env = env, sc_dup = Simplified, sc_cont = rest } CastBy c -> CastIt c rest where rest = pushSimplifiedArgs env args k -- The env has an empty SubstEnv
421
false
false
2
10
123
140
72
68
null
null
fpco/cabal
cabal-install/Distribution/Client/Sandbox/PackageEnvironment.hs
bsd-3-clause
writePackageEnvironmentFile :: FilePath -> IncludeComments -> PackageEnvironment -> PackageEnvironment -> IO () writePackageEnvironmentFile path incComments comments pkgEnv = do let tmpPath = (path <.> "tmp") writeFile tmpPath $ explanation ++ pkgEnvStr ++ "\n" renameFile tmpPath path where pkgEnvStr = case incComments of IncludeComments -> showPackageEnvironmentWithComments (Just comments) pkgEnv NoComments -> showPackageEnvironment pkgEnv explanation = unlines ["-- This is a Cabal package environment file." ,"-- THIS FILE IS AUTO-GENERATED. DO NOT EDIT DIRECTLY." ,"-- Please create a 'cabal.config' file in the same directory" ,"-- if you want to change the default settings for this sandbox." ,"","" ] -- | Pretty-print the package environment.
911
writePackageEnvironmentFile :: FilePath -> IncludeComments -> PackageEnvironment -> PackageEnvironment -> IO () writePackageEnvironmentFile path incComments comments pkgEnv = do let tmpPath = (path <.> "tmp") writeFile tmpPath $ explanation ++ pkgEnvStr ++ "\n" renameFile tmpPath path where pkgEnvStr = case incComments of IncludeComments -> showPackageEnvironmentWithComments (Just comments) pkgEnv NoComments -> showPackageEnvironment pkgEnv explanation = unlines ["-- This is a Cabal package environment file." ,"-- THIS FILE IS AUTO-GENERATED. DO NOT EDIT DIRECTLY." ,"-- Please create a 'cabal.config' file in the same directory" ,"-- if you want to change the default settings for this sandbox." ,"","" ] -- | Pretty-print the package environment.
911
writePackageEnvironmentFile path incComments comments pkgEnv = do let tmpPath = (path <.> "tmp") writeFile tmpPath $ explanation ++ pkgEnvStr ++ "\n" renameFile tmpPath path where pkgEnvStr = case incComments of IncludeComments -> showPackageEnvironmentWithComments (Just comments) pkgEnv NoComments -> showPackageEnvironment pkgEnv explanation = unlines ["-- This is a Cabal package environment file." ,"-- THIS FILE IS AUTO-GENERATED. DO NOT EDIT DIRECTLY." ,"-- Please create a 'cabal.config' file in the same directory" ,"-- if you want to change the default settings for this sandbox." ,"","" ] -- | Pretty-print the package environment.
737
false
true
1
11
258
147
73
74
null
null
abakst/liquidhaskell
src/Language/Haskell/Liquid/Desugar710/Coverage.hs
bsd-3-clause
isGoodSrcSpan' (UnhelpfulSpan _) = False
40
isGoodSrcSpan' (UnhelpfulSpan _) = False
40
isGoodSrcSpan' (UnhelpfulSpan _) = False
40
false
false
0
7
4
15
7
8
null
null
dysinger/amazonka
amazonka-ec2/gen/Network/AWS/EC2/DescribeInstances.hs
mpl-2.0
-- | The token to use when requesting the next set of items. If there are no -- additional items to return, the string is empty. dirNextToken :: Lens' DescribeInstancesResponse (Maybe Text) dirNextToken = lens _dirNextToken (\s a -> s { _dirNextToken = a })
257
dirNextToken :: Lens' DescribeInstancesResponse (Maybe Text) dirNextToken = lens _dirNextToken (\s a -> s { _dirNextToken = a })
128
dirNextToken = lens _dirNextToken (\s a -> s { _dirNextToken = a })
67
true
true
1
9
44
52
26
26
null
null
brendanhay/gogol
gogol-compute/gen/Network/Google/Resource/Compute/HTTPSHealthChecks/Delete.hs
mpl-2.0
-- | Name of the HttpsHealthCheck resource to delete. hhcdHTTPSHealthCheck :: Lens' HTTPSHealthChecksDelete Text hhcdHTTPSHealthCheck = lens _hhcdHTTPSHealthCheck (\ s a -> s{_hhcdHTTPSHealthCheck = a})
210
hhcdHTTPSHealthCheck :: Lens' HTTPSHealthChecksDelete Text hhcdHTTPSHealthCheck = lens _hhcdHTTPSHealthCheck (\ s a -> s{_hhcdHTTPSHealthCheck = a})
156
hhcdHTTPSHealthCheck = lens _hhcdHTTPSHealthCheck (\ s a -> s{_hhcdHTTPSHealthCheck = a})
97
true
true
0
9
32
42
22
20
null
null
kayuri/HNC
Test/Utils.hs
lgpl-3.0
st testName expected actual = testName ~: expected ~=? actual
61
st testName expected actual = testName ~: expected ~=? actual
61
st testName expected actual = testName ~: expected ~=? actual
61
false
false
0
6
9
21
10
11
null
null
jameshsmith/HRL
Server/Abyss/Stats.hs
mit
defaultStats :: Stats defaultStats = Stats attr attr attr attr attr 0 10 Map.empty Map.empty 10 10 [(Roll 1 d6, Bashing)] where attr = (10, Top)
150
defaultStats :: Stats defaultStats = Stats attr attr attr attr attr 0 10 Map.empty Map.empty 10 10 [(Roll 1 d6, Bashing)] where attr = (10, Top)
150
defaultStats = Stats attr attr attr attr attr 0 10 Map.empty Map.empty 10 10 [(Roll 1 d6, Bashing)] where attr = (10, Top)
128
false
true
1
8
31
77
37
40
null
null
cosmo0920/Ahblog
tests/Helper/DB/SetupTeardown.hs
mit
withDeleteImageTable :: YesodExample App a -> YesodExample App a withDeleteImageTable = bracket_ setUpImageTable tearDownImageTable where setUpImageTable = deleteImageTable tearDownImageTable = deleteImageTable deleteImageTable = runDB $ P.deleteWhere ([] :: [P.Filter Image])
290
withDeleteImageTable :: YesodExample App a -> YesodExample App a withDeleteImageTable = bracket_ setUpImageTable tearDownImageTable where setUpImageTable = deleteImageTable tearDownImageTable = deleteImageTable deleteImageTable = runDB $ P.deleteWhere ([] :: [P.Filter Image])
290
withDeleteImageTable = bracket_ setUpImageTable tearDownImageTable where setUpImageTable = deleteImageTable tearDownImageTable = deleteImageTable deleteImageTable = runDB $ P.deleteWhere ([] :: [P.Filter Image])
225
false
true
0
10
43
73
37
36
null
null
GaloisInc/halvm-ghc
compiler/main/DynFlags.hs
bsd-3-clause
ghcUsagePath :: DynFlags -> FilePath ghcUsagePath dflags = sGhcUsagePath (settings dflags)
99
ghcUsagePath :: DynFlags -> FilePath ghcUsagePath dflags = sGhcUsagePath (settings dflags)
99
ghcUsagePath dflags = sGhcUsagePath (settings dflags)
53
false
true
0
7
19
27
13
14
null
null
erochest/life-cast
Life.hs
apache-2.0
onEvent :: Event -> LifeCast -> LifeCast onEvent (EventKey (SpecialKey KeySpace) Up _ _) lc = lc { running = not (running lc) }
131
onEvent :: Event -> LifeCast -> LifeCast onEvent (EventKey (SpecialKey KeySpace) Up _ _) lc = lc { running = not (running lc) }
131
onEvent (EventKey (SpecialKey KeySpace) Up _ _) lc = lc { running = not (running lc) }
90
false
true
0
12
27
68
32
36
null
null
zachsully/hakaru
haskell/Language/Hakaru/Simplify.hs
bsd-3-clause
simplify' :: forall abt a . (ABT Term (abt Term)) => TypedAST (abt Term) -> IO (TypedAST (abt Term)) simplify' = sendToMaple' defaultMapleOptions{command="Simplify"}
180
simplify' :: forall abt a . (ABT Term (abt Term)) => TypedAST (abt Term) -> IO (TypedAST (abt Term)) simplify' = sendToMaple' defaultMapleOptions{command="Simplify"}
180
simplify' = sendToMaple' defaultMapleOptions{command="Simplify"}
64
false
true
0
12
37
76
39
37
null
null
johangirod/statext
src/server/Api/Core.hs
mit
decodePlainText :: ByteString -> Either Error Text decodePlainText x = left (pack . show) (decodeUtf8' x)
105
decodePlainText :: ByteString -> Either Error Text decodePlainText x = left (pack . show) (decodeUtf8' x)
105
decodePlainText x = left (pack . show) (decodeUtf8' x)
54
false
true
0
7
15
41
20
21
null
null
serokell/log-warper
src/System/Wlog/IOLogger.hs
mit
setPrefix :: MonadIO m => Maybe FilePath -> m () setPrefix p = liftIO $ modifyMVar_ logInternalState $ \li -> pure $ li { liPrefix = p }
160
setPrefix :: MonadIO m => Maybe FilePath -> m () setPrefix p = liftIO $ modifyMVar_ logInternalState $ \li -> pure $ li { liPrefix = p }
160
setPrefix p = liftIO $ modifyMVar_ logInternalState $ \li -> pure $ li { liPrefix = p }
111
false
true
4
9
51
68
31
37
null
null
jtojnar/haste-compiler
libraries/ghc-7.10/ghc-prim/GHC/PrimopWrappers.hs
bsd-3-clause
prefetchByteArray2# :: ByteArray# -> Int# -> State# s -> State# s prefetchByteArray2# a1 a2 a3 = (GHC.Prim.prefetchByteArray2#) a1 a2 a3
136
prefetchByteArray2# :: ByteArray# -> Int# -> State# s -> State# s prefetchByteArray2# a1 a2 a3 = (GHC.Prim.prefetchByteArray2#) a1 a2 a3
136
prefetchByteArray2# a1 a2 a3 = (GHC.Prim.prefetchByteArray2#) a1 a2 a3
70
false
true
0
8
19
49
24
25
null
null
pxqr/intset
tests/Main.hs
bsd-3-clause
prop_interval :: Int -> Int -> Bool prop_interval a s = interval l r == fromList [l..r] where l = a r = l + min 10000 s
129
prop_interval :: Int -> Int -> Bool prop_interval a s = interval l r == fromList [l..r] where l = a r = l + min 10000 s
129
prop_interval a s = interval l r == fromList [l..r] where l = a r = l + min 10000 s
93
false
true
4
7
37
74
32
42
null
null
abakst/liquidhaskell
benchmarks/vector-0.10.0.1/Data/Vector/Primitive/Mutable.nocpp.hs
bsd-3-clause
drop = G.drop
13
drop = G.drop
13
drop = G.drop
13
false
false
0
5
2
8
4
4
null
null
haskell-opengl/OpenGLRaw
src/Graphics/GL/Functions/F16.hs
bsd-3-clause
-- glMap1f --------------------------------------------------------------------- -- | Manual page for <https://www.opengl.org/sdk/docs/man2/xhtml/glMap1.xml OpenGL 2.x>. glMap1f :: MonadIO m => GLenum -- ^ @target@ of type [MapTarget](Graphics-GL-Groups.html#MapTarget). -> GLfloat -- ^ @u1@ of type @CoordF@. -> GLfloat -- ^ @u2@ of type @CoordF@. -> GLint -- ^ @stride@. -> GLint -- ^ @order@ of type @CheckedInt32@. -> Ptr GLfloat -- ^ @points@ pointing to @COMPSIZE(target,stride,order)@ elements of type @CoordF@. -> m () glMap1f v1 v2 v3 v4 v5 v6 = liftIO $ dyn520 ptr_glMap1f v1 v2 v3 v4 v5 v6
617
glMap1f :: MonadIO m => GLenum -- ^ @target@ of type [MapTarget](Graphics-GL-Groups.html#MapTarget). -> GLfloat -- ^ @u1@ of type @CoordF@. -> GLfloat -- ^ @u2@ of type @CoordF@. -> GLint -- ^ @stride@. -> GLint -- ^ @order@ of type @CheckedInt32@. -> Ptr GLfloat -- ^ @points@ pointing to @COMPSIZE(target,stride,order)@ elements of type @CoordF@. -> m () glMap1f v1 v2 v3 v4 v5 v6 = liftIO $ dyn520 ptr_glMap1f v1 v2 v3 v4 v5 v6
446
glMap1f v1 v2 v3 v4 v5 v6 = liftIO $ dyn520 ptr_glMap1f v1 v2 v3 v4 v5 v6
73
true
true
0
14
102
94
48
46
null
null
bacchanalia/KitchenSink
KitchenSink/Qualified.hs
gpl-3.0
-- |'BL.foldl1' bl_foldl1 = BL.foldl1
37
bl_foldl1 = BL.foldl1
21
bl_foldl1 = BL.foldl1
21
true
false
0
5
4
9
5
4
null
null
abuiles/turbinado-blog
tmp/dependencies/hdbc-postgresql-1.1.4.1/testsrc/TestMisc.hs
bsd-3-clause
testfetchRowMap = setup $ \dbh -> do sth <- prepare dbh "SELECT * from hdbctest2 ORDER BY testid" execute sth [] fetchRowMap sth >>= (Just (Map.fromList $ head alrows) @=?) fetchRowMap sth >>= (Just (Map.fromList $ alrows !! 1) @=?) fetchRowMap sth >>= (Just (Map.fromList $ alrows !! 2) @=?) fetchRowMap sth >>= (Nothing @=?) finish sth
384
testfetchRowMap = setup $ \dbh -> do sth <- prepare dbh "SELECT * from hdbctest2 ORDER BY testid" execute sth [] fetchRowMap sth >>= (Just (Map.fromList $ head alrows) @=?) fetchRowMap sth >>= (Just (Map.fromList $ alrows !! 1) @=?) fetchRowMap sth >>= (Just (Map.fromList $ alrows !! 2) @=?) fetchRowMap sth >>= (Nothing @=?) finish sth
384
testfetchRowMap = setup $ \dbh -> do sth <- prepare dbh "SELECT * from hdbctest2 ORDER BY testid" execute sth [] fetchRowMap sth >>= (Just (Map.fromList $ head alrows) @=?) fetchRowMap sth >>= (Just (Map.fromList $ alrows !! 1) @=?) fetchRowMap sth >>= (Just (Map.fromList $ alrows !! 2) @=?) fetchRowMap sth >>= (Nothing @=?) finish sth
384
false
false
0
15
103
146
70
76
null
null
kdungs/coursework-functional-programming
11/listMonad.hs
mit
main = do print $ xsComp print $ xsComp' print $ xsComp'' print $ xsComp'''
91
main = do print $ xsComp print $ xsComp' print $ xsComp'' print $ xsComp'''
91
main = do print $ xsComp print $ xsComp' print $ xsComp'' print $ xsComp'''
91
false
false
0
7
30
34
15
19
null
null
tittoassini/flat
test/Spec.hs
bsd-3-clause
ser :: Flat a => a -> [Word8] ser = B.unpack . flat
51
ser :: Flat a => a -> [Word8] ser = B.unpack . flat
51
ser = B.unpack . flat
21
false
true
1
9
12
39
17
22
null
null
jozefg/hasquito
src/Language/Hasquito/Parser.hs
mit
parseFile :: FilePath -> IO (Either Error [Def]) parseFile path = mapL (ParseError . T.pack) . file <$> (TIO.readFile path) where mapL f (Left a) = Left (f a) mapL _ (Right b) = Right b
197
parseFile :: FilePath -> IO (Either Error [Def]) parseFile path = mapL (ParseError . T.pack) . file <$> (TIO.readFile path) where mapL f (Left a) = Left (f a) mapL _ (Right b) = Right b
197
parseFile path = mapL (ParseError . T.pack) . file <$> (TIO.readFile path) where mapL f (Left a) = Left (f a) mapL _ (Right b) = Right b
148
false
true
1
10
47
105
52
53
null
null
bruno-cadorette/Baeta-Compiler
app/Main.hs
gpl-3.0
handleArgs :: [Char] -> [(String, String)] -> IO () handleArgs "-o" = getResult getProgramOutput
96
handleArgs :: [Char] -> [(String, String)] -> IO () handleArgs "-o" = getResult getProgramOutput
96
handleArgs "-o" = getResult getProgramOutput
44
false
true
0
9
13
47
23
24
null
null
aaronc/Idris-dev
src/Idris/AbsSyntaxTree.hs
bsd-3-clause
mapPDeclFC f g (PTransform fc safe l r) = PTransform (f fc) safe (mapPTermFC f g l) (mapPTermFC f g r)
106
mapPDeclFC f g (PTransform fc safe l r) = PTransform (f fc) safe (mapPTermFC f g l) (mapPTermFC f g r)
106
mapPDeclFC f g (PTransform fc safe l r) = PTransform (f fc) safe (mapPTermFC f g l) (mapPTermFC f g r)
106
false
false
0
7
24
60
29
31
null
null
ezyang/ghc
compiler/codeGen/StgCmmClosure.hs
bsd-3-clause
closureSlowEntryLabel :: ClosureInfo -> CLabel closureSlowEntryLabel = toSlowEntryLbl . closureInfoLabel
104
closureSlowEntryLabel :: ClosureInfo -> CLabel closureSlowEntryLabel = toSlowEntryLbl . closureInfoLabel
104
closureSlowEntryLabel = toSlowEntryLbl . closureInfoLabel
57
false
true
0
5
9
19
10
9
null
null
candidtim/euler
src/Problem19.hs
bsd-3-clause
sep = 9
7
sep = 9
7
sep = 9
7
false
false
1
5
2
10
3
7
null
null
jystic/QuickSpec
qs1/TinyWMProperties.hs
bsd-3-clause
prop_push_local (x :: T) i = not (member i x) ==> hidden x == hidden (push i x) where hidden w = [ index n w | n <- [0 ..sz-1], n /= current w ] sz = M.size (stacks x) -- push is idempotent
202
prop_push_local (x :: T) i = not (member i x) ==> hidden x == hidden (push i x) where hidden w = [ index n w | n <- [0 ..sz-1], n /= current w ] sz = M.size (stacks x) -- push is idempotent
202
prop_push_local (x :: T) i = not (member i x) ==> hidden x == hidden (push i x) where hidden w = [ index n w | n <- [0 ..sz-1], n /= current w ] sz = M.size (stacks x) -- push is idempotent
202
false
false
3
9
57
126
57
69
null
null
msakai/icfpc2015
tools/highscores.hs
bsd-3-clause
main = do (dir:_) <- getArgs files <- getDirectoryContents dir let rs = map toResult $ filter (isSuffixOf ".json") files let fs = map (filename.maximum) $ groupBy hash $ sortBy hash' rs forM_ fs $ \f -> putStrLn (dir ++ "/" ++ f) where hash x y = key x == key y hash' x y = compare (key x) (key y)
321
main = do (dir:_) <- getArgs files <- getDirectoryContents dir let rs = map toResult $ filter (isSuffixOf ".json") files let fs = map (filename.maximum) $ groupBy hash $ sortBy hash' rs forM_ fs $ \f -> putStrLn (dir ++ "/" ++ f) where hash x y = key x == key y hash' x y = compare (key x) (key y)
321
main = do (dir:_) <- getArgs files <- getDirectoryContents dir let rs = map toResult $ filter (isSuffixOf ".json") files let fs = map (filename.maximum) $ groupBy hash $ sortBy hash' rs forM_ fs $ \f -> putStrLn (dir ++ "/" ++ f) where hash x y = key x == key y hash' x y = compare (key x) (key y)
321
false
false
1
14
85
167
78
89
null
null
eigengrau/hlint
data/Default.hs
bsd-3-clause
error = foldr1 min ==> minimum
32
error = foldr1 min ==> minimum
32
error = foldr1 min ==> minimum
32
false
false
1
6
7
17
6
11
null
null
halvorgb/AO2D
src/Engine/Graphics/Render/Depth.hs
gpl-3.0
renderDepth :: TransformationMatrix -> GLUtil.ShaderProgram -> [Object] -> IO () renderDepth viewProjMat prog objects = do currentProgram $= (Just $ GLUtil.program prog) mapM_ (renderObjectToDepth viewProjMat prog) objects checkError "renderDepth"
259
renderDepth :: TransformationMatrix -> GLUtil.ShaderProgram -> [Object] -> IO () renderDepth viewProjMat prog objects = do currentProgram $= (Just $ GLUtil.program prog) mapM_ (renderObjectToDepth viewProjMat prog) objects checkError "renderDepth"
259
renderDepth viewProjMat prog objects = do currentProgram $= (Just $ GLUtil.program prog) mapM_ (renderObjectToDepth viewProjMat prog) objects checkError "renderDepth"
178
false
true
0
12
40
87
39
48
null
null
Alex-Diez/haskell-tdd-kata
old-katas/test/LeapYearKata/Day9Spec.hs
bsd-3-clause
spec :: Spec spec = do it "is a leap year when divisible by 4" $ do isLeapYear 1996 `shouldBe` True it "is not a leap year when not divisible by 4" $ do isLeapYear 1995 `shouldBe` False it "is not a leap year when divisible by 100" $ do isLeapYear 1900 `shouldBe` False it "is a leap year when divisible by 400" $ do isLeapYear 2000 `shouldBe` True
435
spec :: Spec spec = do it "is a leap year when divisible by 4" $ do isLeapYear 1996 `shouldBe` True it "is not a leap year when not divisible by 4" $ do isLeapYear 1995 `shouldBe` False it "is not a leap year when divisible by 100" $ do isLeapYear 1900 `shouldBe` False it "is a leap year when divisible by 400" $ do isLeapYear 2000 `shouldBe` True
431
spec = do it "is a leap year when divisible by 4" $ do isLeapYear 1996 `shouldBe` True it "is not a leap year when not divisible by 4" $ do isLeapYear 1995 `shouldBe` False it "is not a leap year when divisible by 100" $ do isLeapYear 1900 `shouldBe` False it "is a leap year when divisible by 400" $ do isLeapYear 2000 `shouldBe` True
418
false
true
0
20
155
108
47
61
null
null
pierric/neural-network
Backend-blashs/Test/Utils.hs
bsd-3-clause
good_corr2 :: Int -> L.Matrix Float -> L.Matrix Float -> L.Matrix Float good_corr2 p k m | w > s = good_corr2 p m k | otherwise = corr2 k padded where (w,h) = L.size k (s,t) = L.size m padded = fromBlocks [[z,0,0] ,[0,m,0] ,[0,0,z]] z = konst 0 (p, p)
339
good_corr2 :: Int -> L.Matrix Float -> L.Matrix Float -> L.Matrix Float good_corr2 p k m | w > s = good_corr2 p m k | otherwise = corr2 k padded where (w,h) = L.size k (s,t) = L.size m padded = fromBlocks [[z,0,0] ,[0,m,0] ,[0,0,z]] z = konst 0 (p, p)
338
good_corr2 p k m | w > s = good_corr2 p m k | otherwise = corr2 k padded where (w,h) = L.size k (s,t) = L.size m padded = fromBlocks [[z,0,0] ,[0,m,0] ,[0,0,z]] z = konst 0 (p, p)
266
false
true
2
10
139
187
92
95
null
null
spechub/Hets
Comorphisms/HolLight2Isabelle.hs
gpl-2.0
mapNamedSen :: Named Sentence -> Named IsaSign.Sentence mapNamedSen n_sen = let sen = sentence n_sen trans = mapHolSen sen in n_sen {sentence = trans}
173
mapNamedSen :: Named Sentence -> Named IsaSign.Sentence mapNamedSen n_sen = let sen = sentence n_sen trans = mapHolSen sen in n_sen {sentence = trans}
173
mapNamedSen n_sen = let sen = sentence n_sen trans = mapHolSen sen in n_sen {sentence = trans}
117
false
true
0
9
46
63
29
34
null
null
ezyang/ghc
libraries/template-haskell/Language/Haskell/TH/PprLib.hs
bsd-3-clause
pprName :: Name -> Doc pprName = pprName' Alone
47
pprName :: Name -> Doc pprName = pprName' Alone
47
pprName = pprName' Alone
24
false
true
0
7
8
24
10
14
null
null
bkeckes/Haskell_Schiffeversenken
src/War.hs
bsd-3-clause
getSpezNum::Int->Int getSpezNum x = if (x `mod` 2) == 1 then x+getTime else x-getTime
132
getSpezNum::Int->Int getSpezNum x = if (x `mod` 2) == 1 then x+getTime else x-getTime
132
getSpezNum x = if (x `mod` 2) == 1 then x+getTime else x-getTime
111
false
true
0
8
60
47
26
21
null
null
palas/detparaminf
src/DetParamInf/AptaTree.hs
bsd-2-clause
getFirstSymb :: ParamSample -> Maybe ParamCall getFirstSymb ps | pt /= [] = Just h | nt /= [] = Just nh | otherwise = Nothing where pt = posTraces ps ((h:_):_) = pt nt = negTraces ps ((nh:_):_) = nt
230
getFirstSymb :: ParamSample -> Maybe ParamCall getFirstSymb ps | pt /= [] = Just h | nt /= [] = Just nh | otherwise = Nothing where pt = posTraces ps ((h:_):_) = pt nt = negTraces ps ((nh:_):_) = nt
230
getFirstSymb ps | pt /= [] = Just h | nt /= [] = Just nh | otherwise = Nothing where pt = posTraces ps ((h:_):_) = pt nt = negTraces ps ((nh:_):_) = nt
183
false
true
2
9
72
137
62
75
null
null
scott-fleischman/greek-grammar
haskell/greek-grammar/src/Text/Greek/Script/Abstract.hs
mit
letterToUnicode L_ν = Unicode.Letter 'ν'
40
letterToUnicode L_ν = Unicode.Letter 'ν'
40
letterToUnicode L_ν = Unicode.Letter 'ν'
40
false
false
0
6
4
16
7
9
null
null
phischu/fragnix
builtins/base/GHC.Desugar.hs
bsd-3-clause
(>>>) :: forall arr. Arrow arr => forall a b c. arr a b -> arr b c -> arr a c -- NB: the type of this function is the "shape" that GHC expects -- in tcInstClassOp. So don't put all the foralls at the front! -- Yes, this is a bit grotesque, but heck it works and the whole -- arrows stuff needs reworking anyway! f >>> g = g . f
342
(>>>) :: forall arr. Arrow arr => forall a b c. arr a b -> arr b c -> arr a c f >>> g = g . f
93
f >>> g = g . f
15
true
true
1
12
88
74
38
36
null
null
Adirelle/hmenu
src/XDG/DesktopEntry/Parser.hs
bsd-3-clause
parseValue "StartupNotify" = booleanValue
43
parseValue "StartupNotify" = booleanValue
43
parseValue "StartupNotify" = booleanValue
43
false
false
0
5
5
9
4
5
null
null
puffnfresh/lastresort
Main.hs
mit
substitutePatternPart :: Unifiers -> PatternPart -> Maybe [String] substitutePatternPart _ (Tag a) = Just [a]
109
substitutePatternPart :: Unifiers -> PatternPart -> Maybe [String] substitutePatternPart _ (Tag a) = Just [a]
109
substitutePatternPart _ (Tag a) = Just [a]
42
false
true
0
8
14
42
21
21
null
null
brendanhay/gogol
gogol-storage/gen/Network/Google/Resource/Storage/Objects/SetIAMPolicy.hs
mpl-2.0
-- | Creates a value of 'ObjectsSetIAMPolicy' with the minimum fields required to make a request. -- -- Use one of the following lenses to modify other fields as desired: -- -- * 'osipBucket' -- -- * 'osipPayload' -- -- * 'osipUserProject' -- -- * 'osipObject' -- -- * 'osipProvisionalUserProject' -- -- * 'osipGeneration' objectsSetIAMPolicy :: Text -- ^ 'osipBucket' -> Policy -- ^ 'osipPayload' -> Text -- ^ 'osipObject' -> ObjectsSetIAMPolicy objectsSetIAMPolicy pOsipBucket_ pOsipPayload_ pOsipObject_ = ObjectsSetIAMPolicy' { _osipBucket = pOsipBucket_ , _osipPayload = pOsipPayload_ , _osipUserProject = Nothing , _osipObject = pOsipObject_ , _osipProvisionalUserProject = Nothing , _osipGeneration = Nothing }
763
objectsSetIAMPolicy :: Text -- ^ 'osipBucket' -> Policy -- ^ 'osipPayload' -> Text -- ^ 'osipObject' -> ObjectsSetIAMPolicy objectsSetIAMPolicy pOsipBucket_ pOsipPayload_ pOsipObject_ = ObjectsSetIAMPolicy' { _osipBucket = pOsipBucket_ , _osipPayload = pOsipPayload_ , _osipUserProject = Nothing , _osipObject = pOsipObject_ , _osipProvisionalUserProject = Nothing , _osipGeneration = Nothing }
440
objectsSetIAMPolicy pOsipBucket_ pOsipPayload_ pOsipObject_ = ObjectsSetIAMPolicy' { _osipBucket = pOsipBucket_ , _osipPayload = pOsipPayload_ , _osipUserProject = Nothing , _osipObject = pOsipObject_ , _osipProvisionalUserProject = Nothing , _osipGeneration = Nothing }
300
true
true
0
9
148
95
60
35
null
null
nilthehuman/H-99
Lists.hs
unlicense
removeAt' xs k = let (front, back) = split xs (pred k) in (head back, front ++ tail back)
89
removeAt' xs k = let (front, back) = split xs (pred k) in (head back, front ++ tail back)
89
removeAt' xs k = let (front, back) = split xs (pred k) in (head back, front ++ tail back)
89
false
false
0
11
18
56
27
29
null
null
shepheb/go10c
Compiler.hs
bsd-3-clause
-- returns the registers to be saved before making a function call. -- saves A, B, and C, unless they are unused or the ultimate target for the return value. regsToSave :: String -> Compiler [String] regsToSave r = do free <- gets freeRegs -- so we need to save: all registers A, B, C that are in use, since the function may clobber them, but we shouldn't save one that is the target register for the return return $ filter (not . (`elem` (r:free))) ["A", "B", "C"] -- given the register target for this expression, returns code to save the necessary subset of A, B and C before a call, and restore them afterward
626
regsToSave :: String -> Compiler [String] regsToSave r = do free <- gets freeRegs -- so we need to save: all registers A, B, C that are in use, since the function may clobber them, but we shouldn't save one that is the target register for the return return $ filter (not . (`elem` (r:free))) ["A", "B", "C"] -- given the register target for this expression, returns code to save the necessary subset of A, B and C before a call, and restore them afterward
468
regsToSave r = do free <- gets freeRegs -- so we need to save: all registers A, B, C that are in use, since the function may clobber them, but we shouldn't save one that is the target register for the return return $ filter (not . (`elem` (r:free))) ["A", "B", "C"] -- given the register target for this expression, returns code to save the necessary subset of A, B and C before a call, and restore them afterward
426
true
true
0
13
127
79
44
35
null
null
modeswitch/barrelfish
hake/Main.hs
mit
hakeModule :: [String] -> [(String,String)] -> String hakeModule allfiles hakefiles = let unqual_imports = ["RuleDefs", "HakeTypes", "Path", "Args"] qual_imports = ["Config"] relfiles = [ stripSrcDir f | f <- allfiles ] wrap1 n c = wrapLet "build a" ("(buildFunction a) allfiles " ++ (show n) ++ " a") c wrap n c = "(" ++ (show n) ++ ", " ++ wrapLet "find fn arg" ("(fn allfiles " ++ (show n) ++ " arg)") ("Rules (" ++ (wrap1 n c) ++ ")") ++ ")" flatten :: [String] -> String flatten s = foldl (++) "" (intersperse ",\n" s) addHeader (fn,fc) = (fn, "{-# LINE 1 \"" ++ fn ++ "\" #-}\n" ++ fc) files = flatten [ wrap (stripSrcDir fn) fc | (fn,fc) <- map addHeader hakefiles ] in unlines ( [ "module Hakefiles where {" ] ++ [ "import " ++ i ++ ";" | i <- unqual_imports ] ++ [ "import qualified " ++ i ++ ";" | i <- qual_imports ] ++ [ "allfiles = " ++ (show relfiles) ++ ";" ] ++ [ "hf = [" ] ) ++ files ++ "];\n}"
1,270
hakeModule :: [String] -> [(String,String)] -> String hakeModule allfiles hakefiles = let unqual_imports = ["RuleDefs", "HakeTypes", "Path", "Args"] qual_imports = ["Config"] relfiles = [ stripSrcDir f | f <- allfiles ] wrap1 n c = wrapLet "build a" ("(buildFunction a) allfiles " ++ (show n) ++ " a") c wrap n c = "(" ++ (show n) ++ ", " ++ wrapLet "find fn arg" ("(fn allfiles " ++ (show n) ++ " arg)") ("Rules (" ++ (wrap1 n c) ++ ")") ++ ")" flatten :: [String] -> String flatten s = foldl (++) "" (intersperse ",\n" s) addHeader (fn,fc) = (fn, "{-# LINE 1 \"" ++ fn ++ "\" #-}\n" ++ fc) files = flatten [ wrap (stripSrcDir fn) fc | (fn,fc) <- map addHeader hakefiles ] in unlines ( [ "module Hakefiles where {" ] ++ [ "import " ++ i ++ ";" | i <- unqual_imports ] ++ [ "import qualified " ++ i ++ ";" | i <- qual_imports ] ++ [ "allfiles = " ++ (show relfiles) ++ ";" ] ++ [ "hf = [" ] ) ++ files ++ "];\n}"
1,270
hakeModule allfiles hakefiles = let unqual_imports = ["RuleDefs", "HakeTypes", "Path", "Args"] qual_imports = ["Config"] relfiles = [ stripSrcDir f | f <- allfiles ] wrap1 n c = wrapLet "build a" ("(buildFunction a) allfiles " ++ (show n) ++ " a") c wrap n c = "(" ++ (show n) ++ ", " ++ wrapLet "find fn arg" ("(fn allfiles " ++ (show n) ++ " arg)") ("Rules (" ++ (wrap1 n c) ++ ")") ++ ")" flatten :: [String] -> String flatten s = foldl (++) "" (intersperse ",\n" s) addHeader (fn,fc) = (fn, "{-# LINE 1 \"" ++ fn ++ "\" #-}\n" ++ fc) files = flatten [ wrap (stripSrcDir fn) fc | (fn,fc) <- map addHeader hakefiles ] in unlines ( [ "module Hakefiles where {" ] ++ [ "import " ++ i ++ ";" | i <- unqual_imports ] ++ [ "import qualified " ++ i ++ ";" | i <- qual_imports ] ++ [ "allfiles = " ++ (show relfiles) ++ ";" ] ++ [ "hf = [" ] ) ++ files ++ "];\n}"
1,216
false
true
0
17
543
396
210
186
null
null
5outh/LambdaPi
src/STLC.hs
mit
-- ^ Propagate type checking to upEval, since value is inferable. downEval (Lam e) d = VLam $ \x -> downEval e (x : d)
118
downEval (Lam e) d = VLam $ \x -> downEval e (x : d)
52
downEval (Lam e) d = VLam $ \x -> downEval e (x : d)
52
true
false
0
9
24
39
20
19
null
null
tomlokhorst/FunVM
src/FunVM/JsCompiler.hs
bsd-3-clause
compile :: Module -> [Js] compile (Module _ _ bgs) = map cvalbind $ concat bgs
78
compile :: Module -> [Js] compile (Module _ _ bgs) = map cvalbind $ concat bgs
78
compile (Module _ _ bgs) = map cvalbind $ concat bgs
52
false
true
0
7
15
41
20
21
null
null
omefire/lens
src/Control/Lens/Plated.hs
bsd-3-clause
------------------------------------------------------------------------------- -- Holes and Contexts ------------------------------------------------------------------------------- -- | Return a list of all of the editable contexts for every location in the structure, recursively. -- -- @ -- propUniverse x = 'universe' x '==' 'map' 'Control.Comonad.Store.Class.pos' ('contexts' x) -- propId x = 'all' ('==' x) ['Control.Lens.Internal.Context.extract' w | w <- 'contexts' x] -- @ -- -- @ -- 'contexts' ≡ 'contextsOf' 'plate' -- @ contexts :: Plated a => a -> [Context a a a] contexts = contextsOf plate
605
contexts :: Plated a => a -> [Context a a a] contexts = contextsOf plate
72
contexts = contextsOf plate
27
true
true
0
8
79
48
30
18
null
null
pgj/bead
src/Bead/View/DictionaryLoader.hs
bsd-3-clause
loadDictionary :: FilePath -> IO (Maybe (FilePath, DictionaryFile)) loadDictionary path = do runGhc (Just libdir) $ do dflags0 <- getSessionDynFlags let dflags1 = dflags0 { hscTarget = HscInterpreted , log_action = defaultLogAction , flushOut = FlushOut $ return () , flushErr = FlushErr $ return () , importPaths = importPaths dflags0 ++ [takeDirectory path] } _ <- setSessionDynFlags dflags1 (dflags2,_) <- liftIO $ initPackages dflags1 liftIO $ unload dflags2 [] t <- guessTarget path Nothing setTargets [t] ok <- load LoadAllTargets case ok of Succeeded -> do modGraph <- getModuleGraph let modNames = map ms_mod_name modGraph loadedModNames <- filterM isLoaded modNames let imps = map (IIDecl . simpleImportDecl) $ mkModuleName "Bead.View.Dictionary" : loadedModNames setContext imps Failed -> error "Failed to load the requested module (see the error messages)." -- Unfortunately, `Data.Dynamic` appears too tricky to use, so instead -- we just simply prescribe the expected type for `dict` and blindly -- cast the fetched value into a `DictionaryFile`. Theoretically, the -- evaluation will not be able to reach this expression otherwise anyway. let dict = takeBaseName path ++ ".dict" (Just . ((,) path)) <$> compileExpr (dict ++ " :: DictionaryFile") >>= unsafeCoerce `catch` (\e -> do printf "Could not load dictionary: %s\n" (show (e :: SomeException)) return Nothing)
1,775
loadDictionary :: FilePath -> IO (Maybe (FilePath, DictionaryFile)) loadDictionary path = do runGhc (Just libdir) $ do dflags0 <- getSessionDynFlags let dflags1 = dflags0 { hscTarget = HscInterpreted , log_action = defaultLogAction , flushOut = FlushOut $ return () , flushErr = FlushErr $ return () , importPaths = importPaths dflags0 ++ [takeDirectory path] } _ <- setSessionDynFlags dflags1 (dflags2,_) <- liftIO $ initPackages dflags1 liftIO $ unload dflags2 [] t <- guessTarget path Nothing setTargets [t] ok <- load LoadAllTargets case ok of Succeeded -> do modGraph <- getModuleGraph let modNames = map ms_mod_name modGraph loadedModNames <- filterM isLoaded modNames let imps = map (IIDecl . simpleImportDecl) $ mkModuleName "Bead.View.Dictionary" : loadedModNames setContext imps Failed -> error "Failed to load the requested module (see the error messages)." -- Unfortunately, `Data.Dynamic` appears too tricky to use, so instead -- we just simply prescribe the expected type for `dict` and blindly -- cast the fetched value into a `DictionaryFile`. Theoretically, the -- evaluation will not be able to reach this expression otherwise anyway. let dict = takeBaseName path ++ ".dict" (Just . ((,) path)) <$> compileExpr (dict ++ " :: DictionaryFile") >>= unsafeCoerce `catch` (\e -> do printf "Could not load dictionary: %s\n" (show (e :: SomeException)) return Nothing)
1,775
loadDictionary path = do runGhc (Just libdir) $ do dflags0 <- getSessionDynFlags let dflags1 = dflags0 { hscTarget = HscInterpreted , log_action = defaultLogAction , flushOut = FlushOut $ return () , flushErr = FlushErr $ return () , importPaths = importPaths dflags0 ++ [takeDirectory path] } _ <- setSessionDynFlags dflags1 (dflags2,_) <- liftIO $ initPackages dflags1 liftIO $ unload dflags2 [] t <- guessTarget path Nothing setTargets [t] ok <- load LoadAllTargets case ok of Succeeded -> do modGraph <- getModuleGraph let modNames = map ms_mod_name modGraph loadedModNames <- filterM isLoaded modNames let imps = map (IIDecl . simpleImportDecl) $ mkModuleName "Bead.View.Dictionary" : loadedModNames setContext imps Failed -> error "Failed to load the requested module (see the error messages)." -- Unfortunately, `Data.Dynamic` appears too tricky to use, so instead -- we just simply prescribe the expected type for `dict` and blindly -- cast the fetched value into a `DictionaryFile`. Theoretically, the -- evaluation will not be able to reach this expression otherwise anyway. let dict = takeBaseName path ++ ".dict" (Just . ((,) path)) <$> compileExpr (dict ++ " :: DictionaryFile") >>= unsafeCoerce `catch` (\e -> do printf "Could not load dictionary: %s\n" (show (e :: SomeException)) return Nothing)
1,707
false
true
0
22
603
399
192
207
null
null
hpacheco/HAAP
examples/plab/oracle/SimulateT6.hs
mit
noBot :: Bot noBot _ _ _ = parado
33
noBot :: Bot noBot _ _ _ = parado
33
noBot _ _ _ = parado
20
false
true
0
5
8
18
9
9
null
null
Megaleo/Minehack
src/World.hs
bsd-3-clause
(|/|) :: Coord -> Int -> Coord (x1,y1) |/| d = (x1 `div` d, y1 `div` d)
71
(|/|) :: Coord -> Int -> Coord (x1,y1) |/| d = (x1 `div` d, y1 `div` d)
71
(x1,y1) |/| d = (x1 `div` d, y1 `div` d)
40
false
true
0
6
16
51
30
21
null
null
bergey/plots
src/Plots/API.hs
bsd-3-clause
-- | Standard 2D axis. -- r3Axis :: R2Backend b n => Axis b V3 n -- r3Axis = def -- | Set the label for the given axis. -- -- @@ -- myaxis = 'r2Axis' &~ 'axisLabel' 'ex' "x-axis" -- @@ axisLabel :: E v -> Lens' (Axis b v n) String axisLabel (E e) = axisLabels . e . axisLabelText
288
axisLabel :: E v -> Lens' (Axis b v n) String axisLabel (E e) = axisLabels . e . axisLabelText
94
axisLabel (E e) = axisLabels . e . axisLabelText
48
true
true
0
8
70
58
32
26
null
null
dylanmc/cryptol
cryptol/REPL/Monad.hs
bsd-3-clause
getTSyns :: REPL (Map.Map P.QName T.TySyn) getTSyns = do me <- getModuleEnv let decls = M.focusedEnv me return (keepOne "getTSyns" `fmap` M.ifTySyns decls)
162
getTSyns :: REPL (Map.Map P.QName T.TySyn) getTSyns = do me <- getModuleEnv let decls = M.focusedEnv me return (keepOne "getTSyns" `fmap` M.ifTySyns decls)
162
getTSyns = do me <- getModuleEnv let decls = M.focusedEnv me return (keepOne "getTSyns" `fmap` M.ifTySyns decls)
119
false
true
0
11
29
72
34
38
null
null
forked-upstream-packages-for-ghcjs/ghc
compiler/deSugar/Check.hs
bsd-3-clause
untidy :: NeedPars -> WarningPat -> WarningPat untidy b (L loc p) = L loc (untidy' b p) where untidy' _ p@(WildPat _) = p untidy' _ p@(VarPat _) = p untidy' _ (LitPat lit) = LitPat (untidy_lit lit) untidy' _ p@(ConPatIn _ (PrefixCon [])) = p untidy' b (ConPatIn name ps) = pars b (L loc (ConPatIn name (untidy_con ps))) untidy' _ (ListPat pats ty Nothing) = ListPat (map untidy_no_pars pats) ty Nothing untidy' _ (TuplePat pats box tys) = TuplePat (map untidy_no_pars pats) box tys untidy' _ (ListPat _ _ (Just _)) = panic "Check.untidy: Overloaded ListPat" untidy' _ (PArrPat _ _) = panic "Check.untidy: Shouldn't get a parallel array here!" untidy' _ (SigPatIn _ _) = panic "Check.untidy: SigPat" untidy' _ (LazyPat {}) = panic "Check.untidy: LazyPat" untidy' _ (AsPat {}) = panic "Check.untidy: AsPat" untidy' _ (ParPat {}) = panic "Check.untidy: ParPat" untidy' _ (BangPat {}) = panic "Check.untidy: BangPat" untidy' _ (ConPatOut {}) = panic "Check.untidy: ConPatOut" untidy' _ (ViewPat {}) = panic "Check.untidy: ViewPat" untidy' _ (SplicePat {}) = panic "Check.untidy: SplicePat" untidy' _ (QuasiQuotePat {}) = panic "Check.untidy: QuasiQuotePat" untidy' _ (NPat {}) = panic "Check.untidy: NPat" untidy' _ (NPlusKPat {}) = panic "Check.untidy: NPlusKPat" untidy' _ (SigPatOut {}) = panic "Check.untidy: SigPatOut" untidy' _ (CoPat {}) = panic "Check.untidy: CoPat"
1,628
untidy :: NeedPars -> WarningPat -> WarningPat untidy b (L loc p) = L loc (untidy' b p) where untidy' _ p@(WildPat _) = p untidy' _ p@(VarPat _) = p untidy' _ (LitPat lit) = LitPat (untidy_lit lit) untidy' _ p@(ConPatIn _ (PrefixCon [])) = p untidy' b (ConPatIn name ps) = pars b (L loc (ConPatIn name (untidy_con ps))) untidy' _ (ListPat pats ty Nothing) = ListPat (map untidy_no_pars pats) ty Nothing untidy' _ (TuplePat pats box tys) = TuplePat (map untidy_no_pars pats) box tys untidy' _ (ListPat _ _ (Just _)) = panic "Check.untidy: Overloaded ListPat" untidy' _ (PArrPat _ _) = panic "Check.untidy: Shouldn't get a parallel array here!" untidy' _ (SigPatIn _ _) = panic "Check.untidy: SigPat" untidy' _ (LazyPat {}) = panic "Check.untidy: LazyPat" untidy' _ (AsPat {}) = panic "Check.untidy: AsPat" untidy' _ (ParPat {}) = panic "Check.untidy: ParPat" untidy' _ (BangPat {}) = panic "Check.untidy: BangPat" untidy' _ (ConPatOut {}) = panic "Check.untidy: ConPatOut" untidy' _ (ViewPat {}) = panic "Check.untidy: ViewPat" untidy' _ (SplicePat {}) = panic "Check.untidy: SplicePat" untidy' _ (QuasiQuotePat {}) = panic "Check.untidy: QuasiQuotePat" untidy' _ (NPat {}) = panic "Check.untidy: NPat" untidy' _ (NPlusKPat {}) = panic "Check.untidy: NPlusKPat" untidy' _ (SigPatOut {}) = panic "Check.untidy: SigPatOut" untidy' _ (CoPat {}) = panic "Check.untidy: CoPat"
1,628
untidy b (L loc p) = L loc (untidy' b p) where untidy' _ p@(WildPat _) = p untidy' _ p@(VarPat _) = p untidy' _ (LitPat lit) = LitPat (untidy_lit lit) untidy' _ p@(ConPatIn _ (PrefixCon [])) = p untidy' b (ConPatIn name ps) = pars b (L loc (ConPatIn name (untidy_con ps))) untidy' _ (ListPat pats ty Nothing) = ListPat (map untidy_no_pars pats) ty Nothing untidy' _ (TuplePat pats box tys) = TuplePat (map untidy_no_pars pats) box tys untidy' _ (ListPat _ _ (Just _)) = panic "Check.untidy: Overloaded ListPat" untidy' _ (PArrPat _ _) = panic "Check.untidy: Shouldn't get a parallel array here!" untidy' _ (SigPatIn _ _) = panic "Check.untidy: SigPat" untidy' _ (LazyPat {}) = panic "Check.untidy: LazyPat" untidy' _ (AsPat {}) = panic "Check.untidy: AsPat" untidy' _ (ParPat {}) = panic "Check.untidy: ParPat" untidy' _ (BangPat {}) = panic "Check.untidy: BangPat" untidy' _ (ConPatOut {}) = panic "Check.untidy: ConPatOut" untidy' _ (ViewPat {}) = panic "Check.untidy: ViewPat" untidy' _ (SplicePat {}) = panic "Check.untidy: SplicePat" untidy' _ (QuasiQuotePat {}) = panic "Check.untidy: QuasiQuotePat" untidy' _ (NPat {}) = panic "Check.untidy: NPat" untidy' _ (NPlusKPat {}) = panic "Check.untidy: NPlusKPat" untidy' _ (SigPatOut {}) = panic "Check.untidy: SigPatOut" untidy' _ (CoPat {}) = panic "Check.untidy: CoPat"
1,581
false
true
18
11
475
618
284
334
null
null
tsiliakis/xmobar
src/Plugins/Monitors/Common.hs
bsd-3-clause
showWithUnits :: Int -> Int -> Float -> String showWithUnits d n x | x < 0 = '-' : showWithUnits d n (-x) | n > 3 || x < 10^(d + 1) = show (round x :: Int) ++ units n | x <= 1024 = showDigits d (x/1024) ++ units (n+1) | otherwise = showWithUnits d (n+1) (x/1024) where units = (!!) ["B", "K", "M", "G", "T"]
317
showWithUnits :: Int -> Int -> Float -> String showWithUnits d n x | x < 0 = '-' : showWithUnits d n (-x) | n > 3 || x < 10^(d + 1) = show (round x :: Int) ++ units n | x <= 1024 = showDigits d (x/1024) ++ units (n+1) | otherwise = showWithUnits d (n+1) (x/1024) where units = (!!) ["B", "K", "M", "G", "T"]
317
showWithUnits d n x | x < 0 = '-' : showWithUnits d n (-x) | n > 3 || x < 10^(d + 1) = show (round x :: Int) ++ units n | x <= 1024 = showDigits d (x/1024) ++ units (n+1) | otherwise = showWithUnits d (n+1) (x/1024) where units = (!!) ["B", "K", "M", "G", "T"]
270
false
true
3
11
79
216
106
110
null
null
loadimpact/http2-test
hs-src/Rede/SpdyProtocol/Session.hs
bsd-3-clause
compressFrameHeaders frame_without_headers = return frame_without_headers
96
compressFrameHeaders frame_without_headers = return frame_without_headers
96
compressFrameHeaders frame_without_headers = return frame_without_headers
96
false
false
0
5
27
12
5
7
null
null
spinda/liquidhaskell
tests/gsoc15/unknown/pos/AVLRJ.hs
bsd-3-clause
ht (Tree _ l r) = if (ht l) > (ht r) then (1 + ht l) else (1 + ht r)
68
ht (Tree _ l r) = if (ht l) > (ht r) then (1 + ht l) else (1 + ht r)
68
ht (Tree _ l r) = if (ht l) > (ht r) then (1 + ht l) else (1 + ht r)
68
false
false
0
8
21
63
32
31
null
null
DaMSL/K3
src/Language/K3/Interpreter/Evaluation.hs
apache-2.0
literal (tag &&& children -> (LSome, [x])) = literal x >>= return . VOption . (, vQualOfLit x) . Just
101
literal (tag &&& children -> (LSome, [x])) = literal x >>= return . VOption . (, vQualOfLit x) . Just
101
literal (tag &&& children -> (LSome, [x])) = literal x >>= return . VOption . (, vQualOfLit x) . Just
101
false
false
0
9
19
55
29
26
null
null
w4ngyi/postgrest
src/PostgREST/PgQuery.hs
mit
returningStarT :: StatementT returningStarT s = s { B.stmtTemplate = B.stmtTemplate s <> " RETURNING *" }
105
returningStarT :: StatementT returningStarT s = s { B.stmtTemplate = B.stmtTemplate s <> " RETURNING *" }
105
returningStarT s = s { B.stmtTemplate = B.stmtTemplate s <> " RETURNING *" }
76
false
true
0
9
16
33
17
16
null
null
leormarqs/TrabalhoGrafos
src/Graph/Graph.hs
agpl-3.0
isAdjacentTo :: NodeId -> NodeId -> Graph -> Bool isAdjacentTo n n' graph = elem n' $ neighbourNodes n graph
108
isAdjacentTo :: NodeId -> NodeId -> Graph -> Bool isAdjacentTo n n' graph = elem n' $ neighbourNodes n graph
108
isAdjacentTo n n' graph = elem n' $ neighbourNodes n graph
58
false
true
0
7
19
42
20
22
null
null
minib00m/jpp
src/TypeChecker.hs
mit
funName :: FunDef -> VarName funName (FunDef (FunHeader name _ _) _ _ _) = fromJust name
88
funName :: FunDef -> VarName funName (FunDef (FunHeader name _ _) _ _ _) = fromJust name
88
funName (FunDef (FunHeader name _ _) _ _ _) = fromJust name
59
false
true
0
9
16
43
21
22
null
null
thomie/cabal
cabal-install/Distribution/Client/Sandbox.hs
bsd-3-clause
getSandboxPackageDB :: ConfigFlags -> IO PackageDB getSandboxPackageDB configFlags = do case configPackageDBs configFlags of [Just sandboxDB@(SpecificPackageDB _)] -> return sandboxDB -- TODO: should we allow multiple package DBs (e.g. with 'inherit')? [] -> die $ "Sandbox package DB is not specified. " ++ sandboxConfigCorrupt [_] -> die $ "Unexpected contents of the 'package-db' field. " ++ sandboxConfigCorrupt _ -> die $ "Too many package DBs provided. " ++ sandboxConfigCorrupt where sandboxConfigCorrupt = "Your 'cabal.sandbox.config' is probably corrupt." -- | Which packages are installed in the sandbox package DB?
795
getSandboxPackageDB :: ConfigFlags -> IO PackageDB getSandboxPackageDB configFlags = do case configPackageDBs configFlags of [Just sandboxDB@(SpecificPackageDB _)] -> return sandboxDB -- TODO: should we allow multiple package DBs (e.g. with 'inherit')? [] -> die $ "Sandbox package DB is not specified. " ++ sandboxConfigCorrupt [_] -> die $ "Unexpected contents of the 'package-db' field. " ++ sandboxConfigCorrupt _ -> die $ "Too many package DBs provided. " ++ sandboxConfigCorrupt where sandboxConfigCorrupt = "Your 'cabal.sandbox.config' is probably corrupt." -- | Which packages are installed in the sandbox package DB?
795
getSandboxPackageDB configFlags = do case configPackageDBs configFlags of [Just sandboxDB@(SpecificPackageDB _)] -> return sandboxDB -- TODO: should we allow multiple package DBs (e.g. with 'inherit')? [] -> die $ "Sandbox package DB is not specified. " ++ sandboxConfigCorrupt [_] -> die $ "Unexpected contents of the 'package-db' field. " ++ sandboxConfigCorrupt _ -> die $ "Too many package DBs provided. " ++ sandboxConfigCorrupt where sandboxConfigCorrupt = "Your 'cabal.sandbox.config' is probably corrupt." -- | Which packages are installed in the sandbox package DB?
744
false
true
1
14
257
119
57
62
null
null
ndmitchell/hlint
data/Test.hs
bsd-3-clause
warn "noop" = a ? 0 ==> a
25
warn "noop" = a ? 0 ==> a
25
warn "noop" = a ? 0 ==> a
25
false
false
0
6
7
18
8
10
null
null
kejace/ethereum-data-sql
src/Blockchain/Data/Address.hs
bsd-3-clause
getNewAddress_unsafe ::Address->Integer->Address getNewAddress_unsafe a n = let theHash = hash $ rlpSerialize $ RLPArray [rlpEncode a, rlpEncode n] in decode $ BL.drop 12 $ encode theHash
195
getNewAddress_unsafe ::Address->Integer->Address getNewAddress_unsafe a n = let theHash = hash $ rlpSerialize $ RLPArray [rlpEncode a, rlpEncode n] in decode $ BL.drop 12 $ encode theHash
195
getNewAddress_unsafe a n = let theHash = hash $ rlpSerialize $ RLPArray [rlpEncode a, rlpEncode n] in decode $ BL.drop 12 $ encode theHash
146
false
true
0
12
33
76
35
41
null
null
anton-k/language-css
src/Language/Css/Build/Idents.hs
bsd-3-clause
-- | color color :: Idents a => a color = ident "color"
55
color :: Idents a => a color = ident "color"
44
color = ident "color"
21
true
true
0
7
12
28
12
16
null
null
spechub/Hets
Logic/Comorphism.hs
gpl-2.0
mkTheoryMapping :: Monad m => (sign1 -> m (sign2, [Named sentence2])) -> (sign1 -> sentence1 -> m sentence2) -> (sign1, [Named sentence1]) -> m (sign2, [Named sentence2]) mkTheoryMapping mapSig mapSen (sign, sens) = do (sign', sens') <- mapSig sign sens'' <- mapM (mapNamedM (mapSen sign) . unmark) sens return (sign', nameAndDisambiguate $ map (markSen "SignatureProperty") sens' ++ sens'')
478
mkTheoryMapping :: Monad m => (sign1 -> m (sign2, [Named sentence2])) -> (sign1 -> sentence1 -> m sentence2) -> (sign1, [Named sentence1]) -> m (sign2, [Named sentence2]) mkTheoryMapping mapSig mapSen (sign, sens) = do (sign', sens') <- mapSig sign sens'' <- mapM (mapNamedM (mapSen sign) . unmark) sens return (sign', nameAndDisambiguate $ map (markSen "SignatureProperty") sens' ++ sens'')
478
mkTheoryMapping mapSig mapSen (sign, sens) = do (sign', sens') <- mapSig sign sens'' <- mapM (mapNamedM (mapSen sign) . unmark) sens return (sign', nameAndDisambiguate $ map (markSen "SignatureProperty") sens' ++ sens'')
250
false
true
0
13
144
181
92
89
null
null
josuf107/xioqbot
src/Messages.hs
bsd-3-clause
alreadyOnTeamMsg :: Msg (TwitchUser, TeamName) alreadyOnTeamMsg (creator, existingTeam) = "Sorry " & creator % ", you are already in a team! You can leave your current team (" % existingTeam % ") with !teamleave."
213
alreadyOnTeamMsg :: Msg (TwitchUser, TeamName) alreadyOnTeamMsg (creator, existingTeam) = "Sorry " & creator % ", you are already in a team! You can leave your current team (" % existingTeam % ") with !teamleave."
213
alreadyOnTeamMsg (creator, existingTeam) = "Sorry " & creator % ", you are already in a team! You can leave your current team (" % existingTeam % ") with !teamleave."
166
false
true
0
8
33
45
24
21
null
null
gridaphobe/liquid-fixpoint
src/Language/Fixpoint/Parse.hs
bsd-3-clause
------------------------------------------------------------------------ remainderP p = do res <- p str <- getInput pos <- getPosition return (res, str, pos)
181
remainderP p = do res <- p str <- getInput pos <- getPosition return (res, str, pos)
107
remainderP p = do res <- p str <- getInput pos <- getPosition return (res, str, pos)
107
true
false
0
8
41
46
22
24
null
null
locaweb/leela
src/warpdrive/src/Leela/Data/LQL/Read.hs
apache-2.0
parseGrepStmt :: Using -> Parser LQL parseGrepStmt u = "grep attr " *> (GrepStmt u <$> parseGrepAttr) <|> "grep make " *> (GrepStmt u <$> parseGrepMake) <|> "grep kill " *> (GrepStmt u <$> parseGrepKill)
239
parseGrepStmt :: Using -> Parser LQL parseGrepStmt u = "grep attr " *> (GrepStmt u <$> parseGrepAttr) <|> "grep make " *> (GrepStmt u <$> parseGrepMake) <|> "grep kill " *> (GrepStmt u <$> parseGrepKill)
239
parseGrepStmt u = "grep attr " *> (GrepStmt u <$> parseGrepAttr) <|> "grep make " *> (GrepStmt u <$> parseGrepMake) <|> "grep kill " *> (GrepStmt u <$> parseGrepKill)
202
false
true
0
12
70
71
35
36
null
null
forked-upstream-packages-for-ghcjs/ghc
compiler/prelude/PrelNames.hs
bsd-3-clause
loopAName = varQual aRROW (fsLit "loop") loopAIdKey
65
loopAName = varQual aRROW (fsLit "loop") loopAIdKey
65
loopAName = varQual aRROW (fsLit "loop") loopAIdKey
65
false
false
1
7
20
22
9
13
null
null
abbradar/yaxmpp
src/Network/XMPP/Address.hs
bsd-3-clause
bareJidGet _ = Nothing
22
bareJidGet _ = Nothing
22
bareJidGet _ = Nothing
22
false
false
0
5
3
9
4
5
null
null
AlexeyRaga/eta
compiler/ETA/Utils/Encoding.hs
bsd-3-clause
decode_lower ch = {-pprTrace "decode_lower" (char ch)-} ch
59
decode_lower ch = {-pprTrace "decode_lower" (char ch)-} ch
59
decode_lower ch = {-pprTrace "decode_lower" (char ch)-} ch
59
false
false
0
5
8
10
5
5
null
null
ocean0yohsuke/Simply-Typed-Lambda
src/Lambda/DataType/Expr.hs
bsd-3-clause
int n = INT n Nothing
21
int n = INT n Nothing
21
int n = INT n Nothing
21
false
false
0
5
5
14
6
8
null
null
sopvop/json-token-stream
src/Data/JSON/TokenStream/Write.hs
bsd-3-clause
text :: Text -> Builder text t = B.char8 '"' <> unquoted t <> B.char8 '"'
73
text :: Text -> Builder text t = B.char8 '"' <> unquoted t <> B.char8 '"'
73
text t = B.char8 '"' <> unquoted t <> B.char8 '"'
49
false
true
0
8
15
39
18
21
null
null
printedheart/Dao
src/Dao/Logic.hs
agpl-3.0
conjunctionLens :: Monad m => Lens m (Conjunction pat) (Array (Satisfy pat)) conjunctionLens = newLens (\ (Conjunction a) -> a) (\a _ -> Conjunction a)
151
conjunctionLens :: Monad m => Lens m (Conjunction pat) (Array (Satisfy pat)) conjunctionLens = newLens (\ (Conjunction a) -> a) (\a _ -> Conjunction a)
151
conjunctionLens = newLens (\ (Conjunction a) -> a) (\a _ -> Conjunction a)
74
false
true
0
10
24
75
38
37
null
null
LukeHoersten/prometheus
src/System/Metrics/Prometheus/Metric/Counter.hs
bsd-3-clause
sample :: Counter -> IO CounterSample sample = addAndSample 0
61
sample :: Counter -> IO CounterSample sample = addAndSample 0
61
sample = addAndSample 0
23
false
true
0
7
9
27
11
16
null
null
JPMoresmau/leksah
src/IDE/Utils/GUIUtils.hs
gpl-2.0
stockIdFromType Class = "ide_class"
47
stockIdFromType Class = "ide_class"
47
stockIdFromType Class = "ide_class"
47
false
false
0
5
15
9
4
5
null
null
JPMoresmau/BuildWrapper
src/Language/Haskell/BuildWrapper/GHC.hs
bsd-3-clause
start ss= (srcSpanStartLine ss, srcSpanStartCol ss)
51
start ss= (srcSpanStartLine ss, srcSpanStartCol ss)
51
start ss= (srcSpanStartLine ss, srcSpanStartCol ss)
51
false
false
1
7
5
26
10
16
null
null
jozefg/hasquito
src/Language/Hasquito/TypeCheck.hs
mit
-- | This generates a "fresh" type for all global variables to -- allow for types to specify polymorphic types. cleanUpTVar :: Ty -> WriterT [Constr] TCM Ty cleanUpTVar ty = do let rigids = rigidTVars ty newVars <- zipWithM (fmap . (,)) rigids . repeat $ TVar Nothing Flexible <$> freshName return $ foldr removeRigid ty newVars where removeRigid ((scope, name), var) = substTy Rigid scope name var rigidTVars (TVar scope Rigid name) = [(scope, name)] rigidTVars (TArr l r) = rigidTVars l ++ rigidTVars r rigidTVars _ = []
602
cleanUpTVar :: Ty -> WriterT [Constr] TCM Ty cleanUpTVar ty = do let rigids = rigidTVars ty newVars <- zipWithM (fmap . (,)) rigids . repeat $ TVar Nothing Flexible <$> freshName return $ foldr removeRigid ty newVars where removeRigid ((scope, name), var) = substTy Rigid scope name var rigidTVars (TVar scope Rigid name) = [(scope, name)] rigidTVars (TArr l r) = rigidTVars l ++ rigidTVars r rigidTVars _ = []
490
cleanUpTVar ty = do let rigids = rigidTVars ty newVars <- zipWithM (fmap . (,)) rigids . repeat $ TVar Nothing Flexible <$> freshName return $ foldr removeRigid ty newVars where removeRigid ((scope, name), var) = substTy Rigid scope name var rigidTVars (TVar scope Rigid name) = [(scope, name)] rigidTVars (TArr l r) = rigidTVars l ++ rigidTVars r rigidTVars _ = []
445
true
true
3
14
170
188
95
93
null
null
vedgar/mlr
2016 Kolokvij/Z4.hs
unlicense
singular (Star r) = True
24
singular (Star r) = True
24
singular (Star r) = True
24
false
false
0
7
4
15
7
8
null
null
thalerjonathan/phd
coding/prototyping/haskell/PureAgentsPar/src/WildFire/WildFireModelStatic.hs
gpl-3.0
agentNeighbours :: WFAgent -> [WFAgent] -> (Int, Int) -> [WFAgent] agentNeighbours a as cells = filter (\a' -> any (==(agentToCell a' cells)) neighbourCells ) as where aCell = agentToCell a cells neighbourCells = neighbours aCell
249
agentNeighbours :: WFAgent -> [WFAgent] -> (Int, Int) -> [WFAgent] agentNeighbours a as cells = filter (\a' -> any (==(agentToCell a' cells)) neighbourCells ) as where aCell = agentToCell a cells neighbourCells = neighbours aCell
249
agentNeighbours a as cells = filter (\a' -> any (==(agentToCell a' cells)) neighbourCells ) as where aCell = agentToCell a cells neighbourCells = neighbours aCell
182
false
true
0
11
54
92
49
43
null
null
dsj36/dropray
src/BabyRays/Color.hs
gpl-3.0
nearlywhite = (0.8,0.8,0.8)
27
nearlywhite = (0.8,0.8,0.8)
27
nearlywhite = (0.8,0.8,0.8)
27
false
false
1
5
2
18
9
9
null
null
tclem/lilo
src/Syntax.hs
mit
int :: (Syntax.Integer :< f) => Int -> Expr (Union f) int = inject . Integer
76
int :: (Syntax.Integer :< f) => Int -> Expr (Union f) int = inject . Integer
76
int = inject . Integer
22
false
true
0
9
15
41
21
20
null
null
ksaveljev/hake-2
src/Game/Monsters/MBoss32.hs
bsd-3-clause
frameAttack413 :: Int frameAttack413 = 221
42
frameAttack413 :: Int frameAttack413 = 221
42
frameAttack413 = 221
20
false
true
0
4
5
11
6
5
null
null
SwiftsNamesake/Occlusion
src/Occlusion/Lenses.hs
mit
colour :: Lens Character Character (Palette.Colour Double) (Palette.Colour Double) colour f s = (\new -> s { _colour=new }) <$> f (_colour s)
141
colour :: Lens Character Character (Palette.Colour Double) (Palette.Colour Double) colour f s = (\new -> s { _colour=new }) <$> f (_colour s)
141
colour f s = (\new -> s { _colour=new }) <$> f (_colour s)
58
false
true
0
9
22
70
36
34
null
null
WraithM/haskell-opaleye
opaleye-sqlite/src/Opaleye/SQLite/PGTypes.hs
bsd-3-clause
pgInt4 :: Int -> Column PGInt4 pgInt4 = IPT.literalColumn . HPQ.IntegerLit . fromIntegral
89
pgInt4 :: Int -> Column PGInt4 pgInt4 = IPT.literalColumn . HPQ.IntegerLit . fromIntegral
89
pgInt4 = IPT.literalColumn . HPQ.IntegerLit . fromIntegral
58
false
true
0
7
12
30
15
15
null
null
dplewa/haskal-interpreter
Runner.hs
apache-2.0
eval (ELeq e1 e2) env = do v1 <- eval e1 env v2 <- eval e2 env return $ VBool (v1 <= v2)
142
eval (ELeq e1 e2) env = do v1 <- eval e1 env v2 <- eval e2 env return $ VBool (v1 <= v2)
142
eval (ELeq e1 e2) env = do v1 <- eval e1 env v2 <- eval e2 env return $ VBool (v1 <= v2)
142
false
false
1
11
76
63
27
36
null
null