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
m-alvarez/jhc
src/Doc/Pretty.hs
mit
linebreak = Line True
27
linebreak = Line True
27
linebreak = Line True
27
false
false
0
5
9
9
4
5
null
null
emwap/feldspar-compiler
lib/Feldspar/Compiler/Imperative/ExternalProgram.hs
bsd-3-clause
namedToType "bool" = MachineVector 1 BoolType
49
namedToType "bool" = MachineVector 1 BoolType
49
namedToType "bool" = MachineVector 1 BoolType
49
false
false
0
5
9
14
6
8
null
null
amccausl/Swish
Swish/HaskellRDF/Proof.hs
lgpl-2.1
-- |showNames -- Return a string representing a single name. showName n = "["++n++"]"
88
showName n = "["++n++"]"
24
showName n = "["++n++"]"
24
true
false
0
6
16
19
10
9
null
null
acple/renzu
src/Renzu/Getter.hs
bsd-3-clause
imatches :: MonadReader s m => IxRainbow r i s t a b -> (i -> a -> Either b r) -> m (Either t r) imatches l = asks . runCapture . l . Indexed . Capture . uncurry
161
imatches :: MonadReader s m => IxRainbow r i s t a b -> (i -> a -> Either b r) -> m (Either t r) imatches l = asks . runCapture . l . Indexed . Capture . uncurry
161
imatches l = asks . runCapture . l . Indexed . Capture . uncurry
64
false
true
2
12
39
98
45
53
null
null
ulricha/dsh
src/Database/DSH/NKL/Quote.hs
bsd-3-clause
pp (AppE2 _ p1 e1 e2) = (PP.text $ show p1) <+> (PP.parens $ pp e1) <+> (PP.parens $ pp e2)
91
pp (AppE2 _ p1 e1 e2) = (PP.text $ show p1) <+> (PP.parens $ pp e1) <+> (PP.parens $ pp e2)
91
pp (AppE2 _ p1 e1 e2) = (PP.text $ show p1) <+> (PP.parens $ pp e1) <+> (PP.parens $ pp e2)
91
false
false
0
9
20
66
32
34
null
null
snowleopard/shaking-up-ghc
src/Utilities.hs
bsd-3-clause
buildWithCmdOptions :: [CmdOption] -> Target -> Action () buildWithCmdOptions opts target = H.buildWithCmdOptions opts target getArgs
133
buildWithCmdOptions :: [CmdOption] -> Target -> Action () buildWithCmdOptions opts target = H.buildWithCmdOptions opts target getArgs
133
buildWithCmdOptions opts target = H.buildWithCmdOptions opts target getArgs
75
false
true
0
8
15
45
21
24
null
null
juodaspaulius/bclafer_old
src/Language/Clafer/Front/LayoutResolver.hs
mit
-- | Check if a token is the layout close token. isLayoutClose :: Token -> Bool isLayoutClose = isTokenIn [layoutClose]
119
isLayoutClose :: Token -> Bool isLayoutClose = isTokenIn [layoutClose]
70
isLayoutClose = isTokenIn [layoutClose]
39
true
true
0
6
19
22
12
10
null
null
nikita-volkov/repr-tree-syb
src/ReprTree.hs
mit
adtReprTree :: Data a => a -> Tree String adtReprTree a = Node (stripBraces $ showConstr $ toConstr a) (gmapQ reprTree a) where stripBraces :: String -> String stripBraces s = fromMaybe s $ stripPrefix "(" s >>= fmap reverse . stripPrefix ")" . reverse
279
adtReprTree :: Data a => a -> Tree String adtReprTree a = Node (stripBraces $ showConstr $ toConstr a) (gmapQ reprTree a) where stripBraces :: String -> String stripBraces s = fromMaybe s $ stripPrefix "(" s >>= fmap reverse . stripPrefix ")" . reverse
279
adtReprTree a = Node (stripBraces $ showConstr $ toConstr a) (gmapQ reprTree a) where stripBraces :: String -> String stripBraces s = fromMaybe s $ stripPrefix "(" s >>= fmap reverse . stripPrefix ")" . reverse
237
false
true
2
9
71
105
49
56
null
null
pushkinma/frag
src/BSP.hs
gpl-2.0
eadHeader :: Handle -> IO BSPHeader readHeader handle = do buf <- mallocBytes 4 _ <- hGetBuf handle buf 4 iD <- mapM (peekByteOff buf) [ 0 .. 3] :: IO [CChar] _ <- hGetBuf handle buf cIntSize ver <- peek (castPtr buf :: Ptr CInt) :: IO CInt free buf return BSPHeader { strID = map castCCharToChar iD, version = fromIntegral ver} -- - - - - - - - - - - - - - - - - - - -- reads the lumps in our bsp
454
readHeader :: Handle -> IO BSPHeader readHeader handle = do buf <- mallocBytes 4 _ <- hGetBuf handle buf 4 iD <- mapM (peekByteOff buf) [ 0 .. 3] :: IO [CChar] _ <- hGetBuf handle buf cIntSize ver <- peek (castPtr buf :: Ptr CInt) :: IO CInt free buf return BSPHeader { strID = map castCCharToChar iD, version = fromIntegral ver} -- - - - - - - - - - - - - - - - - - - -- reads the lumps in our bsp
454
readHeader handle = do buf <- mallocBytes 4 _ <- hGetBuf handle buf 4 iD <- mapM (peekByteOff buf) [ 0 .. 3] :: IO [CChar] _ <- hGetBuf handle buf cIntSize ver <- peek (castPtr buf :: Ptr CInt) :: IO CInt free buf return BSPHeader { strID = map castCCharToChar iD, version = fromIntegral ver} -- - - - - - - - - - - - - - - - - - - -- reads the lumps in our bsp
417
false
true
0
10
145
156
74
82
null
null
DougBurke/swish
src/Swish/RDF/ProofContext.hs
lgpl-2.1
-- Collect RDFS rules -- rulesRDFS :: [RDFRule] rulesRDFS = [ rdfsr1, rdfsr2, rdfsr3, rdfsr4a, rdfsr4b , rdfsr5, rdfsr6, rdfsr7, rdfsr8, rdfsr9 , rdfsr10, rdfsr11, rdfsr12, rdfsr13 , rdfscp11, rdfscp12, rdfscp13 , rdfscp21, rdfscp22, rdfscp23 , rdfscp31, rdfscp32, rdfscp33 ]
345
rulesRDFS :: [RDFRule] rulesRDFS = [ rdfsr1, rdfsr2, rdfsr3, rdfsr4a, rdfsr4b , rdfsr5, rdfsr6, rdfsr7, rdfsr8, rdfsr9 , rdfsr10, rdfsr11, rdfsr12, rdfsr13 , rdfscp11, rdfscp12, rdfscp13 , rdfscp21, rdfscp22, rdfscp23 , rdfscp31, rdfscp32, rdfscp33 ]
319
rulesRDFS = [ rdfsr1, rdfsr2, rdfsr3, rdfsr4a, rdfsr4b , rdfsr5, rdfsr6, rdfsr7, rdfsr8, rdfsr9 , rdfsr10, rdfsr11, rdfsr12, rdfsr13 , rdfscp11, rdfscp12, rdfscp13 , rdfscp21, rdfscp22, rdfscp23 , rdfscp31, rdfscp32, rdfscp33 ]
296
true
true
0
5
109
85
56
29
null
null
joom/WangsAlgorithm
src/WangsAlgorithm/Proposition.hs
mit
orProp _ = error "Only works on Or."
43
orProp _ = error "Only works on Or."
43
orProp _ = error "Only works on Or."
43
false
false
0
5
14
12
5
7
null
null
philderbeast/ghcjs
src/Compiler/Info.hs
mit
compilerInfo :: Bool -> DynFlags -> [(String, String)] compilerInfo nativeToo dflags = do let topDir = getTopDir dflags nubBy ((==) `on` fst) $ [ ("Project name" , "The Glorious Glasgow Haskell Compilation System for JavaScript") , ("Global Package DB", getGlobalPackageDB topDir) , ("Project version" , getCompilerVersion) , ("LibDir" , topDir) , ("Native Too" , if nativeToo then "YES" else "NO") ] ++ DynFlags.compilerInfo dflags -- | the directory to use if started without -B flag
611
compilerInfo :: Bool -> DynFlags -> [(String, String)] compilerInfo nativeToo dflags = do let topDir = getTopDir dflags nubBy ((==) `on` fst) $ [ ("Project name" , "The Glorious Glasgow Haskell Compilation System for JavaScript") , ("Global Package DB", getGlobalPackageDB topDir) , ("Project version" , getCompilerVersion) , ("LibDir" , topDir) , ("Native Too" , if nativeToo then "YES" else "NO") ] ++ DynFlags.compilerInfo dflags -- | the directory to use if started without -B flag
611
compilerInfo nativeToo dflags = do let topDir = getTopDir dflags nubBy ((==) `on` fst) $ [ ("Project name" , "The Glorious Glasgow Haskell Compilation System for JavaScript") , ("Global Package DB", getGlobalPackageDB topDir) , ("Project version" , getCompilerVersion) , ("LibDir" , topDir) , ("Native Too" , if nativeToo then "YES" else "NO") ] ++ DynFlags.compilerInfo dflags -- | the directory to use if started without -B flag
530
false
true
0
11
200
132
76
56
null
null
shlevy/ghc
testsuite/tests/safeHaskell/unsafeLibs/Dep10.hs
bsd-3-clause
bad1 = liftST
13
bad1 = liftST
13
bad1 = liftST
13
false
false
0
4
2
6
3
3
null
null
KommuSoft/ieeextreme8
ieeextreme80/test.hs
gpl-3.0
initkn :: [a] -> Kn a initkn x = [[x]]
38
initkn :: [a] -> Kn a initkn x = [[x]]
38
initkn x = [[x]]
16
false
true
0
6
9
30
16
14
null
null
adp-multi/adp-multi
benchmarks/Criterion/Helpers.hs
bsd-3-clause
benchArray :: NFData b => (a -> b) -> [(String,a)] -> [Benchmark] benchArray fun args = [bench name (nf fun arg) | (name,arg) <- args]
138
benchArray :: NFData b => (a -> b) -> [(String,a)] -> [Benchmark] benchArray fun args = [bench name (nf fun arg) | (name,arg) <- args]
138
benchArray fun args = [bench name (nf fun arg) | (name,arg) <- args]
72
false
true
0
10
28
86
44
42
null
null
brendanhay/gogol
gogol-remotebuildexecution/gen/Network/Google/RemoteBuildExecution/Types/Product.hs
mpl-2.0
gdrruioReadBytesCount :: Lens' GoogleDevtoolsRemotebuildbotResourceUsageIOStats (Maybe Word64) gdrruioReadBytesCount = lens _gdrruioReadBytesCount (\ s a -> s{_gdrruioReadBytesCount = a}) . mapping _Coerce
219
gdrruioReadBytesCount :: Lens' GoogleDevtoolsRemotebuildbotResourceUsageIOStats (Maybe Word64) gdrruioReadBytesCount = lens _gdrruioReadBytesCount (\ s a -> s{_gdrruioReadBytesCount = a}) . mapping _Coerce
219
gdrruioReadBytesCount = lens _gdrruioReadBytesCount (\ s a -> s{_gdrruioReadBytesCount = a}) . mapping _Coerce
124
false
true
0
10
33
54
27
27
null
null
ajnsit/custom-prelude
test-is-a-prelude.hs
gpl-3.0
sequence_ = P.sequence_
23
sequence_ = P.sequence_
23
sequence_ = P.sequence_
23
false
false
0
5
2
8
4
4
null
null
urbanslug/ghc
testsuite/tests/typecheck/should_compile/T10185.hs
bsd-3-clause
foo :: (Coercible (a b) (c d), Coercible (c d) (e f)) => Proxy (c d) -> a b -> e f foo _ = coerce
97
foo :: (Coercible (a b) (c d), Coercible (c d) (e f)) => Proxy (c d) -> a b -> e f foo _ = coerce
97
foo _ = coerce
14
false
true
0
9
25
84
40
44
null
null
erantapaa/parse-cabal
src/PackageRank.hs
bsd-3-clause
predToDAGList :: Rel a -> DAGList a predToDAGList = map (second S.toList) . SM.toList . preds
93
predToDAGList :: Rel a -> DAGList a predToDAGList = map (second S.toList) . SM.toList . preds
93
predToDAGList = map (second S.toList) . SM.toList . preds
57
false
true
0
10
15
48
21
27
null
null
grnet/snf-ganeti
src/Ganeti/Constants.hs
bsd-2-clause
-- | 60 MiB/s, expressed in KiB/s classicDrbdSyncSpeed :: Int classicDrbdSyncSpeed = 60 * 1024
94
classicDrbdSyncSpeed :: Int classicDrbdSyncSpeed = 60 * 1024
60
classicDrbdSyncSpeed = 60 * 1024
32
true
true
1
6
14
24
10
14
null
null
Lepovirta/Crystallize
app/Web/Server.hs
bsd-3-clause
formalizerApp :: FormalizeApp () formalizerApp = appMiddleware >> appRoutes
75
formalizerApp :: FormalizeApp () formalizerApp = appMiddleware >> appRoutes
75
formalizerApp = appMiddleware >> appRoutes
42
false
true
1
6
8
24
10
14
null
null
noteed/buh
bin/buh.hs
bsd-3-clause
computeSha :: Object -> Ref computeSha o = Ref . B16.encode . toStrict . bytestringDigest . sha1 . runPut $ putLoose o
122
computeSha :: Object -> Ref computeSha o = Ref . B16.encode . toStrict . bytestringDigest . sha1 . runPut $ putLoose o
122
computeSha o = Ref . B16.encode . toStrict . bytestringDigest . sha1 . runPut $ putLoose o
94
false
true
0
11
25
47
23
24
null
null
xu-hao/QueryArrow
QueryArrow-db-cypher/src/QueryArrow/Cypher/Cypher.hs
bsd-3-clause
-- (.||.) :: CypherCond -> CypherCond -> CypherCond -- CypherFalseCond .||. b = b -- CypherTrueCond .||. b = CypherTrueCond -- a .||. CypherFalseCond = a -- a .||. CypherTrueCond = CypherTrueCond -- a .||. b = CypherOrCond a b (.=.) :: CypherExpr -> CypherExpr -> CypherCond a .=. b = CypherCompCond "=" a b Pos
312
(.=.) :: CypherExpr -> CypherExpr -> CypherCond a .=. b = CypherCompCond "=" a b Pos
84
a .=. b = CypherCompCond "=" a b Pos
36
true
true
0
9
56
43
24
19
null
null
nevrenato/HetsAlloy
Comorphisms/HetLogicGraph.hs
gpl-2.0
preImageMaybe :: (Ord a, Ord b) => (a -> Maybe b) -> [a] -> Map.Map b (Set.Set a) preImageMaybe f vs = (Map.mapKeysMonotonic fromJust . Map.delete Nothing) $ preImage f vs
206
preImageMaybe :: (Ord a, Ord b) => (a -> Maybe b) -> [a] -> Map.Map b (Set.Set a) preImageMaybe f vs = (Map.mapKeysMonotonic fromJust . Map.delete Nothing) $ preImage f vs
206
preImageMaybe f vs = (Map.mapKeysMonotonic fromJust . Map.delete Nothing) $ preImage f vs
93
false
true
0
11
65
93
46
47
null
null
gcross/LogicGrowsOnTrees-MPI
sources/LogicGrowsOnTrees/Parallel/Adapter/MPI.hs
bsd-2-clause
sendMessage message destination = unsafeUseAsCStringLen (encode message) $ \(p_message,size) → c_sendMessage p_message (fromIntegral size) destination
162
sendMessage message destination = unsafeUseAsCStringLen (encode message) $ \(p_message,size) → c_sendMessage p_message (fromIntegral size) destination
162
sendMessage message destination = unsafeUseAsCStringLen (encode message) $ \(p_message,size) → c_sendMessage p_message (fromIntegral size) destination
162
false
false
0
9
26
48
24
24
null
null
cmahon/backtests
backtests.hs
bsd-3-clause
----------------------------------------------------------------------------- readDay :: String -> Day readDay = read
118
readDay :: String -> Day readDay = read
39
readDay = read
14
true
true
0
5
9
16
9
7
null
null
nvasilakis/lsh
Main.hs
bsd-3-clause
repl :: Uni -> IO () repl uni = do putStr $ ps1 $ configuration uni hFlush stdout line <- getLine newUni <- eval line uni repl (appendToHistory line newUni) -- Function that appends to history, based on user input
226
repl :: Uni -> IO () repl uni = do putStr $ ps1 $ configuration uni hFlush stdout line <- getLine newUni <- eval line uni repl (appendToHistory line newUni) -- Function that appends to history, based on user input
226
repl uni = do putStr $ ps1 $ configuration uni hFlush stdout line <- getLine newUni <- eval line uni repl (appendToHistory line newUni) -- Function that appends to history, based on user input
204
false
true
0
9
52
77
34
43
null
null
pgj/bead
src/Bead/View/Content/Bootstrap.hs
bsd-3-clause
optionTag value text True = H.option ! A.value (fromString value) ! A.selected "" $ fromString text
100
optionTag value text True = H.option ! A.value (fromString value) ! A.selected "" $ fromString text
100
optionTag value text True = H.option ! A.value (fromString value) ! A.selected "" $ fromString text
100
false
false
0
10
16
46
21
25
null
null
JacquesCarette/literate-scientific-software
code/drasil-gool/GOOL/Drasil/LanguageRenderer/LanguagePolymorphic.hs
bsd-2-clause
switch :: (RenderSym repr) => VS (repr (Value repr)) -> [(VS (repr (Value repr)), MS (repr (Body repr)))] -> MS (repr (Body repr)) -> MS (repr (Statement repr)) switch v cs bod = (\b val css de -> mkSt (switchDocD b val de css)) <$> S.state break <*> zoom lensMStoVS v <*> on2StateLists zip (map (zoom lensMStoVS . fst) cs) (map snd cs) <*> bod
355
switch :: (RenderSym repr) => VS (repr (Value repr)) -> [(VS (repr (Value repr)), MS (repr (Body repr)))] -> MS (repr (Body repr)) -> MS (repr (Statement repr)) switch v cs bod = (\b val css de -> mkSt (switchDocD b val de css)) <$> S.state break <*> zoom lensMStoVS v <*> on2StateLists zip (map (zoom lensMStoVS . fst) cs) (map snd cs) <*> bod
355
switch v cs bod = (\b val css de -> mkSt (switchDocD b val de css)) <$> S.state break <*> zoom lensMStoVS v <*> on2StateLists zip (map (zoom lensMStoVS . fst) cs) (map snd cs) <*> bod
188
false
true
3
15
75
219
107
112
null
null
NicolasDP/hs-smtp
tests/Arbitrary.hs
bsd-3-clause
arbitraryDomainNode :: Gen ByteString arbitraryDomainNode = frequency [ (10, BC.singleton <$> arbitraryLetterDigit) , (90, BC.cons <$> arbitraryLetterDigit <*> arbitraryLdhStr) ]
190
arbitraryDomainNode :: Gen ByteString arbitraryDomainNode = frequency [ (10, BC.singleton <$> arbitraryLetterDigit) , (90, BC.cons <$> arbitraryLetterDigit <*> arbitraryLdhStr) ]
190
arbitraryDomainNode = frequency [ (10, BC.singleton <$> arbitraryLetterDigit) , (90, BC.cons <$> arbitraryLetterDigit <*> arbitraryLdhStr) ]
152
false
true
0
9
31
51
28
23
null
null
abakst/liquidhaskell
benchmarks/vector-0.10.0.1/Data/Vector/Generic.hs
bsd-3-clause
elemIndex x = findIndex (x==)
29
elemIndex x = findIndex (x==)
29
elemIndex x = findIndex (x==)
29
false
false
1
6
4
19
8
11
null
null
23Skidoo/aeson
Data/Aeson/TH.hs
bsd-3-clause
(<%>) :: ExpQ -> ExpQ -> ExpQ (<%>) a b = a <^> [|E.char7 ','|] <^> b
69
(<%>) :: ExpQ -> ExpQ -> ExpQ (<%>) a b = a <^> [|E.char7 ','|] <^> b
69
(<%>) a b = a <^> [|E.char7 ','|] <^> b
39
false
true
4
8
16
47
24
23
null
null
spechub/Hets
OWL2/ASKeywords.hs
gpl-2.0
dataMinCardinalityS :: String dataMinCardinalityS = "DataMinCardinality"
72
dataMinCardinalityS :: String dataMinCardinalityS = "DataMinCardinality"
72
dataMinCardinalityS = "DataMinCardinality"
42
false
true
0
4
5
11
6
5
null
null
shlevy/ghc
compiler/codeGen/StgCmmPrim.hs
bsd-3-clause
emitPrimOp dflags [res] (VecPackOp vcat n w) es = do checkVecCompatibility dflags vcat n w when (es `lengthIsNot` n) $ panic "emitPrimOp: VecPackOp has wrong number of arguments" doVecPackOp (vecElemInjectCast dflags vcat w) ty zeros es res where zeros :: CmmExpr zeros = CmmLit $ CmmVec (replicate n zero) zero :: CmmLit zero = case vcat of IntVec -> CmmInt 0 w WordVec -> CmmInt 0 w FloatVec -> CmmFloat 0 w ty :: CmmType ty = vecVmmType vcat n w
538
emitPrimOp dflags [res] (VecPackOp vcat n w) es = do checkVecCompatibility dflags vcat n w when (es `lengthIsNot` n) $ panic "emitPrimOp: VecPackOp has wrong number of arguments" doVecPackOp (vecElemInjectCast dflags vcat w) ty zeros es res where zeros :: CmmExpr zeros = CmmLit $ CmmVec (replicate n zero) zero :: CmmLit zero = case vcat of IntVec -> CmmInt 0 w WordVec -> CmmInt 0 w FloatVec -> CmmFloat 0 w ty :: CmmType ty = vecVmmType vcat n w
538
emitPrimOp dflags [res] (VecPackOp vcat n w) es = do checkVecCompatibility dflags vcat n w when (es `lengthIsNot` n) $ panic "emitPrimOp: VecPackOp has wrong number of arguments" doVecPackOp (vecElemInjectCast dflags vcat w) ty zeros es res where zeros :: CmmExpr zeros = CmmLit $ CmmVec (replicate n zero) zero :: CmmLit zero = case vcat of IntVec -> CmmInt 0 w WordVec -> CmmInt 0 w FloatVec -> CmmFloat 0 w ty :: CmmType ty = vecVmmType vcat n w
538
false
false
3
11
170
204
90
114
null
null
wsuchy/sudoku_solver
dist/build/autogen/Paths_sudoku.hs
gpl-2.0
bindir, libdir, datadir, libexecdir, sysconfdir :: FilePath bindir = "/Users/k.suchanek/Library/Haskell/bin"
113
bindir, libdir, datadir, libexecdir, sysconfdir :: FilePath bindir = "/Users/k.suchanek/Library/Haskell/bin"
112
bindir = "/Users/k.suchanek/Library/Haskell/bin"
52
false
true
8
6
14
39
14
25
null
null
denumerate/raven
src/Raven/Server/ResourceNode.hs
bsd-3-clause
-- |Handles a ChangeUsersPasswordMsg by asking the database to find and -- update the user. -- Tells the connNode the result. handleChangeUsersPassword :: MVar ProcessId -> DB.Pipe -> (ConnectionId, ChangeUsersPasswordMsg) -> Process () handleChangeUsersPassword server p (cPID, ChangeUsersPasswordMsg n name pswd) = void $ spawnLocal (liftIO (readMVar server) >>= (\server' -> liftIO (updateUsersPassword p name pswd) >>= (\out -> case out of Just _ -> Control.Distributed.Process.send server' (cPID,ProcessedMsg n "Password Changed") _ -> Control.Distributed.Process.send server' (cPID,ProcessedMsg n "User not found"))))
706
handleChangeUsersPassword :: MVar ProcessId -> DB.Pipe -> (ConnectionId, ChangeUsersPasswordMsg) -> Process () handleChangeUsersPassword server p (cPID, ChangeUsersPasswordMsg n name pswd) = void $ spawnLocal (liftIO (readMVar server) >>= (\server' -> liftIO (updateUsersPassword p name pswd) >>= (\out -> case out of Just _ -> Control.Distributed.Process.send server' (cPID,ProcessedMsg n "Password Changed") _ -> Control.Distributed.Process.send server' (cPID,ProcessedMsg n "User not found"))))
580
handleChangeUsersPassword server p (cPID, ChangeUsersPasswordMsg n name pswd) = void $ spawnLocal (liftIO (readMVar server) >>= (\server' -> liftIO (updateUsersPassword p name pswd) >>= (\out -> case out of Just _ -> Control.Distributed.Process.send server' (cPID,ProcessedMsg n "Password Changed") _ -> Control.Distributed.Process.send server' (cPID,ProcessedMsg n "User not found"))))
467
true
true
2
18
162
179
93
86
null
null
kazu-yamamoto/dns
internal/Network/DNS/Types/Resolver.hs
bsd-3-clause
-- | Return a default 'ResolvConf': -- -- * 'resolvInfo' is 'RCFilePath' \"\/etc\/resolv.conf\". -- * 'resolvTimeout' is 3,000,000 micro seconds. -- * 'resolvRetry' is 3. -- * 'resolvConcurrent' is False. -- * 'resolvCache' is Nothing. -- * 'resolvQueryControls' is an empty set of overrides. defaultResolvConf :: ResolvConf defaultResolvConf = ResolvConf { resolvInfo = RCFilePath "/etc/resolv.conf" , resolvTimeout = 3 * 1000 * 1000 , resolvRetry = 3 , resolvConcurrent = False , resolvCache = Nothing , resolvQueryControls = mempty }
569
defaultResolvConf :: ResolvConf defaultResolvConf = ResolvConf { resolvInfo = RCFilePath "/etc/resolv.conf" , resolvTimeout = 3 * 1000 * 1000 , resolvRetry = 3 , resolvConcurrent = False , resolvCache = Nothing , resolvQueryControls = mempty }
276
defaultResolvConf = ResolvConf { resolvInfo = RCFilePath "/etc/resolv.conf" , resolvTimeout = 3 * 1000 * 1000 , resolvRetry = 3 , resolvConcurrent = False , resolvCache = Nothing , resolvQueryControls = mempty }
244
true
true
0
8
112
68
44
24
null
null
stgm/prac-testing
week5/Week5.hs
mit
solveNs :: [Node] -> [Node] solveNs = search succNode solved
60
solveNs :: [Node] -> [Node] solveNs = search succNode solved
60
solveNs = search succNode solved
32
false
true
0
6
9
26
14
12
null
null
ekmett/mtl
Control/Monad/Writer/Class.hs
bsd-3-clause
listens :: MonadWriter w m => (w -> b) -> m a -> m (a, b) listens f m = do ~(a, w) <- listen m return (a, f w) -- | @'censor' f m@ is an action that executes the action @m@ and -- applies the function @f@ to its output, leaving the return value -- unchanged. -- -- * @'censor' f m = 'pass' ('liftM' (\\x -> (x,f)) m)@
326
listens :: MonadWriter w m => (w -> b) -> m a -> m (a, b) listens f m = do ~(a, w) <- listen m return (a, f w) -- | @'censor' f m@ is an action that executes the action @m@ and -- applies the function @f@ to its output, leaving the return value -- unchanged. -- -- * @'censor' f m = 'pass' ('liftM' (\\x -> (x,f)) m)@
326
listens f m = do ~(a, w) <- listen m return (a, f w) -- | @'censor' f m@ is an action that executes the action @m@ and -- applies the function @f@ to its output, leaving the return value -- unchanged. -- -- * @'censor' f m = 'pass' ('liftM' (\\x -> (x,f)) m)@
268
false
true
0
9
79
89
46
43
null
null
nevrenato/Hets_Fork
CspCASLProver/Utils.hs
gpl-2.0
-- ---------------------------------------------------------- -- Basic function to help keep strings consistent -- -- ---------------------------------------------------------- -- | Return the list of strings of all gn_totality axiom names produced by the -- translation CASL2PCFOL; CASL2SubCFOL. This function is not implemented in a -- satisfactory way. getCollectionTotAx :: CASLSign.CASLSign -> [String] getCollectionTotAx pfolSign = let totOpList = MapSet.toList . MapSet.filter CASLSign.isTotal $ CASLSign.opMap pfolSign in map (mkTotalityAxiomName . fst) totOpList
605
getCollectionTotAx :: CASLSign.CASLSign -> [String] getCollectionTotAx pfolSign = let totOpList = MapSet.toList . MapSet.filter CASLSign.isTotal $ CASLSign.opMap pfolSign in map (mkTotalityAxiomName . fst) totOpList
240
getCollectionTotAx pfolSign = let totOpList = MapSet.toList . MapSet.filter CASLSign.isTotal $ CASLSign.opMap pfolSign in map (mkTotalityAxiomName . fst) totOpList
188
true
true
0
12
99
74
39
35
null
null
rebasar/follower
follower.hs
gpl-3.0
formatTweet :: Status -> Doc formatTweet tweet = (bold $ langle <> (blue $ text username) <> rangle) <+> (align $ (foldr (</>) empty) $ (map text) $ words tweettext) <$> (text "--") <+> lparen <> (red $ text tweetdate) <> rparen where username = userScreenName (statusUser tweet) tweetdate = shortenTime $ statusCreated tweet tweettext = statusText tweet
472
formatTweet :: Status -> Doc formatTweet tweet = (bold $ langle <> (blue $ text username) <> rangle) <+> (align $ (foldr (</>) empty) $ (map text) $ words tweettext) <$> (text "--") <+> lparen <> (red $ text tweetdate) <> rparen where username = userScreenName (statusUser tweet) tweetdate = shortenTime $ statusCreated tweet tweettext = statusText tweet
472
formatTweet tweet = (bold $ langle <> (blue $ text username) <> rangle) <+> (align $ (foldr (</>) empty) $ (map text) $ words tweettext) <$> (text "--") <+> lparen <> (red $ text tweetdate) <> rparen where username = userScreenName (statusUser tweet) tweetdate = shortenTime $ statusCreated tweet tweettext = statusText tweet
443
false
true
0
15
175
150
76
74
null
null
d0kt0r0/Tidal
src/Sound/Tidal/old/Params.hs
gpl-3.0
sld = slide
11
sld = slide
11
sld = slide
11
false
false
0
4
2
6
3
3
null
null
adinapoli/api-tools
src/Data/API/JSON.hs
bsd-3-clause
withNum s _ v = failWith $ Expected ExpInt s v
46
withNum s _ v = failWith $ Expected ExpInt s v
46
withNum s _ v = failWith $ Expected ExpInt s v
46
false
false
0
6
10
24
11
13
null
null
alanz/Blobs
lib/DData/IntMap.hs
lgpl-2.1
showsTree :: Show a => Bool -> [String] -> [String] -> IntMap a -> ShowS showsTree wide lbars rbars t = case t of Bin p m l r -> showsTree wide (withBar rbars) (withEmpty rbars) r . showWide wide rbars . showsBars lbars . showString (showBin p m) . showString "\n" . showWide wide lbars . showsTree wide (withEmpty lbars) (withBar lbars) l Tip k x -> showsBars lbars . showString " " . shows k . showString ":=" . shows x . showString "\n" Nil -> showsBars lbars . showString "|\n"
574
showsTree :: Show a => Bool -> [String] -> [String] -> IntMap a -> ShowS showsTree wide lbars rbars t = case t of Bin p m l r -> showsTree wide (withBar rbars) (withEmpty rbars) r . showWide wide rbars . showsBars lbars . showString (showBin p m) . showString "\n" . showWide wide lbars . showsTree wide (withEmpty lbars) (withBar lbars) l Tip k x -> showsBars lbars . showString " " . shows k . showString ":=" . shows x . showString "\n" Nil -> showsBars lbars . showString "|\n"
574
showsTree wide lbars rbars t = case t of Bin p m l r -> showsTree wide (withBar rbars) (withEmpty rbars) r . showWide wide rbars . showsBars lbars . showString (showBin p m) . showString "\n" . showWide wide lbars . showsTree wide (withEmpty lbars) (withBar lbars) l Tip k x -> showsBars lbars . showString " " . shows k . showString ":=" . shows x . showString "\n" Nil -> showsBars lbars . showString "|\n"
501
false
true
0
16
185
234
107
127
null
null
pgj/bead
src/Bead/View/Content/Bootstrap.hs
bsd-3-clause
selectTag :: String -> Html -> Html selectTag name = H.select ! A.id (fromString name) ! A.name (fromString name) ! A.required ""
159
selectTag :: String -> Html -> Html selectTag name = H.select ! A.id (fromString name) ! A.name (fromString name) ! A.required ""
159
selectTag name = H.select ! A.id (fromString name) ! A.name (fromString name) ! A.required ""
123
false
true
0
10
51
63
30
33
null
null
sdiehl/ghc
testsuite/tests/rename/should_compile/T13064.hs
bsd-3-clause
-- Import of 'pure' is redundant foo :: IO () foo = () <$ pure ()
66
foo :: IO () foo = () <$ pure ()
32
foo = () <$ pure ()
19
true
true
1
7
16
31
14
17
null
null
ethercrow/ai-challenger
game-grid/Grid.hs
mit
neighborhood4 :: Point -> Grid -> [Tile] neighborhood4 (x, y) (Grid grid0) = let neighborPoints = [ (x - 1, y) , (x + 1, y) , (x, y - 1) , (x, y + 1) ] get (i, j) = (grid0 V.!? j) >>= (V.!? i) in mapMaybe get neighborPoints
299
neighborhood4 :: Point -> Grid -> [Tile] neighborhood4 (x, y) (Grid grid0) = let neighborPoints = [ (x - 1, y) , (x + 1, y) , (x, y - 1) , (x, y + 1) ] get (i, j) = (grid0 V.!? j) >>= (V.!? i) in mapMaybe get neighborPoints
299
neighborhood4 (x, y) (Grid grid0) = let neighborPoints = [ (x - 1, y) , (x + 1, y) , (x, y - 1) , (x, y + 1) ] get (i, j) = (grid0 V.!? j) >>= (V.!? i) in mapMaybe get neighborPoints
258
false
true
0
11
126
147
80
67
null
null
holzensp/ghc
compiler/codeGen/StgCmmPrim.hs
bsd-3-clause
callishOp FloatCoshOp = Just MO_F32_Cosh
42
callishOp FloatCoshOp = Just MO_F32_Cosh
42
callishOp FloatCoshOp = Just MO_F32_Cosh
42
false
false
0
5
6
12
5
7
null
null
ezyang/ghc
compiler/iface/IfaceEnv.hs
bsd-3-clause
newInteractiveBinder :: HscEnv -> OccName -> SrcSpan -> IO Name -- Works in the IO monad, and gets the Module -- from the interactive context newInteractiveBinder hsc_env occ loc = do { let mod = icInteractiveModule (hsc_IC hsc_env) ; updNameCacheIO hsc_env $ \name_cache -> allocateGlobalBinder name_cache mod occ loc }
337
newInteractiveBinder :: HscEnv -> OccName -> SrcSpan -> IO Name newInteractiveBinder hsc_env occ loc = do { let mod = icInteractiveModule (hsc_IC hsc_env) ; updNameCacheIO hsc_env $ \name_cache -> allocateGlobalBinder name_cache mod occ loc }
259
newInteractiveBinder hsc_env occ loc = do { let mod = icInteractiveModule (hsc_IC hsc_env) ; updNameCacheIO hsc_env $ \name_cache -> allocateGlobalBinder name_cache mod occ loc }
195
true
true
0
12
66
80
40
40
null
null
juhnowski/parser_haskell
evaluator1.hs
mit
parseExpr :: Parser LispVal parseExpr = parseAtom <|> parseString <|> parseNumber <|> parseQuoted <|> do char '(' x <- (try parseList) <|> parseDottedList char ')' return x
249
parseExpr :: Parser LispVal parseExpr = parseAtom <|> parseString <|> parseNumber <|> parseQuoted <|> do char '(' x <- (try parseList) <|> parseDottedList char ')' return x
249
parseExpr = parseAtom <|> parseString <|> parseNumber <|> parseQuoted <|> do char '(' x <- (try parseList) <|> parseDottedList char ')' return x
221
false
true
12
11
103
83
38
45
null
null
lucasdicioccio/laborantin-hs
Laborantin/DSL.hs
apache-2.0
-- | Define the main run hook for this scenario run :: Step m () -> State (ScenarioDescription m) () run = appendHook "run"
123
run :: Step m () -> State (ScenarioDescription m) () run = appendHook "run"
75
run = appendHook "run"
22
true
true
0
8
23
39
19
20
null
null
cspollard/HMCMC
test/HVTModel.hs
bsd-3-clause
takeEveryC :: Monad m => Int -> Conduit a m a takeEveryC n = do dropC (n-1) x <- await case x of Just y -> yield y >> takeEveryC n Nothing -> return ()
233
takeEveryC :: Monad m => Int -> Conduit a m a takeEveryC n = do dropC (n-1) x <- await case x of Just y -> yield y >> takeEveryC n Nothing -> return ()
233
takeEveryC n = do dropC (n-1) x <- await case x of Just y -> yield y >> takeEveryC n Nothing -> return ()
187
false
true
0
12
116
94
41
53
null
null
LeMeteore/haskell-introduction
function_basics.hs
bsd-2-clause
-- how to define an operator a |& b = (a || b) && not (a && b)
62
a |& b = (a || b) && not (a && b)
33
a |& b = (a || b) && not (a && b)
33
true
false
0
8
17
37
18
19
null
null
ezyang/ghc
compiler/main/GhcMake.hs
bsd-3-clause
moduleGraphNodes :: Bool -> [ModSummary] -> (Graph SummaryNode, HscSource -> ModuleName -> Maybe SummaryNode) moduleGraphNodes drop_hs_boot_nodes summaries = (graphFromEdgedVerticesUniq nodes, lookup_node) where numbered_summaries = zip summaries [1..] lookup_node :: HscSource -> ModuleName -> Maybe SummaryNode lookup_node hs_src mod = Map.lookup (mod, hscSourceToIsBoot hs_src) node_map lookup_key :: HscSource -> ModuleName -> Maybe Int lookup_key hs_src mod = fmap summaryNodeKey (lookup_node hs_src mod) node_map :: NodeMap SummaryNode node_map = Map.fromList [ ((moduleName (ms_mod s), hscSourceToIsBoot (ms_hsc_src s)), node) | node <- nodes , let s = summaryNodeSummary node ] -- We use integers as the keys for the SCC algorithm nodes :: [SummaryNode] nodes = [ DigraphNode s key out_keys | (s, key) <- numbered_summaries -- Drop the hi-boot ones if told to do so , not (isBootSummary s && drop_hs_boot_nodes) , let out_keys = out_edge_keys hs_boot_key (map unLoc (ms_home_srcimps s)) ++ out_edge_keys HsSrcFile (map unLoc (ms_home_imps s)) ++ (-- see [boot-edges] below if drop_hs_boot_nodes || ms_hsc_src s == HsBootFile then [] else case lookup_key HsBootFile (ms_mod_name s) of Nothing -> [] Just k -> [k]) ] -- [boot-edges] if this is a .hs and there is an equivalent -- .hs-boot, add a link from the former to the latter. This -- has the effect of detecting bogus cases where the .hs-boot -- depends on the .hs, by introducing a cycle. Additionally, -- it ensures that we will always process the .hs-boot before -- the .hs, and so the HomePackageTable will always have the -- most up to date information. -- Drop hs-boot nodes by using HsSrcFile as the key hs_boot_key | drop_hs_boot_nodes = HsSrcFile | otherwise = HsBootFile out_edge_keys :: HscSource -> [ModuleName] -> [Int] out_edge_keys hi_boot ms = mapMaybe (lookup_key hi_boot) ms -- If we want keep_hi_boot_nodes, then we do lookup_key with -- IsBoot; else NotBoot -- The nodes of the graph are keyed by (mod, is boot?) pairs -- NB: hsig files show up as *normal* nodes (not boot!), since they don't -- participate in cycles (for now)
2,610
moduleGraphNodes :: Bool -> [ModSummary] -> (Graph SummaryNode, HscSource -> ModuleName -> Maybe SummaryNode) moduleGraphNodes drop_hs_boot_nodes summaries = (graphFromEdgedVerticesUniq nodes, lookup_node) where numbered_summaries = zip summaries [1..] lookup_node :: HscSource -> ModuleName -> Maybe SummaryNode lookup_node hs_src mod = Map.lookup (mod, hscSourceToIsBoot hs_src) node_map lookup_key :: HscSource -> ModuleName -> Maybe Int lookup_key hs_src mod = fmap summaryNodeKey (lookup_node hs_src mod) node_map :: NodeMap SummaryNode node_map = Map.fromList [ ((moduleName (ms_mod s), hscSourceToIsBoot (ms_hsc_src s)), node) | node <- nodes , let s = summaryNodeSummary node ] -- We use integers as the keys for the SCC algorithm nodes :: [SummaryNode] nodes = [ DigraphNode s key out_keys | (s, key) <- numbered_summaries -- Drop the hi-boot ones if told to do so , not (isBootSummary s && drop_hs_boot_nodes) , let out_keys = out_edge_keys hs_boot_key (map unLoc (ms_home_srcimps s)) ++ out_edge_keys HsSrcFile (map unLoc (ms_home_imps s)) ++ (-- see [boot-edges] below if drop_hs_boot_nodes || ms_hsc_src s == HsBootFile then [] else case lookup_key HsBootFile (ms_mod_name s) of Nothing -> [] Just k -> [k]) ] -- [boot-edges] if this is a .hs and there is an equivalent -- .hs-boot, add a link from the former to the latter. This -- has the effect of detecting bogus cases where the .hs-boot -- depends on the .hs, by introducing a cycle. Additionally, -- it ensures that we will always process the .hs-boot before -- the .hs, and so the HomePackageTable will always have the -- most up to date information. -- Drop hs-boot nodes by using HsSrcFile as the key hs_boot_key | drop_hs_boot_nodes = HsSrcFile | otherwise = HsBootFile out_edge_keys :: HscSource -> [ModuleName] -> [Int] out_edge_keys hi_boot ms = mapMaybe (lookup_key hi_boot) ms -- If we want keep_hi_boot_nodes, then we do lookup_key with -- IsBoot; else NotBoot -- The nodes of the graph are keyed by (mod, is boot?) pairs -- NB: hsig files show up as *normal* nodes (not boot!), since they don't -- participate in cycles (for now)
2,610
moduleGraphNodes drop_hs_boot_nodes summaries = (graphFromEdgedVerticesUniq nodes, lookup_node) where numbered_summaries = zip summaries [1..] lookup_node :: HscSource -> ModuleName -> Maybe SummaryNode lookup_node hs_src mod = Map.lookup (mod, hscSourceToIsBoot hs_src) node_map lookup_key :: HscSource -> ModuleName -> Maybe Int lookup_key hs_src mod = fmap summaryNodeKey (lookup_node hs_src mod) node_map :: NodeMap SummaryNode node_map = Map.fromList [ ((moduleName (ms_mod s), hscSourceToIsBoot (ms_hsc_src s)), node) | node <- nodes , let s = summaryNodeSummary node ] -- We use integers as the keys for the SCC algorithm nodes :: [SummaryNode] nodes = [ DigraphNode s key out_keys | (s, key) <- numbered_summaries -- Drop the hi-boot ones if told to do so , not (isBootSummary s && drop_hs_boot_nodes) , let out_keys = out_edge_keys hs_boot_key (map unLoc (ms_home_srcimps s)) ++ out_edge_keys HsSrcFile (map unLoc (ms_home_imps s)) ++ (-- see [boot-edges] below if drop_hs_boot_nodes || ms_hsc_src s == HsBootFile then [] else case lookup_key HsBootFile (ms_mod_name s) of Nothing -> [] Just k -> [k]) ] -- [boot-edges] if this is a .hs and there is an equivalent -- .hs-boot, add a link from the former to the latter. This -- has the effect of detecting bogus cases where the .hs-boot -- depends on the .hs, by introducing a cycle. Additionally, -- it ensures that we will always process the .hs-boot before -- the .hs, and so the HomePackageTable will always have the -- most up to date information. -- Drop hs-boot nodes by using HsSrcFile as the key hs_boot_key | drop_hs_boot_nodes = HsSrcFile | otherwise = HsBootFile out_edge_keys :: HscSource -> [ModuleName] -> [Int] out_edge_keys hi_boot ms = mapMaybe (lookup_key hi_boot) ms -- If we want keep_hi_boot_nodes, then we do lookup_key with -- IsBoot; else NotBoot -- The nodes of the graph are keyed by (mod, is boot?) pairs -- NB: hsig files show up as *normal* nodes (not boot!), since they don't -- participate in cycles (for now)
2,498
false
true
0
16
829
472
246
226
null
null
23Skidoo/text
Data/Text/Lazy.hs
bsd-2-clause
------------------------------------------------------------------------------- -- * View patterns -- | /O(n)/ Return the suffix of the second string if its prefix -- matches the entire first string. -- -- Examples: -- -- > stripPrefix "foo" "foobar" == Just "bar" -- > stripPrefix "" "baz" == Just "baz" -- > stripPrefix "foo" "quux" == Nothing -- -- This is particularly useful with the @ViewPatterns@ extension to -- GHC, as follows: -- -- > {-# LANGUAGE ViewPatterns #-} -- > import Data.Text.Lazy as T -- > -- > fnordLength :: Text -> Int -- > fnordLength (stripPrefix "fnord" -> Just suf) = T.length suf -- > fnordLength _ = -1 stripPrefix :: Text -> Text -> Maybe Text stripPrefix p t | null p = Just t | otherwise = case commonPrefixes p t of Just (_,c,r) | null c -> Just r _ -> Nothing -- | /O(n)/ Find the longest non-empty common prefix of two strings -- and return it, along with the suffixes of each string at which they -- no longer match. -- -- If the strings do not have a common prefix or either one is empty, -- this function returns 'Nothing'. -- -- Examples: -- -- > commonPrefixes "foobar" "fooquux" == Just ("foo","bar","quux") -- > commonPrefixes "veeble" "fetzer" == Nothing -- > commonPrefixes "" "baz" == Nothing
1,363
stripPrefix :: Text -> Text -> Maybe Text stripPrefix p t | null p = Just t | otherwise = case commonPrefixes p t of Just (_,c,r) | null c -> Just r _ -> Nothing -- | /O(n)/ Find the longest non-empty common prefix of two strings -- and return it, along with the suffixes of each string at which they -- no longer match. -- -- If the strings do not have a common prefix or either one is empty, -- this function returns 'Nothing'. -- -- Examples: -- -- > commonPrefixes "foobar" "fooquux" == Just ("foo","bar","quux") -- > commonPrefixes "veeble" "fetzer" == Nothing -- > commonPrefixes "" "baz" == Nothing
688
stripPrefix p t | null p = Just t | otherwise = case commonPrefixes p t of Just (_,c,r) | null c -> Just r _ -> Nothing -- | /O(n)/ Find the longest non-empty common prefix of two strings -- and return it, along with the suffixes of each string at which they -- no longer match. -- -- If the strings do not have a common prefix or either one is empty, -- this function returns 'Nothing'. -- -- Examples: -- -- > commonPrefixes "foobar" "fooquux" == Just ("foo","bar","quux") -- > commonPrefixes "veeble" "fetzer" == Nothing -- > commonPrefixes "" "baz" == Nothing
646
true
true
0
12
341
125
74
51
null
null
DavidEichmann/boger-banana
src/Reactive/Banana/BOGRE.hs
bsd-3-clause
-- |The current frame time (see 'framT'). Note that, as this is a stepped 'Behavior', it only changes after the frame event occurs. -- So if this is sampled on the frame event, it wall only be the previouse frame's time. getTimeB :: Frameworks t => HookedBogreSystem t -> Behavior t Float getTimeB bs = stepper 0 (frameT <$> (frameE bs))
338
getTimeB :: Frameworks t => HookedBogreSystem t -> Behavior t Float getTimeB bs = stepper 0 (frameT <$> (frameE bs))
116
getTimeB bs = stepper 0 (frameT <$> (frameE bs))
48
true
true
0
9
61
59
27
32
null
null
gafiatulin/codewars
src/5 kyu/Peano.hs
mit
even (Succ p1) = not . even $ p1
32
even (Succ p1) = not . even $ p1
32
even (Succ p1) = not . even $ p1
32
false
false
3
6
8
27
11
16
null
null
ku-fpg/html-kure
Text/HTML/KURE.hs
bsd-3-clause
textC str = Text [ NTree t [] | t <- map (either XText XCharRef) $ escapeText str ]
84
textC str = Text [ NTree t [] | t <- map (either XText XCharRef) $ escapeText str ]
84
textC str = Text [ NTree t [] | t <- map (either XText XCharRef) $ escapeText str ]
84
false
false
1
12
19
52
22
30
null
null
openbrainsrc/hstan
src/Math/Stan/Writer.hs
mit
fresh :: Id -> Stan Id fresh base = do ix <- fmap supply get modify $ \s -> s { supply = ix+1 } return $ base++show ix
124
fresh :: Id -> Stan Id fresh base = do ix <- fmap supply get modify $ \s -> s { supply = ix+1 } return $ base++show ix
124
fresh base = do ix <- fmap supply get modify $ \s -> s { supply = ix+1 } return $ base++show ix
101
false
true
0
12
34
76
35
41
null
null
RayRacine/hs-word2vec
Crawl.hs
bsd-3-clause
convertToText :: String -- file path -> IO String -- Converted file convertToText pdf = do let txt = fst (splitExtension pdf) ++ ".txt" exit <- system $ "pdftotext " ++ pdf case exit of ExitSuccess -> return txt ExitFailure _ -> return ""
279
convertToText :: String -- file path -> IO String convertToText pdf = do let txt = fst (splitExtension pdf) ++ ".txt" exit <- system $ "pdftotext " ++ pdf case exit of ExitSuccess -> return txt ExitFailure _ -> return ""
260
convertToText pdf = do let txt = fst (splitExtension pdf) ++ ".txt" exit <- system $ "pdftotext " ++ pdf case exit of ExitSuccess -> return txt ExitFailure _ -> return ""
186
true
true
0
13
84
88
41
47
null
null
alexander-at-github/eta
compiler/ETA/Prelude/PrelNames.hs
bsd-3-clause
fmapJavaName = varQual gHC_BASE (fsLit "fmapJava") fmapJavaIdKey
74
fmapJavaName = varQual gHC_BASE (fsLit "fmapJava") fmapJavaIdKey
74
fmapJavaName = varQual gHC_BASE (fsLit "fmapJava") fmapJavaIdKey
74
false
false
1
7
16
22
9
13
null
null
Lazersmoke/rhc
src/SimpleExpr.hs
bsd-3-clause
parseLambda :: Parser ParsedExpr parseLambda = Lambda <$> (lexeme (char '\\') *> parseName <* lexeme (string "->")) <*> parseExpr <?> "Lambda"
151
parseLambda :: Parser ParsedExpr parseLambda = Lambda <$> (lexeme (char '\\') *> parseName <* lexeme (string "->")) <*> parseExpr <?> "Lambda"
151
parseLambda = Lambda <$> (lexeme (char '\\') *> parseName <* lexeme (string "->")) <*> parseExpr <?> "Lambda"
118
false
true
7
10
29
61
29
32
null
null
robdockins/edison
edison-core/src/Data/Edison/Coll/SkewHeap.hs
mit
fold1 :: Ord a => (a -> a -> a) -> Heap a -> a fold1 _ E = error "SkewHeap.fold1: empty collection"
99
fold1 :: Ord a => (a -> a -> a) -> Heap a -> a fold1 _ E = error "SkewHeap.fold1: empty collection"
99
fold1 _ E = error "SkewHeap.fold1: empty collection"
52
false
true
0
9
22
48
23
25
null
null
ambiata/highlighting-kate
Text/Highlighting/Kate/Syntax/Djangotemplate.hs
gpl-2.0
regex_'3cstyle'5cb = compileRegex True "<style\\b"
50
regex_'3cstyle'5cb = compileRegex True "<style\\b"
50
regex_'3cstyle'5cb = compileRegex True "<style\\b"
50
false
false
0
5
4
11
5
6
null
null
Garygunn94/DFS
AuthServer/.stack-work/dist/x86_64-linux/Cabal-1.24.0.0/build/autogen/Paths_AuthServer.hs
bsd-3-clause
getLibexecDir = catchIO (getEnv "AuthServer_libexecdir") (\_ -> return libexecdir)
82
getLibexecDir = catchIO (getEnv "AuthServer_libexecdir") (\_ -> return libexecdir)
82
getLibexecDir = catchIO (getEnv "AuthServer_libexecdir") (\_ -> return libexecdir)
82
false
false
0
8
8
28
14
14
null
null
edi-smoljan/FER-PUH-2014-Hash
Language/Exec.hs
bsd-3-clause
evaluateVars vt backCount (c:rest) | c == '\\' = c : evaluateVars vt (backCount + 1) rest | c == '$' = if isSkipped then c : evaluateVars vt 0 rest else varVal ++ evaluateVars vt 0 (drop varNameLen rest) | otherwise = c : evaluateVars vt 0 rest where isSkipped = odd backCount varName = extractVarName rest varNameLen = length varName varVal = case (M.lookup varName vt) of Just s -> s Nothing -> ""
557
evaluateVars vt backCount (c:rest) | c == '\\' = c : evaluateVars vt (backCount + 1) rest | c == '$' = if isSkipped then c : evaluateVars vt 0 rest else varVal ++ evaluateVars vt 0 (drop varNameLen rest) | otherwise = c : evaluateVars vt 0 rest where isSkipped = odd backCount varName = extractVarName rest varNameLen = length varName varVal = case (M.lookup varName vt) of Just s -> s Nothing -> ""
557
evaluateVars vt backCount (c:rest) | c == '\\' = c : evaluateVars vt (backCount + 1) rest | c == '$' = if isSkipped then c : evaluateVars vt 0 rest else varVal ++ evaluateVars vt 0 (drop varNameLen rest) | otherwise = c : evaluateVars vt 0 rest where isSkipped = odd backCount varName = extractVarName rest varNameLen = length varName varVal = case (M.lookup varName vt) of Just s -> s Nothing -> ""
557
false
false
8
8
233
196
89
107
null
null
jamesdabbs/keenser
app/Main.hs
bsd-3-clause
nope :: Worker IO Int nope = Worker "nope" "default" $ \n -> do $(logError) $ "Noping out " <> s n error $ "NOPE " ++ show n
128
nope :: Worker IO Int nope = Worker "nope" "default" $ \n -> do $(logError) $ "Noping out " <> s n error $ "NOPE " ++ show n
128
nope = Worker "nope" "default" $ \n -> do $(logError) $ "Noping out " <> s n error $ "NOPE " ++ show n
106
false
true
0
12
32
62
29
33
null
null
section77/datenverbrauch
src/Args.hs
bsd-3-clause
endpoints :: Parser Endpoints endpoints = fmap catMaybes $ pack <$> quota <*> used <*> available <*> balance <*> daysLeft where pack a b c d e = [a, b, c, d, e] -- FIXME: generic pack quota = optional $ EndpointQuota <$> txtOption ( long "pub-quota" <> metavar "<PUBLISH URL FOR QUOTA>" <> help "endpoint for quota value") used = optional $ EndpointUsed <$> txtOption ( long "pub-used" <> metavar "<PUBLISH URL FOR USED>" <> help "endpoint for used value") available = optional $ EndpointAvailable <$> txtOption ( long "pub-available" <> metavar "<PUBLISH URL FOR AVAILABLE>" <> help "endpoint for available value") balance = optional $ EndpointBalance <$> txtOption ( long "pub-balance" <> metavar "<PUBLISH URL FOR BALANCE>" <> help "endpoint for current balance") daysLeft = optional $ EndpointDaysLeft <$> txtOption ( long "pub-days-left" <> metavar "<PUBLISH URL FOR PREPAID DAYS LEFT>" <> help "endpoint for prepaid days left")
1,289
endpoints :: Parser Endpoints endpoints = fmap catMaybes $ pack <$> quota <*> used <*> available <*> balance <*> daysLeft where pack a b c d e = [a, b, c, d, e] -- FIXME: generic pack quota = optional $ EndpointQuota <$> txtOption ( long "pub-quota" <> metavar "<PUBLISH URL FOR QUOTA>" <> help "endpoint for quota value") used = optional $ EndpointUsed <$> txtOption ( long "pub-used" <> metavar "<PUBLISH URL FOR USED>" <> help "endpoint for used value") available = optional $ EndpointAvailable <$> txtOption ( long "pub-available" <> metavar "<PUBLISH URL FOR AVAILABLE>" <> help "endpoint for available value") balance = optional $ EndpointBalance <$> txtOption ( long "pub-balance" <> metavar "<PUBLISH URL FOR BALANCE>" <> help "endpoint for current balance") daysLeft = optional $ EndpointDaysLeft <$> txtOption ( long "pub-days-left" <> metavar "<PUBLISH URL FOR PREPAID DAYS LEFT>" <> help "endpoint for prepaid days left")
1,289
endpoints = fmap catMaybes $ pack <$> quota <*> used <*> available <*> balance <*> daysLeft where pack a b c d e = [a, b, c, d, e] -- FIXME: generic pack quota = optional $ EndpointQuota <$> txtOption ( long "pub-quota" <> metavar "<PUBLISH URL FOR QUOTA>" <> help "endpoint for quota value") used = optional $ EndpointUsed <$> txtOption ( long "pub-used" <> metavar "<PUBLISH URL FOR USED>" <> help "endpoint for used value") available = optional $ EndpointAvailable <$> txtOption ( long "pub-available" <> metavar "<PUBLISH URL FOR AVAILABLE>" <> help "endpoint for available value") balance = optional $ EndpointBalance <$> txtOption ( long "pub-balance" <> metavar "<PUBLISH URL FOR BALANCE>" <> help "endpoint for current balance") daysLeft = optional $ EndpointDaysLeft <$> txtOption ( long "pub-days-left" <> metavar "<PUBLISH URL FOR PREPAID DAYS LEFT>" <> help "endpoint for prepaid days left")
1,259
false
true
0
12
505
255
125
130
null
null
qpliu/esolang
01_/hs/compiler2/GenLLVM.hs
gpl-3.0
writeNewLabelBack :: [Label -> GenLLVM ()] -> GenLLVM Label writeNewLabelBack forwardRefs = do label <- writeNewLabel mapM_ ($ label) forwardRefs return label
170
writeNewLabelBack :: [Label -> GenLLVM ()] -> GenLLVM Label writeNewLabelBack forwardRefs = do label <- writeNewLabel mapM_ ($ label) forwardRefs return label
170
writeNewLabelBack forwardRefs = do label <- writeNewLabel mapM_ ($ label) forwardRefs return label
110
false
true
0
9
33
58
27
31
null
null
DavidAlphaFox/ghc
libraries/haskeline/tests/Unit.hs
bsd-3-clause
setCharInput i = i { progArgs = ["chars"] }
43
setCharInput i = i { progArgs = ["chars"] }
43
setCharInput i = i { progArgs = ["chars"] }
43
false
false
1
8
8
27
12
15
null
null
tjakway/ghcjvm
compiler/prelude/THNames.hs
bsd-3-clause
fieldPatQTyConKey = mkPreludeTyConUnique 220
50
fieldPatQTyConKey = mkPreludeTyConUnique 220
50
fieldPatQTyConKey = mkPreludeTyConUnique 220
50
false
false
0
5
9
9
4
5
null
null
peddie/libconfig-haskell
src/Language/Libconfig/Optics.hs
bsd-3-clause
-- | -- >>> (asset := Scalar (String "butts")) ^. settingName -- "asset" -- -- >>> let Just shake = textToName "shake" -- >>> (asset := Scalar (String "butts")) & settingName .~ shake -- "shake" := Scalar (String "butts") settingName :: Lens' Setting Name settingName f (name := value) = fmap (:= value) (f name)
312
settingName :: Lens' Setting Name settingName f (name := value) = fmap (:= value) (f name)
90
settingName f (name := value) = fmap (:= value) (f name)
56
true
true
1
7
54
55
29
26
null
null
urbanslug/ghc
testsuite/tests/numeric/should_run/arith013.hs
bsd-3-clause
test :: (Show a, Integral a) => (a -> a -> a) -> [a] -> IO () test f xs = mapM_ print [ (a, b, f a b) | a <- xs, b <- reverse xs, a /= 0 || b /= 0 ]
149
test :: (Show a, Integral a) => (a -> a -> a) -> [a] -> IO () test f xs = mapM_ print [ (a, b, f a b) | a <- xs, b <- reverse xs, a /= 0 || b /= 0 ]
149
test f xs = mapM_ print [ (a, b, f a b) | a <- xs, b <- reverse xs, a /= 0 || b /= 0 ]
87
false
true
0
10
45
115
59
56
null
null
stevely/hspirv
src/SpirV/Builder.hs
bsd-3-clause
functionParameter :: TypeId -> Builder Id functionParameter (TypeId i) = R.functionParameter i
94
functionParameter :: TypeId -> Builder Id functionParameter (TypeId i) = R.functionParameter i
94
functionParameter (TypeId i) = R.functionParameter i
52
false
true
0
9
11
36
16
20
null
null
kallisti-dev/erisbot
src/Erisbot.hs
bsd-3-clause
rejoinListener :: InputListener s rejoinListener IRCMsg {msgCmd = "KICK", msgParams = [channel, nick]} = do BotConf{nick = myNick} <- readMVar =<< use botConf when (BS.map toLower nick == BS.map toLower (BS.pack myNick)) $ do threadDelay 3000000 sendMsg "JOIN" [channel] ""
285
rejoinListener :: InputListener s rejoinListener IRCMsg {msgCmd = "KICK", msgParams = [channel, nick]} = do BotConf{nick = myNick} <- readMVar =<< use botConf when (BS.map toLower nick == BS.map toLower (BS.pack myNick)) $ do threadDelay 3000000 sendMsg "JOIN" [channel] ""
285
rejoinListener IRCMsg {msgCmd = "KICK", msgParams = [channel, nick]} = do BotConf{nick = myNick} <- readMVar =<< use botConf when (BS.map toLower nick == BS.map toLower (BS.pack myNick)) $ do threadDelay 3000000 sendMsg "JOIN" [channel] ""
251
false
true
0
14
51
119
58
61
null
null
sgillespie/ghc
compiler/nativeGen/Dwarf/Types.hs
bsd-3-clause
-- | Generates unwind information for a block. We only generate -- instructions where unwind information actually changes. This small -- optimisations saves a lot of space, as subsequent blocks often have -- the same unwind information. pprFrameBlock :: UnwindTable -> DwarfFrameBlock -> (UnwindTable, SDoc) pprFrameBlock oldUws (DwarfFrameBlock blockLbl hasInfo uws) | uws == oldUws = (oldUws, empty) | otherwise = (,) uws $ sdocWithPlatform $ \plat -> let lbl = ppr blockLbl <> if hasInfo then text "-1" else empty -- see [Note: Info Offset] isChanged g v | old == Just v = Nothing | otherwise = Just (old, v) where old = Map.lookup g oldUws changed = Map.toList $ Map.mapMaybeWithKey isChanged uws died = Map.toList $ Map.difference oldUws uws in pprByte dW_CFA_set_loc $$ pprWord lbl $$ vcat (map (uncurry $ pprSetUnwind plat) changed) $$ vcat (map (pprUndefUnwind plat . fst) died)
1,007
pprFrameBlock :: UnwindTable -> DwarfFrameBlock -> (UnwindTable, SDoc) pprFrameBlock oldUws (DwarfFrameBlock blockLbl hasInfo uws) | uws == oldUws = (oldUws, empty) | otherwise = (,) uws $ sdocWithPlatform $ \plat -> let lbl = ppr blockLbl <> if hasInfo then text "-1" else empty -- see [Note: Info Offset] isChanged g v | old == Just v = Nothing | otherwise = Just (old, v) where old = Map.lookup g oldUws changed = Map.toList $ Map.mapMaybeWithKey isChanged uws died = Map.toList $ Map.difference oldUws uws in pprByte dW_CFA_set_loc $$ pprWord lbl $$ vcat (map (uncurry $ pprSetUnwind plat) changed) $$ vcat (map (pprUndefUnwind plat . fst) died)
770
pprFrameBlock oldUws (DwarfFrameBlock blockLbl hasInfo uws) | uws == oldUws = (oldUws, empty) | otherwise = (,) uws $ sdocWithPlatform $ \plat -> let lbl = ppr blockLbl <> if hasInfo then text "-1" else empty -- see [Note: Info Offset] isChanged g v | old == Just v = Nothing | otherwise = Just (old, v) where old = Map.lookup g oldUws changed = Map.toList $ Map.mapMaybeWithKey isChanged uws died = Map.toList $ Map.difference oldUws uws in pprByte dW_CFA_set_loc $$ pprWord lbl $$ vcat (map (uncurry $ pprSetUnwind plat) changed) $$ vcat (map (pprUndefUnwind plat . fst) died)
699
true
true
6
14
264
280
136
144
null
null
piyush-kurur/yesod
yesod-core/Yesod/Dispatch.hs
mit
mkYesodGeneral :: String -- ^ foundation type -> [String] -- ^ arguments for the type -> Cxt -- ^ the type constraints -> Bool -- ^ it this a subsite -> [ResourceTree String] -> Q([Dec],[Dec]) mkYesodGeneral name args clazzes isSub resS = do subsite <- sub masterTypeSyns <- if isSub then return [] else sequence [handler, widget] renderRouteDec <- mkRenderRouteInstance subsite res dispatchDec <- mkDispatchInstance context sub master res return (renderRouteDec ++ masterTypeSyns, dispatchDec) where sub = foldl appT subCons subArgs master = if isSub then (varT $ mkName "master") else sub context = if isSub then cxt $ yesod : map return clazzes else return [] yesod = classP ''Yesod [master] handler = tySynD (mkName "Handler") [] [t| GHandler $master $master |] widget = tySynD (mkName "Widget") [] [t| GWidget $master $master () |] res = map (fmap parseType) resS subCons = conT $ mkName name subArgs = map (varT. mkName) args -- | If the generation of @'YesodDispatch'@ instance require finer -- control of the types, contexts etc. using this combinator. You will -- hardly need this generality. However, in certain situations, like -- when writing library/plugin for yesod, this combinator becomes -- handy.
1,553
mkYesodGeneral :: String -- ^ foundation type -> [String] -- ^ arguments for the type -> Cxt -- ^ the type constraints -> Bool -- ^ it this a subsite -> [ResourceTree String] -> Q([Dec],[Dec]) mkYesodGeneral name args clazzes isSub resS = do subsite <- sub masterTypeSyns <- if isSub then return [] else sequence [handler, widget] renderRouteDec <- mkRenderRouteInstance subsite res dispatchDec <- mkDispatchInstance context sub master res return (renderRouteDec ++ masterTypeSyns, dispatchDec) where sub = foldl appT subCons subArgs master = if isSub then (varT $ mkName "master") else sub context = if isSub then cxt $ yesod : map return clazzes else return [] yesod = classP ''Yesod [master] handler = tySynD (mkName "Handler") [] [t| GHandler $master $master |] widget = tySynD (mkName "Widget") [] [t| GWidget $master $master () |] res = map (fmap parseType) resS subCons = conT $ mkName name subArgs = map (varT. mkName) args -- | If the generation of @'YesodDispatch'@ instance require finer -- control of the types, contexts etc. using this combinator. You will -- hardly need this generality. However, in certain situations, like -- when writing library/plugin for yesod, this combinator becomes -- handy.
1,553
mkYesodGeneral name args clazzes isSub resS = do subsite <- sub masterTypeSyns <- if isSub then return [] else sequence [handler, widget] renderRouteDec <- mkRenderRouteInstance subsite res dispatchDec <- mkDispatchInstance context sub master res return (renderRouteDec ++ masterTypeSyns, dispatchDec) where sub = foldl appT subCons subArgs master = if isSub then (varT $ mkName "master") else sub context = if isSub then cxt $ yesod : map return clazzes else return [] yesod = classP ''Yesod [master] handler = tySynD (mkName "Handler") [] [t| GHandler $master $master |] widget = tySynD (mkName "Widget") [] [t| GWidget $master $master () |] res = map (fmap parseType) resS subCons = conT $ mkName name subArgs = map (varT. mkName) args -- | If the generation of @'YesodDispatch'@ instance require finer -- control of the types, contexts etc. using this combinator. You will -- hardly need this generality. However, in certain situations, like -- when writing library/plugin for yesod, this combinator becomes -- handy.
1,210
false
true
8
12
534
336
177
159
null
null
christiaanb/ghc
compiler/types/Type.hs
bsd-3-clause
splitAppTy :: Type -> (Type, Type) -- ^ Attempts to take a type application apart, as in 'splitAppTy_maybe', -- and panics if this is not possible splitAppTy ty = case splitAppTy_maybe ty of Just pr -> pr Nothing -> panic "splitAppTy" -------------
281
splitAppTy :: Type -> (Type, Type) splitAppTy ty = case splitAppTy_maybe ty of Just pr -> pr Nothing -> panic "splitAppTy" -------------
169
splitAppTy ty = case splitAppTy_maybe ty of Just pr -> pr Nothing -> panic "splitAppTy" -------------
134
true
true
0
8
74
57
28
29
null
null
romanb/amazonka
gen/src/Main.hs
mpl-2.0
check :: (MonadIO m, MonadState s m) => Lens' s FilePath -> m () check l = gets (view l) >>= canon >>= assign l
111
check :: (MonadIO m, MonadState s m) => Lens' s FilePath -> m () check l = gets (view l) >>= canon >>= assign l
111
check l = gets (view l) >>= canon >>= assign l
46
false
true
0
9
24
65
31
34
null
null
ellis/OnTopOfThings
old-20150308/src/OnTopOfThings/Actions/View.hs
gpl-3.0
viewsub env0 vd (queryString:rest) sorts = do let query_ = parseView queryString case query_ of Left msgs -> return (Left msgs) Right (ViewElement_Value "print" _) -> do viewPrint vd viewsub env0 (vd { viewDataItems = [] }) rest sorts Right elem -> do liftIO $ putStrLn $ show elem case constructViewQuery elem 1 of Left msg -> return (Left [msg]) Right (qd, _) -> do liftIO $ putStrLn wheres liftIO $ putStrLn $ show $ queryTables qd liftIO $ putStrLn stmt liftIO $ putStrLn $ show $ queryValues qd --tasks' <- rawSql (T.pack stmt) [] -- [toPersistValue $ formatTime' fromTime, toPersistValue $ head l] items' <- rawSql (T.pack stmt) (queryValues qd) let items = map entityVal items' --let x = itemTitle $ head items vis <- mapM itemToViewItem items let vd' = vd { viewDataItems = (viewDataItems vd) ++ vis } --liftIO $ mapM_ (putStrLn . show . itemTitle) tasks --liftIO $ putStrLn $ show $ length tasks --return (Right env0) viewsub env0 vd' rest sorts where wheres = fromMaybe "" (queryWhere qd) tables = filter (/= "item") $ Set.toList $ queryTables qd froms = intercalate ", " $ "item" : (map (\s -> "property " ++ s) tables) whereUuid = case tables of [] -> "" tables -> "(" ++ s ++ ") AND " where s = intercalate " AND " $ map (\table -> "item.uuid = " ++ table ++ ".uuid") tables whereExpr = case (whereUuid, wheres) of ("", "") -> "" _ -> " WHERE " ++ whereUuid ++ "(" ++ wheres ++ ")" stmt0 = "SELECT ?? FROM " ++ froms ++ whereExpr stmt = case sorts of [] -> stmt0 _ -> stmt0 ++ " ORDER BY " ++ intercalate " " sorts
2,021
viewsub env0 vd (queryString:rest) sorts = do let query_ = parseView queryString case query_ of Left msgs -> return (Left msgs) Right (ViewElement_Value "print" _) -> do viewPrint vd viewsub env0 (vd { viewDataItems = [] }) rest sorts Right elem -> do liftIO $ putStrLn $ show elem case constructViewQuery elem 1 of Left msg -> return (Left [msg]) Right (qd, _) -> do liftIO $ putStrLn wheres liftIO $ putStrLn $ show $ queryTables qd liftIO $ putStrLn stmt liftIO $ putStrLn $ show $ queryValues qd --tasks' <- rawSql (T.pack stmt) [] -- [toPersistValue $ formatTime' fromTime, toPersistValue $ head l] items' <- rawSql (T.pack stmt) (queryValues qd) let items = map entityVal items' --let x = itemTitle $ head items vis <- mapM itemToViewItem items let vd' = vd { viewDataItems = (viewDataItems vd) ++ vis } --liftIO $ mapM_ (putStrLn . show . itemTitle) tasks --liftIO $ putStrLn $ show $ length tasks --return (Right env0) viewsub env0 vd' rest sorts where wheres = fromMaybe "" (queryWhere qd) tables = filter (/= "item") $ Set.toList $ queryTables qd froms = intercalate ", " $ "item" : (map (\s -> "property " ++ s) tables) whereUuid = case tables of [] -> "" tables -> "(" ++ s ++ ") AND " where s = intercalate " AND " $ map (\table -> "item.uuid = " ++ table ++ ".uuid") tables whereExpr = case (whereUuid, wheres) of ("", "") -> "" _ -> " WHERE " ++ whereUuid ++ "(" ++ wheres ++ ")" stmt0 = "SELECT ?? FROM " ++ froms ++ whereExpr stmt = case sorts of [] -> stmt0 _ -> stmt0 ++ " ORDER BY " ++ intercalate " " sorts
2,021
viewsub env0 vd (queryString:rest) sorts = do let query_ = parseView queryString case query_ of Left msgs -> return (Left msgs) Right (ViewElement_Value "print" _) -> do viewPrint vd viewsub env0 (vd { viewDataItems = [] }) rest sorts Right elem -> do liftIO $ putStrLn $ show elem case constructViewQuery elem 1 of Left msg -> return (Left [msg]) Right (qd, _) -> do liftIO $ putStrLn wheres liftIO $ putStrLn $ show $ queryTables qd liftIO $ putStrLn stmt liftIO $ putStrLn $ show $ queryValues qd --tasks' <- rawSql (T.pack stmt) [] -- [toPersistValue $ formatTime' fromTime, toPersistValue $ head l] items' <- rawSql (T.pack stmt) (queryValues qd) let items = map entityVal items' --let x = itemTitle $ head items vis <- mapM itemToViewItem items let vd' = vd { viewDataItems = (viewDataItems vd) ++ vis } --liftIO $ mapM_ (putStrLn . show . itemTitle) tasks --liftIO $ putStrLn $ show $ length tasks --return (Right env0) viewsub env0 vd' rest sorts where wheres = fromMaybe "" (queryWhere qd) tables = filter (/= "item") $ Set.toList $ queryTables qd froms = intercalate ", " $ "item" : (map (\s -> "property " ++ s) tables) whereUuid = case tables of [] -> "" tables -> "(" ++ s ++ ") AND " where s = intercalate " AND " $ map (\table -> "item.uuid = " ++ table ++ ".uuid") tables whereExpr = case (whereUuid, wheres) of ("", "") -> "" _ -> " WHERE " ++ whereUuid ++ "(" ++ wheres ++ ")" stmt0 = "SELECT ?? FROM " ++ froms ++ whereExpr stmt = case sorts of [] -> stmt0 _ -> stmt0 ++ " ORDER BY " ++ intercalate " " sorts
2,021
false
false
1
29
782
579
281
298
null
null
amitai-hoze/htoml
src/Text/Toml/Parser.hs
bsd-3-clause
assignment :: Parser (Text, TValue) assignment = do k <- pack <$> many1 keyChar skipBlanks >> char '=' >> skipBlanks v <- value return (k, v) where -- TODO: Follow the spec, e.g.: only first char cannot be '['. keyChar = satisfy (\c -> c /= ' ' && c /= '\t' && c /= '\n' && c /= '=' && c /= '#' && c /= '[') -- | Parses a value.
386
assignment :: Parser (Text, TValue) assignment = do k <- pack <$> many1 keyChar skipBlanks >> char '=' >> skipBlanks v <- value return (k, v) where -- TODO: Follow the spec, e.g.: only first char cannot be '['. keyChar = satisfy (\c -> c /= ' ' && c /= '\t' && c /= '\n' && c /= '=' && c /= '#' && c /= '[') -- | Parses a value.
386
assignment = do k <- pack <$> many1 keyChar skipBlanks >> char '=' >> skipBlanks v <- value return (k, v) where -- TODO: Follow the spec, e.g.: only first char cannot be '['. keyChar = satisfy (\c -> c /= ' ' && c /= '\t' && c /= '\n' && c /= '=' && c /= '#' && c /= '[') -- | Parses a value.
350
false
true
0
18
130
132
66
66
null
null
tkonolige/inline-julia
src/Language/Julia/Inline/Marshal.hs
bsd-3-clause
jl_box_uint16 = unsafePerformIO $ dlsym libjulia "jl_box_uint16"
64
jl_box_uint16 = unsafePerformIO $ dlsym libjulia "jl_box_uint16"
64
jl_box_uint16 = unsafePerformIO $ dlsym libjulia "jl_box_uint16"
64
false
false
0
6
6
15
7
8
null
null
phischu/fragnix
tests/packages/scotty/Data.Tree.hs
bsd-3-clause
unfoldForestM :: Monad m => (b -> m (a, [b])) -> [b] -> m (Forest a) unfoldForestM f = Prelude.mapM (unfoldTreeM f)
115
unfoldForestM :: Monad m => (b -> m (a, [b])) -> [b] -> m (Forest a) unfoldForestM f = Prelude.mapM (unfoldTreeM f)
115
unfoldForestM f = Prelude.mapM (unfoldTreeM f)
46
false
true
0
11
21
71
36
35
null
null
mwu-tow/accelerate-cuda
Data/Array/Accelerate/CUDA/CodeGen/Arithmetic.hs
bsd-3-clause
atan :: FloatingType a -> Exp -> Exp atan t x = mathf t "atan" [x]
66
atan :: FloatingType a -> Exp -> Exp atan t x = mathf t "atan" [x]
66
atan t x = mathf t "atan" [x]
29
false
true
0
8
15
44
19
25
null
null
siddhanathan/ghc
testsuite/tests/typecheck/should_fail/FDsFromGivens2.hs
bsd-3-clause
f :: C Char [a] => a -> a f = undefined
39
f :: C Char [a] => a -> a f = undefined
39
f = undefined
13
false
true
0
8
11
34
15
19
null
null
yupferris/write-you-a-haskell
chapter9/provenance/Type.hs
mit
setLoc :: Loc -> Type -> Type setLoc l (TVar _ a) = TVar l a
62
setLoc :: Loc -> Type -> Type setLoc l (TVar _ a) = TVar l a
62
setLoc l (TVar _ a) = TVar l a
32
false
true
0
7
17
37
18
19
null
null
zoranbosnjak/longrun
Control/Concurrent/Longrun/Base.hs
gpl-3.0
-- | Print log messages. printLogger :: Logger printLogger app prio msg = print (app, prio, msg)
96
printLogger :: Logger printLogger app prio msg = print (app, prio, msg)
71
printLogger app prio msg = print (app, prio, msg)
49
true
true
1
6
16
36
17
19
null
null
sordina/Simple-LSR
Test.hs
bsd-3-clause
test6 :: IO () test6 = do randomData <- annealedData [0,2,0,0,-8] let order = 5 points = take 100 randomData linear = bulkPDs (order - 1) points putStrLn "" putStrLn "Order:" print order putStrLn "" putStrLn "Data:" putStrLn $ groom $ points putStrLn "" putStrLn "Linear System of Derivatives:" mapM_ (putStrLn . showSS) (unPD linear) putStrLn "" putStrLn "Solved System:" mapM_ print $ lsr order points putStrLn ""
475
test6 :: IO () test6 = do randomData <- annealedData [0,2,0,0,-8] let order = 5 points = take 100 randomData linear = bulkPDs (order - 1) points putStrLn "" putStrLn "Order:" print order putStrLn "" putStrLn "Data:" putStrLn $ groom $ points putStrLn "" putStrLn "Linear System of Derivatives:" mapM_ (putStrLn . showSS) (unPD linear) putStrLn "" putStrLn "Solved System:" mapM_ print $ lsr order points putStrLn ""
475
test6 = do randomData <- annealedData [0,2,0,0,-8] let order = 5 points = take 100 randomData linear = bulkPDs (order - 1) points putStrLn "" putStrLn "Order:" print order putStrLn "" putStrLn "Data:" putStrLn $ groom $ points putStrLn "" putStrLn "Linear System of Derivatives:" mapM_ (putStrLn . showSS) (unPD linear) putStrLn "" putStrLn "Solved System:" mapM_ print $ lsr order points putStrLn ""
460
false
true
0
13
127
192
83
109
null
null
Athas/banko
barc/Barc/Simplifier.hs
bsd-2-clause
mapBoolHandle :: E0.Fun -> E0.Exp -> SimplifyM E1.ExpBoolList mapBoolHandle (E0.Fun [arg] eBody) es = tryIntSrc <|> tryBoolSrc where tryBoolSrc = do es' <- simplifyBoolListM es indexId <- newIndexId eBody' <- localBindings $ do bind arg (E1.BoolExp (E1.IndexBool es' (E1.CurrentIndex indexId))) simplifyBoolM eBody return $ E1.MapBool indexId (E1.LengthBool es') eBody' tryIntSrc = do es' <- simplifyIntListM es indexId <- newIndexId eBody' <- localBindings $ do bind arg (E1.IntExp (E1.IndexInt es' (E1.CurrentIndex indexId))) simplifyBoolM eBody return $ E1.MapBool indexId (E1.LengthInt es') eBody'
740
mapBoolHandle :: E0.Fun -> E0.Exp -> SimplifyM E1.ExpBoolList mapBoolHandle (E0.Fun [arg] eBody) es = tryIntSrc <|> tryBoolSrc where tryBoolSrc = do es' <- simplifyBoolListM es indexId <- newIndexId eBody' <- localBindings $ do bind arg (E1.BoolExp (E1.IndexBool es' (E1.CurrentIndex indexId))) simplifyBoolM eBody return $ E1.MapBool indexId (E1.LengthBool es') eBody' tryIntSrc = do es' <- simplifyIntListM es indexId <- newIndexId eBody' <- localBindings $ do bind arg (E1.IntExp (E1.IndexInt es' (E1.CurrentIndex indexId))) simplifyBoolM eBody return $ E1.MapBool indexId (E1.LengthInt es') eBody'
740
mapBoolHandle (E0.Fun [arg] eBody) es = tryIntSrc <|> tryBoolSrc where tryBoolSrc = do es' <- simplifyBoolListM es indexId <- newIndexId eBody' <- localBindings $ do bind arg (E1.BoolExp (E1.IndexBool es' (E1.CurrentIndex indexId))) simplifyBoolM eBody return $ E1.MapBool indexId (E1.LengthBool es') eBody' tryIntSrc = do es' <- simplifyIntListM es indexId <- newIndexId eBody' <- localBindings $ do bind arg (E1.IntExp (E1.IndexInt es' (E1.CurrentIndex indexId))) simplifyBoolM eBody return $ E1.MapBool indexId (E1.LengthInt es') eBody'
678
false
true
1
19
218
249
114
135
null
null
amoerie/labyrinth
Labyrinth/Game.hs
mit
showRemainingTreasureCards :: Game -> String showRemainingTreasureCards (Game players _ _) = unlines $ map showRemainingTreasureCardsOfPlayer players
151
showRemainingTreasureCards :: Game -> String showRemainingTreasureCards (Game players _ _) = unlines $ map showRemainingTreasureCardsOfPlayer players
151
showRemainingTreasureCards (Game players _ _) = unlines $ map showRemainingTreasureCardsOfPlayer players
106
false
true
2
6
17
43
19
24
null
null
forked-upstream-packages-for-ghcjs/ghc
compiler/types/TyCon.hs
bsd-3-clause
promotableTyCon_maybe :: TyCon -> Maybe TyCon promotableTyCon_maybe (AlgTyCon { tcPromoted = prom }) = prom
109
promotableTyCon_maybe :: TyCon -> Maybe TyCon promotableTyCon_maybe (AlgTyCon { tcPromoted = prom }) = prom
109
promotableTyCon_maybe (AlgTyCon { tcPromoted = prom }) = prom
63
false
true
0
8
16
38
18
20
null
null
DavidAlphaFox/ghc
compiler/basicTypes/BasicTypes.hs
bsd-3-clause
strongLoopBreaker, weakLoopBreaker :: OccInfo strongLoopBreaker = IAmALoopBreaker False
87
strongLoopBreaker, weakLoopBreaker :: OccInfo strongLoopBreaker = IAmALoopBreaker False
87
strongLoopBreaker = IAmALoopBreaker False
41
false
true
0
5
7
16
9
7
null
null
aelve/hslibs
src/Guide/Views.hs
bsd-3-clause
-- | Render links page with info about broken links renderAdminLinks :: forall m . (MonadIO m) => GlobalState -> HtmlT m () renderAdminLinks globalState = do head_ $ do includeJS "/js.js" includeJS "/jquery.js" includeJS "/sorttable.js" includeCSS "/markup.css" includeCSS "/admin.css" includeCSS "/loader.css" title_ "Links – Aelve Guide" meta_ [name_ "viewport", content_ "width=device-width, initial-scale=1.0, user-scalable=yes"] body_ $ do script_ $ fromJS $ JS.createAjaxIndicator () h1_ "Links" div_ [id_ "stats"] $ do manager <- liftIO $ newManager tlsManagerSettings fullList <- liftIO $ forM allLinks $ \(lnk, location) -> do lnkStatus <- if isURI (T.unpack lnk) then (do request <- parseRequest $ T.unpack lnk status' <- responseStatus <$> httpNoBody request manager print (lnk, status') pure $ case status' of Status 200 _ -> OK Status code err -> Broken (""+|code|+": "+||err||+"") ) `catch` (return . handleHttpException) else pure Unparseable archStatus <- liftIO (getArchivalStatus manager lnk) pure $ LinkInfo { linkUrl = lnk, linkLocation = location, linkStatus = lnkStatus, linkArchivalStatus = archStatus } renderUnparseableLinks fullList renderBrokenLinks fullList renderOKLinks fullList where handleHttpException :: HttpException -> LinkStatus handleHttpException (HttpExceptionRequest _ x) = Broken $ show x handleHttpException (InvalidUrlException _ x) = Broken x -- Link + a text description of where that link was found in Guide allLinks :: [(Url, Text)] allLinks = ordNub (findLinks globalState)
1,935
renderAdminLinks :: forall m . (MonadIO m) => GlobalState -> HtmlT m () renderAdminLinks globalState = do head_ $ do includeJS "/js.js" includeJS "/jquery.js" includeJS "/sorttable.js" includeCSS "/markup.css" includeCSS "/admin.css" includeCSS "/loader.css" title_ "Links – Aelve Guide" meta_ [name_ "viewport", content_ "width=device-width, initial-scale=1.0, user-scalable=yes"] body_ $ do script_ $ fromJS $ JS.createAjaxIndicator () h1_ "Links" div_ [id_ "stats"] $ do manager <- liftIO $ newManager tlsManagerSettings fullList <- liftIO $ forM allLinks $ \(lnk, location) -> do lnkStatus <- if isURI (T.unpack lnk) then (do request <- parseRequest $ T.unpack lnk status' <- responseStatus <$> httpNoBody request manager print (lnk, status') pure $ case status' of Status 200 _ -> OK Status code err -> Broken (""+|code|+": "+||err||+"") ) `catch` (return . handleHttpException) else pure Unparseable archStatus <- liftIO (getArchivalStatus manager lnk) pure $ LinkInfo { linkUrl = lnk, linkLocation = location, linkStatus = lnkStatus, linkArchivalStatus = archStatus } renderUnparseableLinks fullList renderBrokenLinks fullList renderOKLinks fullList where handleHttpException :: HttpException -> LinkStatus handleHttpException (HttpExceptionRequest _ x) = Broken $ show x handleHttpException (InvalidUrlException _ x) = Broken x -- Link + a text description of where that link was found in Guide allLinks :: [(Url, Text)] allLinks = ordNub (findLinks globalState)
1,883
renderAdminLinks globalState = do head_ $ do includeJS "/js.js" includeJS "/jquery.js" includeJS "/sorttable.js" includeCSS "/markup.css" includeCSS "/admin.css" includeCSS "/loader.css" title_ "Links – Aelve Guide" meta_ [name_ "viewport", content_ "width=device-width, initial-scale=1.0, user-scalable=yes"] body_ $ do script_ $ fromJS $ JS.createAjaxIndicator () h1_ "Links" div_ [id_ "stats"] $ do manager <- liftIO $ newManager tlsManagerSettings fullList <- liftIO $ forM allLinks $ \(lnk, location) -> do lnkStatus <- if isURI (T.unpack lnk) then (do request <- parseRequest $ T.unpack lnk status' <- responseStatus <$> httpNoBody request manager print (lnk, status') pure $ case status' of Status 200 _ -> OK Status code err -> Broken (""+|code|+": "+||err||+"") ) `catch` (return . handleHttpException) else pure Unparseable archStatus <- liftIO (getArchivalStatus manager lnk) pure $ LinkInfo { linkUrl = lnk, linkLocation = location, linkStatus = lnkStatus, linkArchivalStatus = archStatus } renderUnparseableLinks fullList renderBrokenLinks fullList renderOKLinks fullList where handleHttpException :: HttpException -> LinkStatus handleHttpException (HttpExceptionRequest _ x) = Broken $ show x handleHttpException (InvalidUrlException _ x) = Broken x -- Link + a text description of where that link was found in Guide allLinks :: [(Url, Text)] allLinks = ordNub (findLinks globalState)
1,811
true
true
0
33
622
509
237
272
null
null
ezyang/ghc
compiler/coreSyn/CoreSeq.hs
bsd-3-clause
seqOneShot :: OneShotInfo -> () seqOneShot l = l `seq` ()
57
seqOneShot :: OneShotInfo -> () seqOneShot l = l `seq` ()
57
seqOneShot l = l `seq` ()
25
false
true
0
6
10
28
15
13
null
null
geophf/1HaskellADay
exercises/HAD/Y2017/M09/D26/Exercise.hs
mit
-- then let's grab the line that has the raw names listed from each article art2RawNames :: Article -> Maybe RawNames art2RawNames art = undefined
147
art2RawNames :: Article -> Maybe RawNames art2RawNames art = undefined
70
art2RawNames art = undefined
28
true
true
0
6
25
22
11
11
null
null
rahulmutt/ghcvm
compiler/Eta/BasicTypes/NameEnv.hs
bsd-3-clause
alterNameEnv = alterUFM
32
alterNameEnv = alterUFM
32
alterNameEnv = alterUFM
32
false
false
0
4
11
6
3
3
null
null
collia/032015_FP
src/Main.hs
gpl-3.0
loadDatFile :: String -> IO (Table) loadDatFile filename = do contents <- readFile filename return $ parseDatFile contents
150
loadDatFile :: String -> IO (Table) loadDatFile filename = do contents <- readFile filename return $ parseDatFile contents
150
loadDatFile filename = do contents <- readFile filename return $ parseDatFile contents
114
false
true
0
9
45
49
21
28
null
null
isomorphism/csound-expression
src/Csound/Air/Misc.hs
bsd-3-clause
-- cps = 1700 pureRimShot' :: TrSpec -> SE Sig pureRimShot' spec = rndAmp =<< addDur =<< (mul 0.8 $ aring + anoise) where dur = trDur spec tune = trTune spec cps = trCps spec fullDur = 0.027 * dur -- ring aenv1 = expsega [1,fullDur,0.001] ifrq1 = sig $ cps * octave tune aring = mul (0.5 * (aenv1 - 0.001)) $ at (bbp ifrq1 (ifrq1 * 8)) $ rndOscBy tabTR808RimShot ifrq1 -- noise aenv2 = expsega [1, 0.002, 0.8, 0.005, 0.5, fullDur-0.002-0.005, 0.0001] kcf = expsegr [4000, fullDur, 20] fullDur 20 anoise = mul (aenv2 - 0.001) $ fmap (blp kcf) $ noise 1 0 tabTR808RimShot = setSize 1024 $ sines [0.971,0.269,0.041,0.054,0.011,0.013,0.08,0.0065,0.005,0.004,0.003,0.003,0.002,0.002,0.002,0.002,0.002,0.001,0.001,0.001,0.001,0.001,0.002,0.001,0.001]
876
pureRimShot' :: TrSpec -> SE Sig pureRimShot' spec = rndAmp =<< addDur =<< (mul 0.8 $ aring + anoise) where dur = trDur spec tune = trTune spec cps = trCps spec fullDur = 0.027 * dur -- ring aenv1 = expsega [1,fullDur,0.001] ifrq1 = sig $ cps * octave tune aring = mul (0.5 * (aenv1 - 0.001)) $ at (bbp ifrq1 (ifrq1 * 8)) $ rndOscBy tabTR808RimShot ifrq1 -- noise aenv2 = expsega [1, 0.002, 0.8, 0.005, 0.5, fullDur-0.002-0.005, 0.0001] kcf = expsegr [4000, fullDur, 20] fullDur 20 anoise = mul (aenv2 - 0.001) $ fmap (blp kcf) $ noise 1 0 tabTR808RimShot = setSize 1024 $ sines [0.971,0.269,0.041,0.054,0.011,0.013,0.08,0.0065,0.005,0.004,0.003,0.003,0.002,0.002,0.002,0.002,0.002,0.001,0.001,0.001,0.001,0.001,0.002,0.001,0.001]
862
pureRimShot' spec = rndAmp =<< addDur =<< (mul 0.8 $ aring + anoise) where dur = trDur spec tune = trTune spec cps = trCps spec fullDur = 0.027 * dur -- ring aenv1 = expsega [1,fullDur,0.001] ifrq1 = sig $ cps * octave tune aring = mul (0.5 * (aenv1 - 0.001)) $ at (bbp ifrq1 (ifrq1 * 8)) $ rndOscBy tabTR808RimShot ifrq1 -- noise aenv2 = expsega [1, 0.002, 0.8, 0.005, 0.5, fullDur-0.002-0.005, 0.0001] kcf = expsegr [4000, fullDur, 20] fullDur 20 anoise = mul (aenv2 - 0.001) $ fmap (blp kcf) $ noise 1 0 tabTR808RimShot = setSize 1024 $ sines [0.971,0.269,0.041,0.054,0.011,0.013,0.08,0.0065,0.005,0.004,0.003,0.003,0.002,0.002,0.002,0.002,0.002,0.001,0.001,0.001,0.001,0.001,0.002,0.001,0.001]
829
true
true
10
15
246
356
196
160
null
null
energyflowanalysis/efa-2.1
test/EFA/Test/StateAnalysis.hs
bsd-3-clause
speed_branchAndBound :: ArbTopology Node -> Bool speed_branchAndBound (ArbTopology g) = StateAnalysis.branchAndBound g == StateAnalysis.branchAndBound g
155
speed_branchAndBound :: ArbTopology Node -> Bool speed_branchAndBound (ArbTopology g) = StateAnalysis.branchAndBound g == StateAnalysis.branchAndBound g
155
speed_branchAndBound (ArbTopology g) = StateAnalysis.branchAndBound g == StateAnalysis.branchAndBound g
106
false
true
0
7
17
41
19
22
null
null
GaloisInc/ivory
ivory-examples/examples/Alloc.hs
bsd-3-clause
assign_test :: Def ('[] ':-> ()) assign_test = proc "assign_test" $ body $ do val <- local (istruct []) _ <- assign (val ~> p) retVoid
141
assign_test :: Def ('[] ':-> ()) assign_test = proc "assign_test" $ body $ do val <- local (istruct []) _ <- assign (val ~> p) retVoid
141
assign_test = proc "assign_test" $ body $ do val <- local (istruct []) _ <- assign (val ~> p) retVoid
108
false
true
0
12
32
78
37
41
null
null