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
redien/reuse-lang
standard-library/specification/string.hs
cc0-1.0
evalReuse (SRest xs) = Reuse.string_rest (evalReuse xs)
55
evalReuse (SRest xs) = Reuse.string_rest (evalReuse xs)
55
evalReuse (SRest xs) = Reuse.string_rest (evalReuse xs)
55
false
false
0
7
6
26
12
14
null
null
BartAdv/Idris-dev
src/Idris/IBC.hs
bsd-3-clause
ibc i (IBCMetaInformation n m) f = return f { ibc_metainformation = (n,m) : ibc_metainformation f }
99
ibc i (IBCMetaInformation n m) f = return f { ibc_metainformation = (n,m) : ibc_metainformation f }
99
ibc i (IBCMetaInformation n m) f = return f { ibc_metainformation = (n,m) : ibc_metainformation f }
99
false
false
1
9
16
48
23
25
null
null
antarestrader/sapphire
Text/Parsec/Combinator.hs
gpl-3.0
-- | @chainl1 p op x@ parser /one/ or more occurrences of @p@, -- separated by @op@ Returns a value obtained by a /left/ associative -- application of all functions returned by @op@ to the values returned -- by @p@. . This parser can for example be used to eliminate left -- recursion which typically occurs in expression grammars. -- -- > expr = term `chainl1` addop -- > term = factor `chainl1` mulop -- > factor = parens expr <|> integer -- > -- > mulop = do{ symbol "*"; return (*) } -- > <|> do{ symbol "/"; return (div) } -- > -- > addop = do{ symbol "+"; return (+) } -- > <|> do{ symbol "-"; return (-) } chainl1 :: (Stream s m t) => ParsecT s u m a -> ParsecT s u m (a -> a -> a) -> ParsecT s u m a chainl1 p op = do{ x <- p; rest x } where rest x = do{ f <- op ; y <- p ; rest (f x y) } <|> return x -- | @chainr1 p op x@ parser /one/ or more occurrences of |p|, -- separated by @op@ Returns a value obtained by a /right/ associative -- application of all functions returned by @op@ to the values returned -- by @p@.
1,262
chainl1 :: (Stream s m t) => ParsecT s u m a -> ParsecT s u m (a -> a -> a) -> ParsecT s u m a chainl1 p op = do{ x <- p; rest x } where rest x = do{ f <- op ; y <- p ; rest (f x y) } <|> return x -- | @chainr1 p op x@ parser /one/ or more occurrences of |p|, -- separated by @op@ Returns a value obtained by a /right/ associative -- application of all functions returned by @op@ to the values returned -- by @p@.
606
chainl1 p op = do{ x <- p; rest x } where rest x = do{ f <- op ; y <- p ; rest (f x y) } <|> return x -- | @chainr1 p op x@ parser /one/ or more occurrences of |p|, -- separated by @op@ Returns a value obtained by a /right/ associative -- application of all functions returned by @op@ to the values returned -- by @p@.
511
true
true
0
12
459
159
88
71
null
null
fumieval/monad-skeleton
src/Control/Monad/Skeleton.hs
bsd-3-clause
-- | Re-add a bone. Inverse of 'debone' boned :: MonadView t (Skeleton t) a -> Skeleton t a boned (Return a) = ReturnS a
120
boned :: MonadView t (Skeleton t) a -> Skeleton t a boned (Return a) = ReturnS a
80
boned (Return a) = ReturnS a
28
true
true
0
8
24
46
22
24
null
null
jochem88/btjchm
Color.hs
mit
colorCode Black = "01"
23
colorCode Black = "01"
23
colorCode Black = "01"
23
false
false
1
5
4
13
4
9
null
null
schnecki/HaskellMachineLearning
src/Data/ML/Util/Util.hs
gpl-3.0
selectMany :: (RandomGen g, Eq a) => Int -> [a] -> Rand g [a] selectMany nr = fmap fst . selectMany' nr
103
selectMany :: (RandomGen g, Eq a) => Int -> [a] -> Rand g [a] selectMany nr = fmap fst . selectMany' nr
103
selectMany nr = fmap fst . selectMany' nr
41
false
true
0
9
21
58
29
29
null
null
dchagniot/threadscopeRestServer
src/Events/SparkStats.hs
bsd-3-clause
-- | Initial, default value of spark stats, at the start of runtime, -- before any spark activity is recorded. initial :: SparkStats initial = SparkStats 0 0 0 0 0 0 0 0 0
171
initial :: SparkStats initial = SparkStats 0 0 0 0 0 0 0 0 0
60
initial = SparkStats 0 0 0 0 0 0 0 0 0
38
true
true
0
6
34
43
18
25
null
null
bitemyapp/ghc
compiler/deSugar/Coverage.hs
bsd-3-clause
isGoodBreakExpr (RecordCon {}) = True
37
isGoodBreakExpr (RecordCon {}) = True
37
isGoodBreakExpr (RecordCon {}) = True
37
false
false
0
7
4
16
8
8
null
null
Lysxia/twentyseven
src/Rubik/Tables/Internal.hs
mit
distanceWith2' :: G.Vector v DInt => MoveTag m [RawMove a] -> MoveTag m [RawMove b] -> Projection' m a -> Projection' m b -> Int -> Int -> v DInt distanceWith2' (MoveTag m1) (MoveTag m2) proj1 proj2 n1 n2 = distances n root neighbors where n = n1 * n2 root = flatIndex n2 (unRawCoord (convertP proj1 iden)) (unRawCoord (convertP proj2 iden)) neighbors ((`divMod` n2) -> (x1, x2)) = zipWith (\v1 v2 -> flatIndex n2 (unRawCoord . indexP proj1 v1 $ RawCoord x1) (unRawCoord . indexP proj2 v2 $ RawCoord x2)) m1 m2
560
distanceWith2' :: G.Vector v DInt => MoveTag m [RawMove a] -> MoveTag m [RawMove b] -> Projection' m a -> Projection' m b -> Int -> Int -> v DInt distanceWith2' (MoveTag m1) (MoveTag m2) proj1 proj2 n1 n2 = distances n root neighbors where n = n1 * n2 root = flatIndex n2 (unRawCoord (convertP proj1 iden)) (unRawCoord (convertP proj2 iden)) neighbors ((`divMod` n2) -> (x1, x2)) = zipWith (\v1 v2 -> flatIndex n2 (unRawCoord . indexP proj1 v1 $ RawCoord x1) (unRawCoord . indexP proj2 v2 $ RawCoord x2)) m1 m2
560
distanceWith2' (MoveTag m1) (MoveTag m2) proj1 proj2 n1 n2 = distances n root neighbors where n = n1 * n2 root = flatIndex n2 (unRawCoord (convertP proj1 iden)) (unRawCoord (convertP proj2 iden)) neighbors ((`divMod` n2) -> (x1, x2)) = zipWith (\v1 v2 -> flatIndex n2 (unRawCoord . indexP proj1 v1 $ RawCoord x1) (unRawCoord . indexP proj2 v2 $ RawCoord x2)) m1 m2
408
false
true
3
15
142
271
127
144
null
null
shlevy/ghc
testsuite/tests/typecheck/should_run/StrictPats.hs
bsd-3-clause
k = True where True = False -- OK
36
k = True where True = False -- OK
36
k = True where True = False -- OK
36
false
false
1
5
11
19
8
11
null
null
izgzhen/logix
Logix/Transform.hs
mit
extractArgs :: Formula -> [String] extractArgs Empty = []
57
extractArgs :: Formula -> [String] extractArgs Empty = []
57
extractArgs Empty = []
22
false
true
0
6
8
23
12
11
null
null
spechub/Hets
GUI/GraphMenu.hs
gpl-2.0
-- | Displays a Save-As dialog and writes the proof-script. askSaveProofScript :: GA.GraphInfo -> IORef IntState -> IO () askSaveProofScript gi ch = do h <- readIORef ch case undoList $ i_hist h of [] -> infoDialog "Information" "The history is empty. No file written." _ -> do ff <- getProofScriptFileName $ rmSuffix $ filename h maybeFilePath <- fileSaveDialog ff [ ("Proof Script", ["*.hpf"]) , ("All Files", ["*"])] Nothing case maybeFilePath of Just fPath -> do GA.showTemporaryMessage gi "Saving proof script ..." saveCommandHistory ch fPath GA.showTemporaryMessage gi $ "Proof script saved to " ++ fPath ++ "!" Nothing -> GA.showTemporaryMessage gi "Aborted!" -- Saves the history of commands in a file.
817
askSaveProofScript :: GA.GraphInfo -> IORef IntState -> IO () askSaveProofScript gi ch = do h <- readIORef ch case undoList $ i_hist h of [] -> infoDialog "Information" "The history is empty. No file written." _ -> do ff <- getProofScriptFileName $ rmSuffix $ filename h maybeFilePath <- fileSaveDialog ff [ ("Proof Script", ["*.hpf"]) , ("All Files", ["*"])] Nothing case maybeFilePath of Just fPath -> do GA.showTemporaryMessage gi "Saving proof script ..." saveCommandHistory ch fPath GA.showTemporaryMessage gi $ "Proof script saved to " ++ fPath ++ "!" Nothing -> GA.showTemporaryMessage gi "Aborted!" -- Saves the history of commands in a file.
757
askSaveProofScript gi ch = do h <- readIORef ch case undoList $ i_hist h of [] -> infoDialog "Information" "The history is empty. No file written." _ -> do ff <- getProofScriptFileName $ rmSuffix $ filename h maybeFilePath <- fileSaveDialog ff [ ("Proof Script", ["*.hpf"]) , ("All Files", ["*"])] Nothing case maybeFilePath of Just fPath -> do GA.showTemporaryMessage gi "Saving proof script ..." saveCommandHistory ch fPath GA.showTemporaryMessage gi $ "Proof script saved to " ++ fPath ++ "!" Nothing -> GA.showTemporaryMessage gi "Aborted!" -- Saves the history of commands in a file.
695
true
true
0
21
217
202
96
106
null
null
mboogerd/hello-haskell
src/lyah/FunctionSyntax.hs
apache-2.0
sayMe 3 = "Three!"
18
sayMe 3 = "Three!"
18
sayMe 3 = "Three!"
18
false
false
1
5
3
13
4
9
null
null
ekmett/ghc
compiler/nativeGen/PPC/CodeGen.hs
bsd-3-clause
ondFltReg cond x y = condReg (condFltCode cond x y)
52
condFltReg cond x y = condReg (condFltCode cond x y)
52
condFltReg cond x y = condReg (condFltCode cond x y)
52
false
false
0
7
10
26
12
14
null
null
naushadh/persistent
persistent-test/src/CompositeTest.hs
mit
specsWith :: (MonadIO m, MonadFail m) => RunDb SqlBackend m -> Spec specsWith runDb = describe "composite" $ describe "primary keys" $ do let p1 = TestParent "a1" "b1" 11 "p1" let p2 = TestParent "a2" "b2" 22 "p2" let p3 = TestParent "a3" "b3" 33 "p3" let p1' = TestParent "a1" "b1" 11 "p1'" let c1 = TestChild "a1" "b1" 11 "c1" let c1' = TestChild "a1" "b1" 11 "c1'" it "insertWithKey" $ runDb $ do kp1 <- insert p1 delete kp1 insertKey kp1 p2 it "repsert" $ runDb $ do kp1 <- insert p1 repsert kp1 p2 it "Insert" $ runDb $ do kp1 <- insert p1 matchParentK kp1 @== Right ("a1","b1",11) mp <- get kp1 isJust mp @== True let Just p11 = mp p1 @== p11 xs <- selectList [TestParentId ==. kp1] [] length xs @== 1 let [Entity newkp1 newp1] = xs matchParentK kp1 @== matchParentK newkp1 p1 @== newp1 it "Id field" $ runDb $ do kp1 <- insert p1 kp2 <- insert p2 xs <- selectList [TestParentId <-. [kp1,kp2]] [] length xs @== 2 [(Entity newkp1 newp1),(Entity newkp2 newp2)] <- pure xs matchParentK kp1 @== matchParentK newkp1 matchParentK kp2 @== matchParentK newkp2 p1 @== newp1 p2 @== newp2 it "Filter by Id with 'not equal'" $ runDb $ do kp1 <- insert p1 kp2 <- insert p2 xs <- selectList [TestParentId !=. kp1] [] length xs @== 1 let [Entity newkp2 _newp2] = xs matchParentK kp2 @== matchParentK newkp2 it "Filter by Id with 'in'" $ runDb $ do kp1 <- insert p1 kp2 <- insert p2 xs <- selectList [TestParentId <-. [kp1,kp2]] [] length xs @== 2 let [Entity newkp1 _newp1,Entity newkp2 _newp2] = xs matchParentK kp1 @== matchParentK newkp1 matchParentK kp2 @== matchParentK newkp2 it "Filter by Id with 'not in'" $ runDb $ do kp1 <- insert p1 kp2 <- insert p2 xs <- selectList [TestParentId /<-. [kp1]] [] length xs @== 1 let [Entity newkp2 _newp2] = xs matchParentK kp2 @== matchParentK newkp2 it "Filter by Id with 'not in' with no data" $ runDb $ do kp1 <- insert p1 kp2 <- insert p2 xs <- selectList [TestParentId /<-. [kp1,kp2]] [] length xs @== 0 it "Extract Parent Foreign Key from Child value" $ runDb $ do kp1 <- insert p1 _ <- insert p2 kc1 <- insert c1 mc <- get kc1 isJust mc @== True let Just c11 = mc c1 @== c11 testChildFkparent c11 @== kp1 it "Validate Key contents" $ runDb $ do _ <- insert p1 _ <- insert p2 _ <- insert p3 xs <- selectKeysList [] [Asc TestParentName] length xs @== 3 let [kps1,kps2,kps3] = xs matchParentK kps1 @== Right ("a1","b1",11) matchParentK kps2 @== Right ("a2","b2",22) matchParentK kps3 @== Right ("a3","b3",33) it "Delete" $ runDb $ do kp1 <- insert p1 kp2 <- insert p2 _ <- delete kp1 r <- get kp1 r @== Nothing r1 <- get kp2 isJust r1 @== True it "Update" $ runDb $ do kp1 <- insert p1 _ <- update kp1 [TestParentExtra44 =. "q1"] newkps1 <- get kp1 newkps1 @== Just (TestParent "a1" "b1" 11 "q1") it "Replace Parent" $ runDb $ do kp1 <- insert p1 _ <- replace kp1 p1' newp1 <- get kp1 newp1 @== Just p1' it "Replace Child" $ runDb $ do -- c1 FKs p1 _ <- insert p1 kc1 <- insert c1 _ <- replace kc1 c1' newc1 <- get kc1 newc1 @== Just c1' it "Insert Many to Many" $ runDb $ do let z1 = Citizen "mk" (Just 11) let a1 = Address "abc" "usa" let z2 = Citizen "gb" (Just 22) let a2 = Address "def" "den" kc1 <- insert z1 ka1 <- insert a1 let ca1 = CitizenAddress kc1 ka1 kca1 <- insert ca1 matchCitizenAddressK kca1 @== matchK2 kc1 ka1 mca <- get kca1 isJust mca @== True let Just newca1 = mca ca1 @== newca1 kc2 <- insert z2 ka2 <- insert a2 let ca2 = CitizenAddress kc2 ka2 kca2 <- insert ca2 matchCitizenAddressK kca2 @== matchK2 kc2 ka2 xs <- selectList [CitizenAddressId ==. kca1] [] length xs @== 1 let [Entity newkca1 newca2] = xs matchCitizenAddressK kca1 @== matchCitizenAddressK newkca1 ca1 @== newca2 it "insertMany" $ runDb $ do [kp1, kp2] <- insertMany [p1, p2] rs <- getMany [kp1, kp2] rs @== Map.fromList [(kp1, p1), (kp2, p2)] it "RawSql Key instance" $ runDb $ do key <- insert p1 keyFromRaw <- rawSql "SELECT name, name2, age FROM test_parent LIMIT 1" [] [key] @== keyFromRaw -- TODO: push into persistent-qq test suite -- it "RawSql Key instance with sqlQQ" $ runDb $ do -- key <- insert p1 -- keyFromRaw' <- [sqlQQ| -- SELECT @{TestParentName}, @{TestParentName2}, @{TestParentAge} -- FROM ^{TestParent} -- LIMIT 1 -- |] -- [key] @== keyFromRaw' it "RawSql Entity instance" $ runDb $ do key <- insert p1 newp1 <- rawSql "SELECT ?? FROM test_parent LIMIT 1" [] [Entity key p1] @== newp1 -- TODO: put into persistent-qq test suite -- it "RawSql Entity instance with sqlQQ" $ runDb $ do -- key <- insert p1 -- newp1' <- [sqlQQ| SELECT ?? FROM ^{TestParent} |] -- [Entity key p1] @== newp1'
5,454
specsWith :: (MonadIO m, MonadFail m) => RunDb SqlBackend m -> Spec specsWith runDb = describe "composite" $ describe "primary keys" $ do let p1 = TestParent "a1" "b1" 11 "p1" let p2 = TestParent "a2" "b2" 22 "p2" let p3 = TestParent "a3" "b3" 33 "p3" let p1' = TestParent "a1" "b1" 11 "p1'" let c1 = TestChild "a1" "b1" 11 "c1" let c1' = TestChild "a1" "b1" 11 "c1'" it "insertWithKey" $ runDb $ do kp1 <- insert p1 delete kp1 insertKey kp1 p2 it "repsert" $ runDb $ do kp1 <- insert p1 repsert kp1 p2 it "Insert" $ runDb $ do kp1 <- insert p1 matchParentK kp1 @== Right ("a1","b1",11) mp <- get kp1 isJust mp @== True let Just p11 = mp p1 @== p11 xs <- selectList [TestParentId ==. kp1] [] length xs @== 1 let [Entity newkp1 newp1] = xs matchParentK kp1 @== matchParentK newkp1 p1 @== newp1 it "Id field" $ runDb $ do kp1 <- insert p1 kp2 <- insert p2 xs <- selectList [TestParentId <-. [kp1,kp2]] [] length xs @== 2 [(Entity newkp1 newp1),(Entity newkp2 newp2)] <- pure xs matchParentK kp1 @== matchParentK newkp1 matchParentK kp2 @== matchParentK newkp2 p1 @== newp1 p2 @== newp2 it "Filter by Id with 'not equal'" $ runDb $ do kp1 <- insert p1 kp2 <- insert p2 xs <- selectList [TestParentId !=. kp1] [] length xs @== 1 let [Entity newkp2 _newp2] = xs matchParentK kp2 @== matchParentK newkp2 it "Filter by Id with 'in'" $ runDb $ do kp1 <- insert p1 kp2 <- insert p2 xs <- selectList [TestParentId <-. [kp1,kp2]] [] length xs @== 2 let [Entity newkp1 _newp1,Entity newkp2 _newp2] = xs matchParentK kp1 @== matchParentK newkp1 matchParentK kp2 @== matchParentK newkp2 it "Filter by Id with 'not in'" $ runDb $ do kp1 <- insert p1 kp2 <- insert p2 xs <- selectList [TestParentId /<-. [kp1]] [] length xs @== 1 let [Entity newkp2 _newp2] = xs matchParentK kp2 @== matchParentK newkp2 it "Filter by Id with 'not in' with no data" $ runDb $ do kp1 <- insert p1 kp2 <- insert p2 xs <- selectList [TestParentId /<-. [kp1,kp2]] [] length xs @== 0 it "Extract Parent Foreign Key from Child value" $ runDb $ do kp1 <- insert p1 _ <- insert p2 kc1 <- insert c1 mc <- get kc1 isJust mc @== True let Just c11 = mc c1 @== c11 testChildFkparent c11 @== kp1 it "Validate Key contents" $ runDb $ do _ <- insert p1 _ <- insert p2 _ <- insert p3 xs <- selectKeysList [] [Asc TestParentName] length xs @== 3 let [kps1,kps2,kps3] = xs matchParentK kps1 @== Right ("a1","b1",11) matchParentK kps2 @== Right ("a2","b2",22) matchParentK kps3 @== Right ("a3","b3",33) it "Delete" $ runDb $ do kp1 <- insert p1 kp2 <- insert p2 _ <- delete kp1 r <- get kp1 r @== Nothing r1 <- get kp2 isJust r1 @== True it "Update" $ runDb $ do kp1 <- insert p1 _ <- update kp1 [TestParentExtra44 =. "q1"] newkps1 <- get kp1 newkps1 @== Just (TestParent "a1" "b1" 11 "q1") it "Replace Parent" $ runDb $ do kp1 <- insert p1 _ <- replace kp1 p1' newp1 <- get kp1 newp1 @== Just p1' it "Replace Child" $ runDb $ do -- c1 FKs p1 _ <- insert p1 kc1 <- insert c1 _ <- replace kc1 c1' newc1 <- get kc1 newc1 @== Just c1' it "Insert Many to Many" $ runDb $ do let z1 = Citizen "mk" (Just 11) let a1 = Address "abc" "usa" let z2 = Citizen "gb" (Just 22) let a2 = Address "def" "den" kc1 <- insert z1 ka1 <- insert a1 let ca1 = CitizenAddress kc1 ka1 kca1 <- insert ca1 matchCitizenAddressK kca1 @== matchK2 kc1 ka1 mca <- get kca1 isJust mca @== True let Just newca1 = mca ca1 @== newca1 kc2 <- insert z2 ka2 <- insert a2 let ca2 = CitizenAddress kc2 ka2 kca2 <- insert ca2 matchCitizenAddressK kca2 @== matchK2 kc2 ka2 xs <- selectList [CitizenAddressId ==. kca1] [] length xs @== 1 let [Entity newkca1 newca2] = xs matchCitizenAddressK kca1 @== matchCitizenAddressK newkca1 ca1 @== newca2 it "insertMany" $ runDb $ do [kp1, kp2] <- insertMany [p1, p2] rs <- getMany [kp1, kp2] rs @== Map.fromList [(kp1, p1), (kp2, p2)] it "RawSql Key instance" $ runDb $ do key <- insert p1 keyFromRaw <- rawSql "SELECT name, name2, age FROM test_parent LIMIT 1" [] [key] @== keyFromRaw -- TODO: push into persistent-qq test suite -- it "RawSql Key instance with sqlQQ" $ runDb $ do -- key <- insert p1 -- keyFromRaw' <- [sqlQQ| -- SELECT @{TestParentName}, @{TestParentName2}, @{TestParentAge} -- FROM ^{TestParent} -- LIMIT 1 -- |] -- [key] @== keyFromRaw' it "RawSql Entity instance" $ runDb $ do key <- insert p1 newp1 <- rawSql "SELECT ?? FROM test_parent LIMIT 1" [] [Entity key p1] @== newp1 -- TODO: put into persistent-qq test suite -- it "RawSql Entity instance with sqlQQ" $ runDb $ do -- key <- insert p1 -- newp1' <- [sqlQQ| SELECT ?? FROM ^{TestParent} |] -- [Entity key p1] @== newp1'
5,454
specsWith runDb = describe "composite" $ describe "primary keys" $ do let p1 = TestParent "a1" "b1" 11 "p1" let p2 = TestParent "a2" "b2" 22 "p2" let p3 = TestParent "a3" "b3" 33 "p3" let p1' = TestParent "a1" "b1" 11 "p1'" let c1 = TestChild "a1" "b1" 11 "c1" let c1' = TestChild "a1" "b1" 11 "c1'" it "insertWithKey" $ runDb $ do kp1 <- insert p1 delete kp1 insertKey kp1 p2 it "repsert" $ runDb $ do kp1 <- insert p1 repsert kp1 p2 it "Insert" $ runDb $ do kp1 <- insert p1 matchParentK kp1 @== Right ("a1","b1",11) mp <- get kp1 isJust mp @== True let Just p11 = mp p1 @== p11 xs <- selectList [TestParentId ==. kp1] [] length xs @== 1 let [Entity newkp1 newp1] = xs matchParentK kp1 @== matchParentK newkp1 p1 @== newp1 it "Id field" $ runDb $ do kp1 <- insert p1 kp2 <- insert p2 xs <- selectList [TestParentId <-. [kp1,kp2]] [] length xs @== 2 [(Entity newkp1 newp1),(Entity newkp2 newp2)] <- pure xs matchParentK kp1 @== matchParentK newkp1 matchParentK kp2 @== matchParentK newkp2 p1 @== newp1 p2 @== newp2 it "Filter by Id with 'not equal'" $ runDb $ do kp1 <- insert p1 kp2 <- insert p2 xs <- selectList [TestParentId !=. kp1] [] length xs @== 1 let [Entity newkp2 _newp2] = xs matchParentK kp2 @== matchParentK newkp2 it "Filter by Id with 'in'" $ runDb $ do kp1 <- insert p1 kp2 <- insert p2 xs <- selectList [TestParentId <-. [kp1,kp2]] [] length xs @== 2 let [Entity newkp1 _newp1,Entity newkp2 _newp2] = xs matchParentK kp1 @== matchParentK newkp1 matchParentK kp2 @== matchParentK newkp2 it "Filter by Id with 'not in'" $ runDb $ do kp1 <- insert p1 kp2 <- insert p2 xs <- selectList [TestParentId /<-. [kp1]] [] length xs @== 1 let [Entity newkp2 _newp2] = xs matchParentK kp2 @== matchParentK newkp2 it "Filter by Id with 'not in' with no data" $ runDb $ do kp1 <- insert p1 kp2 <- insert p2 xs <- selectList [TestParentId /<-. [kp1,kp2]] [] length xs @== 0 it "Extract Parent Foreign Key from Child value" $ runDb $ do kp1 <- insert p1 _ <- insert p2 kc1 <- insert c1 mc <- get kc1 isJust mc @== True let Just c11 = mc c1 @== c11 testChildFkparent c11 @== kp1 it "Validate Key contents" $ runDb $ do _ <- insert p1 _ <- insert p2 _ <- insert p3 xs <- selectKeysList [] [Asc TestParentName] length xs @== 3 let [kps1,kps2,kps3] = xs matchParentK kps1 @== Right ("a1","b1",11) matchParentK kps2 @== Right ("a2","b2",22) matchParentK kps3 @== Right ("a3","b3",33) it "Delete" $ runDb $ do kp1 <- insert p1 kp2 <- insert p2 _ <- delete kp1 r <- get kp1 r @== Nothing r1 <- get kp2 isJust r1 @== True it "Update" $ runDb $ do kp1 <- insert p1 _ <- update kp1 [TestParentExtra44 =. "q1"] newkps1 <- get kp1 newkps1 @== Just (TestParent "a1" "b1" 11 "q1") it "Replace Parent" $ runDb $ do kp1 <- insert p1 _ <- replace kp1 p1' newp1 <- get kp1 newp1 @== Just p1' it "Replace Child" $ runDb $ do -- c1 FKs p1 _ <- insert p1 kc1 <- insert c1 _ <- replace kc1 c1' newc1 <- get kc1 newc1 @== Just c1' it "Insert Many to Many" $ runDb $ do let z1 = Citizen "mk" (Just 11) let a1 = Address "abc" "usa" let z2 = Citizen "gb" (Just 22) let a2 = Address "def" "den" kc1 <- insert z1 ka1 <- insert a1 let ca1 = CitizenAddress kc1 ka1 kca1 <- insert ca1 matchCitizenAddressK kca1 @== matchK2 kc1 ka1 mca <- get kca1 isJust mca @== True let Just newca1 = mca ca1 @== newca1 kc2 <- insert z2 ka2 <- insert a2 let ca2 = CitizenAddress kc2 ka2 kca2 <- insert ca2 matchCitizenAddressK kca2 @== matchK2 kc2 ka2 xs <- selectList [CitizenAddressId ==. kca1] [] length xs @== 1 let [Entity newkca1 newca2] = xs matchCitizenAddressK kca1 @== matchCitizenAddressK newkca1 ca1 @== newca2 it "insertMany" $ runDb $ do [kp1, kp2] <- insertMany [p1, p2] rs <- getMany [kp1, kp2] rs @== Map.fromList [(kp1, p1), (kp2, p2)] it "RawSql Key instance" $ runDb $ do key <- insert p1 keyFromRaw <- rawSql "SELECT name, name2, age FROM test_parent LIMIT 1" [] [key] @== keyFromRaw -- TODO: push into persistent-qq test suite -- it "RawSql Key instance with sqlQQ" $ runDb $ do -- key <- insert p1 -- keyFromRaw' <- [sqlQQ| -- SELECT @{TestParentName}, @{TestParentName2}, @{TestParentAge} -- FROM ^{TestParent} -- LIMIT 1 -- |] -- [key] @== keyFromRaw' it "RawSql Entity instance" $ runDb $ do key <- insert p1 newp1 <- rawSql "SELECT ?? FROM test_parent LIMIT 1" [] [Entity key p1] @== newp1 -- TODO: put into persistent-qq test suite -- it "RawSql Entity instance with sqlQQ" $ runDb $ do -- key <- insert p1 -- newp1' <- [sqlQQ| SELECT ?? FROM ^{TestParent} |] -- [Entity key p1] @== newp1'
5,386
false
true
2
15
1,775
1,962
863
1,099
null
null
pbrisbin/toml-parse
src/Text/Toml/Parser.hs
bsd-3-clause
allSame ((TBoolean{}):xs) = allBoolean xs
41
allSame ((TBoolean{}):xs) = allBoolean xs
41
allSame ((TBoolean{}):xs) = allBoolean xs
41
false
false
0
8
4
27
13
14
null
null
scrive/hpqtypes
test/Test/QuickCheck/Arbitrary/Instances.hs
bsd-3-clause
uuidFromWords :: (Word32, Word32, Word32, Word32) -> U.UUID uuidFromWords (a,b,c,d) = U.fromWords a b c d
105
uuidFromWords :: (Word32, Word32, Word32, Word32) -> U.UUID uuidFromWords (a,b,c,d) = U.fromWords a b c d
105
uuidFromWords (a,b,c,d) = U.fromWords a b c d
45
false
true
0
6
15
55
31
24
null
null
onponomarev/ganeti
src/Ganeti/Types.hs
bsd-2-clause
diskTemplateMovable DTDrbd8 = False
41
diskTemplateMovable DTDrbd8 = False
41
diskTemplateMovable DTDrbd8 = False
41
false
false
0
5
9
9
4
5
null
null
lamefun/haddock
haddock-api/src/Haddock/Backends/Xhtml/Decl.hs
bsd-2-clause
ppShortConstr :: Bool -> ConDecl DocName -> Unicode -> Qualification -> Html ppShortConstr summary con unicode qual = cHead <+> cBody <+> cFoot where (cHead,cBody,cFoot) = ppShortConstrParts summary False con unicode qual -- returns three pieces: header, body, footer so that header & footer can be -- incorporated into the declaration
343
ppShortConstr :: Bool -> ConDecl DocName -> Unicode -> Qualification -> Html ppShortConstr summary con unicode qual = cHead <+> cBody <+> cFoot where (cHead,cBody,cFoot) = ppShortConstrParts summary False con unicode qual -- returns three pieces: header, body, footer so that header & footer can be -- incorporated into the declaration
343
ppShortConstr summary con unicode qual = cHead <+> cBody <+> cFoot where (cHead,cBody,cFoot) = ppShortConstrParts summary False con unicode qual -- returns three pieces: header, body, footer so that header & footer can be -- incorporated into the declaration
266
false
true
0
8
58
78
40
38
null
null
Lainepress/hledger
hledger-lib/Hledger/Utils.hs
gpl-3.0
-- regexMatchCI :: String -> String -> MatchFun Maybe regexMatchCI r s = regexMatch (regexToCaseInsensitive r) s
112
regexMatchCI r s = regexMatch (regexToCaseInsensitive r) s
58
regexMatchCI r s = regexMatch (regexToCaseInsensitive r) s
58
true
false
1
7
16
27
11
16
null
null
mbakke/ganeti
src/Ganeti/Constants.hs
bsd-2-clause
htHvmValidNicTypes :: FrozenSet String htHvmValidNicTypes = ConstantUtils.mkSet [htNicE1000, htNicNe2kIsa, htNicNe2kPci, htNicParavirtual, htNicRtl8139]
246
htHvmValidNicTypes :: FrozenSet String htHvmValidNicTypes = ConstantUtils.mkSet [htNicE1000, htNicNe2kIsa, htNicNe2kPci, htNicParavirtual, htNicRtl8139]
246
htHvmValidNicTypes = ConstantUtils.mkSet [htNicE1000, htNicNe2kIsa, htNicNe2kPci, htNicParavirtual, htNicRtl8139]
207
false
true
0
6
105
34
19
15
null
null
mukeshtiwari/formalized-voting
paper-code-with-ballot/Main.hs
mit
--charCand 'E' = E balfun :: [(Cand, Nat)] -> Ballot balfun ((A, b1) : (B, b2) : (C, b3) : (D, b4) {-: (E, b5) -}: _) = f where f :: Cand -> Nat f A = b1 f B = b2 f C = b3 f D = b4 --f E = b5 {- createCand :: IO () createCand = do let t = (P.replicate 4 "ABCD") P.++ (P.replicate 3 "BCAD") P.++ (P.replicate 2 "CABD") P.++ (P.replicate 1 "ACBD") v <- shuffleM t writeFile ("votes_customized.txt") (P.unlines v) -}
433
balfun :: [(Cand, Nat)] -> Ballot balfun ((A, b1) : (B, b2) : (C, b3) : (D, b4) {-: (E, b5) -}: _) = f where f :: Cand -> Nat f A = b1 f B = b2 f C = b3 f D = b4 --f E = b5 {- createCand :: IO () createCand = do let t = (P.replicate 4 "ABCD") P.++ (P.replicate 3 "BCAD") P.++ (P.replicate 2 "CABD") P.++ (P.replicate 1 "ACBD") v <- shuffleM t writeFile ("votes_customized.txt") (P.unlines v) -}
413
balfun ((A, b1) : (B, b2) : (C, b3) : (D, b4) {-: (E, b5) -}: _) = f where f :: Cand -> Nat f A = b1 f B = b2 f C = b3 f D = b4 --f E = b5 {- createCand :: IO () createCand = do let t = (P.replicate 4 "ABCD") P.++ (P.replicate 3 "BCAD") P.++ (P.replicate 2 "CABD") P.++ (P.replicate 1 "ACBD") v <- shuffleM t writeFile ("votes_customized.txt") (P.unlines v) -}
379
true
true
0
13
109
123
68
55
null
null
plumlife/cabal
cabal-install/Distribution/Client/Dependency/TopDown.hs
bsd-3-clause
showExclusionReason pkgid (ExcludedByTopLevelConstraintInstalled pkgname) = display pkgid ++ " was excluded because of the top level constraint '" ++ display pkgname ++ " installed' which means that only installed instances " ++ "of the package may be selected."
266
showExclusionReason pkgid (ExcludedByTopLevelConstraintInstalled pkgname) = display pkgid ++ " was excluded because of the top level constraint '" ++ display pkgname ++ " installed' which means that only installed instances " ++ "of the package may be selected."
266
showExclusionReason pkgid (ExcludedByTopLevelConstraintInstalled pkgname) = display pkgid ++ " was excluded because of the top level constraint '" ++ display pkgname ++ " installed' which means that only installed instances " ++ "of the package may be selected."
266
false
false
8
7
41
45
18
27
null
null
bkoropoff/Idris-dev
src/Idris/Core/TT.hs
bsd-3-clause
tcname (SN (InstanceN _ _)) = True
34
tcname (SN (InstanceN _ _)) = True
34
tcname (SN (InstanceN _ _)) = True
34
false
false
0
8
6
24
11
13
null
null
zc1036/Compiler-project
src/Analyzer.hs
gpl-3.0
typesAreCompatible :: QualifiedTypeInfo -> QualifiedTypeInfo -> Bool typesAreCompatible (Ptr x) (Ptr y) = typesAreCompatible x y
128
typesAreCompatible :: QualifiedTypeInfo -> QualifiedTypeInfo -> Bool typesAreCompatible (Ptr x) (Ptr y) = typesAreCompatible x y
128
typesAreCompatible (Ptr x) (Ptr y) = typesAreCompatible x y
59
false
true
0
7
15
41
20
21
null
null
ulricha/dsh
src/Database/DSH/SL/Render/Dot.hs
bsd-3-clause
renderColor DCGreen = text "green"
41
renderColor DCGreen = text "green"
41
renderColor DCGreen = text "green"
41
false
false
0
5
11
13
5
8
null
null
codeq/language-py
src/Language/Py/ParserMonad.hs
bsd-3-clause
getLastEOL :: P SrcSpan getLastEOL = gets lastEOL
49
getLastEOL :: P SrcSpan getLastEOL = gets lastEOL
49
getLastEOL = gets lastEOL
25
false
true
0
5
7
17
8
9
null
null
brownplt/ovid
src/Ovid/Abstraction.hs
bsd-2-clause
isFalseValue NullVal = True
27
isFalseValue NullVal = True
27
isFalseValue NullVal = True
27
false
false
0
5
3
9
4
5
null
null
luisgepeto/HaskellLearning
06 Higher Order Functions/07_function_composition.hs
mit
--we can define functions in point free style i.e. with one missing paramter sum' :: (Num a) => [a] -> a sum' xs = foldl (+) 0 xs
134
sum' :: (Num a) => [a] -> a sum' xs = foldl (+) 0 xs
52
sum' xs = foldl (+) 0 xs
24
true
true
0
7
32
40
22
18
null
null
5outh/Haskell-Graphics-Projects
Project2/Utils.hs
mit
--2d point to vertical matrix toMatrix :: (Num a) => IntPoint -> Matrix a toMatrix (x, y) = Matrix 3 1 [[fromIntegral x], [fromIntegral y], [fromIntegral 1]]
157
toMatrix :: (Num a) => IntPoint -> Matrix a toMatrix (x, y) = Matrix 3 1 [[fromIntegral x], [fromIntegral y], [fromIntegral 1]]
127
toMatrix (x, y) = Matrix 3 1 [[fromIntegral x], [fromIntegral y], [fromIntegral 1]]
83
true
true
0
8
26
78
39
39
null
null
ekmett/ghc
compiler/main/HeaderInfo.hs
bsd-3-clause
getOptions :: DynFlags -> StringBuffer -- ^ Input Buffer -> FilePath -- ^ Source filename. Used for location info. -> [Located String] -- ^ Parsed options. getOptions dflags buf filename = getOptions' dflags (getToks dflags filename buf)
279
getOptions :: DynFlags -> StringBuffer -- ^ Input Buffer -> FilePath -- ^ Source filename. Used for location info. -> [Located String] getOptions dflags buf filename = getOptions' dflags (getToks dflags filename buf)
258
getOptions dflags buf filename = getOptions' dflags (getToks dflags filename buf)
85
true
true
0
9
78
54
28
26
null
null
izimbra/PLT2014
Lab2/Interpreter.hs
gpl-2.0
unwrapInt e = error $ "troll unwrap on integer failed because: " ++ show e
75
unwrapInt e = error $ "troll unwrap on integer failed because: " ++ show e
75
unwrapInt e = error $ "troll unwrap on integer failed because: " ++ show e
75
false
false
0
6
15
20
9
11
null
null
kendricktan/dailyprogrammer_h
intermediate/intermediate_293.hs
mit
next (S 4) Green = Error
27
next (S 4) Green = Error
27
next (S 4) Green = Error
27
false
false
1
6
8
22
8
14
null
null
ssaavedra/liquidhaskell
benchmarks/containers-0.5.0.0/Data/Map/Base.hs
bsd-3-clause
glue kcut l r | size l > size r = let (km, m, l') = deleteFindMax l in balanceR km m l' r | otherwise = let (km, m, r') = deleteFindMin r in balanceL km m l r'
169
glue kcut l r | size l > size r = let (km, m, l') = deleteFindMax l in balanceR km m l' r | otherwise = let (km, m, r') = deleteFindMin r in balanceL km m l r'
169
glue kcut l r | size l > size r = let (km, m, l') = deleteFindMax l in balanceR km m l' r | otherwise = let (km, m, r') = deleteFindMin r in balanceL km m l r'
169
false
false
0
10
49
111
50
61
null
null
amar47shah/bank-ocr
src/Parser.hs
mit
display :: [Digit] -> String display = map toChar
49
display :: [Digit] -> String display = map toChar
49
display = map toChar
20
false
true
0
6
8
21
11
10
null
null
sdynerow/Semirings-Library
haskell/Examples/PathCount.hs
apache-2.0
pcExamples 1 = M (toArray 5 [ zero, PC 1, PC 1, zero, PC 1 , zero, zero, PC 1, PC 1, zero , zero, zero, zero, PC 1, PC 1 , zero, zero, zero, zero, PC 1 , zero, zero, zero, zero, zero])
296
pcExamples 1 = M (toArray 5 [ zero, PC 1, PC 1, zero, PC 1 , zero, zero, PC 1, PC 1, zero , zero, zero, zero, PC 1, PC 1 , zero, zero, zero, zero, PC 1 , zero, zero, zero, zero, zero])
296
pcExamples 1 = M (toArray 5 [ zero, PC 1, PC 1, zero, PC 1 , zero, zero, PC 1, PC 1, zero , zero, zero, zero, PC 1, PC 1 , zero, zero, zero, zero, PC 1 , zero, zero, zero, zero, zero])
296
false
false
0
9
155
119
67
52
null
null
mfpi/OpenGLRaw
src/Graphics/Rendering/OpenGL/Raw/ARB/TessellationShader.hs
bsd-3-clause
gl_MAX_TESS_PATCH_COMPONENTS :: GLenum gl_MAX_TESS_PATCH_COMPONENTS = 0x8E84
76
gl_MAX_TESS_PATCH_COMPONENTS :: GLenum gl_MAX_TESS_PATCH_COMPONENTS = 0x8E84
76
gl_MAX_TESS_PATCH_COMPONENTS = 0x8E84
37
false
true
0
4
5
11
6
5
null
null
CarstenKoenig/DOS2015
CountdownGame/src/web/CountdownGame/Database.hs
unlicense
runInPool :: ConnectionPool -> SqlPersistT IO a -> IO a runInPool = flip runSqlPool
84
runInPool :: ConnectionPool -> SqlPersistT IO a -> IO a runInPool = flip runSqlPool
84
runInPool = flip runSqlPool
27
false
true
0
7
14
30
14
16
null
null
expipiplus1/vulkan
generate-new/vma/Main.hs
bsd-3-clause
unitHandles :: GlobalDecls -> Vector (NodeInfo, Handle) unitHandles ds = fromList [ (nodeInfo, Handle (CName (T.pack n)) NonDispatchable NoHandleLevel) | (Ident n _ nodeInfo, TypeDef _ (PtrType (DirectType (TyComp (CompTypeRef (NamedRef (Ident nT _ _)) _ _)) _ _) _ _) _ _) <- Map.toList $ gTypeDefs ds , n <> "_T" == nT ]
334
unitHandles :: GlobalDecls -> Vector (NodeInfo, Handle) unitHandles ds = fromList [ (nodeInfo, Handle (CName (T.pack n)) NonDispatchable NoHandleLevel) | (Ident n _ nodeInfo, TypeDef _ (PtrType (DirectType (TyComp (CompTypeRef (NamedRef (Ident nT _ _)) _ _)) _ _) _ _) _ _) <- Map.toList $ gTypeDefs ds , n <> "_T" == nT ]
334
unitHandles ds = fromList [ (nodeInfo, Handle (CName (T.pack n)) NonDispatchable NoHandleLevel) | (Ident n _ nodeInfo, TypeDef _ (PtrType (DirectType (TyComp (CompTypeRef (NamedRef (Ident nT _ _)) _ _)) _ _) _ _) _ _) <- Map.toList $ gTypeDefs ds , n <> "_T" == nT ]
278
false
true
0
22
66
168
83
85
null
null
antalsz/hs-to-coq
examples/ghc/gen-files/CmmLex.hs
mit
reservedWordsFM = listToUFM $ map (\(x, y) -> (mkFastString x, y)) [ ( "CLOSURE", CmmT_CLOSURE ), ( "INFO_TABLE", CmmT_INFO_TABLE ), ( "INFO_TABLE_RET", CmmT_INFO_TABLE_RET ), ( "INFO_TABLE_FUN", CmmT_INFO_TABLE_FUN ), ( "INFO_TABLE_CONSTR", CmmT_INFO_TABLE_CONSTR ), ( "INFO_TABLE_SELECTOR",CmmT_INFO_TABLE_SELECTOR ), ( "else", CmmT_else ), ( "export", CmmT_export ), ( "section", CmmT_section ), ( "goto", CmmT_goto ), ( "if", CmmT_if ), ( "call", CmmT_call ), ( "jump", CmmT_jump ), ( "foreign", CmmT_foreign ), ( "never", CmmT_never ), ( "prim", CmmT_prim ), ( "reserve", CmmT_reserve ), ( "return", CmmT_return ), ( "returns", CmmT_returns ), ( "import", CmmT_import ), ( "switch", CmmT_switch ), ( "case", CmmT_case ), ( "default", CmmT_default ), ( "push", CmmT_push ), ( "unwind", CmmT_unwind ), ( "bits8", CmmT_bits8 ), ( "bits16", CmmT_bits16 ), ( "bits32", CmmT_bits32 ), ( "bits64", CmmT_bits64 ), ( "bits128", CmmT_bits128 ), ( "bits256", CmmT_bits256 ), ( "bits512", CmmT_bits512 ), ( "float32", CmmT_float32 ), ( "float64", CmmT_float64 ), -- New forms ( "b8", CmmT_bits8 ), ( "b16", CmmT_bits16 ), ( "b32", CmmT_bits32 ), ( "b64", CmmT_bits64 ), ( "b128", CmmT_bits128 ), ( "b256", CmmT_bits256 ), ( "b512", CmmT_bits512 ), ( "f32", CmmT_float32 ), ( "f64", CmmT_float64 ), ( "gcptr", CmmT_gcptr ) ]
2,204
reservedWordsFM = listToUFM $ map (\(x, y) -> (mkFastString x, y)) [ ( "CLOSURE", CmmT_CLOSURE ), ( "INFO_TABLE", CmmT_INFO_TABLE ), ( "INFO_TABLE_RET", CmmT_INFO_TABLE_RET ), ( "INFO_TABLE_FUN", CmmT_INFO_TABLE_FUN ), ( "INFO_TABLE_CONSTR", CmmT_INFO_TABLE_CONSTR ), ( "INFO_TABLE_SELECTOR",CmmT_INFO_TABLE_SELECTOR ), ( "else", CmmT_else ), ( "export", CmmT_export ), ( "section", CmmT_section ), ( "goto", CmmT_goto ), ( "if", CmmT_if ), ( "call", CmmT_call ), ( "jump", CmmT_jump ), ( "foreign", CmmT_foreign ), ( "never", CmmT_never ), ( "prim", CmmT_prim ), ( "reserve", CmmT_reserve ), ( "return", CmmT_return ), ( "returns", CmmT_returns ), ( "import", CmmT_import ), ( "switch", CmmT_switch ), ( "case", CmmT_case ), ( "default", CmmT_default ), ( "push", CmmT_push ), ( "unwind", CmmT_unwind ), ( "bits8", CmmT_bits8 ), ( "bits16", CmmT_bits16 ), ( "bits32", CmmT_bits32 ), ( "bits64", CmmT_bits64 ), ( "bits128", CmmT_bits128 ), ( "bits256", CmmT_bits256 ), ( "bits512", CmmT_bits512 ), ( "float32", CmmT_float32 ), ( "float64", CmmT_float64 ), -- New forms ( "b8", CmmT_bits8 ), ( "b16", CmmT_bits16 ), ( "b32", CmmT_bits32 ), ( "b64", CmmT_bits64 ), ( "b128", CmmT_bits128 ), ( "b256", CmmT_bits256 ), ( "b512", CmmT_bits512 ), ( "f32", CmmT_float32 ), ( "f64", CmmT_float64 ), ( "gcptr", CmmT_gcptr ) ]
2,204
reservedWordsFM = listToUFM $ map (\(x, y) -> (mkFastString x, y)) [ ( "CLOSURE", CmmT_CLOSURE ), ( "INFO_TABLE", CmmT_INFO_TABLE ), ( "INFO_TABLE_RET", CmmT_INFO_TABLE_RET ), ( "INFO_TABLE_FUN", CmmT_INFO_TABLE_FUN ), ( "INFO_TABLE_CONSTR", CmmT_INFO_TABLE_CONSTR ), ( "INFO_TABLE_SELECTOR",CmmT_INFO_TABLE_SELECTOR ), ( "else", CmmT_else ), ( "export", CmmT_export ), ( "section", CmmT_section ), ( "goto", CmmT_goto ), ( "if", CmmT_if ), ( "call", CmmT_call ), ( "jump", CmmT_jump ), ( "foreign", CmmT_foreign ), ( "never", CmmT_never ), ( "prim", CmmT_prim ), ( "reserve", CmmT_reserve ), ( "return", CmmT_return ), ( "returns", CmmT_returns ), ( "import", CmmT_import ), ( "switch", CmmT_switch ), ( "case", CmmT_case ), ( "default", CmmT_default ), ( "push", CmmT_push ), ( "unwind", CmmT_unwind ), ( "bits8", CmmT_bits8 ), ( "bits16", CmmT_bits16 ), ( "bits32", CmmT_bits32 ), ( "bits64", CmmT_bits64 ), ( "bits128", CmmT_bits128 ), ( "bits256", CmmT_bits256 ), ( "bits512", CmmT_bits512 ), ( "float32", CmmT_float32 ), ( "float64", CmmT_float64 ), -- New forms ( "b8", CmmT_bits8 ), ( "b16", CmmT_bits16 ), ( "b32", CmmT_bits32 ), ( "b64", CmmT_bits64 ), ( "b128", CmmT_bits128 ), ( "b256", CmmT_bits256 ), ( "b512", CmmT_bits512 ), ( "f32", CmmT_float32 ), ( "f64", CmmT_float64 ), ( "gcptr", CmmT_gcptr ) ]
2,204
false
false
1
9
1,078
439
286
153
null
null
axch/dysvunctional-language
haskell-fol/FOL/Language/Parser.hs
agpl-3.0
parseCar = liftA Car parseExpr
43
parseCar = liftA Car parseExpr
43
parseCar = liftA Car parseExpr
43
false
false
0
5
17
11
5
6
null
null
CindyLinz/Haskell-Perl
src/Perl/Monad.hs
mit
keepSV :: MonadIO m => SV -> PerlT s m () keepSV sv = PerlT $ \perl cv -> do liftIO $ svREFCNT_inc_NN sv return ([sv], ())
126
keepSV :: MonadIO m => SV -> PerlT s m () keepSV sv = PerlT $ \perl cv -> do liftIO $ svREFCNT_inc_NN sv return ([sv], ())
126
keepSV sv = PerlT $ \perl cv -> do liftIO $ svREFCNT_inc_NN sv return ([sv], ())
84
false
true
0
11
30
72
35
37
null
null
rvion/ftgl-haskell
Graphics/Rendering/FTGL.hs
bsd-2-clause
-- | Get the number of characters loaded into the current charmap for the font. getFontCharMapCount :: Font -> Int getFontCharMapCount f = fromIntegral . unsafePerformIO $ fgetFontCharMapCount f
194
getFontCharMapCount :: Font -> Int getFontCharMapCount f = fromIntegral . unsafePerformIO $ fgetFontCharMapCount f
114
getFontCharMapCount f = fromIntegral . unsafePerformIO $ fgetFontCharMapCount f
79
true
true
0
6
28
30
15
15
null
null
C0DEHERO/Hgamelaunch
Hgamelaunch/UserTools.hs
mit
createUserDirs :: Text -> [Game] -> IO() createUserDirs username ((Game {..}):games) = do createDirectoryIfMissing True (substitute userDir) createDirectoryIfMissing True (substitute inprogressDir) createDirectoryIfMissing True (substitute ttyrecDir) createDirectoryIfMissing True (encodeString $ parent $ decodeString $ substitute cfgFile) templateExists <- doesFileExist (substitute templateCfg) cpTemplate (substitute templateCfg) (substitute cfgFile) templateExists createUserDirs username games where substitute old = unpack $ replace "%n" username . replace "%r" rootPath . replace "%u" userDir $ old cpTemplate old new True = copyFile old new cpTemplate _ _ False = return ()
721
createUserDirs :: Text -> [Game] -> IO() createUserDirs username ((Game {..}):games) = do createDirectoryIfMissing True (substitute userDir) createDirectoryIfMissing True (substitute inprogressDir) createDirectoryIfMissing True (substitute ttyrecDir) createDirectoryIfMissing True (encodeString $ parent $ decodeString $ substitute cfgFile) templateExists <- doesFileExist (substitute templateCfg) cpTemplate (substitute templateCfg) (substitute cfgFile) templateExists createUserDirs username games where substitute old = unpack $ replace "%n" username . replace "%r" rootPath . replace "%u" userDir $ old cpTemplate old new True = copyFile old new cpTemplate _ _ False = return ()
721
createUserDirs username ((Game {..}):games) = do createDirectoryIfMissing True (substitute userDir) createDirectoryIfMissing True (substitute inprogressDir) createDirectoryIfMissing True (substitute ttyrecDir) createDirectoryIfMissing True (encodeString $ parent $ decodeString $ substitute cfgFile) templateExists <- doesFileExist (substitute templateCfg) cpTemplate (substitute templateCfg) (substitute cfgFile) templateExists createUserDirs username games where substitute old = unpack $ replace "%n" username . replace "%r" rootPath . replace "%u" userDir $ old cpTemplate old new True = copyFile old new cpTemplate _ _ False = return ()
679
false
true
0
11
121
237
110
127
null
null
Tener/ProCoGraM
src/Song.hs
bsd-3-clause
-- notes = [ n oct dur () | n <- allNotes, oct <- allOct, dur <- allDur] notesDrum = [ Drum.toMusicDefaultAttr dr dur | dur <- allDur, dr <- myDrumSet ]
154
notesDrum = [ Drum.toMusicDefaultAttr dr dur | dur <- allDur, dr <- myDrumSet ]
79
notesDrum = [ Drum.toMusicDefaultAttr dr dur | dur <- allDur, dr <- myDrumSet ]
79
true
false
1
8
33
37
17
20
null
null
alosich/language-java
Language/Java/Parser.hs
bsd-3-clause
-- Arrays arrayAccessNPS :: P ArrayIndex arrayAccessNPS = do n <- name e <- list1 $ brackets exp return $ ArrayIndex (ExpName n) e
143
arrayAccessNPS :: P ArrayIndex arrayAccessNPS = do n <- name e <- list1 $ brackets exp return $ ArrayIndex (ExpName n) e
132
arrayAccessNPS = do n <- name e <- list1 $ brackets exp return $ ArrayIndex (ExpName n) e
101
true
true
0
10
36
54
25
29
null
null
prove-everywhere/server
src/ProveEverywhere/Parser.hs
bsd-3-clause
parsePrompt :: Text -> Either ParseError CoqtopState parsePrompt = parse prompt "prompt"
88
parsePrompt :: Text -> Either ParseError CoqtopState parsePrompt = parse prompt "prompt"
88
parsePrompt = parse prompt "prompt"
35
false
true
0
6
11
25
12
13
null
null
tjakway/ghcjvm
compiler/types/Type.hs
bsd-3-clause
splitAppTy_maybe ty = repSplitAppTy_maybe ty
44
splitAppTy_maybe ty = repSplitAppTy_maybe ty
44
splitAppTy_maybe ty = repSplitAppTy_maybe ty
44
false
false
1
5
4
15
5
10
null
null
vTurbine/ghc
compiler/hsSyn/HsExpr.hs
bsd-3-clause
matchContextErrString CaseAlt = text "case"
56
matchContextErrString CaseAlt = text "case"
56
matchContextErrString CaseAlt = text "case"
56
false
false
0
5
17
13
5
8
null
null
castaway/pandoc
src/Text/Pandoc/Writers/Docx.hs
gpl-2.0
defaultWriterState :: WriterState defaultWriterState = WriterState{ stTextProperties = [] , stParaProperties = [] , stFootnotes = [] , stSectionIds = [] , stExternalLinks = M.empty , stImages = M.empty , stListLevel = -1 , stListMarker = NoMarker , stNumStyles = M.fromList [(NoMarker, 0)] , stLists = [NoMarker] }
423
defaultWriterState :: WriterState defaultWriterState = WriterState{ stTextProperties = [] , stParaProperties = [] , stFootnotes = [] , stSectionIds = [] , stExternalLinks = M.empty , stImages = M.empty , stListLevel = -1 , stListMarker = NoMarker , stNumStyles = M.fromList [(NoMarker, 0)] , stLists = [NoMarker] }
423
defaultWriterState = WriterState{ stTextProperties = [] , stParaProperties = [] , stFootnotes = [] , stSectionIds = [] , stExternalLinks = M.empty , stImages = M.empty , stListLevel = -1 , stListMarker = NoMarker , stNumStyles = M.fromList [(NoMarker, 0)] , stLists = [NoMarker] }
389
false
true
0
10
156
111
65
46
null
null
mrmonday/Idris-dev
src/Idris/Primitives.hs
bsd-3-clause
bitBin _ _ _ = Nothing
43
bitBin _ _ _ = Nothing
43
bitBin _ _ _ = Nothing
43
false
false
0
5
26
13
6
7
null
null
castaway/pandoc
src/Text/Pandoc/Parsing.hs
gpl-2.0
-- | Parses an ordered list marker and returns list attributes. anyOrderedListMarker :: GenParser Char ParserState ListAttributes anyOrderedListMarker = choice $ [delimParser numParser | delimParser <- [inPeriod, inOneParen, inTwoParens], numParser <- [decimal, exampleNum, defaultNum, romanOne, lowerAlpha, lowerRoman, upperAlpha, upperRoman]]
402
anyOrderedListMarker :: GenParser Char ParserState ListAttributes anyOrderedListMarker = choice $ [delimParser numParser | delimParser <- [inPeriod, inOneParen, inTwoParens], numParser <- [decimal, exampleNum, defaultNum, romanOne, lowerAlpha, lowerRoman, upperAlpha, upperRoman]]
337
anyOrderedListMarker = choice $ [delimParser numParser | delimParser <- [inPeriod, inOneParen, inTwoParens], numParser <- [decimal, exampleNum, defaultNum, romanOne, lowerAlpha, lowerRoman, upperAlpha, upperRoman]]
271
true
true
0
9
96
78
45
33
null
null
brendanhay/gogol
gogol-dataproc/gen/Network/Google/Resource/Dataproc/Projects/Regions/Jobs/GetIAMPolicy.hs
mpl-2.0
-- | Creates a value of 'ProjectsRegionsJobsGetIAMPolicy' with the minimum fields required to make a request. -- -- Use one of the following lenses to modify other fields as desired: -- -- * 'prjgipXgafv' -- -- * 'prjgipUploadProtocol' -- -- * 'prjgipAccessToken' -- -- * 'prjgipUploadType' -- -- * 'prjgipPayload' -- -- * 'prjgipResource' -- -- * 'prjgipCallback' projectsRegionsJobsGetIAMPolicy :: GetIAMPolicyRequest -- ^ 'prjgipPayload' -> Text -- ^ 'prjgipResource' -> ProjectsRegionsJobsGetIAMPolicy projectsRegionsJobsGetIAMPolicy pPrjgipPayload_ pPrjgipResource_ = ProjectsRegionsJobsGetIAMPolicy' { _prjgipXgafv = Nothing , _prjgipUploadProtocol = Nothing , _prjgipAccessToken = Nothing , _prjgipUploadType = Nothing , _prjgipPayload = pPrjgipPayload_ , _prjgipResource = pPrjgipResource_ , _prjgipCallback = Nothing }
873
projectsRegionsJobsGetIAMPolicy :: GetIAMPolicyRequest -- ^ 'prjgipPayload' -> Text -- ^ 'prjgipResource' -> ProjectsRegionsJobsGetIAMPolicy projectsRegionsJobsGetIAMPolicy pPrjgipPayload_ pPrjgipResource_ = ProjectsRegionsJobsGetIAMPolicy' { _prjgipXgafv = Nothing , _prjgipUploadProtocol = Nothing , _prjgipAccessToken = Nothing , _prjgipUploadType = Nothing , _prjgipPayload = pPrjgipPayload_ , _prjgipResource = pPrjgipResource_ , _prjgipCallback = Nothing }
508
projectsRegionsJobsGetIAMPolicy pPrjgipPayload_ pPrjgipResource_ = ProjectsRegionsJobsGetIAMPolicy' { _prjgipXgafv = Nothing , _prjgipUploadProtocol = Nothing , _prjgipAccessToken = Nothing , _prjgipUploadType = Nothing , _prjgipPayload = pPrjgipPayload_ , _prjgipResource = pPrjgipResource_ , _prjgipCallback = Nothing }
355
true
true
0
8
150
96
62
34
null
null
snoyberg/ghc
compiler/simplCore/CoreMonad.hs
bsd-3-clause
plusSimplCount sc1@(SimplCount { ticks = tks1, details = dts1 }) sc2@(SimplCount { ticks = tks2, details = dts2 }) = log_base { ticks = tks1 + tks2, details = Map.unionWith (+) dts1 dts2 } where -- A hackish way of getting recent log info log_base | null (log1 sc2) = sc1 -- Nothing at all in sc2 | null (log2 sc2) = sc2 { log2 = log1 sc1 } | otherwise = sc2
424
plusSimplCount sc1@(SimplCount { ticks = tks1, details = dts1 }) sc2@(SimplCount { ticks = tks2, details = dts2 }) = log_base { ticks = tks1 + tks2, details = Map.unionWith (+) dts1 dts2 } where -- A hackish way of getting recent log info log_base | null (log1 sc2) = sc1 -- Nothing at all in sc2 | null (log2 sc2) = sc2 { log2 = log1 sc1 } | otherwise = sc2
424
plusSimplCount sc1@(SimplCount { ticks = tks1, details = dts1 }) sc2@(SimplCount { ticks = tks2, details = dts2 }) = log_base { ticks = tks1 + tks2, details = Map.unionWith (+) dts1 dts2 } where -- A hackish way of getting recent log info log_base | null (log1 sc2) = sc1 -- Nothing at all in sc2 | null (log2 sc2) = sc2 { log2 = log1 sc1 } | otherwise = sc2
424
false
false
0
10
138
145
78
67
null
null
acowley/ghc
compiler/main/DynFlags.hs
bsd-3-clause
enableGlasgowExts :: DynP () enableGlasgowExts = do setGeneralFlag Opt_PrintExplicitForalls mapM_ setExtensionFlag glasgowExtsFlags
154
enableGlasgowExts :: DynP () enableGlasgowExts = do setGeneralFlag Opt_PrintExplicitForalls mapM_ setExtensionFlag glasgowExtsFlags
154
enableGlasgowExts = do setGeneralFlag Opt_PrintExplicitForalls mapM_ setExtensionFlag glasgowExtsFlags
125
false
true
0
7
34
30
13
17
null
null
OpenXT/manager
upgrade-db/Migrations/M_34.hs
gpl-2.0
updateGuests = xformVmJSON xform where xform tree = case jsGet "/type" tree of Just s | jsUnboxString s == "svm" -> modify tree _ -> tree where modify = addRule 0 . jsMv "/config/acpi-pt" "/config/acpi-table" . jsRm "/config/smbios-pt" . jsRm "/time-offset" addRule pos tree = case jsGet ("/v4v-firewall-rules/" ++ (show pos)) tree of Nothing -> jsSet ("/v4v-firewall-rules/" ++ (show pos)) (jsBoxString "my-stubdom -> 0:5100") tree Just _ -> addRule (pos + 1) tree
569
updateGuests = xformVmJSON xform where xform tree = case jsGet "/type" tree of Just s | jsUnboxString s == "svm" -> modify tree _ -> tree where modify = addRule 0 . jsMv "/config/acpi-pt" "/config/acpi-table" . jsRm "/config/smbios-pt" . jsRm "/time-offset" addRule pos tree = case jsGet ("/v4v-firewall-rules/" ++ (show pos)) tree of Nothing -> jsSet ("/v4v-firewall-rules/" ++ (show pos)) (jsBoxString "my-stubdom -> 0:5100") tree Just _ -> addRule (pos + 1) tree
569
updateGuests = xformVmJSON xform where xform tree = case jsGet "/type" tree of Just s | jsUnboxString s == "svm" -> modify tree _ -> tree where modify = addRule 0 . jsMv "/config/acpi-pt" "/config/acpi-table" . jsRm "/config/smbios-pt" . jsRm "/time-offset" addRule pos tree = case jsGet ("/v4v-firewall-rules/" ++ (show pos)) tree of Nothing -> jsSet ("/v4v-firewall-rules/" ++ (show pos)) (jsBoxString "my-stubdom -> 0:5100") tree Just _ -> addRule (pos + 1) tree
569
false
false
0
16
176
180
84
96
null
null
seliopou/typo
Language/Typo/ASTs.hs
bsd-3-clause
anormalize :: Surface -> Anf Redex anormalize s = case s of Val v -> return (RVal v) Bop op l r -> do l' <- valued (anormalize l) r' <- valued (anormalize r) return (RBop op l' r') App f as -> do as' <- mapM (valued . anormalize) as return (RApp f as') Let x e b -> do e' <- anormalize e mapContT ((ALet x e') `fmap`) (anormalize b) Cond c t f -> do c' <- valued (anormalize c) t' <- lift $ runContT (anormalize t) (\r -> return (ARed r)) f' <- lift $ runContT (anormalize f) (\r -> return (ARed r)) return $ RCond c' t' f'
619
anormalize :: Surface -> Anf Redex anormalize s = case s of Val v -> return (RVal v) Bop op l r -> do l' <- valued (anormalize l) r' <- valued (anormalize r) return (RBop op l' r') App f as -> do as' <- mapM (valued . anormalize) as return (RApp f as') Let x e b -> do e' <- anormalize e mapContT ((ALet x e') `fmap`) (anormalize b) Cond c t f -> do c' <- valued (anormalize c) t' <- lift $ runContT (anormalize t) (\r -> return (ARed r)) f' <- lift $ runContT (anormalize f) (\r -> return (ARed r)) return $ RCond c' t' f'
619
anormalize s = case s of Val v -> return (RVal v) Bop op l r -> do l' <- valued (anormalize l) r' <- valued (anormalize r) return (RBop op l' r') App f as -> do as' <- mapM (valued . anormalize) as return (RApp f as') Let x e b -> do e' <- anormalize e mapContT ((ALet x e') `fmap`) (anormalize b) Cond c t f -> do c' <- valued (anormalize c) t' <- lift $ runContT (anormalize t) (\r -> return (ARed r)) f' <- lift $ runContT (anormalize f) (\r -> return (ARed r)) return $ RCond c' t' f'
584
false
true
0
18
208
325
150
175
null
null
nickspinale/aether
tests/Test.hs
mit
a = Addr (183949123 :: Word32) 8991
35
a = Addr (183949123 :: Word32) 8991
35
a = Addr (183949123 :: Word32) 8991
35
false
false
1
6
6
20
9
11
null
null
trbauer/ebnf
LexicalAnalysis.hs
mit
fmtLiteralChar '|' = "PIPE"
27
fmtLiteralChar '|' = "PIPE"
27
fmtLiteralChar '|' = "PIPE"
27
false
false
1
5
3
13
4
9
null
null
leksah/yi
src/library/Yi/UI/Vty.hs
gpl-2.0
end :: FrontendState -> Bool -> IO () end fs mustQuit = do -- setTerminalAttributes stdInput (oAttrs ui) Immediately void $ tryPutMVar (fsEndInputLoop fs) () void $ tryPutMVar (fsEndRenderLoop fs) () Vty.shutdown (fsVty fs) when mustQuit $ void (tryPutMVar (fsEndMain fs) ())
303
end :: FrontendState -> Bool -> IO () end fs mustQuit = do -- setTerminalAttributes stdInput (oAttrs ui) Immediately void $ tryPutMVar (fsEndInputLoop fs) () void $ tryPutMVar (fsEndRenderLoop fs) () Vty.shutdown (fsVty fs) when mustQuit $ void (tryPutMVar (fsEndMain fs) ())
303
end fs mustQuit = do -- setTerminalAttributes stdInput (oAttrs ui) Immediately void $ tryPutMVar (fsEndInputLoop fs) () void $ tryPutMVar (fsEndRenderLoop fs) () Vty.shutdown (fsVty fs) when mustQuit $ void (tryPutMVar (fsEndMain fs) ())
265
false
true
0
13
69
118
53
65
null
null
IgorRodic/fp16-Pongout
src/Main.hs
mit
-- Pokretanje igre 'n' handleKeys (EventKey (Char 'n') Down _ _) game = if (pause game) then (game { reset = True, start = True, pause = False, nextLevel = False }) else game
174
handleKeys (EventKey (Char 'n') Down _ _) game = if (pause game) then (game { reset = True, start = True, pause = False, nextLevel = False }) else game
151
handleKeys (EventKey (Char 'n') Down _ _) game = if (pause game) then (game { reset = True, start = True, pause = False, nextLevel = False }) else game
151
true
false
1
9
33
76
42
34
null
null
brendanhay/gogol
gogol-books/gen/Network/Google/Resource/Books/Layers/AnnotationData/Get.hs
mpl-2.0
-- | The content version for the volume you are trying to retrieve. ladgContentVersion :: Lens' LayersAnnotationDataGet Text ladgContentVersion = lens _ladgContentVersion (\ s a -> s{_ladgContentVersion = a})
216
ladgContentVersion :: Lens' LayersAnnotationDataGet Text ladgContentVersion = lens _ladgContentVersion (\ s a -> s{_ladgContentVersion = a})
148
ladgContentVersion = lens _ladgContentVersion (\ s a -> s{_ladgContentVersion = a})
91
true
true
0
8
36
43
22
21
null
null
rahulmutt/ghcvm
compiler/Eta/Main/DriverPhases.hs
bsd-3-clause
hscSourceString :: HscSource -> String hscSourceString HsSrcFile = ""
71
hscSourceString :: HscSource -> String hscSourceString HsSrcFile = ""
71
hscSourceString HsSrcFile = ""
32
false
true
0
5
10
22
10
12
null
null
urbanslug/ghc
libraries/base/GHC/Conc/Sync.hs
bsd-3-clause
-- | Internal function used by the RTS to run sparks. runSparks :: IO () runSparks = IO loop where loop s = case getSpark# s of (# s', n, p #) -> if isTrue# (n ==# 0#) then (# s', () #) else p `seq` loop s'
293
runSparks :: IO () runSparks = IO loop where loop s = case getSpark# s of (# s', n, p #) -> if isTrue# (n ==# 0#) then (# s', () #) else p `seq` loop s'
239
runSparks = IO loop where loop s = case getSpark# s of (# s', n, p #) -> if isTrue# (n ==# 0#) then (# s', () #) else p `seq` loop s'
220
true
true
0
11
134
85
45
40
null
null
dmatveev/oak
Graphics/UI/Oak/Widgets.hs
bsd-3-clause
margin :: Identifier i => Int -> (i, Widget i m) -> Widget i m margin m (_, w) = Margin (m, m, m, m) w
102
margin :: Identifier i => Int -> (i, Widget i m) -> Widget i m margin m (_, w) = Margin (m, m, m, m) w
102
margin m (_, w) = Margin (m, m, m, m) w
39
false
true
0
9
25
75
38
37
null
null
michaelbjames/improb
Improb/Parser.hs
mit
natural :: Parser Integer natural = do ds <- many1 digit return (read ds)
81
natural :: Parser Integer natural = do ds <- many1 digit return (read ds)
81
natural = do ds <- many1 digit return (read ds)
55
false
true
0
9
21
36
16
20
null
null
fatlazycat/eventjournal
src/OldJournalFile.hs
bsd-3-clause
openTempJournalFile :: FilePath -> String -> Integer -> IO FilePath openTempJournalFile fpTemplate s size = do (fp,h) <- openBinaryTempFile fpTemplate s hSetFileSize h size hClose h return fp
199
openTempJournalFile :: FilePath -> String -> Integer -> IO FilePath openTempJournalFile fpTemplate s size = do (fp,h) <- openBinaryTempFile fpTemplate s hSetFileSize h size hClose h return fp
199
openTempJournalFile fpTemplate s size = do (fp,h) <- openBinaryTempFile fpTemplate s hSetFileSize h size hClose h return fp
131
false
true
0
8
35
71
32
39
null
null
gregorias/Pentago
src/Pentago/Data/Matrix.hs
bsd-3-clause
-- r rotate90Symmetry :: (Integral i) => Symmetry i rotate90Symmetry (cX, cY, False) (x, y) = (cX + (y - cY), cY - (x - cX))
126
rotate90Symmetry :: (Integral i) => Symmetry i rotate90Symmetry (cX, cY, False) (x, y) = (cX + (y - cY), cY - (x - cX))
121
rotate90Symmetry (cX, cY, False) (x, y) = (cX + (y - cY), cY - (x - cX))
74
true
true
0
8
27
72
41
31
null
null
mb21/qua-kit
apps/hs/helen/src/Helen/Core/Service.hs
mit
-- progress -- almost the same process as for result processMessage smsg@(SourcedMessage cId (MsgProgress token p mr bs)) | sesId <- sessionId smsg = do -- first of all locate instance msInstance <- HashMap.lookup sesId . Lens.view (serviceManager.busyInstances) <$> get case msInstance of -- if there is no such instance, the message may be sent by a service that was not asked to do anything Nothing -> return [ TargetedMessage cId cId (MsgError token "Cannot find you to be working on a task!") ] -- here the difference to result message is that neither current calls -- nor busyInstances or pools should be altered Just (_,SessionId clientId clientToken) -> -- so, we just redirect the message to the client return [TargetedMessage cId clientId $ MsgProgress clientToken p mr bs] ---------------------------------------------------------------------------------------------------- -- | The most important part - logic of processing run message
992
processMessage smsg@(SourcedMessage cId (MsgProgress token p mr bs)) | sesId <- sessionId smsg = do -- first of all locate instance msInstance <- HashMap.lookup sesId . Lens.view (serviceManager.busyInstances) <$> get case msInstance of -- if there is no such instance, the message may be sent by a service that was not asked to do anything Nothing -> return [ TargetedMessage cId cId (MsgError token "Cannot find you to be working on a task!") ] -- here the difference to result message is that neither current calls -- nor busyInstances or pools should be altered Just (_,SessionId clientId clientToken) -> -- so, we just redirect the message to the client return [TargetedMessage cId clientId $ MsgProgress clientToken p mr bs] ---------------------------------------------------------------------------------------------------- -- | The most important part - logic of processing run message
938
processMessage smsg@(SourcedMessage cId (MsgProgress token p mr bs)) | sesId <- sessionId smsg = do -- first of all locate instance msInstance <- HashMap.lookup sesId . Lens.view (serviceManager.busyInstances) <$> get case msInstance of -- if there is no such instance, the message may be sent by a service that was not asked to do anything Nothing -> return [ TargetedMessage cId cId (MsgError token "Cannot find you to be working on a task!") ] -- here the difference to result message is that neither current calls -- nor busyInstances or pools should be altered Just (_,SessionId clientId clientToken) -> -- so, we just redirect the message to the client return [TargetedMessage cId clientId $ MsgProgress clientToken p mr bs] ---------------------------------------------------------------------------------------------------- -- | The most important part - logic of processing run message
938
true
false
0
15
186
162
81
81
null
null
kazu-yamamoto/llrbtree
test/Set.hs
bsd-3-clause
prop_difference :: [Int] -> [Int] -> Bool prop_difference xs ys = valid $ difference (fromList xs) (fromList ys)
112
prop_difference :: [Int] -> [Int] -> Bool prop_difference xs ys = valid $ difference (fromList xs) (fromList ys)
112
prop_difference xs ys = valid $ difference (fromList xs) (fromList ys)
70
false
true
2
8
17
57
27
30
null
null
bergmark/time
lib/Data/Time/Format/Parse.hs
bsd-3-clause
getMilZoneHours 'J' = Nothing
29
getMilZoneHours 'J' = Nothing
29
getMilZoneHours 'J' = Nothing
29
false
false
0
5
3
9
4
5
null
null
rueshyna/gogol
gogol-compute/gen/Network/Google/Resource/Compute/Disks/Insert.hs
mpl-2.0
-- | The name of the zone for this request. diZone :: Lens' DisksInsert Text diZone = lens _diZone (\ s a -> s{_diZone = a})
124
diZone :: Lens' DisksInsert Text diZone = lens _diZone (\ s a -> s{_diZone = a})
80
diZone = lens _diZone (\ s a -> s{_diZone = a})
47
true
true
0
9
25
40
22
18
null
null
tjakway/ghcjvm
compiler/simplCore/SimplUtils.hs
bsd-3-clause
simplEnvForGHCi :: DynFlags -> SimplEnv simplEnvForGHCi dflags = mkSimplEnv $ SimplMode { sm_names = ["GHCi"] , sm_phase = InitialPhase , sm_rules = rules_on , sm_inline = False , sm_eta_expand = eta_expand_on , sm_case_case = True } where rules_on = gopt Opt_EnableRewriteRules dflags eta_expand_on = gopt Opt_DoLambdaEtaExpansion dflags -- Do not do any inlining, in case we expose some unboxed -- tuple stuff that confuses the bytecode interpreter
610
simplEnvForGHCi :: DynFlags -> SimplEnv simplEnvForGHCi dflags = mkSimplEnv $ SimplMode { sm_names = ["GHCi"] , sm_phase = InitialPhase , sm_rules = rules_on , sm_inline = False , sm_eta_expand = eta_expand_on , sm_case_case = True } where rules_on = gopt Opt_EnableRewriteRules dflags eta_expand_on = gopt Opt_DoLambdaEtaExpansion dflags -- Do not do any inlining, in case we expose some unboxed -- tuple stuff that confuses the bytecode interpreter
610
simplEnvForGHCi dflags = mkSimplEnv $ SimplMode { sm_names = ["GHCi"] , sm_phase = InitialPhase , sm_rules = rules_on , sm_inline = False , sm_eta_expand = eta_expand_on , sm_case_case = True } where rules_on = gopt Opt_EnableRewriteRules dflags eta_expand_on = gopt Opt_DoLambdaEtaExpansion dflags -- Do not do any inlining, in case we expose some unboxed -- tuple stuff that confuses the bytecode interpreter
570
false
true
1
8
226
88
51
37
null
null
urbanslug/ghc
compiler/cmm/Hoopl.hs
bsd-3-clause
deepBwdRw f = deepBwdRw3 f f f
31
deepBwdRw f = deepBwdRw3 f f f
31
deepBwdRw f = deepBwdRw3 f f f
31
false
false
1
5
7
19
7
12
null
null
pniedzielski/fowlie-mga
src/Main.hs
gpl-3.0
move _ = Nothing
16
move _ = Nothing
16
move _ = Nothing
16
false
false
0
5
3
9
4
5
null
null
projedi/fluidsynth-hs-complete
src/Sound/Fluidsynth/Synth.hs
bsd-3-clause
addSoundFont :: SoundFont -> FluidSynth (Maybe Event.SoundFontID) addSoundFont = undefined
90
addSoundFont :: SoundFont -> FluidSynth (Maybe Event.SoundFontID) addSoundFont = undefined
90
addSoundFont = undefined
24
false
true
0
10
9
32
14
18
null
null
noughtmare/yi
yi-core/src/Yi/Editor.hs
gpl-2.0
newBufRef :: MonadEditor m => m BufferRef newBufRef = liftM BufferRef newRef
76
newBufRef :: MonadEditor m => m BufferRef newBufRef = liftM BufferRef newRef
76
newBufRef = liftM BufferRef newRef
34
false
true
0
6
11
26
12
14
null
null
adarqui/ztail-tools-redis
src/ZTail/Tools/Dump.hs
mit
dumpMain :: [Redis.ConnectInfo] -> String -> IO () dumpMain hosts dir = do ekg'bootstrap (defaultPort+1) (runDumper . newDumper hosts dir)
142
dumpMain :: [Redis.ConnectInfo] -> String -> IO () dumpMain hosts dir = do ekg'bootstrap (defaultPort+1) (runDumper . newDumper hosts dir)
142
dumpMain hosts dir = do ekg'bootstrap (defaultPort+1) (runDumper . newDumper hosts dir)
91
false
true
0
11
23
66
31
35
null
null
Arguggi/heed
heed-backend/src/Heed/Feed/RSS.hs
bsd-3-clause
rssEntryToItem :: UTCTime -> RSS.RSSItem -> DB.FeedItemHW rssEntryToItem now entry = DB.defFeedItem { DB._feedItemTitle = fromMaybe "No Title" . RSS.rssItemTitle $ entry , DB._feedItemUrl = fromMaybe "No Url" . RSS.rssItemLink $ entry , DB._feedItemDate = fromMaybe now $ join (parseRfc822 . T.unpack <$> RSS.rssItemPubDate entry) , DB._feedItemComments = RSS.rssItemComments entry }
407
rssEntryToItem :: UTCTime -> RSS.RSSItem -> DB.FeedItemHW rssEntryToItem now entry = DB.defFeedItem { DB._feedItemTitle = fromMaybe "No Title" . RSS.rssItemTitle $ entry , DB._feedItemUrl = fromMaybe "No Url" . RSS.rssItemLink $ entry , DB._feedItemDate = fromMaybe now $ join (parseRfc822 . T.unpack <$> RSS.rssItemPubDate entry) , DB._feedItemComments = RSS.rssItemComments entry }
407
rssEntryToItem now entry = DB.defFeedItem { DB._feedItemTitle = fromMaybe "No Title" . RSS.rssItemTitle $ entry , DB._feedItemUrl = fromMaybe "No Url" . RSS.rssItemLink $ entry , DB._feedItemDate = fromMaybe now $ join (parseRfc822 . T.unpack <$> RSS.rssItemPubDate entry) , DB._feedItemComments = RSS.rssItemComments entry }
349
false
true
0
13
74
132
65
67
null
null
Tarrasch/Hong
Fal/Fal.hs
bsd-3-clause
unique :: (Show a, Eq a) => Event a -> Event a unique (Event fe) = Event (\uts -> aux (fe uts)) where aux xs = zipWith remdup (Nothing:xs) xs remdup x y | x==y = Nothing | otherwise = y
237
unique :: (Show a, Eq a) => Event a -> Event a unique (Event fe) = Event (\uts -> aux (fe uts)) where aux xs = zipWith remdup (Nothing:xs) xs remdup x y | x==y = Nothing | otherwise = y
237
unique (Event fe) = Event (\uts -> aux (fe uts)) where aux xs = zipWith remdup (Nothing:xs) xs remdup x y | x==y = Nothing | otherwise = y
190
false
true
0
10
92
118
57
61
null
null
DavidAlphaFox/ghc
libraries/array/Data/Array/Base.hs
bsd-3-clause
thawIOArray arr = stToIO $ do marr <- ArrST.thawSTArray arr return (IOArray marr)
91
thawIOArray arr = stToIO $ do marr <- ArrST.thawSTArray arr return (IOArray marr)
91
thawIOArray arr = stToIO $ do marr <- ArrST.thawSTArray arr return (IOArray marr)
91
false
false
0
10
22
37
16
21
null
null
airt/Haskell-99
test/Cases.hs
mit
case67 = testCase "treeToString, stringToTree" $ ("a(b(,d),c(e,))", Just bTree5) @=? (treeToString bTree5, stringToTree "a(b(,d),c(e,))")
143
case67 = testCase "treeToString, stringToTree" $ ("a(b(,d),c(e,))", Just bTree5) @=? (treeToString bTree5, stringToTree "a(b(,d),c(e,))")
143
case67 = testCase "treeToString, stringToTree" $ ("a(b(,d),c(e,))", Just bTree5) @=? (treeToString bTree5, stringToTree "a(b(,d),c(e,))")
143
false
false
2
8
19
43
21
22
null
null
izgzhen/hadrian
src/Hadrian/Haskell/Package.hs
mit
-- | Check whether a package is a library. isLibrary :: Package -> Bool isLibrary (Package Library _ _) = True
110
isLibrary :: Package -> Bool isLibrary (Package Library _ _) = True
67
isLibrary (Package Library _ _) = True
38
true
true
0
7
20
29
15
14
null
null
mb21/qua-kit
libs/hs/ltiv1p1/src/Web/LTI.hs
mit
encodeTemplate :: [Node] -> ByteString encodeTemplate (NodeElement el :_) = LB.toStrict . renderLBS def{rsPretty = False} $ Document (Prologue [] Nothing []) el []
233
encodeTemplate :: [Node] -> ByteString encodeTemplate (NodeElement el :_) = LB.toStrict . renderLBS def{rsPretty = False} $ Document (Prologue [] Nothing []) el []
233
encodeTemplate (NodeElement el :_) = LB.toStrict . renderLBS def{rsPretty = False} $ Document (Prologue [] Nothing []) el []
194
false
true
0
10
93
80
39
41
null
null
brendanhay/gogol
gogol-cloudprivatecatalogproducer/gen/Network/Google/CloudPrivateCatalogProducer/Types/Product.hs
mpl-2.0
-- | Creates a value of 'GoogleCloudPrivatecatalogproducerV1beta1CopyProductRequest' with the minimum fields required to make a request. -- -- Use one of the following lenses to modify other fields as desired: -- -- * 'gcpvcprDestinationProductName' googleCloudPrivatecatalogproducerV1beta1CopyProductRequest :: GoogleCloudPrivatecatalogproducerV1beta1CopyProductRequest googleCloudPrivatecatalogproducerV1beta1CopyProductRequest = GoogleCloudPrivatecatalogproducerV1beta1CopyProductRequest' {_gcpvcprDestinationProductName = Nothing}
544
googleCloudPrivatecatalogproducerV1beta1CopyProductRequest :: GoogleCloudPrivatecatalogproducerV1beta1CopyProductRequest googleCloudPrivatecatalogproducerV1beta1CopyProductRequest = GoogleCloudPrivatecatalogproducerV1beta1CopyProductRequest' {_gcpvcprDestinationProductName = Nothing}
294
googleCloudPrivatecatalogproducerV1beta1CopyProductRequest = GoogleCloudPrivatecatalogproducerV1beta1CopyProductRequest' {_gcpvcprDestinationProductName = Nothing}
169
true
true
1
7
52
31
17
14
null
null
nyorem/cghs
Cghs/Types/Polygon2.hs
mit
isInsidePolygon2 :: (Fractional a, Ord a) => Polygon2 a -> Point2 a -> Bool isInsidePolygon2 [] _ = False
105
isInsidePolygon2 :: (Fractional a, Ord a) => Polygon2 a -> Point2 a -> Bool isInsidePolygon2 [] _ = False
105
isInsidePolygon2 [] _ = False
29
false
true
0
8
18
47
23
24
null
null
aisamanra/matterhorn
src/Draw/Util.hs
bsd-3-clause
withBrackets :: Widget a -> Widget a withBrackets w = hBox [str "[", w, str "]"]
80
withBrackets :: Widget a -> Widget a withBrackets w = hBox [str "[", w, str "]"]
80
withBrackets w = hBox [str "[", w, str "]"]
43
false
true
0
7
15
42
20
22
null
null
deweyvm/labyrinth
src/Labyrinth/Pathing/Util.hs
mit
expand :: Point -> Point -> [Point] expand (px, py) (qx, qy) = let dx = qx - px dy = qy - py sx = signum dx sy = signum dy n = max (abs dx) (abs dy) iter s = (take (n+1) $ iterate (+s) 0) in ((+px) *** (+py)) <$> zip (iter sx) (iter sy)
284
expand :: Point -> Point -> [Point] expand (px, py) (qx, qy) = let dx = qx - px dy = qy - py sx = signum dx sy = signum dy n = max (abs dx) (abs dy) iter s = (take (n+1) $ iterate (+s) 0) in ((+px) *** (+py)) <$> zip (iter sx) (iter sy)
284
expand (px, py) (qx, qy) = let dx = qx - px dy = qy - py sx = signum dx sy = signum dy n = max (abs dx) (abs dy) iter s = (take (n+1) $ iterate (+s) 0) in ((+px) *** (+py)) <$> zip (iter sx) (iter sy)
248
false
true
0
13
105
176
92
84
null
null
vladimir-ipatov/ganeti
test/hs/Test/Ganeti/TestCommon.hs
gpl-2.0
genNonNegative :: Gen Int genNonNegative = fmap fromIntegral (arbitrary::Gen (Test.QuickCheck.NonNegative Int))
113
genNonNegative :: Gen Int genNonNegative = fmap fromIntegral (arbitrary::Gen (Test.QuickCheck.NonNegative Int))
113
genNonNegative = fmap fromIntegral (arbitrary::Gen (Test.QuickCheck.NonNegative Int))
87
false
true
0
9
12
43
20
23
null
null
yxm4109/pandoc
src/Text/Pandoc/Writers/RST.hs
gpl-2.0
bulletListItemToRST :: [Block] -> State WriterState Doc bulletListItemToRST items = do contents <- blockListToRST items return $ (text "- ") <> contents -- | Convert ordered list item (a list of blocks) to RST.
216
bulletListItemToRST :: [Block] -> State WriterState Doc bulletListItemToRST items = do contents <- blockListToRST items return $ (text "- ") <> contents -- | Convert ordered list item (a list of blocks) to RST.
216
bulletListItemToRST items = do contents <- blockListToRST items return $ (text "- ") <> contents -- | Convert ordered list item (a list of blocks) to RST.
160
false
true
0
10
39
59
27
32
null
null
andrewMacmurray/haskell-book-solutions
src/ch6/excercises.hs
mit
settleDown :: Mood -> Mood settleDown x = if x == Woot then Blah else x
77
settleDown :: Mood -> Mood settleDown x = if x == Woot then Blah else x
77
settleDown x = if x == Woot then Blah else x
50
false
true
0
6
21
30
16
14
null
null
jokusi/Astview
test/SourceLocation.hs
mit
propDuality:: TestTree propDuality = testProperty "Duality of < and >" prop where prop :: SrcSpan -> SrcSpan -> Bool prop a b | a < b = b > a && a /= b | a == b = b == a | a > b = b < a && a /= b | otherwise = True
246
propDuality:: TestTree propDuality = testProperty "Duality of < and >" prop where prop :: SrcSpan -> SrcSpan -> Bool prop a b | a < b = b > a && a /= b | a == b = b == a | a > b = b < a && a /= b | otherwise = True
246
propDuality = testProperty "Duality of < and >" prop where prop :: SrcSpan -> SrcSpan -> Bool prop a b | a < b = b > a && a /= b | a == b = b == a | a > b = b < a && a /= b | otherwise = True
223
false
true
0
8
89
113
55
58
null
null
amccausl/Swish
Swish/HaskellRDF/VarBindingTest.hs
lgpl-2.1
-- 3 compad = findCompositions [vbm3,vbm4,vbm9] ["a","d"]
58
compad = findCompositions [vbm3,vbm4,vbm9] ["a","d"]
52
compad = findCompositions [vbm3,vbm4,vbm9] ["a","d"]
52
true
false
0
6
7
27
16
11
null
null
frenetic-lang/netcore-1.0
src/Frenetic/Slices/Compile.hs
bsd-3-clause
-- TODO(arjun): why? -- |Remove forwarding actions to ports other than p justTo :: Port -> Policy -> Policy justTo _ PoBottom = PoBottom
137
justTo :: Port -> Policy -> Policy justTo _ PoBottom = PoBottom
63
justTo _ PoBottom = PoBottom
28
true
true
0
8
24
32
15
17
null
null
alexvong1995/pandoc
src/Text/Pandoc/Pretty.hs
gpl-2.0
realLength :: String -> Int realLength = foldr (\a b -> charWidth a + b) 0
74
realLength :: String -> Int realLength = foldr (\a b -> charWidth a + b) 0
74
realLength = foldr (\a b -> charWidth a + b) 0
46
false
true
0
9
15
44
20
24
null
null
continuouspi/cpiwb
profileSig1.hs
gpl-3.0
f16 = Pos (0,25) f12
20
f16 = Pos (0,25) f12
20
f16 = Pos (0,25) f12
20
false
false
1
5
4
22
9
13
null
null
onponomarev/ganeti
src/Ganeti/Utils.hs
bsd-2-clause
monadicThe s (x:xs) | all (x ==) xs = return x | otherwise = fail s
71
monadicThe s (x:xs) | all (x ==) xs = return x | otherwise = fail s
71
monadicThe s (x:xs) | all (x ==) xs = return x | otherwise = fail s
71
false
false
0
9
19
53
23
30
null
null
sebastiaanvisser/salvia-extras
src/Network/Salvia/Handler/FileStore.hs
bsd-3-clause
mkError Unchanged = Http.OK
38
mkError Unchanged = Http.OK
38
mkError Unchanged = Http.OK
38
false
false
1
6
14
15
5
10
null
null
nh2/quickcheck
Test/QuickCheck/Property.hs
bsd-3-clause
-- Apply a function to the outermost MkRose constructor of a rose tree. -- The function must be total! onRose :: (a -> [Rose a] -> Rose a) -> Rose a -> Rose a onRose f (MkRose x rs) = f x rs
190
onRose :: (a -> [Rose a] -> Rose a) -> Rose a -> Rose a onRose f (MkRose x rs) = f x rs
87
onRose f (MkRose x rs) = f x rs
31
true
true
0
10
42
65
32
33
null
null
chwthewke/horbits
src/horbits/Horbits/Body/Data.hs
bsd-3-clause
getSphereOfInfluence Vall = Just $ 2.4064014e+006 *~ meter
60
getSphereOfInfluence Vall = Just $ 2.4064014e+006 *~ meter
60
getSphereOfInfluence Vall = Just $ 2.4064014e+006 *~ meter
60
false
false
0
6
9
17
8
9
null
null