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
robstewart57/ripl
src/SkeletonTemplates/Convolve.hs
bsd-3-clause
topRightAction width = C.AnActn (C.ActnTagsStmts tag head stmts) where tag = C.ActnTagDecl [C.Ident "topRight"] head = C.ActnHeadGuardedVars [streamInPattern] [streamOutPattern] [guardExp] localVars guardExp = C.BEEQ (mkVar "midPtr") (mkInt (width - 1)) localVars = C.LocVarsDecl [ mkBufferIdxAssignment "p1" (identCalExp "idx") , mkBufferIdxAssignment "p2" (findIndexFunc (C.BEAdd (identCalExp "idx") (mkInt 1))) , mkBufferIdxAssignment "p3" (findIndexFunc (C.BEAdd (identCalExp "idx") (mkInt 1))) , mkBufferIdxAssignment "p4" (identCalExp "idx") , mkBufferIdxAssignment "p5" (findIndexFunc (C.BEAdd (identCalExp "idx") (mkInt 1))) , mkBufferIdxAssignment "p6" (findIndexFunc (C.BEAdd (identCalExp "idx") (mkInt 1))) , mkBufferIdxAssignment "p7" (findIndexFunc (C.BEAdd (identCalExp "idx") (mkInt width))) , mkBufferIdxAssignment "p8" (findIndexFunc (C.BEAdd (identCalExp "idx") (C.BEAdd (mkInt width) (mkInt 1)))) , mkBufferIdxAssignment "p9" (findIndexFunc (C.BEAdd (identCalExp "idx") (C.BEAdd (mkInt width) (mkInt 2)))) , C.LocVarDecl (C.VDeclExpIMut (intCalType 16) (C.Ident "v") [] (C.IdBrSExpCons (C.Ident "applyKernel") (map identCalExp ["p1", "p2", "p3", "p4", "p5", "p6", "p7", "p8", "p9"]))) ] stmts = [ arrayExpUpdate "buffer" (C.BExp (findIndexFunc (C.BEAdd (mkVar "idx") (mkVar "bufferSize")))) ("token") , varIncr "consumed" , varSetExp "idx" (findIndexFunc (C.BEAdd (mkVar "idx") (mkInt 1))) , varSetInt "midPtr" 0 , varSetInt "processedRows" 1 ]
2,031
topRightAction width = C.AnActn (C.ActnTagsStmts tag head stmts) where tag = C.ActnTagDecl [C.Ident "topRight"] head = C.ActnHeadGuardedVars [streamInPattern] [streamOutPattern] [guardExp] localVars guardExp = C.BEEQ (mkVar "midPtr") (mkInt (width - 1)) localVars = C.LocVarsDecl [ mkBufferIdxAssignment "p1" (identCalExp "idx") , mkBufferIdxAssignment "p2" (findIndexFunc (C.BEAdd (identCalExp "idx") (mkInt 1))) , mkBufferIdxAssignment "p3" (findIndexFunc (C.BEAdd (identCalExp "idx") (mkInt 1))) , mkBufferIdxAssignment "p4" (identCalExp "idx") , mkBufferIdxAssignment "p5" (findIndexFunc (C.BEAdd (identCalExp "idx") (mkInt 1))) , mkBufferIdxAssignment "p6" (findIndexFunc (C.BEAdd (identCalExp "idx") (mkInt 1))) , mkBufferIdxAssignment "p7" (findIndexFunc (C.BEAdd (identCalExp "idx") (mkInt width))) , mkBufferIdxAssignment "p8" (findIndexFunc (C.BEAdd (identCalExp "idx") (C.BEAdd (mkInt width) (mkInt 1)))) , mkBufferIdxAssignment "p9" (findIndexFunc (C.BEAdd (identCalExp "idx") (C.BEAdd (mkInt width) (mkInt 2)))) , C.LocVarDecl (C.VDeclExpIMut (intCalType 16) (C.Ident "v") [] (C.IdBrSExpCons (C.Ident "applyKernel") (map identCalExp ["p1", "p2", "p3", "p4", "p5", "p6", "p7", "p8", "p9"]))) ] stmts = [ arrayExpUpdate "buffer" (C.BExp (findIndexFunc (C.BEAdd (mkVar "idx") (mkVar "bufferSize")))) ("token") , varIncr "consumed" , varSetExp "idx" (findIndexFunc (C.BEAdd (mkVar "idx") (mkInt 1))) , varSetInt "midPtr" 0 , varSetInt "processedRows" 1 ]
2,031
topRightAction width = C.AnActn (C.ActnTagsStmts tag head stmts) where tag = C.ActnTagDecl [C.Ident "topRight"] head = C.ActnHeadGuardedVars [streamInPattern] [streamOutPattern] [guardExp] localVars guardExp = C.BEEQ (mkVar "midPtr") (mkInt (width - 1)) localVars = C.LocVarsDecl [ mkBufferIdxAssignment "p1" (identCalExp "idx") , mkBufferIdxAssignment "p2" (findIndexFunc (C.BEAdd (identCalExp "idx") (mkInt 1))) , mkBufferIdxAssignment "p3" (findIndexFunc (C.BEAdd (identCalExp "idx") (mkInt 1))) , mkBufferIdxAssignment "p4" (identCalExp "idx") , mkBufferIdxAssignment "p5" (findIndexFunc (C.BEAdd (identCalExp "idx") (mkInt 1))) , mkBufferIdxAssignment "p6" (findIndexFunc (C.BEAdd (identCalExp "idx") (mkInt 1))) , mkBufferIdxAssignment "p7" (findIndexFunc (C.BEAdd (identCalExp "idx") (mkInt width))) , mkBufferIdxAssignment "p8" (findIndexFunc (C.BEAdd (identCalExp "idx") (C.BEAdd (mkInt width) (mkInt 1)))) , mkBufferIdxAssignment "p9" (findIndexFunc (C.BEAdd (identCalExp "idx") (C.BEAdd (mkInt width) (mkInt 2)))) , C.LocVarDecl (C.VDeclExpIMut (intCalType 16) (C.Ident "v") [] (C.IdBrSExpCons (C.Ident "applyKernel") (map identCalExp ["p1", "p2", "p3", "p4", "p5", "p6", "p7", "p8", "p9"]))) ] stmts = [ arrayExpUpdate "buffer" (C.BExp (findIndexFunc (C.BEAdd (mkVar "idx") (mkVar "bufferSize")))) ("token") , varIncr "consumed" , varSetExp "idx" (findIndexFunc (C.BEAdd (mkVar "idx") (mkInt 1))) , varSetInt "midPtr" 0 , varSetInt "processedRows" 1 ]
2,031
false
false
0
15
736
628
320
308
null
null
benmos/HLevy
src/DefaultEnv.hs
bsd-3-clause
defaultLabEnv s = case s of "head" -> Just ("stream", V tint) "tail" -> Just ("stream", CRec "stream") "isEmpty" -> Just ("iset", V tbool) "contains" -> Just ("iset", CArrow tint (CRec "iset")) "insert" -> Just ("iset", CArrow tint (CRec "iset")) "union" -> Just ("iset", CArrow (C (CRec "iset")) (CRec "iset")) "Insert" -> Just ("insertunion", CArrow (VPair (C (CRec "iset")) tint) (CRec "iset")) "Union" -> Just ("insertunion", CArrow (VPair (C (CRec "iset")) (C (CRec "iset"))) (CRec "iset")) -- | A default environment
653
defaultLabEnv s = case s of "head" -> Just ("stream", V tint) "tail" -> Just ("stream", CRec "stream") "isEmpty" -> Just ("iset", V tbool) "contains" -> Just ("iset", CArrow tint (CRec "iset")) "insert" -> Just ("iset", CArrow tint (CRec "iset")) "union" -> Just ("iset", CArrow (C (CRec "iset")) (CRec "iset")) "Insert" -> Just ("insertunion", CArrow (VPair (C (CRec "iset")) tint) (CRec "iset")) "Union" -> Just ("insertunion", CArrow (VPair (C (CRec "iset")) (C (CRec "iset"))) (CRec "iset")) -- | A default environment
653
defaultLabEnv s = case s of "head" -> Just ("stream", V tint) "tail" -> Just ("stream", CRec "stream") "isEmpty" -> Just ("iset", V tbool) "contains" -> Just ("iset", CArrow tint (CRec "iset")) "insert" -> Just ("iset", CArrow tint (CRec "iset")) "union" -> Just ("iset", CArrow (C (CRec "iset")) (CRec "iset")) "Insert" -> Just ("insertunion", CArrow (VPair (C (CRec "iset")) tint) (CRec "iset")) "Union" -> Just ("insertunion", CArrow (VPair (C (CRec "iset")) (C (CRec "iset"))) (CRec "iset")) -- | A default environment
653
false
false
0
16
211
262
131
131
null
null
chpatrick/hchip
HChip/ALU.hs
mit
updateReg f rx ry = wrap f rx ry >>= save16 rx
46
updateReg f rx ry = wrap f rx ry >>= save16 rx
46
updateReg f rx ry = wrap f rx ry >>= save16 rx
46
false
false
1
6
11
34
12
22
null
null
nevrenato/Hets_Fork
Common/Id.hs
gpl-2.0
showIds :: [Id] -> ShowS showIds is = noShow (null is) $ showString "[" . showSepList (showString ",") showId is . showString "]"
155
showIds :: [Id] -> ShowS showIds is = noShow (null is) $ showString "[" . showSepList (showString ",") showId is . showString "]"
155
showIds is = noShow (null is) $ showString "[" . showSepList (showString ",") showId is . showString "]"
130
false
true
0
10
48
61
29
32
null
null
peterokagey/haskellOEIS
test/Miscellaneous/A338169Spec.hs
apache-2.0
main :: IO () main = hspec spec
31
main :: IO () main = hspec spec
31
main = hspec spec
17
false
true
1
6
7
22
9
13
null
null
wavewave/detector-yaml
lib/Detector/Parser.hs
gpl-3.0
getTauCombined :: (Monad m) => [ (T.Text,PYaml) ] -> ErrorContextT m TauEffDetail getTauCombined kvlst = withContext "TauCombined" $ do eff <- (getPTEtaData <=< eitherObject <=< find "Efficiency") kvlst rej <- (getPTEtaData <=< eitherObject <=< find "Rejection") kvlst return (TauCombined eff rej) -- |
319
getTauCombined :: (Monad m) => [ (T.Text,PYaml) ] -> ErrorContextT m TauEffDetail getTauCombined kvlst = withContext "TauCombined" $ do eff <- (getPTEtaData <=< eitherObject <=< find "Efficiency") kvlst rej <- (getPTEtaData <=< eitherObject <=< find "Rejection") kvlst return (TauCombined eff rej) -- |
319
getTauCombined kvlst = withContext "TauCombined" $ do eff <- (getPTEtaData <=< eitherObject <=< find "Efficiency") kvlst rej <- (getPTEtaData <=< eitherObject <=< find "Rejection") kvlst return (TauCombined eff rej) -- |
237
false
true
0
13
59
118
56
62
null
null
Fizzixnerd/silveretta-hs
src/Parse.hs
gpl-3.0
indentSize :: Int indentSize = 2
32
indentSize :: Int indentSize = 2
32
indentSize = 2
14
false
true
0
4
5
11
6
5
null
null
erochest/orchestrate
specs/Specs/Orchestrate/Spec/Types.hs
apache-2.0
personName :: Functor f => (T.Text -> f T.Text) -> Person -> f Person personName f (Person n a) = fmap (`Person` a) (f n)
121
personName :: Functor f => (T.Text -> f T.Text) -> Person -> f Person personName f (Person n a) = fmap (`Person` a) (f n)
121
personName f (Person n a) = fmap (`Person` a) (f n)
51
false
true
0
10
24
73
37
36
null
null
horia141/mv-parser
parser.hs
mit
modIn :: Parser MVUnitModIn modIn = do name <- identifier lexer size <- parens lexer expr return (ModIn name size)
137
modIn :: Parser MVUnitModIn modIn = do name <- identifier lexer size <- parens lexer expr return (ModIn name size)
137
modIn = do name <- identifier lexer size <- parens lexer expr return (ModIn name size)
109
false
true
0
9
42
50
22
28
null
null
gibiansky/IHaskell
src/IHaskell/Eval/Evaluate.hs
mit
evalStatementOrIO :: Publisher -> KernelState -> Captured a -> Interpreter Display evalStatementOrIO publish state cmd = do let output str = publish . IntermediateResult $ Display [plain str] case cmd of CapturedStmt stmt -> write state $ "Statement:\n" ++ stmt CapturedIO _ -> write state "Evaluating Action" (printed, result) <- capturedEval (flip output Success) cmd case result of ExecComplete (Right names) _ -> do dflags <- getSessionDynFlags let allNames = map (showPpr dflags) names isItName name = name == "it" || name == "it" ++ show (getExecutionCounter state) nonItNames = filter (not . isItName) allNames oput = [ plain printed | not . null $ strip printed ] write state $ "Names: " ++ show allNames -- Display the types of all bound names if the option is on. This is similar to GHCi :set +t. if not $ useShowTypes state then return $ Display oput else do -- Get all the type strings. types <- forM nonItNames $ \name -> do #if MIN_VERSION_ghc(8,2,0) theType <- showSDocUnqual dflags . ppr <$> exprType TM_Inst name #else theType <- showSDocUnqual dflags . ppr <$> exprType name #endif return $ name ++ " :: " ++ theType let joined = unlines types htmled = unlines $ map formatGetType types return $ case extractPlain oput of "" -> Display [html htmled] -- Return plain and html versions. Previously there was only a plain version. txt -> Display [plain $ joined ++ "\n" ++ txt, html $ htmled ++ mono txt] ExecComplete (Left exception) _ -> throw exception ExecBreak{} -> error "Should not break." -- Read from a file handle until we hit a delimiter or until we've read as many characters as -- requested
1,958
evalStatementOrIO :: Publisher -> KernelState -> Captured a -> Interpreter Display evalStatementOrIO publish state cmd = do let output str = publish . IntermediateResult $ Display [plain str] case cmd of CapturedStmt stmt -> write state $ "Statement:\n" ++ stmt CapturedIO _ -> write state "Evaluating Action" (printed, result) <- capturedEval (flip output Success) cmd case result of ExecComplete (Right names) _ -> do dflags <- getSessionDynFlags let allNames = map (showPpr dflags) names isItName name = name == "it" || name == "it" ++ show (getExecutionCounter state) nonItNames = filter (not . isItName) allNames oput = [ plain printed | not . null $ strip printed ] write state $ "Names: " ++ show allNames -- Display the types of all bound names if the option is on. This is similar to GHCi :set +t. if not $ useShowTypes state then return $ Display oput else do -- Get all the type strings. types <- forM nonItNames $ \name -> do #if MIN_VERSION_ghc(8,2,0) theType <- showSDocUnqual dflags . ppr <$> exprType TM_Inst name #else theType <- showSDocUnqual dflags . ppr <$> exprType name #endif return $ name ++ " :: " ++ theType let joined = unlines types htmled = unlines $ map formatGetType types return $ case extractPlain oput of "" -> Display [html htmled] -- Return plain and html versions. Previously there was only a plain version. txt -> Display [plain $ joined ++ "\n" ++ txt, html $ htmled ++ mono txt] ExecComplete (Left exception) _ -> throw exception ExecBreak{} -> error "Should not break." -- Read from a file handle until we hit a delimiter or until we've read as many characters as -- requested
1,958
evalStatementOrIO publish state cmd = do let output str = publish . IntermediateResult $ Display [plain str] case cmd of CapturedStmt stmt -> write state $ "Statement:\n" ++ stmt CapturedIO _ -> write state "Evaluating Action" (printed, result) <- capturedEval (flip output Success) cmd case result of ExecComplete (Right names) _ -> do dflags <- getSessionDynFlags let allNames = map (showPpr dflags) names isItName name = name == "it" || name == "it" ++ show (getExecutionCounter state) nonItNames = filter (not . isItName) allNames oput = [ plain printed | not . null $ strip printed ] write state $ "Names: " ++ show allNames -- Display the types of all bound names if the option is on. This is similar to GHCi :set +t. if not $ useShowTypes state then return $ Display oput else do -- Get all the type strings. types <- forM nonItNames $ \name -> do #if MIN_VERSION_ghc(8,2,0) theType <- showSDocUnqual dflags . ppr <$> exprType TM_Inst name #else theType <- showSDocUnqual dflags . ppr <$> exprType name #endif return $ name ++ " :: " ++ theType let joined = unlines types htmled = unlines $ map formatGetType types return $ case extractPlain oput of "" -> Display [html htmled] -- Return plain and html versions. Previously there was only a plain version. txt -> Display [plain $ joined ++ "\n" ++ txt, html $ htmled ++ mono txt] ExecComplete (Left exception) _ -> throw exception ExecBreak{} -> error "Should not break." -- Read from a file handle until we hit a delimiter or until we've read as many characters as -- requested
1,875
false
true
0
23
619
492
234
258
null
null
flowbox-public/language-c-quote
Language/C/Pretty.hs
bsd-3-clause
pprStructOrUnion :: String -> Maybe Id -> Maybe [FieldGroup] -> [Attr] -> Doc pprStructOrUnion ty maybe_ident maybe_fields attrs = text ty <+> ppr maybe_ident <+> ppr maybe_fields <+/> ppr attrs
266
pprStructOrUnion :: String -> Maybe Id -> Maybe [FieldGroup] -> [Attr] -> Doc pprStructOrUnion ty maybe_ident maybe_fields attrs = text ty <+> ppr maybe_ident <+> ppr maybe_fields <+/> ppr attrs
266
pprStructOrUnion ty maybe_ident maybe_fields attrs = text ty <+> ppr maybe_ident <+> ppr maybe_fields <+/> ppr attrs
120
false
true
2
10
101
78
35
43
null
null
Mahdi89/eTeak
src/Eval.hs
bsd-3-clause
evalMidDecl cs (comp, node@(CaseDecl pos expr gs elseDecl)) | comp == Complete && isJust (constExpr expr) = ok node' | comp == Complete = evalError cs pos node "conditional declaration guards must be constant" | comp == Incomplete = (Incomplete, node') where node' = CaseDecl pos expr (map modGuard gs) (DeferDecl (declPos elseDecl) Complete elseDecl) modGuard (CaseDeclGuard pos matches decl) = CaseDeclGuard pos (map (typeCheckMatch typ) matches) (DeferDecl (declPos decl) Complete decl) modGuard _ = error "modGuard: can't happen" typ = typeOfExpr cs expr
656
evalMidDecl cs (comp, node@(CaseDecl pos expr gs elseDecl)) | comp == Complete && isJust (constExpr expr) = ok node' | comp == Complete = evalError cs pos node "conditional declaration guards must be constant" | comp == Incomplete = (Incomplete, node') where node' = CaseDecl pos expr (map modGuard gs) (DeferDecl (declPos elseDecl) Complete elseDecl) modGuard (CaseDeclGuard pos matches decl) = CaseDeclGuard pos (map (typeCheckMatch typ) matches) (DeferDecl (declPos decl) Complete decl) modGuard _ = error "modGuard: can't happen" typ = typeOfExpr cs expr
656
evalMidDecl cs (comp, node@(CaseDecl pos expr gs elseDecl)) | comp == Complete && isJust (constExpr expr) = ok node' | comp == Complete = evalError cs pos node "conditional declaration guards must be constant" | comp == Incomplete = (Incomplete, node') where node' = CaseDecl pos expr (map modGuard gs) (DeferDecl (declPos elseDecl) Complete elseDecl) modGuard (CaseDeclGuard pos matches decl) = CaseDeclGuard pos (map (typeCheckMatch typ) matches) (DeferDecl (declPos decl) Complete decl) modGuard _ = error "modGuard: can't happen" typ = typeOfExpr cs expr
656
false
false
0
11
181
215
105
110
null
null
CarmineM74/haskell_craft3e
Chapter8.hs
mit
beat Paper = Scissors
21
beat Paper = Scissors
21
beat Paper = Scissors
21
false
false
0
5
3
9
4
5
null
null
sdiehl/ghc
compiler/basicTypes/DataCon.hs
bsd-3-clause
isUnboxedSumCon :: DataCon -> Bool isUnboxedSumCon (MkData {dcRepTyCon = tc}) = isUnboxedSumTyCon tc
100
isUnboxedSumCon :: DataCon -> Bool isUnboxedSumCon (MkData {dcRepTyCon = tc}) = isUnboxedSumTyCon tc
100
isUnboxedSumCon (MkData {dcRepTyCon = tc}) = isUnboxedSumTyCon tc
65
false
true
0
9
12
33
17
16
null
null
ejlilley/AbstractMusic
Music.hs
gpl-3.0
faInt q n@(Negative _) = faInt' q n
35
faInt q n@(Negative _) = faInt' q n
35
faInt q n@(Negative _) = faInt' q n
35
false
false
1
7
7
32
12
20
null
null
sdiehl/ghc
utils/genapply/Main.hs
bsd-3-clause
genStackApplyArray types = vcat [ text "section \"relrodata\" {", text "stg_ap_stack_entries:", text "W_ 0; W_ 0; W_ 0;", -- ARG_GEN, ARG_GEN_BIG, ARG_BCO vcat (map arr_ent types), text "}" ] where arr_ent ty = text "W_" <+> mkStackApplyEntryLabel ty <> semi
285
genStackApplyArray types = vcat [ text "section \"relrodata\" {", text "stg_ap_stack_entries:", text "W_ 0; W_ 0; W_ 0;", -- ARG_GEN, ARG_GEN_BIG, ARG_BCO vcat (map arr_ent types), text "}" ] where arr_ent ty = text "W_" <+> mkStackApplyEntryLabel ty <> semi
285
genStackApplyArray types = vcat [ text "section \"relrodata\" {", text "stg_ap_stack_entries:", text "W_ 0; W_ 0; W_ 0;", -- ARG_GEN, ARG_GEN_BIG, ARG_BCO vcat (map arr_ent types), text "}" ] where arr_ent ty = text "W_" <+> mkStackApplyEntryLabel ty <> semi
285
false
false
0
9
66
76
36
40
null
null
mathhun/stack
src/Stack/Docker.hs
bsd-3-clause
removeDirectoryContents :: Path Abs Dir -- ^ Directory to remove contents of -> [Path Rel Dir] -- ^ Top-level directory names to exclude from removal -> [Path Rel File] -- ^ Top-level file names to exclude from removal -> IO () removeDirectoryContents path excludeDirs excludeFiles = do isRootDir <- dirExists path when isRootDir (do (lsd,lsf) <- listDirectory path forM_ lsd (\d -> unless (dirname d `elem` excludeDirs) (removeTree d)) forM_ lsf (\f -> unless (filename f `elem` excludeFiles) (removeFile f))) -- | Produce a strict 'S.ByteString' from the stdout of a -- process. Throws a 'ReadProcessException' exception if the -- process fails. Logs process's stderr using @$logError@.
915
removeDirectoryContents :: Path Abs Dir -- ^ Directory to remove contents of -> [Path Rel Dir] -- ^ Top-level directory names to exclude from removal -> [Path Rel File] -- ^ Top-level file names to exclude from removal -> IO () removeDirectoryContents path excludeDirs excludeFiles = do isRootDir <- dirExists path when isRootDir (do (lsd,lsf) <- listDirectory path forM_ lsd (\d -> unless (dirname d `elem` excludeDirs) (removeTree d)) forM_ lsf (\f -> unless (filename f `elem` excludeFiles) (removeFile f))) -- | Produce a strict 'S.ByteString' from the stdout of a -- process. Throws a 'ReadProcessException' exception if the -- process fails. Logs process's stderr using @$logError@.
915
removeDirectoryContents path excludeDirs excludeFiles = do isRootDir <- dirExists path when isRootDir (do (lsd,lsf) <- listDirectory path forM_ lsd (\d -> unless (dirname d `elem` excludeDirs) (removeTree d)) forM_ lsf (\f -> unless (filename f `elem` excludeFiles) (removeFile f))) -- | Produce a strict 'S.ByteString' from the stdout of a -- process. Throws a 'ReadProcessException' exception if the -- process fails. Logs process's stderr using @$logError@.
615
false
true
0
17
333
177
90
87
null
null
FlashKorten/recogs
src/Recogs/Util/RandomList.hs
mit
shuffle :: [a] -> IO [a] shuffle = evalRandIO . permute
55
shuffle :: [a] -> IO [a] shuffle = evalRandIO . permute
55
shuffle = evalRandIO . permute
30
false
true
0
7
10
28
15
13
null
null
justinethier/husk-scheme
hs-src/Language/Scheme/Macro/ExplicitRenaming.hs
mit
-- |The explicit renaming /compare/ function exCompare :: Env -- ^ Environment of use -> Env -- ^ Environment with renames -> Env -- ^ Environment of definition -> [LispVal] -- ^ Values to compare -> IOThrowsError LispVal exCompare _ _ _ [a, b] = do return $ Bool $ eqVal a b
339
exCompare :: Env -- ^ Environment of use -> Env -- ^ Environment with renames -> Env -- ^ Environment of definition -> [LispVal] -- ^ Values to compare -> IOThrowsError LispVal exCompare _ _ _ [a, b] = do return $ Bool $ eqVal a b
294
exCompare _ _ _ [a, b] = do return $ Bool $ eqVal a b
55
true
true
0
11
116
74
38
36
null
null
janrain/riak-haskell-client
src/Network/Riak/Functions.hs
apache-2.0
mapEither :: (a -> c) -> (b -> d) -> Either a b -> Either c d mapEither f _ (Left l) = Left (f l)
98
mapEither :: (a -> c) -> (b -> d) -> Either a b -> Either c d mapEither f _ (Left l) = Left (f l)
98
mapEither f _ (Left l) = Left (f l)
36
false
true
0
8
26
69
34
35
null
null
prikhi/hkredmine
src/Web/HTTP/Redmine/Client.hs
gpl-3.0
deleteEndPoint :: EndPoint -> Redmine () deleteEndPoint ep = do initReq <- redmineRequest ep void $ makeRequest initReq { method = "DELETE" } -- | Send a Request to a Redmine Instance
233
deleteEndPoint :: EndPoint -> Redmine () deleteEndPoint ep = do initReq <- redmineRequest ep void $ makeRequest initReq { method = "DELETE" } -- | Send a Request to a Redmine Instance
233
deleteEndPoint ep = do initReq <- redmineRequest ep void $ makeRequest initReq { method = "DELETE" } -- | Send a Request to a Redmine Instance
192
false
true
0
10
81
52
25
27
null
null
facebookincubator/duckling
Duckling/Rules/KA.hs
bsd-3-clause
langRules (Seal TimeGrain) = TimeGrain.rules
44
langRules (Seal TimeGrain) = TimeGrain.rules
44
langRules (Seal TimeGrain) = TimeGrain.rules
44
false
false
0
6
4
18
8
10
null
null
andreasfrom/truths
Form.hs
mit
rights showF p op q = showF p <> op <> "(" <> showF q <> ")"
60
rights showF p op q = showF p <> op <> "(" <> showF q <> ")"
60
rights showF p op q = showF p <> op <> "(" <> showF q <> ")"
60
false
false
0
9
16
37
17
20
null
null
alang9/deque
Data/Deque/NonCat.hs
bsd-3-clause
fixup2' (BigR (RX B0 (B2 n o)) N (TinyL (B3 (P s t) (P u v) (P w x)))) = go8 s t u v w x n o
120
fixup2' (BigR (RX B0 (B2 n o)) N (TinyL (B3 (P s t) (P u v) (P w x)))) = go8 s t u v w x n o
120
fixup2' (BigR (RX B0 (B2 n o)) N (TinyL (B3 (P s t) (P u v) (P w x)))) = go8 s t u v w x n o
120
false
false
0
12
56
93
45
48
null
null
judah/haskeline
System/Console/Haskeline/IO.hs
bsd-3-clause
-- | Initialize a session of line-oriented user interaction. initializeInput :: Settings IO -> IO InputState initializeInput settings = do reqV <- newEmptyMVar finished <- newEmptyMVar tid <- forkIO (runHaskeline settings reqV finished) return HD {requestVar = reqV, forkedThread = tid, subthreadFinished = finished}
348
initializeInput :: Settings IO -> IO InputState initializeInput settings = do reqV <- newEmptyMVar finished <- newEmptyMVar tid <- forkIO (runHaskeline settings reqV finished) return HD {requestVar = reqV, forkedThread = tid, subthreadFinished = finished}
287
initializeInput settings = do reqV <- newEmptyMVar finished <- newEmptyMVar tid <- forkIO (runHaskeline settings reqV finished) return HD {requestVar = reqV, forkedThread = tid, subthreadFinished = finished}
239
true
true
0
11
75
90
43
47
null
null
AlbinTheander/oden
src/Oden/Output/Parser.hs
mit
commaOr [x] = text x
20
commaOr [x] = text x
20
commaOr [x] = text x
20
false
false
0
6
4
15
7
8
null
null
lemilonkh/algorithmuss
visuals/Util.hs
mit
desat = hsv $ modY (*0.9)
25
desat = hsv $ modY (*0.9)
25
desat = hsv $ modY (*0.9)
25
false
false
0
7
5
17
9
8
null
null
Concelo/concelo
src/Data/Tree/RBTree.hs
bsd-3-clause
succZip :: RBZip a -> RBZip a succZip (RBZip (Node c v l r@(Node _ _ _ _)) path) = leftMostZip (RBZip r ((Step c v ToRight l):path))
132
succZip :: RBZip a -> RBZip a succZip (RBZip (Node c v l r@(Node _ _ _ _)) path) = leftMostZip (RBZip r ((Step c v ToRight l):path))
132
succZip (RBZip (Node c v l r@(Node _ _ _ _)) path) = leftMostZip (RBZip r ((Step c v ToRight l):path))
102
false
true
0
12
27
89
44
45
null
null
tjakway/ghcjvm
compiler/typecheck/TcRnTypes.hs
bsd-3-clause
-- | Access the 'EvBindsVar' carried by the 'TcPluginM' during -- constraint solving. Returns 'Nothing' if invoked during -- 'tcPluginInit' or 'tcPluginStop'. getEvBindsTcPluginM_maybe :: TcPluginM (Maybe EvBindsVar) getEvBindsTcPluginM_maybe = TcPluginM return
262
getEvBindsTcPluginM_maybe :: TcPluginM (Maybe EvBindsVar) getEvBindsTcPluginM_maybe = TcPluginM return
102
getEvBindsTcPluginM_maybe = TcPluginM return
44
true
true
1
7
31
29
14
15
null
null
kyagrd/mininax
src/Infer.hs
bsd-2-clause
replaceSuffix xs ys = reverse (drop (length ys) (reverse xs)) ++ ys
67
replaceSuffix xs ys = reverse (drop (length ys) (reverse xs)) ++ ys
67
replaceSuffix xs ys = reverse (drop (length ys) (reverse xs)) ++ ys
67
false
false
0
10
11
38
18
20
null
null
asayers/manifesto
src/Manifesto/Types.hs
bsd-2-clause
hTsLabel = "timestamp: "
30
hTsLabel = "timestamp: "
30
hTsLabel = "timestamp: "
30
false
false
1
5
9
10
3
7
null
null
joehillen/aura
src/Aura/Install.hs
gpl-3.0
displayPkgDeps :: InstallOptions -> [String] -> Aura () displayPkgDeps _ [] = return ()
87
displayPkgDeps :: InstallOptions -> [String] -> Aura () displayPkgDeps _ [] = return ()
87
displayPkgDeps _ [] = return ()
31
false
true
0
9
13
43
20
23
null
null
brendanhay/gogol
gogol-shopping-content/gen/Network/Google/ShoppingContent/Types/Product.hs
mpl-2.0
-- | Required. Minutes of hour of day. Must be from 0 to 59. dtMinutes :: Lens' DateTime'' (Maybe Int32) dtMinutes = lens _dtMinutes (\ s a -> s{_dtMinutes = a}) . mapping _Coerce
187
dtMinutes :: Lens' DateTime'' (Maybe Int32) dtMinutes = lens _dtMinutes (\ s a -> s{_dtMinutes = a}) . mapping _Coerce
126
dtMinutes = lens _dtMinutes (\ s a -> s{_dtMinutes = a}) . mapping _Coerce
82
true
true
0
10
41
55
28
27
null
null
fmthoma/ghc
libraries/template-haskell/Language/Haskell/TH/Syntax.hs
bsd-3-clause
thenCmp :: Ordering -> Ordering -> Ordering thenCmp EQ o2 = o2
62
thenCmp :: Ordering -> Ordering -> Ordering thenCmp EQ o2 = o2
62
thenCmp EQ o2 = o2
18
false
true
0
6
11
24
12
12
null
null
josuf107/Adverb
Adverb/Common.hs
gpl-3.0
unenviously = id
16
unenviously = id
16
unenviously = id
16
false
false
0
4
2
6
3
3
null
null
snoyberg/yesodcms
Handler/Page.hs
bsd-2-clause
getPageR' :: [T.Text] -> Handler RepHtml getPageR' ts = do mu <- maybeAuth let canWrite = fmap (userAdmin . snd) mu == Just True Cms { formatHandlers = fhs, fileStore = fs } <- getYesod mfile <- liftIO $ findFile "page" ts fs fhs case mfile of Just (fh, ext, enum) -> do mtitle <- liftIO $ fhTitle fh (fsSM fs) enum let widget = fhWidget fh (fsSM fs) enum defaultLayout $ do maybe (return ()) (setTitle . toHtml) mtitle $(widgetFile "show-page") Nothing -> do unless canWrite notFound defaultLayout $(widgetFile "create-wiki-page") where pieces' ext = "page" : ts ++ ["index." `T.append` ext]
726
getPageR' :: [T.Text] -> Handler RepHtml getPageR' ts = do mu <- maybeAuth let canWrite = fmap (userAdmin . snd) mu == Just True Cms { formatHandlers = fhs, fileStore = fs } <- getYesod mfile <- liftIO $ findFile "page" ts fs fhs case mfile of Just (fh, ext, enum) -> do mtitle <- liftIO $ fhTitle fh (fsSM fs) enum let widget = fhWidget fh (fsSM fs) enum defaultLayout $ do maybe (return ()) (setTitle . toHtml) mtitle $(widgetFile "show-page") Nothing -> do unless canWrite notFound defaultLayout $(widgetFile "create-wiki-page") where pieces' ext = "page" : ts ++ ["index." `T.append` ext]
726
getPageR' ts = do mu <- maybeAuth let canWrite = fmap (userAdmin . snd) mu == Just True Cms { formatHandlers = fhs, fileStore = fs } <- getYesod mfile <- liftIO $ findFile "page" ts fs fhs case mfile of Just (fh, ext, enum) -> do mtitle <- liftIO $ fhTitle fh (fsSM fs) enum let widget = fhWidget fh (fsSM fs) enum defaultLayout $ do maybe (return ()) (setTitle . toHtml) mtitle $(widgetFile "show-page") Nothing -> do unless canWrite notFound defaultLayout $(widgetFile "create-wiki-page") where pieces' ext = "page" : ts ++ ["index." `T.append` ext]
685
false
true
1
18
235
273
130
143
null
null
dmp1ce/Haskell-Programming-Exercises
Chapter 22/Chapter Exercises.hs
unlicense
x2 :: Maybe (Integer, Integer) x2 = (,) <$> ys <*> zs
53
x2 :: Maybe (Integer, Integer) x2 = (,) <$> ys <*> zs
53
x2 = (,) <$> ys <*> zs
22
false
true
0
7
11
31
17
14
null
null
urbanslug/ghc
compiler/llvmGen/LlvmCodeGen/CodeGen.hs
bsd-3-clause
-- | Convert a CmmExpr to a list of LlvmStatements with the result of the -- expression being stored in the returned LlvmVar. exprToVar :: CmmExpr -> LlvmM ExprData exprToVar = exprToVarOpt wordOption
200
exprToVar :: CmmExpr -> LlvmM ExprData exprToVar = exprToVarOpt wordOption
74
exprToVar = exprToVarOpt wordOption
35
true
true
0
7
32
29
13
16
null
null
kelnage/tamarin-prover
lib/term/src/Term/Term/Raw.hs
gpl-3.0
-- | Smart constructor for AC terms. fAppAC :: Ord a => ACSym -> [Term a] -> Term a fAppAC _ [] = error "Term.fAppAC: empty argument list"
143
fAppAC :: Ord a => ACSym -> [Term a] -> Term a fAppAC _ [] = error "Term.fAppAC: empty argument list"
106
fAppAC _ [] = error "Term.fAppAC: empty argument list"
59
true
true
0
10
32
51
23
28
null
null
GaloisInc/halvm-ghc
compiler/ghci/ByteCodeGen.hs
bsd-3-clause
findPushSeq (N: rest) = (PUSH_APPLY_N, 1, rest)
49
findPushSeq (N: rest) = (PUSH_APPLY_N, 1, rest)
49
findPushSeq (N: rest) = (PUSH_APPLY_N, 1, rest)
49
false
false
0
7
8
25
14
11
null
null
vincenthz/hs-foundation
basement/Basement/UArray/Mutable.hs
bsd-3-clause
mutableLength :: PrimType ty => MUArray ty st -> CountOf ty mutableLength (MUArray _ end _) = end
99
mutableLength :: PrimType ty => MUArray ty st -> CountOf ty mutableLength (MUArray _ end _) = end
99
mutableLength (MUArray _ end _) = end
39
false
true
0
7
19
43
20
23
null
null
kmels/hledger
hledger-lib/Hledger/Data/Dates.hs
gpl-3.0
spanEnd :: DateSpan -> Maybe Day spanEnd (DateSpan _ d) = d
59
spanEnd :: DateSpan -> Maybe Day spanEnd (DateSpan _ d) = d
59
spanEnd (DateSpan _ d) = d
26
false
true
0
6
11
33
15
18
null
null
sherwoodwang/wxHaskell
wxcore/src/haskell/Graphics/UI/WXCore/WxcDefs.hs
lgpl-2.1
wxSTC_CAML_CHAR :: Int wxSTC_CAML_CHAR = 9
42
wxSTC_CAML_CHAR :: Int wxSTC_CAML_CHAR = 9
42
wxSTC_CAML_CHAR = 9
19
false
true
0
6
5
18
7
11
null
null
green-haskell/ghc
compiler/main/Packages.hs
bsd-3-clause
calcKey :: PackageConfig -> PackageKey calcKey p | pk <- packageNameString p , pk `elem` wired_in_pkgids = stringToPackageKey pk | otherwise = packageConfigId p
202
calcKey :: PackageConfig -> PackageKey calcKey p | pk <- packageNameString p , pk `elem` wired_in_pkgids = stringToPackageKey pk | otherwise = packageConfigId p
202
calcKey p | pk <- packageNameString p , pk `elem` wired_in_pkgids = stringToPackageKey pk | otherwise = packageConfigId p
163
false
true
0
9
65
56
26
30
null
null
mightymoose/RubyQuiz
quiz_1/solution.hs
bsd-2-clause
shuffleStepFour d = (bottomCut d) ++ (middleCut d) ++ (topCut d)
64
shuffleStepFour d = (bottomCut d) ++ (middleCut d) ++ (topCut d)
64
shuffleStepFour d = (bottomCut d) ++ (middleCut d) ++ (topCut d)
64
false
false
0
8
10
35
17
18
null
null
mightymoose/liquidhaskell
tests/pos/mapreduce-bare.hs
bsd-3-clause
mytest = let docs = [ "this is the end" , "go to the end" , "the end is the beginning"] in putStrLn $ isZero {- show -} $ wordCount docs
167
mytest = let docs = [ "this is the end" , "go to the end" , "the end is the beginning"] in putStrLn $ isZero {- show -} $ wordCount docs
167
mytest = let docs = [ "this is the end" , "go to the end" , "the end is the beginning"] in putStrLn $ isZero {- show -} $ wordCount docs
167
false
false
5
9
61
43
20
23
null
null
nh2/shake
Development/Ninja/Parse.hs
bsd-3-clause
splitUnescaped :: Char -> Str -> (Str, Str) splitUnescaped c x = case filter valid $ BS.elemIndices c x of [] -> (x, BS.empty) i:_ -> (BS.take i x, BS.drop (i+1) x) where -- technically there could be $$:, so an escaped $ followed by a literal : -- that seems very unlikely... valid i = i == 0 || BS.index x (i-1) /= '$' -- Find a non-escape :
390
splitUnescaped :: Char -> Str -> (Str, Str) splitUnescaped c x = case filter valid $ BS.elemIndices c x of [] -> (x, BS.empty) i:_ -> (BS.take i x, BS.drop (i+1) x) where -- technically there could be $$:, so an escaped $ followed by a literal : -- that seems very unlikely... valid i = i == 0 || BS.index x (i-1) /= '$' -- Find a non-escape :
389
splitUnescaped c x = case filter valid $ BS.elemIndices c x of [] -> (x, BS.empty) i:_ -> (BS.take i x, BS.drop (i+1) x) where -- technically there could be $$:, so an escaped $ followed by a literal : -- that seems very unlikely... valid i = i == 0 || BS.index x (i-1) /= '$' -- Find a non-escape :
345
false
true
1
11
116
149
74
75
null
null
hephaestus-pl/hephaestus
alexandre/feature-modeling/src/FeatureModel/NewTypes/Types.hs
mit
getClauses otherwhise = []
31
getClauses otherwhise = []
31
getClauses otherwhise = []
31
false
false
0
5
8
11
5
6
null
null
DaMSL/K3
src/Language/K3/Metaprogram/Evaluation.hs
apache-2.0
spliceBinder (BRecord ijs) = mapM (\(i,j) -> (,) <$> spliceIdentifier i <*> spliceIdentifier j) ijs >>= return . BRecord
120
spliceBinder (BRecord ijs) = mapM (\(i,j) -> (,) <$> spliceIdentifier i <*> spliceIdentifier j) ijs >>= return . BRecord
120
spliceBinder (BRecord ijs) = mapM (\(i,j) -> (,) <$> spliceIdentifier i <*> spliceIdentifier j) ijs >>= return . BRecord
120
false
false
0
12
18
59
30
29
null
null
vdweegen/UvA-Software_Testing
Lab1/Cas/Exercises.hs
gpl-3.0
guilty, honest :: [Boy] -- 3 tell the truth (so we check who is accused exactly 3 times) guilty = [x | x <- boys, length (accusers x) == 3]
139
guilty, honest :: [Boy] guilty = [x | x <- boys, length (accusers x) == 3]
74
guilty = [x | x <- boys, length (accusers x) == 3]
50
true
true
2
11
29
56
26
30
null
null
supermario/stack
src/Stack/Image.hs
bsd-3-clause
-- | Convert Docker image opts monoid to Docker image options. imgDockerOptsFromMonoid :: ImageDockerOptsMonoid -> ImageDockerOpts imgDockerOptsFromMonoid ImageDockerOptsMonoid{..} = ImageDockerOpts { imgDockerBase = emptyToNothing imgDockerMonoidBase , imgDockerEntrypoints = emptyToNothing imgDockerMonoidEntrypoints , imgDockerAdd = fromMaybe Map.empty imgDockerMonoidAdd , imgDockerImageName = emptyToNothing imgDockerMonoidImageName } where emptyToNothing Nothing = Nothing emptyToNothing (Just s) | null s = Nothing | otherwise = Just s -- | Stack image exceptions.
670
imgDockerOptsFromMonoid :: ImageDockerOptsMonoid -> ImageDockerOpts imgDockerOptsFromMonoid ImageDockerOptsMonoid{..} = ImageDockerOpts { imgDockerBase = emptyToNothing imgDockerMonoidBase , imgDockerEntrypoints = emptyToNothing imgDockerMonoidEntrypoints , imgDockerAdd = fromMaybe Map.empty imgDockerMonoidAdd , imgDockerImageName = emptyToNothing imgDockerMonoidImageName } where emptyToNothing Nothing = Nothing emptyToNothing (Just s) | null s = Nothing | otherwise = Just s -- | Stack image exceptions.
607
imgDockerOptsFromMonoid ImageDockerOptsMonoid{..} = ImageDockerOpts { imgDockerBase = emptyToNothing imgDockerMonoidBase , imgDockerEntrypoints = emptyToNothing imgDockerMonoidEntrypoints , imgDockerAdd = fromMaybe Map.empty imgDockerMonoidAdd , imgDockerImageName = emptyToNothing imgDockerMonoidImageName } where emptyToNothing Nothing = Nothing emptyToNothing (Just s) | null s = Nothing | otherwise = Just s -- | Stack image exceptions.
539
true
true
1
8
163
117
58
59
null
null
ImsungChoi/haskell-test
src/HW02.hs
bsd-3-clause
filterCodes :: Move -> [Code] -> [Code] filterCodes m = filter (isConsistent m)
79
filterCodes :: Move -> [Code] -> [Code] filterCodes m = filter (isConsistent m)
79
filterCodes m = filter (isConsistent m)
39
false
true
0
7
12
37
19
18
null
null
kadena-io/pact
src/Pact/Types/Term.hs
bsd-3-clause
canEq TLiteral{} TLiteral{} = True
34
canEq TLiteral{} TLiteral{} = True
34
canEq TLiteral{} TLiteral{} = True
34
false
false
0
6
4
19
9
10
null
null
Elastifile/git-sling
server/src/Sling/Proposal.hs
gpl-2.0
slingPrefix :: Text slingPrefix = "sling"
41
slingPrefix :: Text slingPrefix = "sling"
41
slingPrefix = "sling"
21
false
true
0
6
5
18
7
11
null
null
Concomitant/LambdaHack
Game/LambdaHack/Common/RingBuffer.hs
bsd-3-clause
empty :: Int -> a -> RingBuffer a empty size dummy = RingBuffer (V.replicate size dummy) 0 0
92
empty :: Int -> a -> RingBuffer a empty size dummy = RingBuffer (V.replicate size dummy) 0 0
92
empty size dummy = RingBuffer (V.replicate size dummy) 0 0
58
false
true
0
8
17
49
22
27
null
null
li-zhirui/EoplLangs
src/CallByNeed/Parser.hs
bsd-3-clause
-- | CondExpr ::= cond {Expression ==> Expression}* end condExpr :: Parser Expression condExpr = do keyWord "cond" pairs <- many pair keyWord "end" return $ CondExpr pairs where pair = try $ do expr1 <- expression longArrow expr2 <- expression return (expr1, expr2) -- | ProcExpr ::= proc ({Identifier}*) Expression
354
condExpr :: Parser Expression condExpr = do keyWord "cond" pairs <- many pair keyWord "end" return $ CondExpr pairs where pair = try $ do expr1 <- expression longArrow expr2 <- expression return (expr1, expr2) -- | ProcExpr ::= proc ({Identifier}*) Expression
298
condExpr = do keyWord "cond" pairs <- many pair keyWord "end" return $ CondExpr pairs where pair = try $ do expr1 <- expression longArrow expr2 <- expression return (expr1, expr2) -- | ProcExpr ::= proc ({Identifier}*) Expression
268
true
true
0
9
89
89
40
49
null
null
tweag/distributed-process
src/Control/Distributed/Process/Management.hs
bsd-3-clause
-- | The 'MxAgent' version of 'mxNotify'. -- mxBroadcast :: (Serializable m) => m -> MxAgent s () mxBroadcast msg = do state <- ST.get liftMX $ liftIO $ atomically $ do writeTChan (mxBus state) (unsafeCreateUnencodedMessage msg) -- | Gracefully terminate an agent. --
276
mxBroadcast :: (Serializable m) => m -> MxAgent s () mxBroadcast msg = do state <- ST.get liftMX $ liftIO $ atomically $ do writeTChan (mxBus state) (unsafeCreateUnencodedMessage msg) -- | Gracefully terminate an agent. --
231
mxBroadcast msg = do state <- ST.get liftMX $ liftIO $ atomically $ do writeTChan (mxBus state) (unsafeCreateUnencodedMessage msg) -- | Gracefully terminate an agent. --
178
true
true
0
12
52
82
41
41
null
null
rueshyna/gogol
gogol-dfareporting/gen/Network/Google/Resource/DFAReporting/UserRoles/List.hs
mpl-2.0
-- | Select only account level user roles not associated with any specific -- subaccount. urlAccountUserRoleOnly :: Lens' UserRolesList (Maybe Bool) urlAccountUserRoleOnly = lens _urlAccountUserRoleOnly (\ s a -> s{_urlAccountUserRoleOnly = a})
252
urlAccountUserRoleOnly :: Lens' UserRolesList (Maybe Bool) urlAccountUserRoleOnly = lens _urlAccountUserRoleOnly (\ s a -> s{_urlAccountUserRoleOnly = a})
162
urlAccountUserRoleOnly = lens _urlAccountUserRoleOnly (\ s a -> s{_urlAccountUserRoleOnly = a})
103
true
true
0
9
39
49
26
23
null
null
kyren/hsgb
lib/Gameboy/Util.hs
unlicense
lowNibble :: Word8 -> Word8 lowNibble w = w .&. 0x0f
52
lowNibble :: Word8 -> Word8 lowNibble w = w .&. 0x0f
52
lowNibble w = w .&. 0x0f
24
false
true
2
7
10
30
13
17
null
null
aisamanra/matterhorn
src/Types/Messages.hs
bsd-3-clause
isReplyable :: Message -> Bool isReplyable m = isJust (messagePostId m) && (_mType m `elem` [CP NormalPost, CP Emote])
126
isReplyable :: Message -> Bool isReplyable m = isJust (messagePostId m) && (_mType m `elem` [CP NormalPost, CP Emote])
126
isReplyable m = isJust (messagePostId m) && (_mType m `elem` [CP NormalPost, CP Emote])
95
false
true
0
9
26
55
28
27
null
null
jwiegley/ghc-release
libraries/bytestring/Data/ByteString/Lazy.hs
gpl-3.0
-- | Write a 'ByteString' to a file. -- writeFile :: FilePath -> ByteString -> IO () writeFile f txt = bracket (openBinaryFile f WriteMode) hClose (\hdl -> hPut hdl txt)
173
writeFile :: FilePath -> ByteString -> IO () writeFile f txt = bracket (openBinaryFile f WriteMode) hClose (\hdl -> hPut hdl txt)
133
writeFile f txt = bracket (openBinaryFile f WriteMode) hClose (\hdl -> hPut hdl txt)
88
true
true
0
9
34
66
31
35
null
null
bmmoore/logic
Logic/Orders.hs
bsd-3-clause
{- t = Term . Function v = VarTerm . Var -} multiGe :: (Eq a) => MbOrder a -> (Multiset a -> Multiset a -> Bool) multiGe termOrd m1 m2 = all (\(t1,k1) -> (case lookup t1 m2 of Just k2 -> k1 >= k2 || any (\(t',k') -> termOrd t' t1 == Ordered GT && case lookup t' m2 of Just k2' -> k' > k2' Nothing -> True) m1 Nothing -> True)) m1
428
multiGe :: (Eq a) => MbOrder a -> (Multiset a -> Multiset a -> Bool) multiGe termOrd m1 m2 = all (\(t1,k1) -> (case lookup t1 m2 of Just k2 -> k1 >= k2 || any (\(t',k') -> termOrd t' t1 == Ordered GT && case lookup t' m2 of Just k2' -> k' > k2' Nothing -> True) m1 Nothing -> True)) m1
383
multiGe termOrd m1 m2 = all (\(t1,k1) -> (case lookup t1 m2 of Just k2 -> k1 >= k2 || any (\(t',k') -> termOrd t' t1 == Ordered GT && case lookup t' m2 of Just k2' -> k' > k2' Nothing -> True) m1 Nothing -> True)) m1
314
true
true
0
20
174
169
85
84
null
null
seL4/capDL-tool
CapDL/PrintUtils.hs
bsd-2-clause
prettyBits bits = num bits <+> text "bits"
42
prettyBits bits = num bits <+> text "bits"
42
prettyBits bits = num bits <+> text "bits"
42
false
false
0
6
7
19
8
11
null
null
PSU-CS-300-Fall2015/taunet-utils
LocalAddr.hs
gpl-3.0
hostAddr :: SockAddr -> AddressData hostAddr (SockAddrInet _ ha) = AddressDataIPv4 ha
89
hostAddr :: SockAddr -> AddressData hostAddr (SockAddrInet _ ha) = AddressDataIPv4 ha
89
hostAddr (SockAddrInet _ ha) = AddressDataIPv4 ha
53
false
true
0
6
15
33
15
18
null
null
stevely/hspirv
src/SpirV/Builder/Raw.hs
bsd-3-clause
getKernelNDrangeSubGroupCount :: Id -> Id -> Id -> Builder Id getKernelNDrangeSubGroupCount = fourOp OpGetKernelNDrangeSubGroupCount
132
getKernelNDrangeSubGroupCount :: Id -> Id -> Id -> Builder Id getKernelNDrangeSubGroupCount = fourOp OpGetKernelNDrangeSubGroupCount
132
getKernelNDrangeSubGroupCount = fourOp OpGetKernelNDrangeSubGroupCount
70
false
true
0
8
13
29
14
15
null
null
cheng81/schemish
app/Main.hs
bsd-3-clause
primitiveBindings :: IO Env primitiveBindings = nullEnv >>= flip bindVars (map (makeFunc PrimitiveFunc) primitives ++map (makeFunc IOFunc) ioPrimitives ++map (makeFunc SpecialForm) specialForms ) where makeFunc constructor (var, func) = (var, constructor func)
397
primitiveBindings :: IO Env primitiveBindings = nullEnv >>= flip bindVars (map (makeFunc PrimitiveFunc) primitives ++map (makeFunc IOFunc) ioPrimitives ++map (makeFunc SpecialForm) specialForms ) where makeFunc constructor (var, func) = (var, constructor func)
397
primitiveBindings = nullEnv >>= flip bindVars (map (makeFunc PrimitiveFunc) primitives ++map (makeFunc IOFunc) ioPrimitives ++map (makeFunc SpecialForm) specialForms ) where makeFunc constructor (var, func) = (var, constructor func)
369
false
true
0
12
168
95
47
48
null
null
bgamari/linear
src/Linear/Vector.hs
bsd-3-clause
-- | Outer (tensor) product of two vectors outer :: (Functor f, Functor g, Num a) => f a -> g a -> f (g a) outer a b = fmap (\x->fmap (*x) b) a
143
outer :: (Functor f, Functor g, Num a) => f a -> g a -> f (g a) outer a b = fmap (\x->fmap (*x) b) a
100
outer a b = fmap (\x->fmap (*x) b) a
36
true
true
0
10
34
83
42
41
null
null
jstolarek/ghc
compiler/nativeGen/X86/Ppr.hs
bsd-3-clause
pprInstr g@(GTAN sz l1 l2 src dst) = pprG g (pprTrigOp "fptan" True l1 l2 src dst sz)
88
pprInstr g@(GTAN sz l1 l2 src dst) = pprG g (pprTrigOp "fptan" True l1 l2 src dst sz)
88
pprInstr g@(GTAN sz l1 l2 src dst) = pprG g (pprTrigOp "fptan" True l1 l2 src dst sz)
88
false
false
0
8
20
49
24
25
null
null
wkoiking/intervals
app/Main.hs
bsd-3-clause
main = do contents <- getContents case parse (endBy intervalP eol) "" contents of Right intervals -> do mapM_ (putStrLn . showInterval) $ joinIntervals intervals Left err -> putStrLn $ show err
232
main = do contents <- getContents case parse (endBy intervalP eol) "" contents of Right intervals -> do mapM_ (putStrLn . showInterval) $ joinIntervals intervals Left err -> putStrLn $ show err
232
main = do contents <- getContents case parse (endBy intervalP eol) "" contents of Right intervals -> do mapM_ (putStrLn . showInterval) $ joinIntervals intervals Left err -> putStrLn $ show err
232
false
false
1
16
70
84
36
48
null
null
pparkkin/eta
compiler/ETA/CodeGen/Prim.hs
bsd-3-clause
shouldInlinePrimOp' _ DeRefStablePtrOp args = Right $ return [ normalOp (invokestatic (mkMethodRef "eta/runtime/stg/StablePtrTable" "getClosure" [jint] (ret closureType))) args ]
180
shouldInlinePrimOp' _ DeRefStablePtrOp args = Right $ return [ normalOp (invokestatic (mkMethodRef "eta/runtime/stg/StablePtrTable" "getClosure" [jint] (ret closureType))) args ]
180
shouldInlinePrimOp' _ DeRefStablePtrOp args = Right $ return [ normalOp (invokestatic (mkMethodRef "eta/runtime/stg/StablePtrTable" "getClosure" [jint] (ret closureType))) args ]
180
false
false
0
12
20
55
27
28
null
null
alphalambda/codeworld
codeworld-compiler/src/CodeWorld/Compile/Stages.hs
apache-2.0
isParenthesizedOpExp (Con _ qname) = isOpQName qname
52
isParenthesizedOpExp (Con _ qname) = isOpQName qname
52
isParenthesizedOpExp (Con _ qname) = isOpQName qname
52
false
false
0
7
6
20
9
11
null
null
sgillespie/ghc
compiler/simplStg/RepType.hs
bsd-3-clause
slotPrimRep Word64Slot = Word64Rep
35
slotPrimRep Word64Slot = Word64Rep
35
slotPrimRep Word64Slot = Word64Rep
35
false
false
0
5
4
9
4
5
null
null
alephcloud/hs-aws-general
src/Aws/SignatureV4.hs
mit
-- | Create Canonical Request for AWS Signature Version 4 -- -- <http://docs.aws.amazon.com/general/1.0/gr/sigv4-create-canonical-request.html> -- -- This functions performs normalization of the URI and the Headers which is -- expensive. We should consider providing an alternate version of this -- function that bypasses these steps and simply assumes that the input is -- already canonical. -- canonicalRequest :: HTTP.Method -- ^ HTTP method of request -> UriPath -- ^ canonical URI Path of request -> UriQuery -- ^ canonical URI Query of request -> HTTP.RequestHeaders -- ^ canonical request headers -> B.ByteString -- ^ Request payload -> CanonicalRequest canonicalRequest method path query headers payload = CanonicalRequest $ B8.intercalate "\n" [ method , cUri , cHeaders , sHeaders , signingHash16 payload ] where CanonicalUri cUri = canonicalUri path query CanonicalHeaders cHeaders = canonicalHeaders headers SignedHeaders sHeaders = signedHeaders headers -- The hash is stored hex encoded --
1,094
canonicalRequest :: HTTP.Method -- ^ HTTP method of request -> UriPath -- ^ canonical URI Path of request -> UriQuery -- ^ canonical URI Query of request -> HTTP.RequestHeaders -- ^ canonical request headers -> B.ByteString -- ^ Request payload -> CanonicalRequest canonicalRequest method path query headers payload = CanonicalRequest $ B8.intercalate "\n" [ method , cUri , cHeaders , sHeaders , signingHash16 payload ] where CanonicalUri cUri = canonicalUri path query CanonicalHeaders cHeaders = canonicalHeaders headers SignedHeaders sHeaders = signedHeaders headers -- The hash is stored hex encoded --
698
canonicalRequest method path query headers payload = CanonicalRequest $ B8.intercalate "\n" [ method , cUri , cHeaders , sHeaders , signingHash16 payload ] where CanonicalUri cUri = canonicalUri path query CanonicalHeaders cHeaders = canonicalHeaders headers SignedHeaders sHeaders = signedHeaders headers -- The hash is stored hex encoded --
409
true
true
2
10
235
128
73
55
null
null
mseri/fbmessenger-api-hs
src/Web/FBMessenger/API/Bot/SendAPI.hs
bsd-3-clause
-- | Set a welcome message, this can be an image message (containing an image url) -- or any template message (generic, button, receipt). -- In addition to the token and the message request, you need to provide the -- facebook page_id. -- Return a simple object containing a string indicating if the welcome message -- is correctly registered. setWelcomeMessage :: Maybe Token -> Text -> WelcomeMessageRequest -> Manager -> IO (Either ServantError WelcomeMessageResponse) setWelcomeMessage token pageId message manager = runClientM (welcomeMessage_ token pageId message) (ClientEnv manager graphAPIBaseUrl)
620
setWelcomeMessage :: Maybe Token -> Text -> WelcomeMessageRequest -> Manager -> IO (Either ServantError WelcomeMessageResponse) setWelcomeMessage token pageId message manager = runClientM (welcomeMessage_ token pageId message) (ClientEnv manager graphAPIBaseUrl)
266
setWelcomeMessage token pageId message manager = runClientM (welcomeMessage_ token pageId message) (ClientEnv manager graphAPIBaseUrl)
138
true
true
0
11
101
85
42
43
null
null
AlexeyRaga/eta
compiler/ETA/Prelude/PrimOp.hs
bsd-3-clause
primOpOutOfLine MaskUninterruptibleOp = True
44
primOpOutOfLine MaskUninterruptibleOp = True
44
primOpOutOfLine MaskUninterruptibleOp = True
44
false
false
0
4
3
10
4
6
null
null
kevintvh/sodium
haskell/src/FRP/Sodium/Plain.hs
bsd-3-clause
-- | Merge two streams of events of the same type. -- -- In the case where two event occurrences are simultaneous (i.e. both -- within the same transaction), both will be delivered in the same -- transaction. If the event firings are ordered for some reason, then -- their ordering is retained. In many common cases the ordering will -- be undefined. merge :: Event a -> Event a -> Event a merge ea eb = Event gl cacheRef (dep (ea, eb)) where cacheRef = unsafeNewIORef Nothing eb gl = do (l, push, nodeRef) <- ioReactive newEventImpl unlistener <- later $ do u1 <- linkedListen ea (Just nodeRef) False push u2 <- linkedListen eb (Just nodeRef) False $ schedulePrioritized (Just nodeRef) . push return (u1 >> u2) addCleanup_Listen unlistener l -- | Unwrap Just values, and discard event occurrences with Nothing values.
905
merge :: Event a -> Event a -> Event a merge ea eb = Event gl cacheRef (dep (ea, eb)) where cacheRef = unsafeNewIORef Nothing eb gl = do (l, push, nodeRef) <- ioReactive newEventImpl unlistener <- later $ do u1 <- linkedListen ea (Just nodeRef) False push u2 <- linkedListen eb (Just nodeRef) False $ schedulePrioritized (Just nodeRef) . push return (u1 >> u2) addCleanup_Listen unlistener l -- | Unwrap Just values, and discard event occurrences with Nothing values.
554
merge ea eb = Event gl cacheRef (dep (ea, eb)) where cacheRef = unsafeNewIORef Nothing eb gl = do (l, push, nodeRef) <- ioReactive newEventImpl unlistener <- later $ do u1 <- linkedListen ea (Just nodeRef) False push u2 <- linkedListen eb (Just nodeRef) False $ schedulePrioritized (Just nodeRef) . push return (u1 >> u2) addCleanup_Listen unlistener l -- | Unwrap Just values, and discard event occurrences with Nothing values.
515
true
true
1
17
229
189
93
96
null
null
unisonweb/platform
parser-typechecker/src/Unison/Runtime/Pattern.hs
mit
decomposeSeqP avoid (L n) (P.SequenceLiteral _ ps) | length ps >= n , (pl, pr) <- splitAt n ps = Cover $ P.SequenceLiteral u <$> [pl,pr] | otherwise = Disjoint where u = freshIn avoid $ typed Pattern
209
decomposeSeqP avoid (L n) (P.SequenceLiteral _ ps) | length ps >= n , (pl, pr) <- splitAt n ps = Cover $ P.SequenceLiteral u <$> [pl,pr] | otherwise = Disjoint where u = freshIn avoid $ typed Pattern
209
decomposeSeqP avoid (L n) (P.SequenceLiteral _ ps) | length ps >= n , (pl, pr) <- splitAt n ps = Cover $ P.SequenceLiteral u <$> [pl,pr] | otherwise = Disjoint where u = freshIn avoid $ typed Pattern
209
false
false
1
9
47
105
51
54
null
null
plaprade/haskoin
haskoin-core/src/Network/Haskoin/Test/Script.hs
unlicense
-- | Arbitrary ScriptOutput of type PayMS arbitraryMSOutput :: Gen ScriptOutput arbitraryMSOutput = do (m, n) <- arbitraryMSParam keys <- map snd <$> vectorOf n arbitraryPubKey return $ PayMulSig keys m -- | Arbitrary ScriptOutput of type PayMS containing only compressed keys
289
arbitraryMSOutput :: Gen ScriptOutput arbitraryMSOutput = do (m, n) <- arbitraryMSParam keys <- map snd <$> vectorOf n arbitraryPubKey return $ PayMulSig keys m -- | Arbitrary ScriptOutput of type PayMS containing only compressed keys
247
arbitraryMSOutput = do (m, n) <- arbitraryMSParam keys <- map snd <$> vectorOf n arbitraryPubKey return $ PayMulSig keys m -- | Arbitrary ScriptOutput of type PayMS containing only compressed keys
209
true
true
1
10
54
64
29
35
null
null
ancientlanguage/haskell-analysis
prepare/src/Prepare/Decompose.hs
mit
decomposeChar '\x022A' = "\x004F\x0308\x0304"
45
decomposeChar '\x022A' = "\x004F\x0308\x0304"
45
decomposeChar '\x022A' = "\x004F\x0308\x0304"
45
false
false
1
5
3
13
4
9
null
null
joelburget/haste-compiler
Tests/IntWrap.hs
bsd-3-clause
int_min :: Intish int_min = -2147483648
39
int_min :: Intish int_min = -2147483648
39
int_min = -2147483648
21
false
true
0
6
5
19
8
11
null
null
spechub/Hets
Comorphisms/Hs2HOLCFaux.hs
gpl-2.0
typEq :: Typ -> Typ -> Bool -- make some distinction for case noType? typEq t1 t2 = t1 == noTypeT || t2 == noTypeT || case (t1, t2) of (IsaSign.Type _ _ ls1, IsaSign.Type _ _ ls2) -> typeId t1 == typeId t2 && typeSort t1 == typeSort t2 && typLEq ls1 ls2 (TFree _ _, TFree _ _) -> typeSort t1 == typeSort t2 _ -> False
343
typEq :: Typ -> Typ -> Bool typEq t1 t2 = t1 == noTypeT || t2 == noTypeT || case (t1, t2) of (IsaSign.Type _ _ ls1, IsaSign.Type _ _ ls2) -> typeId t1 == typeId t2 && typeSort t1 == typeSort t2 && typLEq ls1 ls2 (TFree _ _, TFree _ _) -> typeSort t1 == typeSort t2 _ -> False
297
typEq t1 t2 = t1 == noTypeT || t2 == noTypeT || case (t1, t2) of (IsaSign.Type _ _ ls1, IsaSign.Type _ _ ls2) -> typeId t1 == typeId t2 && typeSort t1 == typeSort t2 && typLEq ls1 ls2 (TFree _ _, TFree _ _) -> typeSort t1 == typeSort t2 _ -> False
269
true
true
2
15
94
165
77
88
null
null
jean-edouard/manager
upgrade-db/UpgradeEngine.hs
gpl-2.0
mainConfigFile :: String mainConfigFile = "/config/db"
54
mainConfigFile :: String mainConfigFile = "/config/db"
54
mainConfigFile = "/config/db"
29
false
true
0
4
5
11
6
5
null
null
sseefried/play-space-online
config/Settings.hs
bsd-2-clause
withConnectionPool :: MonadControlIO m => (ConnectionPool -> m a) -> m a withConnectionPool = withSqlitePool connStr connectionCount
132
withConnectionPool :: MonadControlIO m => (ConnectionPool -> m a) -> m a withConnectionPool = withSqlitePool connStr connectionCount
132
withConnectionPool = withSqlitePool connStr connectionCount
59
false
true
0
9
16
40
19
21
null
null
abakst/liquidhaskell
benchmarks/vector-0.10.0.1/Data/Vector/Primitive/Mutable.nocpp.hs
bsd-3-clause
replicate = G.replicate
23
replicate = G.replicate
23
replicate = G.replicate
23
false
false
0
5
2
8
4
4
null
null
paulsamways/hs-scheme
src/Scheme.hs
bsd-3-clause
numBoolBinop = boolBinOp unpackNum
35
numBoolBinop = boolBinOp unpackNum
35
numBoolBinop = boolBinOp unpackNum
35
false
false
1
5
4
12
4
8
null
null
snoyberg/ghc
compiler/hsSyn/HsExpr.hs
bsd-3-clause
matchSeparator ThPatSplice = panic "unused"
44
matchSeparator ThPatSplice = panic "unused"
44
matchSeparator ThPatSplice = panic "unused"
44
false
false
0
5
5
12
5
7
null
null
league/postgrest
test/SpecHelper.hs
mit
acceptHdrs :: BS.ByteString -> [Header] acceptHdrs mime = [(hAccept, mime)]
75
acceptHdrs :: BS.ByteString -> [Header] acceptHdrs mime = [(hAccept, mime)]
75
acceptHdrs mime = [(hAccept, mime)]
35
false
true
0
6
9
32
18
14
null
null
GaloisInc/halvm-ghc
compiler/main/DynFlags.hs
bsd-3-clause
-- Determines whether we will be compiling -- info tables that reside just before the entry code, or with an -- indirection to the entry code. See TABLES_NEXT_TO_CODE in -- includes/rts/storage/InfoTables.h. mkTablesNextToCode :: Bool -> Bool mkTablesNextToCode unregisterised = not unregisterised && cGhcEnableTablesNextToCode == "YES"
341
mkTablesNextToCode :: Bool -> Bool mkTablesNextToCode unregisterised = not unregisterised && cGhcEnableTablesNextToCode == "YES"
132
mkTablesNextToCode unregisterised = not unregisterised && cGhcEnableTablesNextToCode == "YES"
97
true
true
0
7
49
33
18
15
null
null
DougBurke/swish
src/Swish/RDF/Graph.hs
lgpl-2.1
fromUTCFormat :: UTCTime -> String fromUTCFormat = formatTime defaultTimeLocale "%FT%T%QZ"
90
fromUTCFormat :: UTCTime -> String fromUTCFormat = formatTime defaultTimeLocale "%FT%T%QZ"
90
fromUTCFormat = formatTime defaultTimeLocale "%FT%T%QZ"
55
false
true
0
7
9
26
11
15
null
null
vollmerm/shallow-fission
tests/mandelbrot/src-acc/Mandel.hs
bsd-3-clause
-- Directly convert the iteration count on escape to a colour. The base set -- (x,y,z) yields a dark background with light highlights. -- -- Note that OpenGL reads pixel data in AGBR format, rather than RGBA. -- escapeToColour :: Exp Int32 -> Exp RGBA32 escapeToColour m = constant 0xFFFFFFFF - (packRGBA32 $ lift (r,g,b,a)) where r = A.fromIntegral (3 * m) g = A.fromIntegral (5 * m) b = A.fromIntegral (7 * m) a = constant 0 --} {-- -- A simple colour scheme -- prettyRGBA :: Elt a => Exp Int -> Exp (Complex a, Int) -> Exp RGBA32 prettyRGBA lIMIT s' = r + g + b + a where s = A.snd s' t = A.fromIntegral $ ((lIMIT - s) * 255) `quot` lIMIT r = (t `rem` 128 + 64) * 0x1000000 g = (t * 2 `rem` 128 + 64) * 0x10000 b = (t * 3 `rem` 256 ) * 0x100 a = 0xFF --} {-- prettyRGBA :: Exp Int32 -> Exp Int32 -> Exp RGBA32 prettyRGBA cmax' c' = let cmax = A.fromIntegral cmax' :: Exp Float c = A.fromIntegral c' / cmax in c A.>* 0.98 ? ( 0xFF000000, rampColourHotToCold 0 1 c ) -- Standard Hot-to-Cold hypsometric colour ramp. Colour sequence is -- Red, Yellow, Green, Cyan, Blue -- rampColourHotToCold :: (Elt a, IsFloating a) => Exp a -- ^ minimum value of the range -> Exp a -- ^ maximum value of the range -> Exp a -- ^ data value -> Exp RGBA32 rampColourHotToCold vmin vmax vNotNorm = let v = vmin `max` vNotNorm `min` vmax dv = vmax - vmin -- result = v A.<* vmin + 0.28 * dv ? ( lift ( constant 0.0 , 4 * (v-vmin) / dv , constant 1.0 , constant 1.0 ) , v A.<* vmin + 0.5 * dv ? ( lift ( constant 0.0 , constant 1.0 , 1 + 4 * (vmin + 0.25 * dv - v) / dv , constant 1.0 ) , v A.<* vmin + 0.75 * dv ? ( lift ( 4 * (v - vmin - 0.5 * dv) / dv , constant 1.0 , constant 0.0 , constant 1.0 ) , lift ( constant 1.0 , 1 + 4 * (vmin + 0.75 * dv - v) / dv , constant 0.0 , constant 1.0 ) ))) in rgba32OfFloat result --}
2,478
escapeToColour :: Exp Int32 -> Exp RGBA32 escapeToColour m = constant 0xFFFFFFFF - (packRGBA32 $ lift (r,g,b,a)) where r = A.fromIntegral (3 * m) g = A.fromIntegral (5 * m) b = A.fromIntegral (7 * m) a = constant 0 --} {-- -- A simple colour scheme -- prettyRGBA :: Elt a => Exp Int -> Exp (Complex a, Int) -> Exp RGBA32 prettyRGBA lIMIT s' = r + g + b + a where s = A.snd s' t = A.fromIntegral $ ((lIMIT - s) * 255) `quot` lIMIT r = (t `rem` 128 + 64) * 0x1000000 g = (t * 2 `rem` 128 + 64) * 0x10000 b = (t * 3 `rem` 256 ) * 0x100 a = 0xFF --} {-- prettyRGBA :: Exp Int32 -> Exp Int32 -> Exp RGBA32 prettyRGBA cmax' c' = let cmax = A.fromIntegral cmax' :: Exp Float c = A.fromIntegral c' / cmax in c A.>* 0.98 ? ( 0xFF000000, rampColourHotToCold 0 1 c ) -- Standard Hot-to-Cold hypsometric colour ramp. Colour sequence is -- Red, Yellow, Green, Cyan, Blue -- rampColourHotToCold :: (Elt a, IsFloating a) => Exp a -- ^ minimum value of the range -> Exp a -- ^ maximum value of the range -> Exp a -- ^ data value -> Exp RGBA32 rampColourHotToCold vmin vmax vNotNorm = let v = vmin `max` vNotNorm `min` vmax dv = vmax - vmin -- result = v A.<* vmin + 0.28 * dv ? ( lift ( constant 0.0 , 4 * (v-vmin) / dv , constant 1.0 , constant 1.0 ) , v A.<* vmin + 0.5 * dv ? ( lift ( constant 0.0 , constant 1.0 , 1 + 4 * (vmin + 0.25 * dv - v) / dv , constant 1.0 ) , v A.<* vmin + 0.75 * dv ? ( lift ( 4 * (v - vmin - 0.5 * dv) / dv , constant 1.0 , constant 0.0 , constant 1.0 ) , lift ( constant 1.0 , 1 + 4 * (vmin + 0.75 * dv - v) / dv , constant 0.0 , constant 1.0 ) ))) in rgba32OfFloat result --}
2,266
escapeToColour m = constant 0xFFFFFFFF - (packRGBA32 $ lift (r,g,b,a)) where r = A.fromIntegral (3 * m) g = A.fromIntegral (5 * m) b = A.fromIntegral (7 * m) a = constant 0 --} {-- -- A simple colour scheme -- prettyRGBA :: Elt a => Exp Int -> Exp (Complex a, Int) -> Exp RGBA32 prettyRGBA lIMIT s' = r + g + b + a where s = A.snd s' t = A.fromIntegral $ ((lIMIT - s) * 255) `quot` lIMIT r = (t `rem` 128 + 64) * 0x1000000 g = (t * 2 `rem` 128 + 64) * 0x10000 b = (t * 3 `rem` 256 ) * 0x100 a = 0xFF --} {-- prettyRGBA :: Exp Int32 -> Exp Int32 -> Exp RGBA32 prettyRGBA cmax' c' = let cmax = A.fromIntegral cmax' :: Exp Float c = A.fromIntegral c' / cmax in c A.>* 0.98 ? ( 0xFF000000, rampColourHotToCold 0 1 c ) -- Standard Hot-to-Cold hypsometric colour ramp. Colour sequence is -- Red, Yellow, Green, Cyan, Blue -- rampColourHotToCold :: (Elt a, IsFloating a) => Exp a -- ^ minimum value of the range -> Exp a -- ^ maximum value of the range -> Exp a -- ^ data value -> Exp RGBA32 rampColourHotToCold vmin vmax vNotNorm = let v = vmin `max` vNotNorm `min` vmax dv = vmax - vmin -- result = v A.<* vmin + 0.28 * dv ? ( lift ( constant 0.0 , 4 * (v-vmin) / dv , constant 1.0 , constant 1.0 ) , v A.<* vmin + 0.5 * dv ? ( lift ( constant 0.0 , constant 1.0 , 1 + 4 * (vmin + 0.25 * dv - v) / dv , constant 1.0 ) , v A.<* vmin + 0.75 * dv ? ( lift ( 4 * (v - vmin - 0.5 * dv) / dv , constant 1.0 , constant 0.0 , constant 1.0 ) , lift ( constant 1.0 , 1 + 4 * (vmin + 0.75 * dv - v) / dv , constant 0.0 , constant 1.0 ) ))) in rgba32OfFloat result --}
2,224
true
true
4
9
1,073
138
68
70
null
null
rfranek/duckling
Duckling/Time/Types.hs
bsd-3-clause
-- | Applies `f` to each interval yielded by `g`. -- | Intervals including "now" are in the future. timeSeqMap :: Bool -- Given an interval and range, compute a single new interval -> (TimeObject -> TimeContext -> Maybe TimeObject) -- First-layer series generator -> Predicate -- Series generator for values that come from `f` -> SeriesPredicate timeSeqMap dontReverse f g = series where series nowTime context = (past, future) where -- computes a single interval from `f` based on each interval in the series applyF series = mapMaybe (\x -> f x context) $ take safeMaxInterval series (firstPast, firstFuture) = runPredicate g nowTime context (past1, future1) = (applyF firstPast, applyF firstFuture) -- Separate what's before and after now from the past's series (newFuture, stillPast) = span (timeStartsBeforeTheEndOf nowTime) past1 -- A series that ends at the earliest time oldPast = takeWhile (timeStartsBeforeTheEndOf $ minTime context) stillPast -- Separate what's before and after now from the future's series (newPast, stillFuture) = break (timeStartsBeforeTheEndOf nowTime) future1 -- A series that ends at the furthest future time oldFuture = takeWhile (\x -> timeStartsBeforeTheEndOf x $ maxTime context) stillFuture -- Reverse the list if needed? applyRev series = if dontReverse then series else reverse series (sortedPast, sortedFuture) = (applyRev newPast, applyRev newFuture) -- Past is the past from the future's series with the -- past from the past's series tacked on past = sortedPast ++ oldPast -- Future is the future from the past's series with the -- future from the future's series tacked on future = sortedFuture ++ oldFuture
1,809
timeSeqMap :: Bool -- Given an interval and range, compute a single new interval -> (TimeObject -> TimeContext -> Maybe TimeObject) -- First-layer series generator -> Predicate -- Series generator for values that come from `f` -> SeriesPredicate timeSeqMap dontReverse f g = series where series nowTime context = (past, future) where -- computes a single interval from `f` based on each interval in the series applyF series = mapMaybe (\x -> f x context) $ take safeMaxInterval series (firstPast, firstFuture) = runPredicate g nowTime context (past1, future1) = (applyF firstPast, applyF firstFuture) -- Separate what's before and after now from the past's series (newFuture, stillPast) = span (timeStartsBeforeTheEndOf nowTime) past1 -- A series that ends at the earliest time oldPast = takeWhile (timeStartsBeforeTheEndOf $ minTime context) stillPast -- Separate what's before and after now from the future's series (newPast, stillFuture) = break (timeStartsBeforeTheEndOf nowTime) future1 -- A series that ends at the furthest future time oldFuture = takeWhile (\x -> timeStartsBeforeTheEndOf x $ maxTime context) stillFuture -- Reverse the list if needed? applyRev series = if dontReverse then series else reverse series (sortedPast, sortedFuture) = (applyRev newPast, applyRev newFuture) -- Past is the past from the future's series with the -- past from the past's series tacked on past = sortedPast ++ oldPast -- Future is the future from the past's series with the -- future from the future's series tacked on future = sortedFuture ++ oldFuture
1,709
timeSeqMap dontReverse f g = series where series nowTime context = (past, future) where -- computes a single interval from `f` based on each interval in the series applyF series = mapMaybe (\x -> f x context) $ take safeMaxInterval series (firstPast, firstFuture) = runPredicate g nowTime context (past1, future1) = (applyF firstPast, applyF firstFuture) -- Separate what's before and after now from the past's series (newFuture, stillPast) = span (timeStartsBeforeTheEndOf nowTime) past1 -- A series that ends at the earliest time oldPast = takeWhile (timeStartsBeforeTheEndOf $ minTime context) stillPast -- Separate what's before and after now from the future's series (newPast, stillFuture) = break (timeStartsBeforeTheEndOf nowTime) future1 -- A series that ends at the furthest future time oldFuture = takeWhile (\x -> timeStartsBeforeTheEndOf x $ maxTime context) stillFuture -- Reverse the list if needed? applyRev series = if dontReverse then series else reverse series (sortedPast, sortedFuture) = (applyRev newPast, applyRev newFuture) -- Past is the past from the future's series with the -- past from the past's series tacked on past = sortedPast ++ oldPast -- Future is the future from the past's series with the -- future from the future's series tacked on future = sortedFuture ++ oldFuture
1,440
true
true
0
11
413
317
169
148
null
null
ozgurakgun/Idris-dev
src/Idris/REPL.hs
bsd-3-clause
runIdeModeCommand h id orig fn mods (IdeMode.CallsWho n) = case splitName n of Left err -> iPrintError err Right n -> do calls <- callsWho n ist <- getIState let msg = (IdeMode.SymbolAtom "ok", map (\ (n,ns) -> (pn ist n, map (pn ist) ns)) calls) runIO . hPutStrLn h $ IdeMode.convSExp "return" msg id where pn ist = displaySpans . renderPretty 0.9 1000 . fmap (fancifyAnnots ist True) . prettyName True True []
575
runIdeModeCommand h id orig fn mods (IdeMode.CallsWho n) = case splitName n of Left err -> iPrintError err Right n -> do calls <- callsWho n ist <- getIState let msg = (IdeMode.SymbolAtom "ok", map (\ (n,ns) -> (pn ist n, map (pn ist) ns)) calls) runIO . hPutStrLn h $ IdeMode.convSExp "return" msg id where pn ist = displaySpans . renderPretty 0.9 1000 . fmap (fancifyAnnots ist True) . prettyName True True []
575
runIdeModeCommand h id orig fn mods (IdeMode.CallsWho n) = case splitName n of Left err -> iPrintError err Right n -> do calls <- callsWho n ist <- getIState let msg = (IdeMode.SymbolAtom "ok", map (\ (n,ns) -> (pn ist n, map (pn ist) ns)) calls) runIO . hPutStrLn h $ IdeMode.convSExp "return" msg id where pn ist = displaySpans . renderPretty 0.9 1000 . fmap (fancifyAnnots ist True) . prettyName True True []
575
false
false
0
20
237
203
96
107
null
null
ghcjs/jsaddle-dom
src/JSDOM/Generated/IDBKeyRange.hs
mit
-- | <https://developer.mozilla.org/en-US/docs/Web/API/IDBKeyRange.bound Mozilla IDBKeyRange.bound documentation> bound_ :: (MonadDOM m, ToJSVal lower, ToJSVal upper) => lower -> upper -> Bool -> Bool -> m () bound_ lower upper lowerOpen upperOpen = liftDOM (void ((jsg "IDBKeyRange") ^. jsf "bound" [toJSVal lower, toJSVal upper, toJSVal lowerOpen, toJSVal upperOpen]))
429
bound_ :: (MonadDOM m, ToJSVal lower, ToJSVal upper) => lower -> upper -> Bool -> Bool -> m () bound_ lower upper lowerOpen upperOpen = liftDOM (void ((jsg "IDBKeyRange") ^. jsf "bound" [toJSVal lower, toJSVal upper, toJSVal lowerOpen, toJSVal upperOpen]))
314
bound_ lower upper lowerOpen upperOpen = liftDOM (void ((jsg "IDBKeyRange") ^. jsf "bound" [toJSVal lower, toJSVal upper, toJSVal lowerOpen, toJSVal upperOpen]))
203
true
true
0
12
104
114
57
57
null
null
wolfspyre/noisefunge
src/Language/NoiseFunge/ALSA.hs
gpl-3.0
startALSAThread :: ALSAThreadConfig -> IO ALSAThread startALSAThread conf = do cl <- newTVarIO def nin <- newTChanIO nout <- newTChanIO let handler = alsaHandler conf cl nin nout th <- forkIO $ Seq.withDefault Seq.Block handler return $ ALSAThread th cl nin nout
287
startALSAThread :: ALSAThreadConfig -> IO ALSAThread startALSAThread conf = do cl <- newTVarIO def nin <- newTChanIO nout <- newTChanIO let handler = alsaHandler conf cl nin nout th <- forkIO $ Seq.withDefault Seq.Block handler return $ ALSAThread th cl nin nout
287
startALSAThread conf = do cl <- newTVarIO def nin <- newTChanIO nout <- newTChanIO let handler = alsaHandler conf cl nin nout th <- forkIO $ Seq.withDefault Seq.Block handler return $ ALSAThread th cl nin nout
234
false
true
0
11
66
104
45
59
null
null
phadej/stack
src/Stack/Package.hs
bsd-3-clause
testFiles :: (MonadLogger m, MonadIO m, MonadCatch m, MonadReader (Path Abs File, Path Abs Dir) m) => TestSuite -> m (Set ModuleName, Set DotCabalPath, [PackageWarning]) testFiles test = do dirs <- mapMaybeM resolveDirOrWarn (hsSourceDirs build) dir <- asks (parent . fst) (modules,files,warnings) <- resolveFilesAndDeps (Just $ testName test) (dirs ++ [dir]) (bnames <> exposed) haskellModuleExts cfiles <- buildOtherSources build return (modules, files <> cfiles, warnings) where exposed = case testInterface test of TestSuiteExeV10 _ fp -> [DotCabalMain fp] TestSuiteLibV09 _ mn -> [DotCabalModule mn] TestSuiteUnsupported _ -> [] bnames = map DotCabalModule (otherModules build) build = testBuildInfo test -- | Get all files referenced by the executable.
905
testFiles :: (MonadLogger m, MonadIO m, MonadCatch m, MonadReader (Path Abs File, Path Abs Dir) m) => TestSuite -> m (Set ModuleName, Set DotCabalPath, [PackageWarning]) testFiles test = do dirs <- mapMaybeM resolveDirOrWarn (hsSourceDirs build) dir <- asks (parent . fst) (modules,files,warnings) <- resolveFilesAndDeps (Just $ testName test) (dirs ++ [dir]) (bnames <> exposed) haskellModuleExts cfiles <- buildOtherSources build return (modules, files <> cfiles, warnings) where exposed = case testInterface test of TestSuiteExeV10 _ fp -> [DotCabalMain fp] TestSuiteLibV09 _ mn -> [DotCabalModule mn] TestSuiteUnsupported _ -> [] bnames = map DotCabalModule (otherModules build) build = testBuildInfo test -- | Get all files referenced by the executable.
905
testFiles test = do dirs <- mapMaybeM resolveDirOrWarn (hsSourceDirs build) dir <- asks (parent . fst) (modules,files,warnings) <- resolveFilesAndDeps (Just $ testName test) (dirs ++ [dir]) (bnames <> exposed) haskellModuleExts cfiles <- buildOtherSources build return (modules, files <> cfiles, warnings) where exposed = case testInterface test of TestSuiteExeV10 _ fp -> [DotCabalMain fp] TestSuiteLibV09 _ mn -> [DotCabalModule mn] TestSuiteUnsupported _ -> [] bnames = map DotCabalModule (otherModules build) build = testBuildInfo test -- | Get all files referenced by the executable.
723
false
true
0
11
253
289
143
146
null
null
unknownloner/calccomp
Asm/InstrSize.hs
mit
instrSize SET args = instrSize BIT args
41
instrSize SET args = instrSize BIT args
41
instrSize SET args = instrSize BIT args
41
false
false
1
5
8
20
7
13
null
null
D4r1/project-euler
Euler/E24.hs
mit
getPermutation :: Eq a => [a] -> Int -> [a] getPermutation [] _ = []
68
getPermutation :: Eq a => [a] -> Int -> [a] getPermutation [] _ = []
68
getPermutation [] _ = []
24
false
true
0
8
14
41
21
20
null
null
iliastsi/gac
src/basicTypes/UnTypedAst.hs
mit
dumpUType (UTypeArr lutype (Just lidx)) = dumpUType (unLoc lutype) ++ "[" ++ show (unLoc lidx) ++ "]"
105
dumpUType (UTypeArr lutype (Just lidx)) = dumpUType (unLoc lutype) ++ "[" ++ show (unLoc lidx) ++ "]"
105
dumpUType (UTypeArr lutype (Just lidx)) = dumpUType (unLoc lutype) ++ "[" ++ show (unLoc lidx) ++ "]"
105
false
false
0
10
20
53
25
28
null
null
Fuuzetsu/haddock
haddock-library/vendor/attoparsec-0.13.1.0/Data/Attoparsec/ByteString/Char8.hs
bsd-2-clause
-- | Consume input as long as the predicate returns 'False' -- (i.e. until it returns 'True'), and return the consumed input. -- -- This parser does not fail. It will return an empty string if the -- predicate returns 'True' on the first byte of input. -- -- /Note/: Because this parser does not fail, do not use it with -- combinators such as 'many', because such parsers loop until a -- failure occurs. Careless use will thus result in an infinite loop. takeTill :: (Char -> Bool) -> Parser B.ByteString takeTill p = I.takeTill (p . w2c)
541
takeTill :: (Char -> Bool) -> Parser B.ByteString takeTill p = I.takeTill (p . w2c)
83
takeTill p = I.takeTill (p . w2c)
33
true
true
0
7
100
51
30
21
null
null
zeniuseducation/poly-euler
haskell/next/three.hs
epl-1.0
sum_primes :: Int -> Int sum_primes lim = let loop i res | i > lim = res | prime' i = loop (i+2) (res+i) | otherwise = loop (i+2) res in loop 3 2
173
sum_primes :: Int -> Int sum_primes lim = let loop i res | i > lim = res | prime' i = loop (i+2) (res+i) | otherwise = loop (i+2) res in loop 3 2
173
sum_primes lim = let loop i res | i > lim = res | prime' i = loop (i+2) (res+i) | otherwise = loop (i+2) res in loop 3 2
148
false
true
0
12
62
101
47
54
null
null