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
spechub/Hets
CASL/Overload.hs
gpl-2.0
checkIdAndArgs :: Id -> [a] -> Range -> Result Int checkIdAndArgs ide args poss = let nargs = length args pargs = placeCount ide in if isMixfix ide && pargs /= nargs then Result [Diag Error ("expected " ++ shows pargs " argument(s) of mixfix identifier '" ++ showDoc ide "' but found " ++ shows nargs " argument(s)") poss] Nothing else return nargs
395
checkIdAndArgs :: Id -> [a] -> Range -> Result Int checkIdAndArgs ide args poss = let nargs = length args pargs = placeCount ide in if isMixfix ide && pargs /= nargs then Result [Diag Error ("expected " ++ shows pargs " argument(s) of mixfix identifier '" ++ showDoc ide "' but found " ++ shows nargs " argument(s)") poss] Nothing else return nargs
395
checkIdAndArgs ide args poss = let nargs = length args pargs = placeCount ide in if isMixfix ide && pargs /= nargs then Result [Diag Error ("expected " ++ shows pargs " argument(s) of mixfix identifier '" ++ showDoc ide "' but found " ++ shows nargs " argument(s)") poss] Nothing else return nargs
344
false
true
0
15
110
130
61
69
null
null
frontrowed/stratosphere
library-gen/Stratosphere/ResourceProperties/IoTAnalyticsPipelineDatastore.hs
mit
-- | http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotanalytics-pipeline-datastore.html#cfn-iotanalytics-pipeline-datastore-datastorename itapdDatastoreName :: Lens' IoTAnalyticsPipelineDatastore (Maybe (Val Text)) itapdDatastoreName = lens _ioTAnalyticsPipelineDatastoreDatastoreName (\s a -> s { _ioTAnalyticsPipelineDatastoreDatastoreName = a })
379
itapdDatastoreName :: Lens' IoTAnalyticsPipelineDatastore (Maybe (Val Text)) itapdDatastoreName = lens _ioTAnalyticsPipelineDatastoreDatastoreName (\s a -> s { _ioTAnalyticsPipelineDatastoreDatastoreName = a })
210
itapdDatastoreName = lens _ioTAnalyticsPipelineDatastoreDatastoreName (\s a -> s { _ioTAnalyticsPipelineDatastoreDatastoreName = a })
133
true
true
1
9
22
55
28
27
null
null
apunktbau/co4
src/CO4/TypesUtil.hs
gpl-3.0
-- |Builds a function scheme from a list of parameter types and a result type functionType :: [Type] -> Type -> Type functionType = flip $ foldr (\a b -> TCon funName [a,b])
173
functionType :: [Type] -> Type -> Type functionType = flip $ foldr (\a b -> TCon funName [a,b])
95
functionType = flip $ foldr (\a b -> TCon funName [a,b])
56
true
true
0
10
32
51
28
23
null
null
dolio/vector
old-testsuite/microsuite/zip.hs
bsd-3-clause
main = print . U.sum . U.map fst $ U.zip (U.enumFromTo 1 (100000000 :: Int)) (U.enumFromTo 2 (100000001 :: Int))
160
main = print . U.sum . U.map fst $ U.zip (U.enumFromTo 1 (100000000 :: Int)) (U.enumFromTo 2 (100000001 :: Int))
160
main = print . U.sum . U.map fst $ U.zip (U.enumFromTo 1 (100000000 :: Int)) (U.enumFromTo 2 (100000001 :: Int))
160
false
false
3
9
67
69
33
36
null
null
sherwoodwang/wxHaskell
wxcore/src/haskell/Graphics/UI/WXCore/WxcDefs.hs
lgpl-2.1
wxDRAG_DEFALUTMOVE :: Int wxDRAG_DEFALUTMOVE = 3
48
wxDRAG_DEFALUTMOVE :: Int wxDRAG_DEFALUTMOVE = 3
48
wxDRAG_DEFALUTMOVE = 3
22
false
true
0
6
5
18
7
11
null
null
apollo-lang/apollo
src/Util.hs
mit
oDuration (VInt i) = Duration i
37
toDuration (VInt i) = Duration i
37
toDuration (VInt i) = Duration i
37
false
false
0
7
11
18
8
10
null
null
nevrenato/Hets_Fork
GMP/versioning/gmp-coloss-0.0.3/GMP/Prover.hs
gpl-2.0
osprovable flags ec (Sequent seq) = trace ("\n <Current Sequent:> " ++ (pretty_seq (Sequent (expand seq)))) $ any (\p -> (all (\q -> any (osprovable flags ec) q) p)) (oallRules flags ec (Sequent seq))
237
osprovable flags ec (Sequent seq) = trace ("\n <Current Sequent:> " ++ (pretty_seq (Sequent (expand seq)))) $ any (\p -> (all (\q -> any (osprovable flags ec) q) p)) (oallRules flags ec (Sequent seq))
237
osprovable flags ec (Sequent seq) = trace ("\n <Current Sequent:> " ++ (pretty_seq (Sequent (expand seq)))) $ any (\p -> (all (\q -> any (osprovable flags ec) q) p)) (oallRules flags ec (Sequent seq))
237
false
false
0
15
70
109
55
54
null
null
DavidAlphaFox/ghc
libraries/Cabal/Cabal/Distribution/ParseUtils.hs
bsd-3-clause
-- for testing lineNo :: Field -> LineNo lineNo (F n _ _) = n
62
lineNo :: Field -> LineNo lineNo (F n _ _) = n
46
lineNo (F n _ _) = n
20
true
true
0
7
15
29
15
14
null
null
brendanhay/gogol
gogol-logging/gen/Network/Google/Logging/Types/Product.hs
mpl-2.0
-- | Creates a value of 'LocationLabels' with the minimum fields required to make a request. -- -- Use one of the following lenses to modify other fields as desired: -- -- * 'llAddtional' locationLabels :: HashMap Text Text -- ^ 'llAddtional' -> LocationLabels locationLabels pLlAddtional_ = LocationLabels' {_llAddtional = _Coerce # pLlAddtional_}
358
locationLabels :: HashMap Text Text -- ^ 'llAddtional' -> LocationLabels locationLabels pLlAddtional_ = LocationLabels' {_llAddtional = _Coerce # pLlAddtional_}
170
locationLabels pLlAddtional_ = LocationLabels' {_llAddtional = _Coerce # pLlAddtional_}
89
true
true
0
8
62
47
25
22
null
null
Brightgalrs/con-lang-gen
src/Morph/Phonology.hs
mit
--simple rules should probably execute -- Applies a rule to each phoneme in multiple syllables executeRuleOnSyllWord :: Int -> Rule -> [Syllable] -> [Syllable] -> ([Syllable], Int) executeRuleOnSyllWord _ NoChange _ xs = (xs, 0)
229
executeRuleOnSyllWord :: Int -> Rule -> [Syllable] -> [Syllable] -> ([Syllable], Int) executeRuleOnSyllWord _ NoChange _ xs = (xs, 0)
133
executeRuleOnSyllWord _ NoChange _ xs = (xs, 0)
47
true
true
0
10
35
59
34
25
null
null
ml9951/ghc
compiler/main/GhcMake.hs
bsd-3-clause
maybeGetIfaceDate :: DynFlags -> ModLocation -> IO (Maybe UTCTime) maybeGetIfaceDate dflags location | writeInterfaceOnlyMode dflags -- Minor optimization: it should be harmless to check the hi file location -- always, but it's better to avoid hitting the filesystem if possible. = modificationTimeIfExists (ml_hi_file location) | otherwise = return Nothing
375
maybeGetIfaceDate :: DynFlags -> ModLocation -> IO (Maybe UTCTime) maybeGetIfaceDate dflags location | writeInterfaceOnlyMode dflags -- Minor optimization: it should be harmless to check the hi file location -- always, but it's better to avoid hitting the filesystem if possible. = modificationTimeIfExists (ml_hi_file location) | otherwise = return Nothing
375
maybeGetIfaceDate dflags location | writeInterfaceOnlyMode dflags -- Minor optimization: it should be harmless to check the hi file location -- always, but it's better to avoid hitting the filesystem if possible. = modificationTimeIfExists (ml_hi_file location) | otherwise = return Nothing
308
false
true
0
9
66
67
31
36
null
null
dcreager/cabal
Distribution/Simple/Setup.hs
bsd-3-clause
unregisterCommand :: CommandUI RegisterFlags unregisterCommand = makeCommand name shortDesc longDesc defaultRegisterFlags options where name = "unregister" shortDesc = "Unregister this package with the compiler." longDesc = Nothing options showOrParseArgs = [optionVerbosity regVerbosity (\v flags -> flags { regVerbosity = v }) ,optionDistPref regDistPref (\d flags -> flags { regDistPref = d }) showOrParseArgs ,option "" ["user"] "" regPackageDB (\v flags -> flags { regPackageDB = v }) (choiceOpt [ (Flag UserPackageDB, ([],["user"]), "unregister this package in the user's local package database") , (Flag GlobalPackageDB, ([],["global"]), "(default) unregister this package in the system-wide package database")]) ,option "" ["gen-script"] "Instead of performing the unregister command, generate a script to unregister later" regGenScript (\v flags -> flags { regGenScript = v }) trueArg ]
1,099
unregisterCommand :: CommandUI RegisterFlags unregisterCommand = makeCommand name shortDesc longDesc defaultRegisterFlags options where name = "unregister" shortDesc = "Unregister this package with the compiler." longDesc = Nothing options showOrParseArgs = [optionVerbosity regVerbosity (\v flags -> flags { regVerbosity = v }) ,optionDistPref regDistPref (\d flags -> flags { regDistPref = d }) showOrParseArgs ,option "" ["user"] "" regPackageDB (\v flags -> flags { regPackageDB = v }) (choiceOpt [ (Flag UserPackageDB, ([],["user"]), "unregister this package in the user's local package database") , (Flag GlobalPackageDB, ([],["global"]), "(default) unregister this package in the system-wide package database")]) ,option "" ["gen-script"] "Instead of performing the unregister command, generate a script to unregister later" regGenScript (\v flags -> flags { regGenScript = v }) trueArg ]
1,099
unregisterCommand = makeCommand name shortDesc longDesc defaultRegisterFlags options where name = "unregister" shortDesc = "Unregister this package with the compiler." longDesc = Nothing options showOrParseArgs = [optionVerbosity regVerbosity (\v flags -> flags { regVerbosity = v }) ,optionDistPref regDistPref (\d flags -> flags { regDistPref = d }) showOrParseArgs ,option "" ["user"] "" regPackageDB (\v flags -> flags { regPackageDB = v }) (choiceOpt [ (Flag UserPackageDB, ([],["user"]), "unregister this package in the user's local package database") , (Flag GlobalPackageDB, ([],["global"]), "(default) unregister this package in the system-wide package database")]) ,option "" ["gen-script"] "Instead of performing the unregister command, generate a script to unregister later" regGenScript (\v flags -> flags { regGenScript = v }) trueArg ]
1,054
false
true
0
12
324
237
134
103
null
null
Rembane/Stormy-Dreadful-Microphone
Main.hs
gpl-2.0
getInput :: SerialPort -> IO B.ByteString getInput s = recv s 100
65
getInput :: SerialPort -> IO B.ByteString getInput s = recv s 100
65
getInput s = recv s 100
23
false
true
0
7
11
28
13
15
null
null
ony/hledger
hledger/Hledger/Cli/Commands/Add.hs
gpl-3.0
showHelp = hPutStr stderr $ unlines [ "Any command line arguments will be used as defaults." ,"Use tab key to complete, readline keys to edit, enter to accept defaults." ,"An optional (CODE) may follow transaction dates." ,"An optional ; COMMENT may follow descriptions or amounts." ,"If you make a mistake, enter < at any prompt to restart the transaction." ,"To end a transaction, enter . when prompted." ,"To quit, enter . at a date prompt or press control-d or control-c." ]
511
showHelp = hPutStr stderr $ unlines [ "Any command line arguments will be used as defaults." ,"Use tab key to complete, readline keys to edit, enter to accept defaults." ,"An optional (CODE) may follow transaction dates." ,"An optional ; COMMENT may follow descriptions or amounts." ,"If you make a mistake, enter < at any prompt to restart the transaction." ,"To end a transaction, enter . when prompted." ,"To quit, enter . at a date prompt or press control-d or control-c." ]
511
showHelp = hPutStr stderr $ unlines [ "Any command line arguments will be used as defaults." ,"Use tab key to complete, readline keys to edit, enter to accept defaults." ,"An optional (CODE) may follow transaction dates." ,"An optional ; COMMENT may follow descriptions or amounts." ,"If you make a mistake, enter < at any prompt to restart the transaction." ,"To end a transaction, enter . when prompted." ,"To quit, enter . at a date prompt or press control-d or control-c." ]
511
false
false
0
7
113
37
21
16
null
null
oahziur/yige-pass
src/VaultData.hs
bsd-3-clause
selectEntry :: [VaultEntry] -> IO (Maybe VaultEntry) selectEntry es = do mapM_ putStrLn $ previewEntries es flushStr "Select index: " selectedIndex <- getLine return $ readMaybe selectedIndex >>= getEntryByIndex es
230
selectEntry :: [VaultEntry] -> IO (Maybe VaultEntry) selectEntry es = do mapM_ putStrLn $ previewEntries es flushStr "Select index: " selectedIndex <- getLine return $ readMaybe selectedIndex >>= getEntryByIndex es
230
selectEntry es = do mapM_ putStrLn $ previewEntries es flushStr "Select index: " selectedIndex <- getLine return $ readMaybe selectedIndex >>= getEntryByIndex es
177
false
true
0
9
45
73
32
41
null
null
roldugin/LiveFusion
Data/LiveFusion/Fuse.hs
bsd-3-clause
rebindLengthVar :: Unique -> Unique -> Loop -> Loop rebindLengthVar curr prev = addStmt stmt (initLbl curr) where stmt = bindStmt (lengthVar curr) (VarE $ lengthVar prev) -- | Log combinator if D.LF.Util.dEBUG is on.
220
rebindLengthVar :: Unique -> Unique -> Loop -> Loop rebindLengthVar curr prev = addStmt stmt (initLbl curr) where stmt = bindStmt (lengthVar curr) (VarE $ lengthVar prev) -- | Log combinator if D.LF.Util.dEBUG is on.
220
rebindLengthVar curr prev = addStmt stmt (initLbl curr) where stmt = bindStmt (lengthVar curr) (VarE $ lengthVar prev) -- | Log combinator if D.LF.Util.dEBUG is on.
168
false
true
0
8
38
69
34
35
null
null
Solonarv/TicTacToe
TicTacToeIO.hs
mit
parseMove :: [Pos] -> String -> GameStateIO Pos parseMove occupied move | length move == 2 = let cc:rc:"" = move coli = elemIndex (toUpper cc) "LCR" rowi = elemIndex (toUpper rc) "123" in if coli == Nothing || rowi == Nothing then retry occupied else return (toEnum $ fromJust coli, toEnum $ fromJust rowi) | otherwise = retry occupied
527
parseMove :: [Pos] -> String -> GameStateIO Pos parseMove occupied move | length move == 2 = let cc:rc:"" = move coli = elemIndex (toUpper cc) "LCR" rowi = elemIndex (toUpper rc) "123" in if coli == Nothing || rowi == Nothing then retry occupied else return (toEnum $ fromJust coli, toEnum $ fromJust rowi) | otherwise = retry occupied
527
parseMove occupied move | length move == 2 = let cc:rc:"" = move coli = elemIndex (toUpper cc) "LCR" rowi = elemIndex (toUpper rc) "123" in if coli == Nothing || rowi == Nothing then retry occupied else return (toEnum $ fromJust coli, toEnum $ fromJust rowi) | otherwise = retry occupied
479
false
true
1
12
251
155
74
81
null
null
jcsaenzcarrasco/MPhil-thesis
Nilsson.hs
mit
mkStrictPair x y = let xy = (x, y) in deepseq xy xy
60
mkStrictPair x y = let xy = (x, y) in deepseq xy xy
60
mkStrictPair x y = let xy = (x, y) in deepseq xy xy
60
false
false
0
9
21
35
16
19
null
null
glguy/ssh-hans
src/Network/SSH/PubKey.hs
bsd-3-clause
sign :: PrivateKey -> S.ByteString -> IO SshSig sign pk token = case pk of PrivateRsa priv -> do result <- RSA.signSafer (Just Hash.SHA1) priv token case result of Right x -> return (SshSigRsa x) Left e -> fail (show e) PrivateDsa priv -> do sig <- DSA.sign priv Hash.SHA1 token return (SshSigDss (DSA.sign_r sig) (DSA.sign_s sig)) PrivateEd25519 (Ed25519SecretKey priv) (Ed25519PublicKey pub) -> return (SshSigEd25519 (convert (Ed25519.sign priv pub token))) PrivateEcdsa256 priv -> SshSigEcDsaP256 . eccSigToBinary <$> ECDSA.sign priv Hash.SHA256 token PrivateEcdsa384 priv -> SshSigEcDsaP384 . eccSigToBinary <$> ECDSA.sign priv Hash.SHA384 token PrivateEcdsa521 priv -> SshSigEcDsaP521 . eccSigToBinary <$> ECDSA.sign priv Hash.SHA512 token -- | Verify server signature (in client) using server public key. -- -- RFC 4253 Section 8 Step 3.
952
sign :: PrivateKey -> S.ByteString -> IO SshSig sign pk token = case pk of PrivateRsa priv -> do result <- RSA.signSafer (Just Hash.SHA1) priv token case result of Right x -> return (SshSigRsa x) Left e -> fail (show e) PrivateDsa priv -> do sig <- DSA.sign priv Hash.SHA1 token return (SshSigDss (DSA.sign_r sig) (DSA.sign_s sig)) PrivateEd25519 (Ed25519SecretKey priv) (Ed25519PublicKey pub) -> return (SshSigEd25519 (convert (Ed25519.sign priv pub token))) PrivateEcdsa256 priv -> SshSigEcDsaP256 . eccSigToBinary <$> ECDSA.sign priv Hash.SHA256 token PrivateEcdsa384 priv -> SshSigEcDsaP384 . eccSigToBinary <$> ECDSA.sign priv Hash.SHA384 token PrivateEcdsa521 priv -> SshSigEcDsaP521 . eccSigToBinary <$> ECDSA.sign priv Hash.SHA512 token -- | Verify server signature (in client) using server public key. -- -- RFC 4253 Section 8 Step 3.
952
sign pk token = case pk of PrivateRsa priv -> do result <- RSA.signSafer (Just Hash.SHA1) priv token case result of Right x -> return (SshSigRsa x) Left e -> fail (show e) PrivateDsa priv -> do sig <- DSA.sign priv Hash.SHA1 token return (SshSigDss (DSA.sign_r sig) (DSA.sign_s sig)) PrivateEd25519 (Ed25519SecretKey priv) (Ed25519PublicKey pub) -> return (SshSigEd25519 (convert (Ed25519.sign priv pub token))) PrivateEcdsa256 priv -> SshSigEcDsaP256 . eccSigToBinary <$> ECDSA.sign priv Hash.SHA256 token PrivateEcdsa384 priv -> SshSigEcDsaP384 . eccSigToBinary <$> ECDSA.sign priv Hash.SHA384 token PrivateEcdsa521 priv -> SshSigEcDsaP521 . eccSigToBinary <$> ECDSA.sign priv Hash.SHA512 token -- | Verify server signature (in client) using server public key. -- -- RFC 4253 Section 8 Step 3.
904
false
true
0
15
230
307
143
164
null
null
sixohsix/tak
src/Tak/Editor/Search.hs
mit
updateInfoLineSearching sstr wasFound gst = let searching = ["Searching for: '", sstr, "'", wasFoundStr] wasFoundStr = if wasFound then "" else " NOT FOUND" in updateInfoLine (infoLineContent gst $ Just $ mconcat searching) gst
239
updateInfoLineSearching sstr wasFound gst = let searching = ["Searching for: '", sstr, "'", wasFoundStr] wasFoundStr = if wasFound then "" else " NOT FOUND" in updateInfoLine (infoLineContent gst $ Just $ mconcat searching) gst
239
updateInfoLineSearching sstr wasFound gst = let searching = ["Searching for: '", sstr, "'", wasFoundStr] wasFoundStr = if wasFound then "" else " NOT FOUND" in updateInfoLine (infoLineContent gst $ Just $ mconcat searching) gst
239
false
false
0
11
45
71
37
34
null
null
gridaphobe/ghc
compiler/simplCore/SimplEnv.hs
bsd-3-clause
--------------------- zapSubstEnv :: SimplEnv -> SimplEnv zapSubstEnv env = env {seTvSubst = emptyVarEnv, seCvSubst = emptyVarEnv, seIdSubst = emptyVarEnv}
155
zapSubstEnv :: SimplEnv -> SimplEnv zapSubstEnv env = env {seTvSubst = emptyVarEnv, seCvSubst = emptyVarEnv, seIdSubst = emptyVarEnv}
133
zapSubstEnv env = env {seTvSubst = emptyVarEnv, seCvSubst = emptyVarEnv, seIdSubst = emptyVarEnv}
97
true
true
0
6
18
39
23
16
null
null
cmc-haskell-2016/nonogram
src/Logic.hs
bsd-3-clause
-- | Проверка, помечена ли ячейка крестиком. isU :: Cell -> Bool isU U = True
77
isU :: Cell -> Bool isU U = True
32
isU U = True
12
true
true
0
5
15
19
10
9
null
null
tolysz/prepare-ghcjs
spec-lts8/cabal/Cabal/tests/UnitTests/Distribution/Compat/CreatePipe.hs
bsd-3-clause
case_Locale_Encoding :: Assertion case_Locale_Encoding = assert $ do let str = "\0252" (r, w) <- createPipe hSetEncoding w localeEncoding out <- hGetContents r hPutStr w str hClose w return $! out == str
231
case_Locale_Encoding :: Assertion case_Locale_Encoding = assert $ do let str = "\0252" (r, w) <- createPipe hSetEncoding w localeEncoding out <- hGetContents r hPutStr w str hClose w return $! out == str
231
case_Locale_Encoding = assert $ do let str = "\0252" (r, w) <- createPipe hSetEncoding w localeEncoding out <- hGetContents r hPutStr w str hClose w return $! out == str
197
false
true
2
9
60
88
37
51
null
null
IanConnolly/aws-sdk-fork
AWS/EC2/NetworkInterfaceAttribute.hs
bsd-3-clause
modifyNetworkInterfaceDescription :: (MonadBaseControl IO m, MonadResource m) => Text -- ^ The ID of the network interface. -> Text -- ^ The description of the network interface. -> EC2 m Bool modifyNetworkInterfaceDescription iface desc = modifyNetworkInterfaceAttribute iface ["Description.Value" |= desc]
327
modifyNetworkInterfaceDescription :: (MonadBaseControl IO m, MonadResource m) => Text -- ^ The ID of the network interface. -> Text -- ^ The description of the network interface. -> EC2 m Bool modifyNetworkInterfaceDescription iface desc = modifyNetworkInterfaceAttribute iface ["Description.Value" |= desc]
327
modifyNetworkInterfaceDescription iface desc = modifyNetworkInterfaceAttribute iface ["Description.Value" |= desc]
118
false
true
0
9
59
64
32
32
null
null
Lysxia/unparse-attoparsec
src/Data/Attoparsec/Unparse/Printer.hs
mit
see :: ByteString -> Printer' () see b = BS.foldr (\w m -> check w >> m) done b where done = modify $ \(tellAhead, builder) -> (tellAhead, builder <> Builder.byteString b)
183
see :: ByteString -> Printer' () see b = BS.foldr (\w m -> check w >> m) done b where done = modify $ \(tellAhead, builder) -> (tellAhead, builder <> Builder.byteString b)
183
see b = BS.foldr (\w m -> check w >> m) done b where done = modify $ \(tellAhead, builder) -> (tellAhead, builder <> Builder.byteString b)
150
false
true
0
10
43
87
45
42
null
null
remyoudompheng/hs-language-go
Language/Go/Pretty.hs
gpl-3.0
prettyFields :: Pretty a => String -> [a] -> Doc prettyFields kw specs = case specs of [] -> text kw <+> lbrace <> rbrace _ -> (text kw <+> lbrace) $+$ indent (vcat (map pretty specs)) $+$ rbrace
200
prettyFields :: Pretty a => String -> [a] -> Doc prettyFields kw specs = case specs of [] -> text kw <+> lbrace <> rbrace _ -> (text kw <+> lbrace) $+$ indent (vcat (map pretty specs)) $+$ rbrace
200
prettyFields kw specs = case specs of [] -> text kw <+> lbrace <> rbrace _ -> (text kw <+> lbrace) $+$ indent (vcat (map pretty specs)) $+$ rbrace
151
false
true
0
14
43
98
48
50
null
null
ezyang/ghc
testsuite/tests/concurrent/prog003/CASList.hs
bsd-3-clause
cntList :: Show a => ListHandle a -> IO Int cntList (ListHandle {headList = ptrPtr}) = do startptr <- ( do ptr <- readIORef ptrPtr Head {next = startptr} <- readIORef ptr return startptr) cntListHelp startptr 0
253
cntList :: Show a => ListHandle a -> IO Int cntList (ListHandle {headList = ptrPtr}) = do startptr <- ( do ptr <- readIORef ptrPtr Head {next = startptr} <- readIORef ptr return startptr) cntListHelp startptr 0
253
cntList (ListHandle {headList = ptrPtr}) = do startptr <- ( do ptr <- readIORef ptrPtr Head {next = startptr} <- readIORef ptr return startptr) cntListHelp startptr 0
209
false
true
0
15
79
101
45
56
null
null
kumasento/accelerate-cuda
Data/Array/Accelerate/CUDA/Compile.hs
bsd-3-clause
link :: Context -> KernelTable -> KernelKey -> IO CUDA.Module link context table key = let intErr = $internalError "link" "missing kernel entry" ctx = deviceContext context weak_ctx = weakContext context in do entry <- fromMaybe intErr `fmap` KT.lookup context table key case entry of CompileProcess cufile done -> do -- Wait for the compiler to finish and load the binary object into the -- current context. -- -- A forked thread will fill the MVar once the external compilation -- process completes, but only the main thread executes kernels. Hence, -- only one thread will ever attempt to take the MVar in order to link -- the binary object. -- message "waiting for nvcc..." takeMVar done let cubin = replaceExtension cufile ".cubin" bin <- B.readFile cubin mdl <- CUDA.loadData bin addFinalizer mdl (module_finalizer weak_ctx key mdl) -- Update hash tables and stash the binary object into the persistent -- cache -- KT.insert table key $! KernelObject bin (FL.singleton ctx mdl) KT.persist table cubin key -- Remove temporary build products. -- If compiling kernels with debugging symbols, leave the source files -- in place so that they can be referenced by 'cuda-gdb'. -- D.unless D.debug_cc $ do removeFile cufile removeDirectory (dropFileName cufile) `catchIOError` \_ -> return () -- directory not empty return mdl -- If we get a real object back, then this will already be in the -- persistent cache, since either it was just read in from there, or we -- had to generate new code and the link step above has added it. -- KernelObject bin active | Just mdl <- FL.lookup ctx active -> return mdl | otherwise -> do message "re-linking module for current context" mdl <- CUDA.loadData bin addFinalizer mdl (module_finalizer weak_ctx key mdl) KT.insert table key $! KernelObject bin (FL.cons ctx mdl active) return mdl -- Generate and compile code for a single open array expression --
2,371
link :: Context -> KernelTable -> KernelKey -> IO CUDA.Module link context table key = let intErr = $internalError "link" "missing kernel entry" ctx = deviceContext context weak_ctx = weakContext context in do entry <- fromMaybe intErr `fmap` KT.lookup context table key case entry of CompileProcess cufile done -> do -- Wait for the compiler to finish and load the binary object into the -- current context. -- -- A forked thread will fill the MVar once the external compilation -- process completes, but only the main thread executes kernels. Hence, -- only one thread will ever attempt to take the MVar in order to link -- the binary object. -- message "waiting for nvcc..." takeMVar done let cubin = replaceExtension cufile ".cubin" bin <- B.readFile cubin mdl <- CUDA.loadData bin addFinalizer mdl (module_finalizer weak_ctx key mdl) -- Update hash tables and stash the binary object into the persistent -- cache -- KT.insert table key $! KernelObject bin (FL.singleton ctx mdl) KT.persist table cubin key -- Remove temporary build products. -- If compiling kernels with debugging symbols, leave the source files -- in place so that they can be referenced by 'cuda-gdb'. -- D.unless D.debug_cc $ do removeFile cufile removeDirectory (dropFileName cufile) `catchIOError` \_ -> return () -- directory not empty return mdl -- If we get a real object back, then this will already be in the -- persistent cache, since either it was just read in from there, or we -- had to generate new code and the link step above has added it. -- KernelObject bin active | Just mdl <- FL.lookup ctx active -> return mdl | otherwise -> do message "re-linking module for current context" mdl <- CUDA.loadData bin addFinalizer mdl (module_finalizer weak_ctx key mdl) KT.insert table key $! KernelObject bin (FL.cons ctx mdl active) return mdl -- Generate and compile code for a single open array expression --
2,371
link context table key = let intErr = $internalError "link" "missing kernel entry" ctx = deviceContext context weak_ctx = weakContext context in do entry <- fromMaybe intErr `fmap` KT.lookup context table key case entry of CompileProcess cufile done -> do -- Wait for the compiler to finish and load the binary object into the -- current context. -- -- A forked thread will fill the MVar once the external compilation -- process completes, but only the main thread executes kernels. Hence, -- only one thread will ever attempt to take the MVar in order to link -- the binary object. -- message "waiting for nvcc..." takeMVar done let cubin = replaceExtension cufile ".cubin" bin <- B.readFile cubin mdl <- CUDA.loadData bin addFinalizer mdl (module_finalizer weak_ctx key mdl) -- Update hash tables and stash the binary object into the persistent -- cache -- KT.insert table key $! KernelObject bin (FL.singleton ctx mdl) KT.persist table cubin key -- Remove temporary build products. -- If compiling kernels with debugging symbols, leave the source files -- in place so that they can be referenced by 'cuda-gdb'. -- D.unless D.debug_cc $ do removeFile cufile removeDirectory (dropFileName cufile) `catchIOError` \_ -> return () -- directory not empty return mdl -- If we get a real object back, then this will already be in the -- persistent cache, since either it was just read in from there, or we -- had to generate new code and the link step above has added it. -- KernelObject bin active | Just mdl <- FL.lookup ctx active -> return mdl | otherwise -> do message "re-linking module for current context" mdl <- CUDA.loadData bin addFinalizer mdl (module_finalizer weak_ctx key mdl) KT.insert table key $! KernelObject bin (FL.cons ctx mdl active) return mdl -- Generate and compile code for a single open array expression --
2,309
false
true
0
21
793
419
194
225
null
null
brendanhay/gogol
gogol-vision/gen/Network/Google/Vision/Types/Product.hs
mpl-2.0
-- | Creates a value of 'GoogleCloudVisionV1p3beta1ImageAnnotationContext' with the minimum fields required to make a request. -- -- Use one of the following lenses to modify other fields as desired: -- -- * 'gcvviacURI' -- -- * 'gcvviacPageNumber' googleCloudVisionV1p3beta1ImageAnnotationContext :: GoogleCloudVisionV1p3beta1ImageAnnotationContext googleCloudVisionV1p3beta1ImageAnnotationContext = GoogleCloudVisionV1p3beta1ImageAnnotationContext' {_gcvviacURI = Nothing, _gcvviacPageNumber = Nothing}
514
googleCloudVisionV1p3beta1ImageAnnotationContext :: GoogleCloudVisionV1p3beta1ImageAnnotationContext googleCloudVisionV1p3beta1ImageAnnotationContext = GoogleCloudVisionV1p3beta1ImageAnnotationContext' {_gcvviacURI = Nothing, _gcvviacPageNumber = Nothing}
265
googleCloudVisionV1p3beta1ImageAnnotationContext = GoogleCloudVisionV1p3beta1ImageAnnotationContext' {_gcvviacURI = Nothing, _gcvviacPageNumber = Nothing}
160
true
true
1
7
59
39
23
16
null
null
frantisekfarka/ghc-dsi
compiler/codeGen/StgCmmMonad.hs
bsd-3-clause
getHpUsage :: FCode HeapUsage getHpUsage = do state <- getState return $ cgs_hp_usg state
105
getHpUsage :: FCode HeapUsage getHpUsage = do state <- getState return $ cgs_hp_usg state
105
getHpUsage = do state <- getState return $ cgs_hp_usg state
75
false
true
0
8
29
31
14
17
null
null
uwap/timers
src/Control/Concurrent/Timer.hs
bsd-3-clause
-- | Forks a new thread that runs the supplied action -- (at least) after the given delay. oneShotAction :: IO () -> Delay -> IO ThreadId oneShotAction action delay = fork (suspend delay >> action)
225
oneShotAction :: IO () -> Delay -> IO ThreadId oneShotAction action delay = fork (suspend delay >> action)
134
oneShotAction action delay = fork (suspend delay >> action)
59
true
true
0
8
63
47
23
24
null
null
uuhan/Idris-dev
src/IRTS/CodegenC.hs
bsd-3-clause
debug _ = ""
12
debug _ = ""
12
debug _ = ""
12
false
false
0
4
3
10
4
6
null
null
aslatter/xhb
build-utils/src/Generate.hs
bsd-3-clause
xDecl (_,xhd) (XRequest name opcode fields resp) = appMany [ declareStruct name fields , exportType name , addDecl $ declareSerRequest xhd name opcode fields , case resp of Nothing -> id -- empty Just rFields -> let rName = replyName name in appMany [ declareStruct rName rFields , exportType rName , addDecl $ declareDeserReply rName rFields ] ]
451
xDecl (_,xhd) (XRequest name opcode fields resp) = appMany [ declareStruct name fields , exportType name , addDecl $ declareSerRequest xhd name opcode fields , case resp of Nothing -> id -- empty Just rFields -> let rName = replyName name in appMany [ declareStruct rName rFields , exportType rName , addDecl $ declareDeserReply rName rFields ] ]
451
xDecl (_,xhd) (XRequest name opcode fields resp) = appMany [ declareStruct name fields , exportType name , addDecl $ declareSerRequest xhd name opcode fields , case resp of Nothing -> id -- empty Just rFields -> let rName = replyName name in appMany [ declareStruct rName rFields , exportType rName , addDecl $ declareDeserReply rName rFields ] ]
451
false
false
1
15
162
131
63
68
null
null
jsavatgy/xroads-game
code/io-segs.hs
gpl-2.0
normal (Vector dx dy) = Vector (-dy) dx
42
normal (Vector dx dy) = Vector (-dy) dx
42
normal (Vector dx dy) = Vector (-dy) dx
42
false
false
0
7
10
27
13
14
null
null
bergmark/haskell-opaleye
src/Opaleye/Internal/HaskellDB/Sql/Default.hs
bsd-3-clause
showAggrOp AggrMin = "MIN"
37
showAggrOp AggrMin = "MIN"
37
showAggrOp AggrMin = "MIN"
37
false
false
0
5
14
9
4
5
null
null
ssaavedra/liquidhaskell
src/Language/Haskell/Liquid/Transforms/ANF.hs
bsd-3-clause
titch :: AnfEnv -> CoreExpr -> DsMW CoreExpr stitch γ e = do bs' <- get modify $ \s -> s {st_binds = []} e' <- normalize γ e bs <- st_binds <$> get put bs' return $ mkCoreLets bs e' --------------------------------------------------------------------------------
309
stitch :: AnfEnv -> CoreExpr -> DsMW CoreExpr stitch γ e = do bs' <- get modify $ \s -> s {st_binds = []} e' <- normalize γ e bs <- st_binds <$> get put bs' return $ mkCoreLets bs e' --------------------------------------------------------------------------------
309
stitch γ e = do bs' <- get modify $ \s -> s {st_binds = []} e' <- normalize γ e bs <- st_binds <$> get put bs' return $ mkCoreLets bs e' --------------------------------------------------------------------------------
263
false
true
0
11
88
102
47
55
null
null
NotBrianZach/postgrest
src/PostgREST/App.hs
mit
postgrest :: AppConfig -> IORef DbStructure -> P.Pool -> IO POSIXTime -> Application postgrest conf refDbStructure pool getTime = let middle = (if configQuiet conf then id else logStdout) . defaultMiddle in middle $ \ req respond -> do time <- getTime body <- strictRequestBody req dbStructure <- readIORef refDbStructure let schema = toS $ configSchema conf apiRequest = userApiRequest schema req body eClaims = jwtClaims (secret <$> configJwtSecret conf) (iJWT apiRequest) time authed = containsRole eClaims handleReq = runWithClaims conf eClaims (app dbStructure conf) apiRequest txMode = transactionMode $ iAction apiRequest resp <- either (pgErrResponse authed) id <$> P.use pool (HT.run handleReq HT.ReadCommitted txMode) respond resp
840
postgrest :: AppConfig -> IORef DbStructure -> P.Pool -> IO POSIXTime -> Application postgrest conf refDbStructure pool getTime = let middle = (if configQuiet conf then id else logStdout) . defaultMiddle in middle $ \ req respond -> do time <- getTime body <- strictRequestBody req dbStructure <- readIORef refDbStructure let schema = toS $ configSchema conf apiRequest = userApiRequest schema req body eClaims = jwtClaims (secret <$> configJwtSecret conf) (iJWT apiRequest) time authed = containsRole eClaims handleReq = runWithClaims conf eClaims (app dbStructure conf) apiRequest txMode = transactionMode $ iAction apiRequest resp <- either (pgErrResponse authed) id <$> P.use pool (HT.run handleReq HT.ReadCommitted txMode) respond resp
840
postgrest conf refDbStructure pool getTime = let middle = (if configQuiet conf then id else logStdout) . defaultMiddle in middle $ \ req respond -> do time <- getTime body <- strictRequestBody req dbStructure <- readIORef refDbStructure let schema = toS $ configSchema conf apiRequest = userApiRequest schema req body eClaims = jwtClaims (secret <$> configJwtSecret conf) (iJWT apiRequest) time authed = containsRole eClaims handleReq = runWithClaims conf eClaims (app dbStructure conf) apiRequest txMode = transactionMode $ iAction apiRequest resp <- either (pgErrResponse authed) id <$> P.use pool (HT.run handleReq HT.ReadCommitted txMode) respond resp
742
false
true
0
17
206
258
123
135
null
null
fpco/hlint
src/CmdLine.hs
bsd-3-clause
cmdHintFiles :: Cmd -> IO [FilePath] cmdHintFiles cmd = mapM (getHintFile $ cmdDataDir cmd) $ cmdGivenHints cmd ++ ["HLint" | null (cmdGivenHints cmd) && null (cmdWithHints cmd)]
178
cmdHintFiles :: Cmd -> IO [FilePath] cmdHintFiles cmd = mapM (getHintFile $ cmdDataDir cmd) $ cmdGivenHints cmd ++ ["HLint" | null (cmdGivenHints cmd) && null (cmdWithHints cmd)]
178
cmdHintFiles cmd = mapM (getHintFile $ cmdDataDir cmd) $ cmdGivenHints cmd ++ ["HLint" | null (cmdGivenHints cmd) && null (cmdWithHints cmd)]
141
false
true
0
11
26
77
37
40
null
null
jcgruenhage/dendrite
vendor/src/github.com/apache/thrift/lib/hs/src/Thrift/Protocol/Compact.hs
apache-2.0
-- 0001 1111 typeMask = 0xe0
31
typeMask = 0xe0
18
typeMask = 0xe0
18
true
false
0
4
8
7
4
3
null
null
maciej-bendkowski/boltzmann-brain
Data/Boltzmann/System/Tuner/Algebraic.hs
bsd-3-clause
sparseTypeVec find' offset ((t, n) : xs) = (n, offset + find' t) : sparseTypeVec find' offset xs
98
sparseTypeVec find' offset ((t, n) : xs) = (n, offset + find' t) : sparseTypeVec find' offset xs
98
sparseTypeVec find' offset ((t, n) : xs) = (n, offset + find' t) : sparseTypeVec find' offset xs
98
false
false
0
8
19
50
26
24
null
null
frontrowed/stratosphere
library-gen/Stratosphere/ResourceProperties/SSMPatchBaselinePatchFilter.hs
mit
-- | http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ssm-patchbaseline-patchfilter.html#cfn-ssm-patchbaseline-patchfilter-key ssmpbpfKey :: Lens' SSMPatchBaselinePatchFilter (Maybe (Val Text)) ssmpbpfKey = lens _sSMPatchBaselinePatchFilterKey (\s a -> s { _sSMPatchBaselinePatchFilterKey = a })
323
ssmpbpfKey :: Lens' SSMPatchBaselinePatchFilter (Maybe (Val Text)) ssmpbpfKey = lens _sSMPatchBaselinePatchFilterKey (\s a -> s { _sSMPatchBaselinePatchFilterKey = a })
168
ssmpbpfKey = lens _sSMPatchBaselinePatchFilterKey (\s a -> s { _sSMPatchBaselinePatchFilterKey = a })
101
true
true
0
9
22
52
28
24
null
null
facebookincubator/duckling
Duckling/Time/BG/Rules.hs
bsd-3-clause
ruleYYYYQQ :: Rule ruleYYYYQQ = Rule { name = "yyyyqq" , pattern = [ regex "(\\d{2,4})q([1-4])" ] , prod = \case (Token RegexMatch (GroupMatch (yy:qq:_)):_) -> do y <- parseInt yy q <- parseInt qq tt . cycleNthAfter True TG.Quarter (q - 1) $ year y _ -> Nothing }
315
ruleYYYYQQ :: Rule ruleYYYYQQ = Rule { name = "yyyyqq" , pattern = [ regex "(\\d{2,4})q([1-4])" ] , prod = \case (Token RegexMatch (GroupMatch (yy:qq:_)):_) -> do y <- parseInt yy q <- parseInt qq tt . cycleNthAfter True TG.Quarter (q - 1) $ year y _ -> Nothing }
315
ruleYYYYQQ = Rule { name = "yyyyqq" , pattern = [ regex "(\\d{2,4})q([1-4])" ] , prod = \case (Token RegexMatch (GroupMatch (yy:qq:_)):_) -> do y <- parseInt yy q <- parseInt qq tt . cycleNthAfter True TG.Quarter (q - 1) $ year y _ -> Nothing }
296
false
true
0
18
101
134
67
67
null
null
green-haskell/ghc
libraries/base/Data/OldList.hs
bsd-3-clause
maximumBy :: (a -> a -> Ordering) -> [a] -> a maximumBy _ [] = error "List.maximumBy: empty list"
121
maximumBy :: (a -> a -> Ordering) -> [a] -> a maximumBy _ [] = error "List.maximumBy: empty list"
121
maximumBy _ [] = error "List.maximumBy: empty list"
61
false
true
0
8
42
43
22
21
null
null
qpliu/esolang
DGOL/hs/interp/Scope.hs
gpl-3.0
eq :: Scope -> Var -> Var -> Bool eq (Scope (vars,_,_)) v1 v2 = Vars.eq vars v1 v2
82
eq :: Scope -> Var -> Var -> Bool eq (Scope (vars,_,_)) v1 v2 = Vars.eq vars v1 v2
82
eq (Scope (vars,_,_)) v1 v2 = Vars.eq vars v1 v2
48
false
true
0
12
18
59
29
30
null
null
wavewave/hxournal
lib/Application/HXournal/Coroutine/Default.hs
bsd-2-clause
menuEventProcess MenuPageWidth = pageZoomChange FitWidth
56
menuEventProcess MenuPageWidth = pageZoomChange FitWidth
56
menuEventProcess MenuPageWidth = pageZoomChange FitWidth
56
false
false
0
5
4
12
5
7
null
null
ezyang/ghc
testsuite/tests/simplCore/should_run/T13429a.hs
bsd-3-clause
appendTree4 xs a b c d (Single x) = xs |> a |> b |> c |> d |> x
67
appendTree4 xs a b c d (Single x) = xs |> a |> b |> c |> d |> x
67
appendTree4 xs a b c d (Single x) = xs |> a |> b |> c |> d |> x
67
false
false
3
9
23
58
24
34
null
null
PepeLui17/Proyecto_Lenguajes_De_Programacion_Segundo_Parcial
HeapInternal.hs
gpl-2.0
isEmpty _ = False
21
isEmpty _ = False
21
isEmpty _ = False
21
false
false
0
5
7
9
4
5
null
null
brendanhay/gogol
gogol-doubleclick-bids/gen/Network/Google/Resource/DoubleClickBidManager/Lineitems/Uploadlineitems.hs
mpl-2.0
-- | OAuth access token. luAccessToken :: Lens' LineitemsUploadlineitems (Maybe Text) luAccessToken = lens _luAccessToken (\ s a -> s{_luAccessToken = a})
162
luAccessToken :: Lens' LineitemsUploadlineitems (Maybe Text) luAccessToken = lens _luAccessToken (\ s a -> s{_luAccessToken = a})
137
luAccessToken = lens _luAccessToken (\ s a -> s{_luAccessToken = a})
76
true
true
0
9
29
48
25
23
null
null
robmcl4/Glug
test/CacheSpec.hs
bsd-3-clause
twoItemCache :: Cache twoItemCache = insertHardCache "http://example.com/foo" "examplecontent" $ insertHardCache "http://example.com/bar" "comeonandslam" $ newCache 100
198
twoItemCache :: Cache twoItemCache = insertHardCache "http://example.com/foo" "examplecontent" $ insertHardCache "http://example.com/bar" "comeonandslam" $ newCache 100
198
twoItemCache = insertHardCache "http://example.com/foo" "examplecontent" $ insertHardCache "http://example.com/bar" "comeonandslam" $ newCache 100
176
false
true
0
7
44
32
15
17
null
null
phischu/fragnix
builtins/base/Data.Typeable.Internal.hs
bsd-3-clause
{- ********************************************************* * * * TyCon/TypeRep definitions for type literals * * (Symbol and Nat) * * * ********************************************************* -} mkTypeLitTyCon :: String -> TyCon mkTypeLitTyCon name = mkTyCon3 "base" "GHC.TypeLits" name
459
mkTypeLitTyCon :: String -> TyCon mkTypeLitTyCon name = mkTyCon3 "base" "GHC.TypeLits" name
91
mkTypeLitTyCon name = mkTyCon3 "base" "GHC.TypeLits" name
57
true
true
0
5
200
26
13
13
null
null
DougBurke/swish
src/Swish/RDF/Datatype/XSD/String.hs
lgpl-2.1
-- Variable binding modifier to create new binding to a canonical -- form of a datatyped literal. stringPlainValue :: RDFLabel -> RDFLabel -> RDFVarBindingModify stringPlainValue svar lvar = VarBindingModify { vbmName = makeNSScopedName namespaceRDFD "stringPlain" , vbmApply = concatMap app1 , vbmVocab = [svar,lvar] , vbmUsage = [[svar],[lvar],[]] } where app1 vbind = app2 (vbMap vbind svar) (vbMap vbind lvar) vbind -- Going to assume can only get TypedLit here, and assume LangLit -- can be ignored. app2 (Just (TypedLit s _)) (Just (Lit l)) vbind | s == l = [vbind] app2 (Just (TypedLit s _)) Nothing vbind = [addVarBinding lvar (Lit s) vbind] app2 Nothing (Just (Lit l)) vbind = [addVarBinding svar (TypedLit l typeNameXsdString) vbind] app2 _ _ _ = [] -------------------------------------------------------------------------------- -- -- Copyright (c) 2003, Graham Klyne, 2009 Vasili I Galchin, -- 2011, 2012 Douglas Burke -- All rights reserved. -- -- This file is part of Swish. -- -- Swish is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- -- Swish is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with Swish; if not, write to: -- The Free Software Foundation, Inc., -- 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -- --------------------------------------------------------------------------------
2,037
stringPlainValue :: RDFLabel -> RDFLabel -> RDFVarBindingModify stringPlainValue svar lvar = VarBindingModify { vbmName = makeNSScopedName namespaceRDFD "stringPlain" , vbmApply = concatMap app1 , vbmVocab = [svar,lvar] , vbmUsage = [[svar],[lvar],[]] } where app1 vbind = app2 (vbMap vbind svar) (vbMap vbind lvar) vbind -- Going to assume can only get TypedLit here, and assume LangLit -- can be ignored. app2 (Just (TypedLit s _)) (Just (Lit l)) vbind | s == l = [vbind] app2 (Just (TypedLit s _)) Nothing vbind = [addVarBinding lvar (Lit s) vbind] app2 Nothing (Just (Lit l)) vbind = [addVarBinding svar (TypedLit l typeNameXsdString) vbind] app2 _ _ _ = [] -------------------------------------------------------------------------------- -- -- Copyright (c) 2003, Graham Klyne, 2009 Vasili I Galchin, -- 2011, 2012 Douglas Burke -- All rights reserved. -- -- This file is part of Swish. -- -- Swish is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- -- Swish is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with Swish; if not, write to: -- The Free Software Foundation, Inc., -- 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -- --------------------------------------------------------------------------------
1,937
stringPlainValue svar lvar = VarBindingModify { vbmName = makeNSScopedName namespaceRDFD "stringPlain" , vbmApply = concatMap app1 , vbmVocab = [svar,lvar] , vbmUsage = [[svar],[lvar],[]] } where app1 vbind = app2 (vbMap vbind svar) (vbMap vbind lvar) vbind -- Going to assume can only get TypedLit here, and assume LangLit -- can be ignored. app2 (Just (TypedLit s _)) (Just (Lit l)) vbind | s == l = [vbind] app2 (Just (TypedLit s _)) Nothing vbind = [addVarBinding lvar (Lit s) vbind] app2 Nothing (Just (Lit l)) vbind = [addVarBinding svar (TypedLit l typeNameXsdString) vbind] app2 _ _ _ = [] -------------------------------------------------------------------------------- -- -- Copyright (c) 2003, Graham Klyne, 2009 Vasili I Galchin, -- 2011, 2012 Douglas Burke -- All rights reserved. -- -- This file is part of Swish. -- -- Swish is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- -- Swish is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with Swish; if not, write to: -- The Free Software Foundation, Inc., -- 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -- --------------------------------------------------------------------------------
1,869
true
true
4
8
547
319
167
152
null
null
shlevy/ghc
testsuite/tests/programs/andy_cherry/Interp.hs
bsd-3-clause
pgnInterp toks = failP ("when reading: " ++ unwords (map userFormat (take 10 toks)))
100
pgnInterp toks = failP ("when reading: " ++ unwords (map userFormat (take 10 toks)))
100
pgnInterp toks = failP ("when reading: " ++ unwords (map userFormat (take 10 toks)))
100
false
false
0
12
29
38
18
20
null
null
rubenmoor/skull
skull-server/src/Game/Bot.hs
mit
isAllRevealed :: Player -> Bool isAllRevealed player = all (== FaceUp) $ _cardFace <$> player ^. plAgent . aStack . stCards
129
isAllRevealed :: Player -> Bool isAllRevealed player = all (== FaceUp) $ _cardFace <$> player ^. plAgent . aStack . stCards
129
isAllRevealed player = all (== FaceUp) $ _cardFace <$> player ^. plAgent . aStack . stCards
93
false
true
0
11
26
51
24
27
null
null
input-output-hk/pos-haskell-prototype
util/test/Test/Pos/Util/ModifierSpec.hs
mit
mapModifierFormsMonoid :: (Show k, Show v, Eq k, Eq v, Hashable k) => Core.MapModifier k v -> Core.MapModifier k v -> Core.MapModifier k v -> Property mapModifierFormsMonoid = formsMonoid
207
mapModifierFormsMonoid :: (Show k, Show v, Eq k, Eq v, Hashable k) => Core.MapModifier k v -> Core.MapModifier k v -> Core.MapModifier k v -> Property mapModifierFormsMonoid = formsMonoid
207
mapModifierFormsMonoid = formsMonoid
36
false
true
0
10
48
77
38
39
null
null
kazu-yamamoto/wai
time-manager/System/TimeManager.hs
mit
tickle :: Handle -> IO () tickle (Handle _ stateRef) = I.writeIORef stateRef Active
83
tickle :: Handle -> IO () tickle (Handle _ stateRef) = I.writeIORef stateRef Active
83
tickle (Handle _ stateRef) = I.writeIORef stateRef Active
57
false
true
0
7
13
38
18
20
null
null
JPMoresmau/BuildWrapper
src/Language/Haskell/BuildWrapper/GHC.hs
bsd-3-clause
-- a section heading tokenType (ITdocOptions {})="D"
53
tokenType (ITdocOptions {})="D"
32
tokenType (ITdocOptions {})="D"
32
true
false
0
6
7
18
9
9
null
null
jameshsmith/HRL
Server/Abyss/Game.hs
mit
levelOne :: LevelSpec levelOne = LevelSpec { generator = dungeonGen (ritualChamber : hallway : map plainRoom rooms) , initializer = defaultInitializer , monsterCount = 40 , monsterTable = [ (10, Egg 'Z' White Monster.zombie) , (10, Egg 'S' White Monster.skeleton) ] , itemCount = 40 , itemTable = [ (10, (Item.longswordP2, 1)) , (10, (Item.greenPotion, 1)) , (10, (Item.redPotion, 1)) ] }
531
levelOne :: LevelSpec levelOne = LevelSpec { generator = dungeonGen (ritualChamber : hallway : map plainRoom rooms) , initializer = defaultInitializer , monsterCount = 40 , monsterTable = [ (10, Egg 'Z' White Monster.zombie) , (10, Egg 'S' White Monster.skeleton) ] , itemCount = 40 , itemTable = [ (10, (Item.longswordP2, 1)) , (10, (Item.greenPotion, 1)) , (10, (Item.redPotion, 1)) ] }
531
levelOne = LevelSpec { generator = dungeonGen (ritualChamber : hallway : map plainRoom rooms) , initializer = defaultInitializer , monsterCount = 40 , monsterTable = [ (10, Egg 'Z' White Monster.zombie) , (10, Egg 'S' White Monster.skeleton) ] , itemCount = 40 , itemTable = [ (10, (Item.longswordP2, 1)) , (10, (Item.greenPotion, 1)) , (10, (Item.redPotion, 1)) ] }
509
false
true
0
11
204
165
95
70
null
null
jwbuurlage/category-theory-programmers
examples/parser/lisp_like_dsl.hs
mit
operatorFunctions :: [(Int -> Int -> Int, OperatorType)] operatorFunctions = [((+), Add), ((*), Multiply)]
106
operatorFunctions :: [(Int -> Int -> Int, OperatorType)] operatorFunctions = [((+), Add), ((*), Multiply)]
106
operatorFunctions = [((+), Add), ((*), Multiply)]
49
false
true
0
10
13
57
33
24
null
null
philopon/web-routing
src/Network/Routing.hs
mit
fetching :: MonadPlus m => m a -> D.Store d -> Method -> [T.Text] -> Params d m a -> m a fetching next d m pps = {-# SCC fetching #-} loop where loop PNil = next loop (PCons f r o) = do (d', pps') <- f d pps execute' d' r m pps' `mplus` loop o
281
fetching :: MonadPlus m => m a -> D.Store d -> Method -> [T.Text] -> Params d m a -> m a fetching next d m pps = {-# SCC fetching #-} loop where loop PNil = next loop (PCons f r o) = do (d', pps') <- f d pps execute' d' r m pps' `mplus` loop o
281
fetching next d m pps = {-# SCC fetching #-} loop where loop PNil = next loop (PCons f r o) = do (d', pps') <- f d pps execute' d' r m pps' `mplus` loop o
192
false
true
1
12
96
150
69
81
null
null
ml9951/ghc
compiler/nativeGen/Dwarf/Types.hs
bsd-3-clause
escapeChar c | isAscii c && isPrint c && c /= '?' -- prevents trigraph warnings = char c | otherwise = char '\\' <> char (intToDigit (ch `div` 64)) <> char (intToDigit ((ch `div` 8) `mod` 8)) <> char (intToDigit (ch `mod` 8)) where ch = ord c -- | Generate an offset into another section. This is tricky because -- this is handled differently depending on platform: Mac Os expects -- us to calculate the offset using assembler arithmetic. Linux expects -- us to just reference the target directly, and will figure out on -- their own that we actually need an offset. Finally, Windows has -- a special directive to refer to relative offsets. Fun.
690
escapeChar c | isAscii c && isPrint c && c /= '?' -- prevents trigraph warnings = char c | otherwise = char '\\' <> char (intToDigit (ch `div` 64)) <> char (intToDigit ((ch `div` 8) `mod` 8)) <> char (intToDigit (ch `mod` 8)) where ch = ord c -- | Generate an offset into another section. This is tricky because -- this is handled differently depending on platform: Mac Os expects -- us to calculate the offset using assembler arithmetic. Linux expects -- us to just reference the target directly, and will figure out on -- their own that we actually need an offset. Finally, Windows has -- a special directive to refer to relative offsets. Fun.
690
escapeChar c | isAscii c && isPrint c && c /= '?' -- prevents trigraph warnings = char c | otherwise = char '\\' <> char (intToDigit (ch `div` 64)) <> char (intToDigit ((ch `div` 8) `mod` 8)) <> char (intToDigit (ch `mod` 8)) where ch = ord c -- | Generate an offset into another section. This is tricky because -- this is handled differently depending on platform: Mac Os expects -- us to calculate the offset using assembler arithmetic. Linux expects -- us to just reference the target directly, and will figure out on -- their own that we actually need an offset. Finally, Windows has -- a special directive to refer to relative offsets. Fun.
690
false
false
0
14
162
143
75
68
null
null
AndrewRademacher/stack
src/Stack/Types/Config.hs
bsd-3-clause
configMonoidAllowNewerName :: Text configMonoidAllowNewerName = "allow-newer"
77
configMonoidAllowNewerName :: Text configMonoidAllowNewerName = "allow-newer"
77
configMonoidAllowNewerName = "allow-newer"
42
false
true
0
4
5
11
6
5
null
null
wavewave/lhc-analysis-collection
exe/2013-07-22-SimplifiedSUSYlep.hs
gpl-3.0
squarkL = [ 1000001, 1000002, 1000003, 1000004 ]
52
squarkL = [ 1000001, 1000002, 1000003, 1000004 ]
52
squarkL = [ 1000001, 1000002, 1000003, 1000004 ]
52
false
false
0
5
11
18
11
7
null
null
Noeda/userinterface
src/Graphics/UI/Widget.hs
mit
layout :: IsWidget a => a -> UIAction (Maybe SomeLayout) layout (getWidget -> widget) = liftIO $ withManagedQObject widget $ \widget_ptr -> do r <- get_widget_layout widget_ptr if r == nullPtr then return Nothing else Just . SomeLayout <$> (manageQObject =<< createTrackedQObject r)
322
layout :: IsWidget a => a -> UIAction (Maybe SomeLayout) layout (getWidget -> widget) = liftIO $ withManagedQObject widget $ \widget_ptr -> do r <- get_widget_layout widget_ptr if r == nullPtr then return Nothing else Just . SomeLayout <$> (manageQObject =<< createTrackedQObject r)
322
layout (getWidget -> widget) = liftIO $ withManagedQObject widget $ \widget_ptr -> do r <- get_widget_layout widget_ptr if r == nullPtr then return Nothing else Just . SomeLayout <$> (manageQObject =<< createTrackedQObject r)
265
false
true
0
13
82
103
50
53
null
null
bkoropoff/Idris-dev
src/Idris/Reflection.hs
bsd-3-clause
rawPairTy :: Raw -> Raw -> Raw rawPairTy t1 t2 = raw_apply (Var pairTy) [t1, t2]
80
rawPairTy :: Raw -> Raw -> Raw rawPairTy t1 t2 = raw_apply (Var pairTy) [t1, t2]
80
rawPairTy t1 t2 = raw_apply (Var pairTy) [t1, t2]
49
false
true
0
7
15
41
21
20
null
null
arnizamani/occam
occam.hs
mit
langOps _ _ = []
16
langOps _ _ = []
16
langOps _ _ = []
16
false
false
0
5
4
13
6
7
null
null
brendanhay/gogol
gogol-android-publisher/gen/Network/Google/AndroidPublisher/Types/Product.hs
mpl-2.0
-- | User account identifier in the third-party service. Only present if -- account linking happened as part of the subscription purchase flow. spExternalAccountId :: Lens' SubscriptionPurchase (Maybe Text) spExternalAccountId = lens _spExternalAccountId (\ s a -> s{_spExternalAccountId = a})
301
spExternalAccountId :: Lens' SubscriptionPurchase (Maybe Text) spExternalAccountId = lens _spExternalAccountId (\ s a -> s{_spExternalAccountId = a})
157
spExternalAccountId = lens _spExternalAccountId (\ s a -> s{_spExternalAccountId = a})
94
true
true
0
9
47
49
26
23
null
null
uduki/hsQt
Qtc/Gui/QApplication.hs
bsd-2-clause
qApplicationRestoreOverrideCursor :: (()) -> IO () qApplicationRestoreOverrideCursor () = qtc_QApplication_restoreOverrideCursor
130
qApplicationRestoreOverrideCursor :: (()) -> IO () qApplicationRestoreOverrideCursor () = qtc_QApplication_restoreOverrideCursor
130
qApplicationRestoreOverrideCursor () = qtc_QApplication_restoreOverrideCursor
79
false
true
0
7
11
30
15
15
null
null
fmthoma/ghc
compiler/typecheck/TcEvidence.hs
bsd-3-clause
lookupEvBind :: EvBindMap -> EvVar -> Maybe EvBind lookupEvBind bs = lookupVarEnv (ev_bind_varenv bs)
101
lookupEvBind :: EvBindMap -> EvVar -> Maybe EvBind lookupEvBind bs = lookupVarEnv (ev_bind_varenv bs)
101
lookupEvBind bs = lookupVarEnv (ev_bind_varenv bs)
50
false
true
0
8
13
38
17
21
null
null
jclee/cartparse
parse.hs
bsd-2-clause
pExprCommand :: TokenParser ACommand pExprCommand = do expr <- pExpr (semicolonDecs, _) <- pSemicolon return AExprCommand { aecExpr=expr , aecSemicolonDecs=semicolonDecs }
201
pExprCommand :: TokenParser ACommand pExprCommand = do expr <- pExpr (semicolonDecs, _) <- pSemicolon return AExprCommand { aecExpr=expr , aecSemicolonDecs=semicolonDecs }
201
pExprCommand = do expr <- pExpr (semicolonDecs, _) <- pSemicolon return AExprCommand { aecExpr=expr , aecSemicolonDecs=semicolonDecs }
164
false
true
0
9
50
54
28
26
null
null
hecrj/haskell-format
test/specs/case-of/input.hs
bsd-3-clause
test :: Int -> IO () test n = case n of 0 -> putStrLn "0 case" 1 -> putStrLn "1 case" _ -> putStrLn "default case"
120
test :: Int -> IO () test n = case n of 0 -> putStrLn "0 case" 1 -> putStrLn "1 case" _ -> putStrLn "default case"
120
test n = case n of 0 -> putStrLn "0 case" 1 -> putStrLn "1 case" _ -> putStrLn "default case"
99
false
true
0
8
32
58
26
32
null
null
23Skidoo/aeson
tests/DataFamilies/Encoders.hs
bsd-3-clause
thNullaryParseJSON2ElemArray :: Value -> Parser (Nullary Int) thNullaryParseJSON2ElemArray = $(mkParseJSON opts2ElemArray 'C3)
126
thNullaryParseJSON2ElemArray :: Value -> Parser (Nullary Int) thNullaryParseJSON2ElemArray = $(mkParseJSON opts2ElemArray 'C3)
126
thNullaryParseJSON2ElemArray = $(mkParseJSON opts2ElemArray 'C3)
64
false
true
0
8
11
34
17
17
null
null
gbaz/cabal
cabal-install/Distribution/Client/Dependency/Modular/Tree.hs
bsd-3-clause
out (FChoice p i b m ts) = FChoiceF p i b m ts
52
out (FChoice p i b m ts) = FChoiceF p i b m ts
52
out (FChoice p i b m ts) = FChoiceF p i b m ts
52
false
false
0
7
19
34
16
18
null
null
grnet/snf-ganeti
src/Ganeti/HTools/Cluster.hs
bsd-2-clause
tryAlloc opts nl il inst (Left all_nodes) = let sols = foldl (\cstate -> concatAllocCollections cstate . allocateOnSingle opts nl inst ) emptyAllocCollection all_nodes n1pred = if algCapacity opts then allocGlobalN1 nl il else const True in return . annotateSolution $ collectionToSolution FailN1 n1pred sols
424
tryAlloc opts nl il inst (Left all_nodes) = let sols = foldl (\cstate -> concatAllocCollections cstate . allocateOnSingle opts nl inst ) emptyAllocCollection all_nodes n1pred = if algCapacity opts then allocGlobalN1 nl il else const True in return . annotateSolution $ collectionToSolution FailN1 n1pred sols
424
tryAlloc opts nl il inst (Left all_nodes) = let sols = foldl (\cstate -> concatAllocCollections cstate . allocateOnSingle opts nl inst ) emptyAllocCollection all_nodes n1pred = if algCapacity opts then allocGlobalN1 nl il else const True in return . annotateSolution $ collectionToSolution FailN1 n1pred sols
424
false
false
0
13
160
102
49
53
null
null
dmalikov/matrix-cdl
Data/Array/Boolean.hs
mit
row ∷ Matrix α → Int → Matrix α row m r = let (xi,xj) = bds m in if r <= xi && r > 0 then Matrix (1,xj) [ m !* (r,j) | j <- [1..xj] ] else error "no such row"
168
row ∷ Matrix α → Int → Matrix α row m r = let (xi,xj) = bds m in if r <= xi && r > 0 then Matrix (1,xj) [ m !* (r,j) | j <- [1..xj] ] else error "no such row"
168
row m r = let (xi,xj) = bds m in if r <= xi && r > 0 then Matrix (1,xj) [ m !* (r,j) | j <- [1..xj] ] else error "no such row"
136
false
true
0
12
53
111
57
54
null
null
IreneKnapp/Faction
libfaction/Distribution/Simple/Hpc.hs
bsd-3-clause
tixDir :: FilePath -- ^ \"dist/\" prefix -> FilePath -- ^ Component name -> FilePath -- ^ Directory containing test suite's .tix files tixDir distPref name = hpcDir distPref </> "tix" </> name
209
tixDir :: FilePath -- ^ \"dist/\" prefix -> FilePath -- ^ Component name -> FilePath tixDir distPref name = hpcDir distPref </> "tix" </> name
158
tixDir distPref name = hpcDir distPref </> "tix" </> name
57
true
true
0
8
49
44
21
23
null
null
mydaum/cabal
Cabal/Distribution/Make.hs
bsd-3-clause
configureAction :: ConfigFlags -> [String] -> IO () configureAction flags args = do noExtraFlags args let verbosity = fromFlag (configVerbosity flags) rawSystemExit verbosity "sh" $ "configure" : configureArgs backwardsCompatHack flags where backwardsCompatHack = True
284
configureAction :: ConfigFlags -> [String] -> IO () configureAction flags args = do noExtraFlags args let verbosity = fromFlag (configVerbosity flags) rawSystemExit verbosity "sh" $ "configure" : configureArgs backwardsCompatHack flags where backwardsCompatHack = True
284
configureAction flags args = do noExtraFlags args let verbosity = fromFlag (configVerbosity flags) rawSystemExit verbosity "sh" $ "configure" : configureArgs backwardsCompatHack flags where backwardsCompatHack = True
232
false
true
0
12
49
85
39
46
null
null
haroldcarr/learn-haskell-coq-ml-etc
haskell/paper/haroldcarr/2014-02-23-concrete-monads-0-motivating-example/concrete-monads-0-motivating-example.hs
unlicense
t2a2 = U.t "t2a2" -- 12 + (\x -> x) (runEval2 (eval2a Map.empty (Plus (Lit 12) (Abs "x" (Var "x"))))) (Left "Pattern match failure in do expression at concrete-monads-0-motivating-example.hs:117:31-39")
217
t2a2 = U.t "t2a2" -- 12 + (\x -> x) (runEval2 (eval2a Map.empty (Plus (Lit 12) (Abs "x" (Var "x"))))) (Left "Pattern match failure in do expression at concrete-monads-0-motivating-example.hs:117:31-39")
217
t2a2 = U.t "t2a2" -- 12 + (\x -> x) (runEval2 (eval2a Map.empty (Plus (Lit 12) (Abs "x" (Var "x"))))) (Left "Pattern match failure in do expression at concrete-monads-0-motivating-example.hs:117:31-39")
217
false
false
0
15
43
66
33
33
null
null
tylerjl/adventofcode
benchmark/Bench.hs
mit
main :: IO () main = defaultMain [ Y2015.Bench.benchmarks , Y2016.Bench.benchmarks ]
96
main :: IO () main = defaultMain [ Y2015.Bench.benchmarks , Y2016.Bench.benchmarks ]
96
main = defaultMain [ Y2015.Bench.benchmarks , Y2016.Bench.benchmarks ]
82
false
true
0
6
23
31
17
14
null
null
rueshyna/gogol
gogol-apps-tasks/gen/Network/Google/AppsTasks/Types/Product.hs
mpl-2.0
-- | Flag indicating whether the task is hidden. This is the case if the task -- had been marked completed when the task list was last cleared. The -- default is False. This field is read-only. ttHidden :: Lens' Task (Maybe Bool) ttHidden = lens _ttHidden (\ s a -> s{_ttHidden = a})
283
ttHidden :: Lens' Task (Maybe Bool) ttHidden = lens _ttHidden (\ s a -> s{_ttHidden = a})
89
ttHidden = lens _ttHidden (\ s a -> s{_ttHidden = a})
53
true
true
2
9
53
57
27
30
null
null
dmcclean/ais
src/Network/AIS/State.hs
bsd-3-clause
compatibleWithStereotype (ChannelManagementCommand { }) BaseStation = True
92
compatibleWithStereotype (ChannelManagementCommand { }) BaseStation = True
92
compatibleWithStereotype (ChannelManagementCommand { }) BaseStation = True
92
false
false
0
7
24
18
9
9
null
null
zeekay/lambdabot
Plugin/Undo.hs
mit
transform :: (String -> HsExp -> HsExp) -> String -> String transform f = withParsed $ \e -> everywhere (mkT . f . findVar $ e) e
129
transform :: (String -> HsExp -> HsExp) -> String -> String transform f = withParsed $ \e -> everywhere (mkT . f . findVar $ e) e
129
transform f = withParsed $ \e -> everywhere (mkT . f . findVar $ e) e
69
false
true
0
11
26
67
33
34
null
null
kairne/repa-lts
Data/Rope/Operators/Reduction.hs
bsd-3-clause
--MapCurReb ls ds mds n1 n2 l1 l2) reduceLTSUntil :: forall a . Par Bool -> (a -> a -> a) -> a -> Rope a -> Par (Progress (ReduceCur a) a) reduceLTSUntil cond f z rp = m xs ctx where mSeq :: a -> ReduceCtx a -> a mSeq x ctx = case reduceNext f x ctx of Finished p' -> p' More (xs', ctx') -> mSeq (Seq.reduce f z xs') ctx' m :: Seq a -> ReduceCtx a -> Par (Progress (ReduceCur a) a) m xs ctx = case Seq.reduceUntil cond f z xs of Finished p' -> p' `seq` case reduceNext f p' ctx of --Completed this leaf, move onto next Finished red' -> return $ Finished red' More (seq', ctx') -> m seq' ctx' More (p', useq') -> if reduceCurLength (ReduceCur p' useq' ctx) >= 2 then return $ More (ReduceCur p' useq' ctx) else return $ Finished (mSeq (Seq.reduce f p' useq') ctx) xs :: Seq a ctx :: ReduceCtx a (xs, ctx) = reduceLeftmost rp RCTop
1,118
reduceLTSUntil :: forall a . Par Bool -> (a -> a -> a) -> a -> Rope a -> Par (Progress (ReduceCur a) a) reduceLTSUntil cond f z rp = m xs ctx where mSeq :: a -> ReduceCtx a -> a mSeq x ctx = case reduceNext f x ctx of Finished p' -> p' More (xs', ctx') -> mSeq (Seq.reduce f z xs') ctx' m :: Seq a -> ReduceCtx a -> Par (Progress (ReduceCur a) a) m xs ctx = case Seq.reduceUntil cond f z xs of Finished p' -> p' `seq` case reduceNext f p' ctx of --Completed this leaf, move onto next Finished red' -> return $ Finished red' More (seq', ctx') -> m seq' ctx' More (p', useq') -> if reduceCurLength (ReduceCur p' useq' ctx) >= 2 then return $ More (ReduceCur p' useq' ctx) else return $ Finished (mSeq (Seq.reduce f p' useq') ctx) xs :: Seq a ctx :: ReduceCtx a (xs, ctx) = reduceLeftmost rp RCTop
1,082
reduceLTSUntil cond f z rp = m xs ctx where mSeq :: a -> ReduceCtx a -> a mSeq x ctx = case reduceNext f x ctx of Finished p' -> p' More (xs', ctx') -> mSeq (Seq.reduce f z xs') ctx' m :: Seq a -> ReduceCtx a -> Par (Progress (ReduceCur a) a) m xs ctx = case Seq.reduceUntil cond f z xs of Finished p' -> p' `seq` case reduceNext f p' ctx of --Completed this leaf, move onto next Finished red' -> return $ Finished red' More (seq', ctx') -> m seq' ctx' More (p', useq') -> if reduceCurLength (ReduceCur p' useq' ctx) >= 2 then return $ More (ReduceCur p' useq' ctx) else return $ Finished (mSeq (Seq.reduce f p' useq') ctx) xs :: Seq a ctx :: ReduceCtx a (xs, ctx) = reduceLeftmost rp RCTop
930
true
true
0
15
461
403
198
205
null
null
AKST/wikit
socket-server/src/Util/Common.hs
mit
getArticle v = do articles <- (v .: "query") >>= (.: "pages") case HM.elems (articles :: HM.HashMap Text Value) of Object v:_ -> return v _ -> mzero
170
getArticle v = do articles <- (v .: "query") >>= (.: "pages") case HM.elems (articles :: HM.HashMap Text Value) of Object v:_ -> return v _ -> mzero
170
getArticle v = do articles <- (v .: "query") >>= (.: "pages") case HM.elems (articles :: HM.HashMap Text Value) of Object v:_ -> return v _ -> mzero
170
false
false
0
11
49
78
38
40
null
null
fizruk/demarcate
examples/concurrent.hs
bsd-3-clause
forkEnv :: Env a -> Env () forkEnv (ReaderT g) = ReaderT $ \e -> do forkIO (g e >> return ()) return () -- | Subprogram. Outputs current state.
148
forkEnv :: Env a -> Env () forkEnv (ReaderT g) = ReaderT $ \e -> do forkIO (g e >> return ()) return () -- | Subprogram. Outputs current state.
148
forkEnv (ReaderT g) = ReaderT $ \e -> do forkIO (g e >> return ()) return () -- | Subprogram. Outputs current state.
121
false
true
0
13
34
75
34
41
null
null
olsner/ghc
compiler/types/Coercion.hs
bsd-3-clause
lcTCvSubst :: LiftingContext -> TCvSubst lcTCvSubst (LC subst _) = subst
72
lcTCvSubst :: LiftingContext -> TCvSubst lcTCvSubst (LC subst _) = subst
72
lcTCvSubst (LC subst _) = subst
31
false
true
0
6
10
30
14
16
null
null
TOSPIO/yi
src/library/Yi/Keymap/Vim/Ex/Commands/Quit.hs
gpl-2.0
parse :: EventString -> Maybe ExCommand parse = Common.parse $ P.choice [ do void $ P.try ( P.string "xit") <|> P.string "x" bangs <- P.many (P.char '!') return (quit True (not $ null bangs) False) , do ws <- P.many (P.char 'w') void $ P.try ( P.string "quit") <|> P.string "q" as <- P.many (P.try ( P.string "all") <|> P.string "a") bangs <- P.many (P.char '!') return $! quit (not $ null ws) (not $ null bangs) (not $ null as) ]
506
parse :: EventString -> Maybe ExCommand parse = Common.parse $ P.choice [ do void $ P.try ( P.string "xit") <|> P.string "x" bangs <- P.many (P.char '!') return (quit True (not $ null bangs) False) , do ws <- P.many (P.char 'w') void $ P.try ( P.string "quit") <|> P.string "q" as <- P.many (P.try ( P.string "all") <|> P.string "a") bangs <- P.many (P.char '!') return $! quit (not $ null ws) (not $ null bangs) (not $ null as) ]
506
parse = Common.parse $ P.choice [ do void $ P.try ( P.string "xit") <|> P.string "x" bangs <- P.many (P.char '!') return (quit True (not $ null bangs) False) , do ws <- P.many (P.char 'w') void $ P.try ( P.string "quit") <|> P.string "q" as <- P.many (P.try ( P.string "all") <|> P.string "a") bangs <- P.many (P.char '!') return $! quit (not $ null ws) (not $ null bangs) (not $ null as) ]
466
false
true
0
15
157
260
121
139
null
null
glutamate/tnutils
TNUtils.hs
bsd-3-clause
safeHead [] = Nothing
21
safeHead [] = Nothing
21
safeHead [] = Nothing
21
false
false
0
6
3
11
5
6
null
null
roelvandijk/aeson
Data/Aeson/Functions.hs
bsd-3-clause
-- | Transform a 'M.Map' into a 'H.HashMap' while transforming the keys. mapHashKeyVal :: (Eq k2, Hashable k2) => (k1 -> k2) -> (v1 -> v2) -> M.Map k1 v1 -> H.HashMap k2 v2 mapHashKeyVal fk kv = M.foldrWithKey (\k v -> H.insert (fk k) (kv v)) H.empty
264
mapHashKeyVal :: (Eq k2, Hashable k2) => (k1 -> k2) -> (v1 -> v2) -> M.Map k1 v1 -> H.HashMap k2 v2 mapHashKeyVal fk kv = M.foldrWithKey (\k v -> H.insert (fk k) (kv v)) H.empty
191
mapHashKeyVal fk kv = M.foldrWithKey (\k v -> H.insert (fk k) (kv v)) H.empty
77
true
true
0
11
61
114
57
57
null
null
green-haskell/ghc
compiler/prelude/PrelNames.hs
bsd-3-clause
fromString_RDR :: RdrName fromString_RDR = nameRdrName fromStringName
78
fromString_RDR :: RdrName fromString_RDR = nameRdrName fromStringName
78
fromString_RDR = nameRdrName fromStringName
52
false
true
0
5
15
14
7
7
null
null
ciderpunx/exercismo
src/RobotSimulator.hs
gpl-3.0
charToMove :: Char -> Robot -> Robot charToMove 'A' = advance
61
charToMove :: Char -> Robot -> Robot charToMove 'A' = advance
61
charToMove 'A' = advance
24
false
true
0
6
10
22
11
11
null
null
ezrakilty/narc
Database/Narc/Util.hs
bsd-2-clause
onRight f = cross id f
22
onRight f = cross id f
22
onRight f = cross id f
22
false
false
0
5
5
14
6
8
null
null
kuribas/metatyper
src/Parselang.hs
gpl-3.0
numericEq :: DepExp -> MetaParser () numericEq e = do void $ char '='; someSpace e2 <- castType NumType expression saveDeps $ e === e2 numericEq e <|> return ()
168
numericEq :: DepExp -> MetaParser () numericEq e = do void $ char '='; someSpace e2 <- castType NumType expression saveDeps $ e === e2 numericEq e <|> return ()
168
numericEq e = do void $ char '='; someSpace e2 <- castType NumType expression saveDeps $ e === e2 numericEq e <|> return ()
131
false
true
0
9
37
75
33
42
null
null
oldmanmike/ghc
compiler/prelude/PrelNames.hs
bsd-3-clause
emptyCallStackKey, pushCallStackKey :: Unique emptyCallStackKey = mkPreludeMiscIdUnique 517
91
emptyCallStackKey, pushCallStackKey :: Unique emptyCallStackKey = mkPreludeMiscIdUnique 517
91
emptyCallStackKey = mkPreludeMiscIdUnique 517
45
false
true
0
5
7
16
9
7
null
null
Laar/antiquoter
src/Language/Haskell/AntiQuoter/Base.hs
bsd-3-clause
-- | Create an QuasiQuoter for expressions and patterns from a parser and two -- antiquoters. The quasiquoter from the example could also have been -- constructed by using @mkQuasiQuoter (return . parse) antiE antiP @. mkQuasiQuoter :: Data a => (String -> Q a) -> AntiQuoter Exp -> AntiQuoter Pat -> QuasiQuoter mkQuasiQuoter parse aqExp aqPat = QuasiQuoter { quoteExp = parse >=> dataToExpQ aqExp , quotePat = parse >=> dataToPatQ aqPat -- To prevent warnings #if MIN_VERSION_template_haskell(2,5,0) , quoteType = error $ "Language.Haskell.Antiquoter: can't handle types" , quoteDec = error $ "Language.Haskell.Antiquoter: can't handle decls" #endif }
694
mkQuasiQuoter :: Data a => (String -> Q a) -> AntiQuoter Exp -> AntiQuoter Pat -> QuasiQuoter mkQuasiQuoter parse aqExp aqPat = QuasiQuoter { quoteExp = parse >=> dataToExpQ aqExp , quotePat = parse >=> dataToPatQ aqPat -- To prevent warnings #if MIN_VERSION_template_haskell(2,5,0) , quoteType = error $ "Language.Haskell.Antiquoter: can't handle types" , quoteDec = error $ "Language.Haskell.Antiquoter: can't handle decls" #endif }
475
mkQuasiQuoter parse aqExp aqPat = QuasiQuoter { quoteExp = parse >=> dataToExpQ aqExp , quotePat = parse >=> dataToPatQ aqPat -- To prevent warnings #if MIN_VERSION_template_haskell(2,5,0) , quoteType = error $ "Language.Haskell.Antiquoter: can't handle types" , quoteDec = error $ "Language.Haskell.Antiquoter: can't handle decls" #endif }
365
true
true
0
9
139
107
58
49
null
null
infotroph/pandoc
src/Text/Pandoc/Readers/Org/ParserState.hs
gpl-2.0
returnF :: Monad m => a -> m (F a) returnF = return . return
60
returnF :: Monad m => a -> m (F a) returnF = return . return
60
returnF = return . return
25
false
true
0
9
14
35
17
18
null
null
snoyberg/photosorter
fay/Language/Fay/JQuery.hs
bsd-2-clause
setText :: String -> JQuery -> Fay JQuery setText = ffi "%2['text'](%1)"
72
setText :: String -> JQuery -> Fay JQuery setText = ffi "%2['text'](%1)"
72
setText = ffi "%2['text'](%1)"
30
false
true
0
7
11
25
12
13
null
null
nikita-volkov/hasql
library/Hasql/Private/Decoders/Result.hs
mit
checkExecStatus :: (LibPQ.ExecStatus -> Bool) -> Result () checkExecStatus predicate = {-# SCC "checkExecStatus" #-} do status <- Result $ ReaderT $ \(_, result) -> lift $ LibPQ.resultStatus result unless (predicate status) $ do case status of LibPQ.BadResponse -> serverError LibPQ.NonfatalError -> serverError LibPQ.FatalError -> serverError _ -> Result $ lift $ ExceptT $ pure $ Left $ UnexpectedResult $ "Unexpected result status: " <> (fromString $ show status)
524
checkExecStatus :: (LibPQ.ExecStatus -> Bool) -> Result () checkExecStatus predicate = {-# SCC "checkExecStatus" #-} do status <- Result $ ReaderT $ \(_, result) -> lift $ LibPQ.resultStatus result unless (predicate status) $ do case status of LibPQ.BadResponse -> serverError LibPQ.NonfatalError -> serverError LibPQ.FatalError -> serverError _ -> Result $ lift $ ExceptT $ pure $ Left $ UnexpectedResult $ "Unexpected result status: " <> (fromString $ show status)
524
checkExecStatus predicate = {-# SCC "checkExecStatus" #-} do status <- Result $ ReaderT $ \(_, result) -> lift $ LibPQ.resultStatus result unless (predicate status) $ do case status of LibPQ.BadResponse -> serverError LibPQ.NonfatalError -> serverError LibPQ.FatalError -> serverError _ -> Result $ lift $ ExceptT $ pure $ Left $ UnexpectedResult $ "Unexpected result status: " <> (fromString $ show status)
465
false
true
0
19
126
162
80
82
null
null
frantisekfarka/ghc-dsi
compiler/main/DynFlags.hs
bsd-3-clause
isAvx512erEnabled :: DynFlags -> Bool isAvx512erEnabled dflags = avx512er dflags
80
isAvx512erEnabled :: DynFlags -> Bool isAvx512erEnabled dflags = avx512er dflags
80
isAvx512erEnabled dflags = avx512er dflags
42
false
true
0
5
9
24
11
13
null
null
HIPERFIT/futhark
src/Futhark/Transform/Rename.hs
isc
renameBound :: [VName] -> RenameM a -> RenameM a renameBound vars body = do vars' <- mapM newName vars -- This works because map union prefers elements from left -- operand. local (renameBound' vars') body where renameBound' vars' env = env { envNameMap = M.fromList (zip vars vars') `M.union` envNameMap env } -- | Rename some statements, then execute an action with the name -- substitutions induced by the statements active.
490
renameBound :: [VName] -> RenameM a -> RenameM a renameBound vars body = do vars' <- mapM newName vars -- This works because map union prefers elements from left -- operand. local (renameBound' vars') body where renameBound' vars' env = env { envNameMap = M.fromList (zip vars vars') `M.union` envNameMap env } -- | Rename some statements, then execute an action with the name -- substitutions induced by the statements active.
490
renameBound vars body = do vars' <- mapM newName vars -- This works because map union prefers elements from left -- operand. local (renameBound' vars') body where renameBound' vars' env = env { envNameMap = M.fromList (zip vars vars') `M.union` envNameMap env } -- | Rename some statements, then execute an action with the name -- substitutions induced by the statements active.
441
false
true
0
10
133
108
54
54
null
null
junjihashimoto/th-cas
Algebra/CAS/Integrate.hs
mit
derivationCandidate :: [Formula] -- ^ variables -> [Formula] -- ^ diff of variables -> Formula -- ^ candidate formula -> Formula -- ^ derivation of candidate formula derivationCandidate vars dvars candidate = sum $ do (dv,v) <- zip dvars vars return $ dv * (diff candidate v) -- | split formula by coeff and vars -- -- >>> let [a0,a1,a2,a3,a4,a5,a6,a7,a8,a9] = reverse $ genCoeff "a" 10 -- >>> let [x,y,z] = map V ["x","y","z"] -- >>> let f = a6 + 2*a9*x + (-1)*y + (-1)*a1*y + a8*y + (-1)*a7*x*y + (-1)*a4*(y^2) + a3*z + a7*z + a8*x*z + (-2)*a2*y*z + 2*a5*y*z + a4*(z^2) -- >>> splitCoeffAndVariable f -- [(a6,1),(2*a9,x),(-1 + (-1)*a1 + a8,y),((-1)*a7,x*y),((-1)*a4,y^2),(a3 + a7,z),(a8,x*z),((-2)*a2 + 2*a5,y*z),(a4,z^2)]
797
derivationCandidate :: [Formula] -- ^ variables -> [Formula] -- ^ diff of variables -> Formula -- ^ candidate formula -> Formula derivationCandidate vars dvars candidate = sum $ do (dv,v) <- zip dvars vars return $ dv * (diff candidate v) -- | split formula by coeff and vars -- -- >>> let [a0,a1,a2,a3,a4,a5,a6,a7,a8,a9] = reverse $ genCoeff "a" 10 -- >>> let [x,y,z] = map V ["x","y","z"] -- >>> let f = a6 + 2*a9*x + (-1)*y + (-1)*a1*y + a8*y + (-1)*a7*x*y + (-1)*a4*(y^2) + a3*z + a7*z + a8*x*z + (-2)*a2*y*z + 2*a5*y*z + a4*(z^2) -- >>> splitCoeffAndVariable f -- [(a6,1),(2*a9,x),(-1 + (-1)*a1 + a8,y),((-1)*a7,x*y),((-1)*a4,y^2),(a3 + a7,z),(a8,x*z),((-2)*a2 + 2*a5,y*z),(a4,z^2)]
760
derivationCandidate vars dvars candidate = sum $ do (dv,v) <- zip dvars vars return $ dv * (diff candidate v) -- | split formula by coeff and vars -- -- >>> let [a0,a1,a2,a3,a4,a5,a6,a7,a8,a9] = reverse $ genCoeff "a" 10 -- >>> let [x,y,z] = map V ["x","y","z"] -- >>> let f = a6 + 2*a9*x + (-1)*y + (-1)*a1*y + a8*y + (-1)*a7*x*y + (-1)*a4*(y^2) + a3*z + a7*z + a8*x*z + (-2)*a2*y*z + 2*a5*y*z + a4*(z^2) -- >>> splitCoeffAndVariable f -- [(a6,1),(2*a9,x),(-1 + (-1)*a1 + a8,y),((-1)*a7,x*y),((-1)*a4,y^2),(a3 + a7,z),(a8,x*z),((-2)*a2 + 2*a5,y*z),(a4,z^2)]
571
true
true
2
10
190
90
50
40
null
null