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
olive/vacivity
src/Vacivity/Proc/BSPDungeon.hs
mit
connectTree :: Orientation -> Tree -> Tree -> [Line] connectTree o t1 t2 = let n1 = assembleRects t1 in let n2 = assembleRects t2 in let (r1, r2) = closest n1 n2 in let (l1, l2) = nearest o r1 r2 in connect o l1 l2
234
connectTree :: Orientation -> Tree -> Tree -> [Line] connectTree o t1 t2 = let n1 = assembleRects t1 in let n2 = assembleRects t2 in let (r1, r2) = closest n1 n2 in let (l1, l2) = nearest o r1 r2 in connect o l1 l2
234
connectTree o t1 t2 = let n1 = assembleRects t1 in let n2 = assembleRects t2 in let (r1, r2) = closest n1 n2 in let (l1, l2) = nearest o r1 r2 in connect o l1 l2
181
false
true
0
15
66
116
55
61
null
null
gridaphobe/ghc
compiler/ghci/ByteCodeGen.hs
bsd-3-clause
unsupportedCConvException :: a unsupportedCConvException = throwGhcException (ProgramError ("Error: bytecode compiler can't handle some foreign calling conventions\n"++ " Workaround: use -fobject-code, or compile this module to .o separately."))
251
unsupportedCConvException :: a unsupportedCConvException = throwGhcException (ProgramError ("Error: bytecode compiler can't handle some foreign calling conventions\n"++ " Workaround: use -fobject-code, or compile this module to .o separately."))
251
unsupportedCConvException = throwGhcException (ProgramError ("Error: bytecode compiler can't handle some foreign calling conventions\n"++ " Workaround: use -fobject-code, or compile this module to .o separately."))
220
false
true
0
9
32
27
14
13
null
null
robdockins/edison
edison-core/src/Data/Edison/Assoc/Defaults.hs
mit
lookupAllUsingLookupM :: (AssocX m k,S.Sequence seq) => k -> m a -> seq a lookupAllUsingLookupM k m = case lookupM k m of Just x -> S.singleton x Nothing -> S.empty
224
lookupAllUsingLookupM :: (AssocX m k,S.Sequence seq) => k -> m a -> seq a lookupAllUsingLookupM k m = case lookupM k m of Just x -> S.singleton x Nothing -> S.empty
224
lookupAllUsingLookupM k m = case lookupM k m of Just x -> S.singleton x Nothing -> S.empty
150
false
true
0
9
90
80
38
42
null
null
jrockway/c2hs
src/C2HS/CHS.hs
gpl-2.0
showCHSHook (CHSClass oclassIde classIde typeIde _) = showString "class " . (case oclassIde of Nothing -> showString "" Just classIde' -> showCHSIdent classIde' . showString " => ") . showCHSIdent classIde . showString " " . showCHSIdent typeIde
278
showCHSHook (CHSClass oclassIde classIde typeIde _) = showString "class " . (case oclassIde of Nothing -> showString "" Just classIde' -> showCHSIdent classIde' . showString " => ") . showCHSIdent classIde . showString " " . showCHSIdent typeIde
278
showCHSHook (CHSClass oclassIde classIde typeIde _) = showString "class " . (case oclassIde of Nothing -> showString "" Just classIde' -> showCHSIdent classIde' . showString " => ") . showCHSIdent classIde . showString " " . showCHSIdent typeIde
278
false
false
4
10
70
88
38
50
null
null
ecaustin/haskhol-core
src/HaskHOL/Core/Parser/TermParser.hs
bsd-2-clause
pfrees PConst{} acc = return acc
32
pfrees PConst{} acc = return acc
32
pfrees PConst{} acc = return acc
32
false
false
0
6
5
18
8
10
null
null
hargettp/courier
tests/TestUDP.hs
mit
_log :: String _log = "_test_UDP"
33
_log :: String _log = "_test_UDP"
33
_log = "_test_UDP"
18
false
true
0
4
5
11
6
5
null
null
elieux/ghc
compiler/prelude/PrelNames.hs
bsd-3-clause
instCoercionTyConKey = mkPreludeTyConUnique 97
65
instCoercionTyConKey = mkPreludeTyConUnique 97
65
instCoercionTyConKey = mkPreludeTyConUnique 97
65
false
false
0
5
22
9
4
5
null
null
kyren/hsgb
lib/Gameboy/Instructions.hs
unlicense
encodeInstruction (SET_B_R Bit4 CRegister) = [0xcb, 0xe1]
57
encodeInstruction (SET_B_R Bit4 CRegister) = [0xcb, 0xe1]
57
encodeInstruction (SET_B_R Bit4 CRegister) = [0xcb, 0xe1]
57
false
false
0
6
6
24
12
12
null
null
basilpocklington/haskell-TTT
src/Board.hs
mit
o = O
5
o = O
5
o = O
5
false
false
1
5
2
10
3
7
null
null
dmvianna/strict
src/fusion.hs
bsd-3-clause
testV' :: Int -> V.Vector Int testV' n = V.map (+n) $ V.map (+n) $ V.map (+n) $ V.map (+n) (V.fromList [1..10000])
129
testV' :: Int -> V.Vector Int testV' n = V.map (+n) $ V.map (+n) $ V.map (+n) $ V.map (+n) (V.fromList [1..10000])
129
testV' n = V.map (+n) $ V.map (+n) $ V.map (+n) $ V.map (+n) (V.fromList [1..10000])
99
false
true
0
9
36
86
45
41
null
null
sgillespie/ghc
testsuite/tests/typecheck/should_run/Defer01.hs
bsd-3-clause
i a = seq (not (K a)) ()
24
i a = seq (not (K a)) ()
24
i a = seq (not (K a)) ()
24
false
false
1
8
7
33
13
20
null
null
Copilot-Language/sbv-for-copilot
SBVUnitTest/TestSuite/Basics/ArithSolver.hs
bsd-3-clause
i32s :: [Int32] i32s = xsSigned
31
i32s :: [Int32] i32s = xsSigned
31
i32s = xsSigned
15
false
true
0
5
5
14
8
6
null
null
SimSaladin/rnfssp
rnfssp-media/devel.hs
bsd-3-clause
terminateDevel :: IO () terminateDevel = exitSuccess
52
terminateDevel :: IO () terminateDevel = exitSuccess
52
terminateDevel = exitSuccess
28
false
true
0
6
6
16
8
8
null
null
manhong2112/CodeColle
Agda/MAlonzo/RTE.hs
mit
positiveInfinity :: Double positiveInfinity = 1.0 / 0.0
55
positiveInfinity :: Double positiveInfinity = 1.0 / 0.0
55
positiveInfinity = 1.0 / 0.0
28
false
true
0
5
7
15
8
7
null
null
jtdaugherty/mix-assembler
src/MIX/Assembler.hs
bsd-3-clause
evalAddress (S.AddrLiteral l) = evalWValue l
44
evalAddress (S.AddrLiteral l) = evalWValue l
44
evalAddress (S.AddrLiteral l) = evalWValue l
44
false
false
0
8
5
20
9
11
null
null
HJvT/hdirect
src/Parser.hs
bsd-3-clause
happyReduction_127 _ _ _ = notHappyAtAll
41
happyReduction_127 _ _ _ = notHappyAtAll
41
happyReduction_127 _ _ _ = notHappyAtAll
41
false
false
0
5
6
13
6
7
null
null
supki/outdated
src/Main.hs
bsd-2-clause
printAndDie :: MonadIO m => Sink String m a printAndDie = flip fix True $ \loop r -> do mx <- C.await case mx of Nothing -> if r then liftIO (println "OK" >> exitSuccess) else liftIO exitFailure Just x -> do println x; loop False
242
printAndDie :: MonadIO m => Sink String m a printAndDie = flip fix True $ \loop r -> do mx <- C.await case mx of Nothing -> if r then liftIO (println "OK" >> exitSuccess) else liftIO exitFailure Just x -> do println x; loop False
242
printAndDie = flip fix True $ \loop r -> do mx <- C.await case mx of Nothing -> if r then liftIO (println "OK" >> exitSuccess) else liftIO exitFailure Just x -> do println x; loop False
198
false
true
2
16
58
118
52
66
null
null
sgillespie/lambda-calculus
test/Language/SystemF/ParserSpec.hs
mit
spec :: Spec spec = do describe "parseExpr" $ do it "parses simple variables" $ parseExpr "x" `shouldBe` Right (Var "x") it "parses parenthesized variables" $ parseExpr "(x)" `shouldBe` Right (Var "x") it "parses simple abstractions" $ parseExpr "\\x:T. x" `shouldBe` Right (Abs "x" (TyVar "T") (Var "x")) it "parses simple type abstractions" $ parseExpr "\\X. x" `shouldBe` Right (TyAbs "X" (Var "x")) it "parses simple type applications" $ parseExpr "x [T]" `shouldBe` Right (TyApp (Var "x") (TyVar "T")) it "parses nested abstractions" $ parseExpr "\\a:A b:B. b" `shouldBe` Right (Abs "a" (TyVar "A") (Abs "b" (TyVar "B") (Var "b"))) it "parses abstractions with arrow types" $ parseExpr "\\f:(T->U). f" `shouldBe` Right (Abs "f" (TyArrow (TyVar "T") (TyVar "U")) (Var "f")) it "parses simple applications" $ parseExpr "f x" `shouldBe` Right (App (Var "f") (Var "x")) it "parses chained applications" $ parseExpr "a b c" `shouldBe` Right (App (App (Var "a") (Var "b")) (Var "c")) it "parses complex expressions" $ do let exprs = [ "\\f:(A->B) x:B. f x", "(\\p:(X->Y->Z) x:X y:Y. y) (\\p:(A->B->C) x:B y:C. x)", "f (\\x:T. x)", "(\\ x:X . f x) g y", "(\\f:(X->Y) . (\\ x:X y:Y. f x y) f x y) w x y", "(\\x:T. x) [U]" ] mapM_ (flip shouldSatisfy isRight . parseExpr) exprs it "does not parse trailing errors" $ parseExpr "x +" `shouldSatisfy` isLeft it "ignores whitespace" $ do let exprs = [ " x ", " \\ x : X. x ", " ( x ) " ] mapM_ (flip shouldSatisfy isRight . parseExpr) exprs describe "parseType" $ do it "parses simple variables" $ parseType "X" `shouldBe` Right (TyVar "X") it "parses parenthesized variables" $ parseType "(T)" `shouldBe` Right (TyVar "T") it "parses simple arrow types" $ parseType "A -> B" `shouldBe` Right (TyArrow (TyVar "A") (TyVar "B")) it "parses parenthesized arrow types" $ parseType "((X)->(Y))" `shouldBe` Right (TyArrow (TyVar "X") (TyVar "Y")) it "parses nested arrow types" $ do parseType "T -> U -> V" `shouldBe` Right (TyArrow (TyVar "T") (TyArrow (TyVar "U") (TyVar "V"))) parseType "(W -> V) -> U" `shouldBe` Right (TyArrow (TyArrow (TyVar "W") (TyVar "V")) (TyVar "U"))
2,496
spec :: Spec spec = do describe "parseExpr" $ do it "parses simple variables" $ parseExpr "x" `shouldBe` Right (Var "x") it "parses parenthesized variables" $ parseExpr "(x)" `shouldBe` Right (Var "x") it "parses simple abstractions" $ parseExpr "\\x:T. x" `shouldBe` Right (Abs "x" (TyVar "T") (Var "x")) it "parses simple type abstractions" $ parseExpr "\\X. x" `shouldBe` Right (TyAbs "X" (Var "x")) it "parses simple type applications" $ parseExpr "x [T]" `shouldBe` Right (TyApp (Var "x") (TyVar "T")) it "parses nested abstractions" $ parseExpr "\\a:A b:B. b" `shouldBe` Right (Abs "a" (TyVar "A") (Abs "b" (TyVar "B") (Var "b"))) it "parses abstractions with arrow types" $ parseExpr "\\f:(T->U). f" `shouldBe` Right (Abs "f" (TyArrow (TyVar "T") (TyVar "U")) (Var "f")) it "parses simple applications" $ parseExpr "f x" `shouldBe` Right (App (Var "f") (Var "x")) it "parses chained applications" $ parseExpr "a b c" `shouldBe` Right (App (App (Var "a") (Var "b")) (Var "c")) it "parses complex expressions" $ do let exprs = [ "\\f:(A->B) x:B. f x", "(\\p:(X->Y->Z) x:X y:Y. y) (\\p:(A->B->C) x:B y:C. x)", "f (\\x:T. x)", "(\\ x:X . f x) g y", "(\\f:(X->Y) . (\\ x:X y:Y. f x y) f x y) w x y", "(\\x:T. x) [U]" ] mapM_ (flip shouldSatisfy isRight . parseExpr) exprs it "does not parse trailing errors" $ parseExpr "x +" `shouldSatisfy` isLeft it "ignores whitespace" $ do let exprs = [ " x ", " \\ x : X. x ", " ( x ) " ] mapM_ (flip shouldSatisfy isRight . parseExpr) exprs describe "parseType" $ do it "parses simple variables" $ parseType "X" `shouldBe` Right (TyVar "X") it "parses parenthesized variables" $ parseType "(T)" `shouldBe` Right (TyVar "T") it "parses simple arrow types" $ parseType "A -> B" `shouldBe` Right (TyArrow (TyVar "A") (TyVar "B")) it "parses parenthesized arrow types" $ parseType "((X)->(Y))" `shouldBe` Right (TyArrow (TyVar "X") (TyVar "Y")) it "parses nested arrow types" $ do parseType "T -> U -> V" `shouldBe` Right (TyArrow (TyVar "T") (TyArrow (TyVar "U") (TyVar "V"))) parseType "(W -> V) -> U" `shouldBe` Right (TyArrow (TyArrow (TyVar "W") (TyVar "V")) (TyVar "U"))
2,496
spec = do describe "parseExpr" $ do it "parses simple variables" $ parseExpr "x" `shouldBe` Right (Var "x") it "parses parenthesized variables" $ parseExpr "(x)" `shouldBe` Right (Var "x") it "parses simple abstractions" $ parseExpr "\\x:T. x" `shouldBe` Right (Abs "x" (TyVar "T") (Var "x")) it "parses simple type abstractions" $ parseExpr "\\X. x" `shouldBe` Right (TyAbs "X" (Var "x")) it "parses simple type applications" $ parseExpr "x [T]" `shouldBe` Right (TyApp (Var "x") (TyVar "T")) it "parses nested abstractions" $ parseExpr "\\a:A b:B. b" `shouldBe` Right (Abs "a" (TyVar "A") (Abs "b" (TyVar "B") (Var "b"))) it "parses abstractions with arrow types" $ parseExpr "\\f:(T->U). f" `shouldBe` Right (Abs "f" (TyArrow (TyVar "T") (TyVar "U")) (Var "f")) it "parses simple applications" $ parseExpr "f x" `shouldBe` Right (App (Var "f") (Var "x")) it "parses chained applications" $ parseExpr "a b c" `shouldBe` Right (App (App (Var "a") (Var "b")) (Var "c")) it "parses complex expressions" $ do let exprs = [ "\\f:(A->B) x:B. f x", "(\\p:(X->Y->Z) x:X y:Y. y) (\\p:(A->B->C) x:B y:C. x)", "f (\\x:T. x)", "(\\ x:X . f x) g y", "(\\f:(X->Y) . (\\ x:X y:Y. f x y) f x y) w x y", "(\\x:T. x) [U]" ] mapM_ (flip shouldSatisfy isRight . parseExpr) exprs it "does not parse trailing errors" $ parseExpr "x +" `shouldSatisfy` isLeft it "ignores whitespace" $ do let exprs = [ " x ", " \\ x : X. x ", " ( x ) " ] mapM_ (flip shouldSatisfy isRight . parseExpr) exprs describe "parseType" $ do it "parses simple variables" $ parseType "X" `shouldBe` Right (TyVar "X") it "parses parenthesized variables" $ parseType "(T)" `shouldBe` Right (TyVar "T") it "parses simple arrow types" $ parseType "A -> B" `shouldBe` Right (TyArrow (TyVar "A") (TyVar "B")) it "parses parenthesized arrow types" $ parseType "((X)->(Y))" `shouldBe` Right (TyArrow (TyVar "X") (TyVar "Y")) it "parses nested arrow types" $ do parseType "T -> U -> V" `shouldBe` Right (TyArrow (TyVar "T") (TyArrow (TyVar "U") (TyVar "V"))) parseType "(W -> V) -> U" `shouldBe` Right (TyArrow (TyArrow (TyVar "W") (TyVar "V")) (TyVar "U"))
2,483
false
true
0
21
734
804
382
422
null
null
phischu/fragnix
builtins/base/GHC.ForeignPtr.hs
bsd-3-clause
addForeignPtrConcFinalizer_ :: ForeignPtrContents -> IO () -> IO () addForeignPtrConcFinalizer_ (PlainForeignPtr r) finalizer = do noFinalizers <- insertHaskellFinalizer r finalizer if noFinalizers then IO $ \s -> case r of { IORef (STRef r#) -> case mkWeak# r# () (unIO $ foreignPtrFinalizer r) s of { (# s1, _ #) -> (# s1, () #) }} else return ()
406
addForeignPtrConcFinalizer_ :: ForeignPtrContents -> IO () -> IO () addForeignPtrConcFinalizer_ (PlainForeignPtr r) finalizer = do noFinalizers <- insertHaskellFinalizer r finalizer if noFinalizers then IO $ \s -> case r of { IORef (STRef r#) -> case mkWeak# r# () (unIO $ foreignPtrFinalizer r) s of { (# s1, _ #) -> (# s1, () #) }} else return ()
406
addForeignPtrConcFinalizer_ (PlainForeignPtr r) finalizer = do noFinalizers <- insertHaskellFinalizer r finalizer if noFinalizers then IO $ \s -> case r of { IORef (STRef r#) -> case mkWeak# r# () (unIO $ foreignPtrFinalizer r) s of { (# s1, _ #) -> (# s1, () #) }} else return ()
338
false
true
0
17
116
143
72
71
null
null
a143753/AOJ
0105.hs
apache-2.0
ans i = let s = sortBy (\ (w1,p1) (w2,p2) -> if w1 /= w2 then compare w1 w2 else compare p1 p2 ) i c = cmp s in c
205
ans i = let s = sortBy (\ (w1,p1) (w2,p2) -> if w1 /= w2 then compare w1 w2 else compare p1 p2 ) i c = cmp s in c
205
ans i = let s = sortBy (\ (w1,p1) (w2,p2) -> if w1 /= w2 then compare w1 w2 else compare p1 p2 ) i c = cmp s in c
205
false
false
0
13
122
77
40
37
null
null
twittner/wai-routing
test/Tests/Wai/Route.hs
mpl-2.0
tests :: TestTree tests = testGroup "Network.Wai.Routing" [ testCase "Sitemap" testSitemap , testCase "Media Selection" testMedia , testCase "Custom Error Renderer" testErrorRenderer ]
200
tests :: TestTree tests = testGroup "Network.Wai.Routing" [ testCase "Sitemap" testSitemap , testCase "Media Selection" testMedia , testCase "Custom Error Renderer" testErrorRenderer ]
200
tests = testGroup "Network.Wai.Routing" [ testCase "Sitemap" testSitemap , testCase "Media Selection" testMedia , testCase "Custom Error Renderer" testErrorRenderer ]
182
false
true
0
7
38
48
21
27
null
null
gregorias/rummikubsolver
test/GameTest.hs
gpl-3.0
shouldSolveTheRummikubCompletely :: HU.Test shouldSolveTheRummikubCompletely = HU.TestCase $ do HU.assertBool "" $ isJust rummikubStateMay let Just rummikubState = rummikubStateMay solutionMaybe <- Game.solveRummikubState rummikubState HU.assertBool "" $ isJust solutionMaybe let Just (_, tiles) = solutionMaybe HU.assertEqual "" (length tilesOnRack) (length tiles) where tilesOnTable = map (\v -> Game.ValueTile (v, Game.Red)) [5 .. 13] ++ map (\v -> Game.ValueTile (v, Game.Blue)) ([7 .. 13] ++ [10, 1]) ++ map (\v -> Game.ValueTile (v, Game.Yellow)) [1, 10, 11] ++ map (\v -> Game.ValueTile (v, Game.Black)) ([3 .. 7] ++ [9 .. 11] ++ [1, 13]) ++ [Game.Joker] tilesOnRack = map (\v -> Game.ValueTile (v, Game.Red)) [2, 12] ++ [Game.ValueTile (2, Game.Blue)] ++ map (\v -> Game.ValueTile (v, Game.Yellow)) [2, 5, 6, 8] ++ map (\v -> Game.ValueTile (v, Game.Black)) [2, 12] rummikubStateMay = foldr (<=<) Just (map (Game.modifyRackMay 1) tilesOnRack) <=< foldr (<=<) Just (map (Game.modifyTableMay 1) tilesOnTable) $ Game.initialRummikubState
1,146
shouldSolveTheRummikubCompletely :: HU.Test shouldSolveTheRummikubCompletely = HU.TestCase $ do HU.assertBool "" $ isJust rummikubStateMay let Just rummikubState = rummikubStateMay solutionMaybe <- Game.solveRummikubState rummikubState HU.assertBool "" $ isJust solutionMaybe let Just (_, tiles) = solutionMaybe HU.assertEqual "" (length tilesOnRack) (length tiles) where tilesOnTable = map (\v -> Game.ValueTile (v, Game.Red)) [5 .. 13] ++ map (\v -> Game.ValueTile (v, Game.Blue)) ([7 .. 13] ++ [10, 1]) ++ map (\v -> Game.ValueTile (v, Game.Yellow)) [1, 10, 11] ++ map (\v -> Game.ValueTile (v, Game.Black)) ([3 .. 7] ++ [9 .. 11] ++ [1, 13]) ++ [Game.Joker] tilesOnRack = map (\v -> Game.ValueTile (v, Game.Red)) [2, 12] ++ [Game.ValueTile (2, Game.Blue)] ++ map (\v -> Game.ValueTile (v, Game.Yellow)) [2, 5, 6, 8] ++ map (\v -> Game.ValueTile (v, Game.Black)) [2, 12] rummikubStateMay = foldr (<=<) Just (map (Game.modifyRackMay 1) tilesOnRack) <=< foldr (<=<) Just (map (Game.modifyTableMay 1) tilesOnTable) $ Game.initialRummikubState
1,146
shouldSolveTheRummikubCompletely = HU.TestCase $ do HU.assertBool "" $ isJust rummikubStateMay let Just rummikubState = rummikubStateMay solutionMaybe <- Game.solveRummikubState rummikubState HU.assertBool "" $ isJust solutionMaybe let Just (_, tiles) = solutionMaybe HU.assertEqual "" (length tilesOnRack) (length tiles) where tilesOnTable = map (\v -> Game.ValueTile (v, Game.Red)) [5 .. 13] ++ map (\v -> Game.ValueTile (v, Game.Blue)) ([7 .. 13] ++ [10, 1]) ++ map (\v -> Game.ValueTile (v, Game.Yellow)) [1, 10, 11] ++ map (\v -> Game.ValueTile (v, Game.Black)) ([3 .. 7] ++ [9 .. 11] ++ [1, 13]) ++ [Game.Joker] tilesOnRack = map (\v -> Game.ValueTile (v, Game.Red)) [2, 12] ++ [Game.ValueTile (2, Game.Blue)] ++ map (\v -> Game.ValueTile (v, Game.Yellow)) [2, 5, 6, 8] ++ map (\v -> Game.ValueTile (v, Game.Black)) [2, 12] rummikubStateMay = foldr (<=<) Just (map (Game.modifyRackMay 1) tilesOnRack) <=< foldr (<=<) Just (map (Game.modifyTableMay 1) tilesOnTable) $ Game.initialRummikubState
1,102
false
true
19
12
249
539
275
264
null
null
Fuuzetsu/cabal2nix
src/Distribution/Nixpkgs/Haskell/FromCabal/Name.hs
bsd-3-clause
libNixName "gobject-introspection-1.0" = return "gobjectIntrospection"
79
libNixName "gobject-introspection-1.0" = return "gobjectIntrospection"
79
libNixName "gobject-introspection-1.0" = return "gobjectIntrospection"
79
false
false
0
5
13
12
5
7
null
null
matthew-eads/yesod-articles
src/Yesod/Articles.hs
bsd-3-clause
getDates :: [Text] -> IO [DateTime] getDates [] = return []
59
getDates :: [Text] -> IO [DateTime] getDates [] = return []
59
getDates [] = return []
23
false
true
0
7
10
34
17
17
null
null
ocramz/petsc-hs
src/Numerical/PETSc/Internal/PutGet/Vec.hs
gpl-3.0
-- | vecDuplicate : allocates memory for an indentical Vec vecDuplicate :: Vec -> IO Vec vecDuplicate v = chk1 $ vecDuplicate1 v
129
vecDuplicate :: Vec -> IO Vec vecDuplicate v = chk1 $ vecDuplicate1 v
69
vecDuplicate v = chk1 $ vecDuplicate1 v
39
true
true
0
6
23
29
14
15
null
null
WSCU/JSEuterpea
Euterpea Examples/SimpleEuterpea.hs
gpl-3.0
f8 = pitchToMusic 111
22
ef8 = pitchToMusic 111
22
ef8 = pitchToMusic 111
22
false
false
0
5
4
9
4
5
null
null
niexshao/Exercises
src/HQuestions.hs
bsd-3-clause
apply Divide _ 0 = Nothing
28
apply Divide _ 0 = Nothing
28
apply Divide _ 0 = Nothing
28
false
false
1
5
7
15
6
9
null
null
athanclark/Idris-dev
src/Idris/Core/TT.hs
bsd-3-clause
lookupCtxtExact :: Name -> Ctxt a -> Maybe a lookupCtxtExact n ctxt = listToMaybe [ v | (nm, v) <- lookupCtxtName n ctxt, nm == n]
130
lookupCtxtExact :: Name -> Ctxt a -> Maybe a lookupCtxtExact n ctxt = listToMaybe [ v | (nm, v) <- lookupCtxtName n ctxt, nm == n]
130
lookupCtxtExact n ctxt = listToMaybe [ v | (nm, v) <- lookupCtxtName n ctxt, nm == n]
85
false
true
0
9
25
63
31
32
null
null
energyflowanalysis/efa-2.1
src/EFA/Signal/Record.hs
bsd-3-clause
{- sumFlowRecord :: (V.FromList v, V.Zipper v, V.Walker v, V.Storage v d, V.Singleton v, Product d) => DTimeFlowRecord node v d -> CumFlowRecord node v d sumFlowRecord (Record dtime map) = Record (S.sum dtime) (Map.map (S.sum) map) -} makeStepped :: (V.Storage v d1, V.FromList v, V.Storage v d2) => Record s1 s2 t1 t2 id v d1 d2 -> Record s1 s2 t1 t2 id v d1 d2 makeStepped (Record time pmap) = Record (S.duplicateR time) $ Map.map (S.duplicateL) pmap
561
makeStepped :: (V.Storage v d1, V.FromList v, V.Storage v d2) => Record s1 s2 t1 t2 id v d1 d2 -> Record s1 s2 t1 t2 id v d1 d2 makeStepped (Record time pmap) = Record (S.duplicateR time) $ Map.map (S.duplicateL) pmap
234
makeStepped (Record time pmap) = Record (S.duplicateR time) $ Map.map (S.duplicateL) pmap
89
true
true
0
9
188
119
59
60
null
null
hy-zhang/parser
experimental/Lib.hs
bsd-3-clause
parseBase :: KnownNat n => Proxy n -> TList fs -> Parser (Fix fs n) parseBase p ps = do _ <- char '(' state <- getState modifyState $ \s -> s {stk = []} x <- ps !!! p _ <- char ')' modifyState $ \s -> s {stk = stk state} return x
243
parseBase :: KnownNat n => Proxy n -> TList fs -> Parser (Fix fs n) parseBase p ps = do _ <- char '(' state <- getState modifyState $ \s -> s {stk = []} x <- ps !!! p _ <- char ')' modifyState $ \s -> s {stk = stk state} return x
243
parseBase p ps = do _ <- char '(' state <- getState modifyState $ \s -> s {stk = []} x <- ps !!! p _ <- char ')' modifyState $ \s -> s {stk = stk state} return x
175
false
true
0
12
68
142
65
77
null
null
ComputationWithBoundedResources/ara-inference
doc/tpdb_trs/Haskell/basic_haskell/notElem_2.hs
mit
esEsMyBool MyTrue MyTrue = MyTrue
33
esEsMyBool MyTrue MyTrue = MyTrue
33
esEsMyBool MyTrue MyTrue = MyTrue
33
false
false
0
5
4
11
5
6
null
null
getyourguide/fbthrift
thrift/compiler/test/fixtures/namespace/gen-hs/My/Namespacing/Test/HsTestService.hs
apache-2.0
typemap_Init_result :: Types.TypeMap typemap_Init_result = Map.fromList [("success",(0,Types.T_I64))]
101
typemap_Init_result :: Types.TypeMap typemap_Init_result = Map.fromList [("success",(0,Types.T_I64))]
101
typemap_Init_result = Map.fromList [("success",(0,Types.T_I64))]
64
false
true
0
9
6
35
20
15
null
null
nbloomf/carl
src/Carl/Bool.hs
gpl-3.0
boolNEq :: Bool -> Bool -> Either BoolErr Bool boolNEq a b = Right $ a /= b
75
boolNEq :: Bool -> Bool -> Either BoolErr Bool boolNEq a b = Right $ a /= b
75
boolNEq a b = Right $ a /= b
28
false
true
2
8
17
42
19
23
null
null
lseelenbinder/oodle-compiler
Oodle/Lexer.hs
mit
lexer' cs' file line col = let -- This isn't the most efficient means, but it will do for now since the -- files aren't too big. new_col = col + (length cs' - length rest) in Token token (TokenPosition file line col) : (if token == TokenNewline || token == NilNewlineToken then lexer' rest file (line + 1) 1 else lexer' rest file line new_col ) where (token, rest) = lexSymbol cs' -- lexes a single symbol (and passes sequences to additional functions), -- returns the correct token and the remaining text to lex
575
lexer' cs' file line col = let -- This isn't the most efficient means, but it will do for now since the -- files aren't too big. new_col = col + (length cs' - length rest) in Token token (TokenPosition file line col) : (if token == TokenNewline || token == NilNewlineToken then lexer' rest file (line + 1) 1 else lexer' rest file line new_col ) where (token, rest) = lexSymbol cs' -- lexes a single symbol (and passes sequences to additional functions), -- returns the correct token and the remaining text to lex
575
lexer' cs' file line col = let -- This isn't the most efficient means, but it will do for now since the -- files aren't too big. new_col = col + (length cs' - length rest) in Token token (TokenPosition file line col) : (if token == TokenNewline || token == NilNewlineToken then lexer' rest file (line + 1) 1 else lexer' rest file line new_col ) where (token, rest) = lexSymbol cs' -- lexes a single symbol (and passes sequences to additional functions), -- returns the correct token and the remaining text to lex
575
false
false
0
12
157
131
67
64
null
null
fractalcat/unpdf
Main.hs
mit
extractFile :: ExtractorOptions -> IO () extractFile ExtractorOptions{..} = do res <- withBinaryFile argFilename ReadMode $ \handle -> runPdfWithHandle handle knownFilters $ do pgRoot <- document >>= documentCatalog >>= catalogPageNode nPages <- pageNodeNKids pgRoot pages <- mapM (pageNodePageByNum pgRoot) (enumFromTo 0 (nPages - 1)) txts <- mapM pageExtractText pages liftIO $ mapM_ (putStrLn . unpack) txts case res of Left badness -> hPutStr stderr $ "PDF error: " ++ show badness Right _ -> return ()
599
extractFile :: ExtractorOptions -> IO () extractFile ExtractorOptions{..} = do res <- withBinaryFile argFilename ReadMode $ \handle -> runPdfWithHandle handle knownFilters $ do pgRoot <- document >>= documentCatalog >>= catalogPageNode nPages <- pageNodeNKids pgRoot pages <- mapM (pageNodePageByNum pgRoot) (enumFromTo 0 (nPages - 1)) txts <- mapM pageExtractText pages liftIO $ mapM_ (putStrLn . unpack) txts case res of Left badness -> hPutStr stderr $ "PDF error: " ++ show badness Right _ -> return ()
599
extractFile ExtractorOptions{..} = do res <- withBinaryFile argFilename ReadMode $ \handle -> runPdfWithHandle handle knownFilters $ do pgRoot <- document >>= documentCatalog >>= catalogPageNode nPages <- pageNodeNKids pgRoot pages <- mapM (pageNodePageByNum pgRoot) (enumFromTo 0 (nPages - 1)) txts <- mapM pageExtractText pages liftIO $ mapM_ (putStrLn . unpack) txts case res of Left badness -> hPutStr stderr $ "PDF error: " ++ show badness Right _ -> return ()
558
false
true
0
18
168
192
88
104
null
null
vikraman/ghc
compiler/basicTypes/OccName.hs
bsd-3-clause
mkVectTyConOcc = mk_simple_deriv_with tcName "V:"
55
mkVectTyConOcc = mk_simple_deriv_with tcName "V:"
55
mkVectTyConOcc = mk_simple_deriv_with tcName "V:"
55
false
false
0
5
10
11
5
6
null
null
sdiehl/ghc
compiler/nativeGen/X86/CodeGen.hs
bsd-3-clause
getSomeReg :: CmmExpr -> NatM (Reg, InstrBlock) getSomeReg expr = do r <- getRegister expr case r of Any rep code -> do tmp <- getNewRegNat rep return (tmp, code tmp) Fixed _ reg code -> return (reg, code)
241
getSomeReg :: CmmExpr -> NatM (Reg, InstrBlock) getSomeReg expr = do r <- getRegister expr case r of Any rep code -> do tmp <- getNewRegNat rep return (tmp, code tmp) Fixed _ reg code -> return (reg, code)
241
getSomeReg expr = do r <- getRegister expr case r of Any rep code -> do tmp <- getNewRegNat rep return (tmp, code tmp) Fixed _ reg code -> return (reg, code)
193
false
true
0
14
74
102
48
54
null
null
kawu/ltag
src/NLP/LTAG/Tree.hs
bsd-2-clause
step (INode _ xs) k = xs !? k
29
step (INode _ xs) k = xs !? k
29
step (INode _ xs) k = xs !? k
29
false
false
3
6
8
25
11
14
null
null
vladfi1/game-ai
lib/TicTacToe.hs
mit
horizontal = [[(x, y) | x <- range] | y <- range]
49
horizontal = [[(x, y) | x <- range] | y <- range]
49
horizontal = [[(x, y) | x <- range] | y <- range]
49
false
false
1
9
11
38
19
19
null
null
maximilianhuber/softwareProjekt
benchmarks/HeavyBench.hs
bsd-3-clause
multP'' :: [(Int,Int)] -> [(Int,Int)] -> [(Int,Int)] multP'' _ [] = []
76
multP'' :: [(Int,Int)] -> [(Int,Int)] -> [(Int,Int)] multP'' _ [] = []
76
multP'' _ [] = []
23
false
true
0
8
17
55
32
23
null
null
spechub/Hets
OWL2/StaticAnalysis.hs
gpl-2.0
addEquiv :: Sign -> Sign -> [SymbItems] -> [SymbItems] -> Result (Sign, Sign, Sign, EndoMap AS.Entity, EndoMap AS.Entity) addEquiv ssig tsig l1 l2 = do let l1' = statSymbItems ssig l1 l2' = statSymbItems tsig l2 case (l1', l2') of ([rs1], [rs2]) -> do let match1 = filter (`matchesSym` rs1) $ Set.toList $ symOf ssig match2 = filter (`matchesSym` rs2) $ Set.toList $ symOf tsig case (match1, match2) of ([e1], [e2]) -> if AS.entityKind e1 == AS.entityKind e2 then do s <- AS.pairSymbols e1 e2 sig <- addSymbToSign emptySign s sig1 <- addSymbToSign emptySign e1 sig2 <- addSymbToSign emptySign e2 return (sig, sig1, sig2, Map.insert e1 s Map.empty, Map.insert e2 s Map.empty) else fail "only symbols of same kind can be equivalent in an alignment" _ -> fail $ "non-unique symbol match:" ++ showDoc l1 " " ++ showDoc l2 " " _ -> fail "terms not yet supported in alignments"
1,179
addEquiv :: Sign -> Sign -> [SymbItems] -> [SymbItems] -> Result (Sign, Sign, Sign, EndoMap AS.Entity, EndoMap AS.Entity) addEquiv ssig tsig l1 l2 = do let l1' = statSymbItems ssig l1 l2' = statSymbItems tsig l2 case (l1', l2') of ([rs1], [rs2]) -> do let match1 = filter (`matchesSym` rs1) $ Set.toList $ symOf ssig match2 = filter (`matchesSym` rs2) $ Set.toList $ symOf tsig case (match1, match2) of ([e1], [e2]) -> if AS.entityKind e1 == AS.entityKind e2 then do s <- AS.pairSymbols e1 e2 sig <- addSymbToSign emptySign s sig1 <- addSymbToSign emptySign e1 sig2 <- addSymbToSign emptySign e2 return (sig, sig1, sig2, Map.insert e1 s Map.empty, Map.insert e2 s Map.empty) else fail "only symbols of same kind can be equivalent in an alignment" _ -> fail $ "non-unique symbol match:" ++ showDoc l1 " " ++ showDoc l2 " " _ -> fail "terms not yet supported in alignments"
1,179
addEquiv ssig tsig l1 l2 = do let l1' = statSymbItems ssig l1 l2' = statSymbItems tsig l2 case (l1', l2') of ([rs1], [rs2]) -> do let match1 = filter (`matchesSym` rs1) $ Set.toList $ symOf ssig match2 = filter (`matchesSym` rs2) $ Set.toList $ symOf tsig case (match1, match2) of ([e1], [e2]) -> if AS.entityKind e1 == AS.entityKind e2 then do s <- AS.pairSymbols e1 e2 sig <- addSymbToSign emptySign s sig1 <- addSymbToSign emptySign e1 sig2 <- addSymbToSign emptySign e2 return (sig, sig1, sig2, Map.insert e1 s Map.empty, Map.insert e2 s Map.empty) else fail "only symbols of same kind can be equivalent in an alignment" _ -> fail $ "non-unique symbol match:" ++ showDoc l1 " " ++ showDoc l2 " " _ -> fail "terms not yet supported in alignments"
1,024
false
true
0
22
458
374
188
186
null
null
deontologician/orbRPG
Game/OrbRPG/Combinations.hs
gpl-3.0
D Asmodeus @>> P Blue = E Erbium
32
D Asmodeus @>> P Blue = E Erbium
32
D Asmodeus @>> P Blue = E Erbium
32
false
false
0
6
7
21
8
13
null
null
ku-fpg/diagrams-canvas
examples/Gradients.hs
bsd-3-clause
stops' = mkStops [(lightskyblue, 0, 1), (darkgreen, 1, 0.5)]
60
stops' = mkStops [(lightskyblue, 0, 1), (darkgreen, 1, 0.5)]
60
stops' = mkStops [(lightskyblue, 0, 1), (darkgreen, 1, 0.5)]
60
false
false
1
7
8
36
20
16
null
null
ghorn/classy-dvda
src/Classy/State.hs
bsd-3-clause
-- | @c = frameWithAngVel n (wx,wy,wz) name@ defines a new frame @c@ named @name@ -- which is defined as having angular velocity @wx*cx>+ wy*cy> + wz*cz>@ with respect to frame @n@ basesWithAngVel :: Monad a => Bases -> (Sca,Sca,Sca) -> String -> StateT System a Bases basesWithAngVel f0 (wx,wy,wz) name | any isCoord [wx,wy,wz] = error $ "frameWithAngVel can't be given generalized coordinates " ++ show (filter isCoord [wx,wy,wz]) ++ " as speeds" | otherwise = do let rb = RotatedBases f0 (RotSpeed (wx,wy,wz)) name addBases rb return rb
564
basesWithAngVel :: Monad a => Bases -> (Sca,Sca,Sca) -> String -> StateT System a Bases basesWithAngVel f0 (wx,wy,wz) name | any isCoord [wx,wy,wz] = error $ "frameWithAngVel can't be given generalized coordinates " ++ show (filter isCoord [wx,wy,wz]) ++ " as speeds" | otherwise = do let rb = RotatedBases f0 (RotSpeed (wx,wy,wz)) name addBases rb return rb
382
basesWithAngVel f0 (wx,wy,wz) name | any isCoord [wx,wy,wz] = error $ "frameWithAngVel can't be given generalized coordinates " ++ show (filter isCoord [wx,wy,wz]) ++ " as speeds" | otherwise = do let rb = RotatedBases f0 (RotSpeed (wx,wy,wz)) name addBases rb return rb
294
true
true
1
14
114
167
86
81
null
null
haskell-opengl/OpenGLRaw
src/Graphics/GL/ExtensionPredicates.hs
bsd-3-clause
-- | Is the <https://www.opengl.org/registry/specs/ARB/depth_texture.txt ARB_depth_texture> extension supported? -- Note that in the presence of multiple contexts with different capabilities, -- this might be wrong. Use 'glGetARBDepthTexture' in those cases instead. gl_ARB_depth_texture :: Bool gl_ARB_depth_texture = member "GL_ARB_depth_texture" extensions
359
gl_ARB_depth_texture :: Bool gl_ARB_depth_texture = member "GL_ARB_depth_texture" extensions
92
gl_ARB_depth_texture = member "GL_ARB_depth_texture" extensions
63
true
true
0
5
38
19
11
8
null
null
jstolarek/haddock
haddock-api/src/Haddock/Utils.hs
bsd-2-clause
synopsisFrameName = "synopsis"
30
synopsisFrameName = "synopsis"
30
synopsisFrameName = "synopsis"
30
false
false
0
4
2
6
3
3
null
null
lordi/flowskell
src/Flowskell/Lib/GL.hs
gpl-2.0
extractGLfloat :: LispVal -> GLfloat extractGLfloat = realToFrac . extractFloat
79
extractGLfloat :: LispVal -> GLfloat extractGLfloat = realToFrac . extractFloat
79
extractGLfloat = realToFrac . extractFloat
42
false
true
1
7
9
27
11
16
null
null
frantisekfarka/ghc-dsi
libraries/base/System/Posix/Internals.hs
bsd-3-clause
s_isfifo :: CMode -> Bool s_isfifo cm = c_s_isfifo cm /= 0
58
s_isfifo :: CMode -> Bool s_isfifo cm = c_s_isfifo cm /= 0
58
s_isfifo cm = c_s_isfifo cm /= 0
32
false
true
0
6
11
25
12
13
null
null
IgorRodic/fp16-Pongout
dist/build/autogen/Paths_fp16_Pongout.hs
mit
getBinDir :: IO FilePath getBinDir = getPrefixDirRel bindirrel
62
getBinDir :: IO FilePath getBinDir = getPrefixDirRel bindirrel
62
getBinDir = getPrefixDirRel bindirrel
37
false
true
0
6
7
23
9
14
null
null
diku-dk/futhark
src/Futhark/IR/SegOp.hs
isc
segOpType (SegRed _ space reds ts kbody) = red_ts ++ zipWith (segResultShape space) map_ts (drop (length red_ts) $ kernelBodyResult kbody) where map_ts = drop (length red_ts) ts segment_dims = init $ segSpaceDims space red_ts = do op <- reds let shape = Shape segment_dims <> segBinOpShape op map (`arrayOfShape` shape) (lambdaReturnType $ segBinOpLambda op)
414
segOpType (SegRed _ space reds ts kbody) = red_ts ++ zipWith (segResultShape space) map_ts (drop (length red_ts) $ kernelBodyResult kbody) where map_ts = drop (length red_ts) ts segment_dims = init $ segSpaceDims space red_ts = do op <- reds let shape = Shape segment_dims <> segBinOpShape op map (`arrayOfShape` shape) (lambdaReturnType $ segBinOpLambda op)
414
segOpType (SegRed _ space reds ts kbody) = red_ts ++ zipWith (segResultShape space) map_ts (drop (length red_ts) $ kernelBodyResult kbody) where map_ts = drop (length red_ts) ts segment_dims = init $ segSpaceDims space red_ts = do op <- reds let shape = Shape segment_dims <> segBinOpShape op map (`arrayOfShape` shape) (lambdaReturnType $ segBinOpLambda op)
414
false
false
2
12
109
147
70
77
null
null
urbanslug/ghc
compiler/main/HscTypes.hs
bsd-3-clause
extras_plus :: TyThing -> [TyThing] extras_plus thing = thing : implicitTyThings thing
86
extras_plus :: TyThing -> [TyThing] extras_plus thing = thing : implicitTyThings thing
86
extras_plus thing = thing : implicitTyThings thing
50
false
true
2
8
11
34
15
19
null
null
brendanhay/gogol
gogol-android-enterprise/gen/Network/Google/AndroidEnterprise/Types/Product.hs
mpl-2.0
-- | Creates a value of 'AutoInstallConstraint' with the minimum fields required to make a request. -- -- Use one of the following lenses to modify other fields as desired: -- -- * 'aicChargingStateConstraint' -- -- * 'aicDeviceIdleStateConstraint' -- -- * 'aicNetworkTypeConstraint' autoInstallConstraint :: AutoInstallConstraint autoInstallConstraint = AutoInstallConstraint' { _aicChargingStateConstraint = Nothing , _aicDeviceIdleStateConstraint = Nothing , _aicNetworkTypeConstraint = Nothing }
521
autoInstallConstraint :: AutoInstallConstraint autoInstallConstraint = AutoInstallConstraint' { _aicChargingStateConstraint = Nothing , _aicDeviceIdleStateConstraint = Nothing , _aicNetworkTypeConstraint = Nothing }
237
autoInstallConstraint = AutoInstallConstraint' { _aicChargingStateConstraint = Nothing , _aicDeviceIdleStateConstraint = Nothing , _aicNetworkTypeConstraint = Nothing }
186
true
true
1
7
82
47
29
18
null
null
GinBaby/applicatives
address/src/Main.hs
gpl-3.0
parserInfoCommand :: ParserInfo Command parserInfoCommand = info parserCommand (progDesc "Manage address book.")
112
parserInfoCommand :: ParserInfo Command parserInfoCommand = info parserCommand (progDesc "Manage address book.")
112
parserInfoCommand = info parserCommand (progDesc "Manage address book.")
72
false
true
0
7
11
25
12
13
null
null
DigitalBrains1/clash-lt24
Simul/Common.hs
bsd-2-clause
{- - Construct a list of inputs from a list of events - - The function `eventList` is to deal with the input to CLaSH's simulate - function on another conceptual level. A list of events coupled with a - user-defined function to convert a "Set" event to a new input is used to - generate a list of inputs (i.e., a stream). - - Arguments: - tr - The user-defined state transformer - f - Operating frequency (for using "Time" events) - s - The initial state of the inputs - es - The event list - - As an example, let's define the input of the function to simulate as - (Bit, Unsigned 8); i.e., it has two inputs: just a wire and an 8-bit port - interpreted as an unsigned number. Let's call the inputs a and n - respectively. Suppose we define a type as follows: - - data SI = A Bit | N (Unsigned 8) - - Now the state transformer is simply: - - trSI (a, n) (A a') = (a', n ) - trSI (a, n) (N n') = (a , n') - - And we could generate an input stream from an event list as follows: - - eventList trSI 50e6 (L, 0) [ Set A H, Set N 5, Ticks 1, Set A L, Time 52e-9 - , Set N 0, Infinity ] - - Every Time or Ticks statement advances time. A Time statement advances to - the first clock tick /after/ the amount of time specified has past. A Set - statement does not advance time, so you can alter multiple inputs in one - clock tick. - - The statement 'Infinity' simply keeps the inputs the same for an infinite - amount of time. -} eventList :: Real f => (c -> b -> c) -> f -> c -> [EventList b] -> [c] eventList tr f s [] = []
1,587
eventList :: Real f => (c -> b -> c) -> f -> c -> [EventList b] -> [c] eventList tr f s [] = []
95
eventList tr f s [] = []
24
true
true
0
11
392
68
35
33
null
null
apyrgio/ganeti
src/Ganeti/HTools/Program/Hspace.hs
bsd-2-clause
-- | Cpu efficiency. cpuEff :: Cluster.CStats -> Double cpuEff = effFn Cluster.csIcpu (fromIntegral . Cluster.csVcpu)
117
cpuEff :: Cluster.CStats -> Double cpuEff = effFn Cluster.csIcpu (fromIntegral . Cluster.csVcpu)
96
cpuEff = effFn Cluster.csIcpu (fromIntegral . Cluster.csVcpu)
61
true
true
0
8
15
41
19
22
null
null
ComputationWithBoundedResources/jat
src/Jat/Utils/TRS.hs
bsd-3-clause
prettyPARule :: PARule -> Doc prettyPARule (r,[]) = prettyRule r
64
prettyPARule :: PARule -> Doc prettyPARule (r,[]) = prettyRule r
64
prettyPARule (r,[]) = prettyRule r
34
false
true
0
7
9
29
15
14
null
null
derekelkins/servant-docs
src/Servant/Docs.hs
bsd-3-clause
-- Default 'Action'. Has no 'captures', no GET 'params', expects -- no request body ('rqbody') and the typical response is 'defResponse'. -- -- Tweakable with lenses. -- -- > λ> defAction -- > Action {_captures = [], _params = [], _rqbody = Nothing, _response = Response {_respStatus = 200, _respBody = Nothing}} -- > λ> defAction & response.respStatus .~ 201 -- > Action {_captures = [], _params = [], _rqbody = Nothing, _response = Response {_respStatus = 201, _respBody = Nothing}} defAction :: Action defAction = Action [] [] [] Nothing defResponse
590
defAction :: Action defAction = Action [] [] [] Nothing defResponse
105
defAction = Action [] [] [] Nothing defResponse
85
true
true
0
6
129
48
24
24
null
null
vladimir-ipatov/ganeti
src/Ganeti/Constants.hs
gpl-2.0
instanceRebootExit :: String instanceRebootExit = "exit"
56
instanceRebootExit :: String instanceRebootExit = "exit"
56
instanceRebootExit = "exit"
27
false
true
0
6
5
18
7
11
null
null
MajronMan/Himage
app/Main.hs
bsd-3-clause
-- | -- Main function: asks for input, calls functions and sings quietly main :: IO () main = greeter
101
main :: IO () main = greeter
28
main = greeter
14
true
true
0
6
19
18
10
8
null
null
Ongy/monky
Monky/Examples/Tminus.hs
lgpl-3.0
getCurrent :: TargetTime -> IO [MonkyOut] getCurrent (TargetTime target) = do now <- getCurrentTime timezone <- getCurrentTimeZone let (TimeOfDay hour minute second) = localTimeOfDay $ utcToLocalTime timezone now nowSeconds = timeToSeconds [hour, minute, (floor second)] targetSeconds = timeToSeconds target delta = diffTime targetSeconds nowSeconds pure $ [ MonkyPlain . T.pack $ renderSecs (toInteger delta) ]
451
getCurrent :: TargetTime -> IO [MonkyOut] getCurrent (TargetTime target) = do now <- getCurrentTime timezone <- getCurrentTimeZone let (TimeOfDay hour minute second) = localTimeOfDay $ utcToLocalTime timezone now nowSeconds = timeToSeconds [hour, minute, (floor second)] targetSeconds = timeToSeconds target delta = diffTime targetSeconds nowSeconds pure $ [ MonkyPlain . T.pack $ renderSecs (toInteger delta) ]
451
getCurrent (TargetTime target) = do now <- getCurrentTime timezone <- getCurrentTimeZone let (TimeOfDay hour minute second) = localTimeOfDay $ utcToLocalTime timezone now nowSeconds = timeToSeconds [hour, minute, (floor second)] targetSeconds = timeToSeconds target delta = diffTime targetSeconds nowSeconds pure $ [ MonkyPlain . T.pack $ renderSecs (toInteger delta) ]
409
false
true
0
13
94
143
70
73
null
null
chetant/bioSpace
Handler/Wiki.hs
bsd-2-clause
getPageCreateR :: Handler RepHtml getPageCreateR = do uId <- requireAuthId profile <- runDB $ snd <$> getBy404 (UniqueProfile uId) case (isEditableType . profileType) profile of True -> do ((res, form), enctype) <- runFormPost $ pageFormlet Nothing defaultLayout $ do setTitle "Create New Page" let objName :: Text objName = "Create Page" actionName :: Text actionName = "Create" addWidget $(widgetFile "createEdit") False -> permissionDenied "Not Authorized"
611
getPageCreateR :: Handler RepHtml getPageCreateR = do uId <- requireAuthId profile <- runDB $ snd <$> getBy404 (UniqueProfile uId) case (isEditableType . profileType) profile of True -> do ((res, form), enctype) <- runFormPost $ pageFormlet Nothing defaultLayout $ do setTitle "Create New Page" let objName :: Text objName = "Create Page" actionName :: Text actionName = "Create" addWidget $(widgetFile "createEdit") False -> permissionDenied "Not Authorized"
611
getPageCreateR = do uId <- requireAuthId profile <- runDB $ snd <$> getBy404 (UniqueProfile uId) case (isEditableType . profileType) profile of True -> do ((res, form), enctype) <- runFormPost $ pageFormlet Nothing defaultLayout $ do setTitle "Create New Page" let objName :: Text objName = "Create Page" actionName :: Text actionName = "Create" addWidget $(widgetFile "createEdit") False -> permissionDenied "Not Authorized"
577
false
true
0
19
216
159
74
85
null
null
sdiehl/ghc
compiler/simplCore/SetLevels.hs
bsd-3-clause
extendCaseBndrEnv env _ _ = env
31
extendCaseBndrEnv env _ _ = env
31
extendCaseBndrEnv env _ _ = env
31
false
false
0
5
5
13
6
7
null
null
mydaum/cabal
Cabal/Distribution/Simple/BuildTarget.hs
bsd-3-clause
componentStringName _ (CFLibName name) = unUnqualComponentName name
70
componentStringName _ (CFLibName name) = unUnqualComponentName name
70
componentStringName _ (CFLibName name) = unUnqualComponentName name
70
false
false
0
7
9
20
9
11
null
null
bitemyapp/ghc
libraries/template-haskell/Language/Haskell/TH/Syntax.hs
bsd-3-clause
unboxedTupleDataName n = mk_unboxed_tup_name (n-1) DataName
59
unboxedTupleDataName n = mk_unboxed_tup_name (n-1) DataName
59
unboxedTupleDataName n = mk_unboxed_tup_name (n-1) DataName
59
false
false
0
7
5
21
10
11
null
null
siddhanathan/ghc
compiler/prelude/PrelNames.hs
bsd-3-clause
uIntHash_RDR = varQual_RDR gHC_GENERICS (fsLit "uInt#")
58
uIntHash_RDR = varQual_RDR gHC_GENERICS (fsLit "uInt#")
58
uIntHash_RDR = varQual_RDR gHC_GENERICS (fsLit "uInt#")
58
false
false
0
7
8
17
8
9
null
null
ezyang/ghc
libraries/base/GHC/Event/PSQ.hs
bsd-3-clause
nomatch :: Key -> Key -> Mask -> Bool nomatch k1 k2 m = natFromInt (asInt k1) .&. m' /= natFromInt (asInt k2) .&. m' where m' = maskW (natFromInt m)
160
nomatch :: Key -> Key -> Mask -> Bool nomatch k1 k2 m = natFromInt (asInt k1) .&. m' /= natFromInt (asInt k2) .&. m' where m' = maskW (natFromInt m)
160
nomatch k1 k2 m = natFromInt (asInt k1) .&. m' /= natFromInt (asInt k2) .&. m' where m' = maskW (natFromInt m)
122
false
true
0
10
42
77
37
40
null
null
peterokagey/haskellOEIS
test/Coins/A047932Spec.hs
apache-2.0
main :: IO () main = hspec spec
31
main :: IO () main = hspec spec
31
main = hspec spec
17
false
true
0
7
7
25
10
15
null
null
lucasdicioccio/haskell-paris-src
app.hs
apache-2.0
main :: IO () main = do config <- readConfig pipe <- runIOE $ connect (host $ dbServer config) let db = access pipe master $ dbName config isAdmin = isAuthentified $ authTest config adminOnly = basicAuth $ authTest config scotty 3000 $ do middleware logStdoutDev middleware (staticPolicy $ addBase "static/") W.get "/" $ do results <- liftIO $ db $ find' (select [] "meetup") let page = either (\_ -> degradedHomepage []) (\xs -> homepage $ map fst xs) results html $ TL.pack $ page W.post "/talk" $ do (who :: String) <- param "talk[speaker]" (title :: String) <- param "talk[title]" (dur :: Int) <- param "talk[duration]" (lvl :: String) <- param "talk[difficulty]" let talk = submittedTalk who title dur lvl insertAndRedirect db "/talk" talk W.get "/talk" $ do adminOnly $ do let query = (select [] "talk") findAndRender db query listTalkPage W.get "/talk/:id" $ do auth <- isAdmin (oId :: ObjectId) <- param "id" >>= return . read let query = (select ["_id" := ObjId oId] "talk") {limit = 1} findAndRender db query (if auth ; then editTalkPage ; else displayTalkPage) deleteFromPost "/talk/:id" $ do adminOnly $ do (oId :: ObjectId)<- param "id" >>= return . read deleteAndRedirect db "/talk" (model :: Talk) oId W.post "/talk/:id" $ do adminOnly $ do (oId :: ObjectId) <- param "id" >>= return . read (who :: String) <- param "talk[speaker]" (title :: String) <- param "talk[title]" (dur :: Int) <- param "talk[duration]" (lvl :: String) <- param "talk[difficulty]" (st :: String) <- param "talk[status]" let talk = Talk who title dur lvl st replaceAndRedirect db "/talk" talk oId W.get "/meetup" $ do adminOnly $ do let query = (select [] "meetup") findAndRender db query listMeetupPage W.get "/meetup/:id" $ do adminOnly $ do (oId :: ObjectId) <- param "id" >>= return . read let query = (select ["_id" := ObjId oId] "meetup") {limit = 1} findAndRender db query editMeetupPage W.post "/meetup" $ do adminOnly $ do (year :: Int) <- param "meetup[year]" (month :: String) <- param "meetup[month]" (place :: String) <- param "meetup[place]" (summary :: String) <- param "meetup[summary]" (sponsors :: [String])<- param "meetup[sponsors]" >>= return . lines (links :: [String])<- param "meetup[links]" >>= return . lines (slides :: [String])<- param "meetup[slides]" >>= return . lines let m = newMeetup year month place sponsors summary links slides insertAndRedirect db "/meetup" m deleteFromPost "/meetup/:id" $ do adminOnly $ do (oId :: ObjectId)<- param "id" >>= return . read deleteAndRedirect db "/meetup" (model :: Meetup) oId W.post "/meetup/:id" $ do adminOnly $ do (year :: Int) <- param "meetup[year]" (month :: String) <- param "meetup[month]" (place :: String) <- param "meetup[place]" (summary :: String) <- param "meetup[summary]" (sponsors :: [String])<- param "meetup[sponsors]" >>= return . lines (links :: [String])<- param "meetup[links]" >>= return . lines (slides :: [String])<- param "meetup[slides]" >>= return . lines (oId :: ObjectId)<- param "id" >>= return . read let m = newMeetup year month place sponsors summary links slides replaceAndRedirect db "/meetup" m oId close pipe -- helpers -- -- a Scotty handler that handles HTTP-POST as HTTP-DELETE -- this method uses the wanted-http-method field of the HTTP-POST -- note that, this function must be called before any "POST" handlers on same paths
4,495
main :: IO () main = do config <- readConfig pipe <- runIOE $ connect (host $ dbServer config) let db = access pipe master $ dbName config isAdmin = isAuthentified $ authTest config adminOnly = basicAuth $ authTest config scotty 3000 $ do middleware logStdoutDev middleware (staticPolicy $ addBase "static/") W.get "/" $ do results <- liftIO $ db $ find' (select [] "meetup") let page = either (\_ -> degradedHomepage []) (\xs -> homepage $ map fst xs) results html $ TL.pack $ page W.post "/talk" $ do (who :: String) <- param "talk[speaker]" (title :: String) <- param "talk[title]" (dur :: Int) <- param "talk[duration]" (lvl :: String) <- param "talk[difficulty]" let talk = submittedTalk who title dur lvl insertAndRedirect db "/talk" talk W.get "/talk" $ do adminOnly $ do let query = (select [] "talk") findAndRender db query listTalkPage W.get "/talk/:id" $ do auth <- isAdmin (oId :: ObjectId) <- param "id" >>= return . read let query = (select ["_id" := ObjId oId] "talk") {limit = 1} findAndRender db query (if auth ; then editTalkPage ; else displayTalkPage) deleteFromPost "/talk/:id" $ do adminOnly $ do (oId :: ObjectId)<- param "id" >>= return . read deleteAndRedirect db "/talk" (model :: Talk) oId W.post "/talk/:id" $ do adminOnly $ do (oId :: ObjectId) <- param "id" >>= return . read (who :: String) <- param "talk[speaker]" (title :: String) <- param "talk[title]" (dur :: Int) <- param "talk[duration]" (lvl :: String) <- param "talk[difficulty]" (st :: String) <- param "talk[status]" let talk = Talk who title dur lvl st replaceAndRedirect db "/talk" talk oId W.get "/meetup" $ do adminOnly $ do let query = (select [] "meetup") findAndRender db query listMeetupPage W.get "/meetup/:id" $ do adminOnly $ do (oId :: ObjectId) <- param "id" >>= return . read let query = (select ["_id" := ObjId oId] "meetup") {limit = 1} findAndRender db query editMeetupPage W.post "/meetup" $ do adminOnly $ do (year :: Int) <- param "meetup[year]" (month :: String) <- param "meetup[month]" (place :: String) <- param "meetup[place]" (summary :: String) <- param "meetup[summary]" (sponsors :: [String])<- param "meetup[sponsors]" >>= return . lines (links :: [String])<- param "meetup[links]" >>= return . lines (slides :: [String])<- param "meetup[slides]" >>= return . lines let m = newMeetup year month place sponsors summary links slides insertAndRedirect db "/meetup" m deleteFromPost "/meetup/:id" $ do adminOnly $ do (oId :: ObjectId)<- param "id" >>= return . read deleteAndRedirect db "/meetup" (model :: Meetup) oId W.post "/meetup/:id" $ do adminOnly $ do (year :: Int) <- param "meetup[year]" (month :: String) <- param "meetup[month]" (place :: String) <- param "meetup[place]" (summary :: String) <- param "meetup[summary]" (sponsors :: [String])<- param "meetup[sponsors]" >>= return . lines (links :: [String])<- param "meetup[links]" >>= return . lines (slides :: [String])<- param "meetup[slides]" >>= return . lines (oId :: ObjectId)<- param "id" >>= return . read let m = newMeetup year month place sponsors summary links slides replaceAndRedirect db "/meetup" m oId close pipe -- helpers -- -- a Scotty handler that handles HTTP-POST as HTTP-DELETE -- this method uses the wanted-http-method field of the HTTP-POST -- note that, this function must be called before any "POST" handlers on same paths
4,495
main = do config <- readConfig pipe <- runIOE $ connect (host $ dbServer config) let db = access pipe master $ dbName config isAdmin = isAuthentified $ authTest config adminOnly = basicAuth $ authTest config scotty 3000 $ do middleware logStdoutDev middleware (staticPolicy $ addBase "static/") W.get "/" $ do results <- liftIO $ db $ find' (select [] "meetup") let page = either (\_ -> degradedHomepage []) (\xs -> homepage $ map fst xs) results html $ TL.pack $ page W.post "/talk" $ do (who :: String) <- param "talk[speaker]" (title :: String) <- param "talk[title]" (dur :: Int) <- param "talk[duration]" (lvl :: String) <- param "talk[difficulty]" let talk = submittedTalk who title dur lvl insertAndRedirect db "/talk" talk W.get "/talk" $ do adminOnly $ do let query = (select [] "talk") findAndRender db query listTalkPage W.get "/talk/:id" $ do auth <- isAdmin (oId :: ObjectId) <- param "id" >>= return . read let query = (select ["_id" := ObjId oId] "talk") {limit = 1} findAndRender db query (if auth ; then editTalkPage ; else displayTalkPage) deleteFromPost "/talk/:id" $ do adminOnly $ do (oId :: ObjectId)<- param "id" >>= return . read deleteAndRedirect db "/talk" (model :: Talk) oId W.post "/talk/:id" $ do adminOnly $ do (oId :: ObjectId) <- param "id" >>= return . read (who :: String) <- param "talk[speaker]" (title :: String) <- param "talk[title]" (dur :: Int) <- param "talk[duration]" (lvl :: String) <- param "talk[difficulty]" (st :: String) <- param "talk[status]" let talk = Talk who title dur lvl st replaceAndRedirect db "/talk" talk oId W.get "/meetup" $ do adminOnly $ do let query = (select [] "meetup") findAndRender db query listMeetupPage W.get "/meetup/:id" $ do adminOnly $ do (oId :: ObjectId) <- param "id" >>= return . read let query = (select ["_id" := ObjId oId] "meetup") {limit = 1} findAndRender db query editMeetupPage W.post "/meetup" $ do adminOnly $ do (year :: Int) <- param "meetup[year]" (month :: String) <- param "meetup[month]" (place :: String) <- param "meetup[place]" (summary :: String) <- param "meetup[summary]" (sponsors :: [String])<- param "meetup[sponsors]" >>= return . lines (links :: [String])<- param "meetup[links]" >>= return . lines (slides :: [String])<- param "meetup[slides]" >>= return . lines let m = newMeetup year month place sponsors summary links slides insertAndRedirect db "/meetup" m deleteFromPost "/meetup/:id" $ do adminOnly $ do (oId :: ObjectId)<- param "id" >>= return . read deleteAndRedirect db "/meetup" (model :: Meetup) oId W.post "/meetup/:id" $ do adminOnly $ do (year :: Int) <- param "meetup[year]" (month :: String) <- param "meetup[month]" (place :: String) <- param "meetup[place]" (summary :: String) <- param "meetup[summary]" (sponsors :: [String])<- param "meetup[sponsors]" >>= return . lines (links :: [String])<- param "meetup[links]" >>= return . lines (slides :: [String])<- param "meetup[slides]" >>= return . lines (oId :: ObjectId)<- param "id" >>= return . read let m = newMeetup year month place sponsors summary links slides replaceAndRedirect db "/meetup" m oId close pipe -- helpers -- -- a Scotty handler that handles HTTP-POST as HTTP-DELETE -- this method uses the wanted-http-method field of the HTTP-POST -- note that, this function must be called before any "POST" handlers on same paths
4,481
false
true
0
37
1,698
1,347
630
717
null
null
haskell-infra/hackage-server
Distribution/Server/Features/Distro/Backup.hs
bsd-3-clause
dumpBackup :: Distros -> [BackupEntry] dumpBackup allDist = let distros = distDistros allDist versions = distVersions allDist in distroUsersToExport distros:distrosToExport distros versions
207
dumpBackup :: Distros -> [BackupEntry] dumpBackup allDist = let distros = distDistros allDist versions = distVersions allDist in distroUsersToExport distros:distrosToExport distros versions
207
dumpBackup allDist = let distros = distDistros allDist versions = distVersions allDist in distroUsersToExport distros:distrosToExport distros versions
167
false
true
2
9
39
64
27
37
null
null
wavewave/madgraph-auto-dataset
src/HEP/Automation/MadGraph/Dataset/Set20110314set1.hs
gpl-3.0
zptasklist :: [WorkSetup] zptasklist = [ WS my_ssetup (psetup_zp_ttbar01j) (rsetupGen p MLM (UserCutDef ucut) RunPGS 100000 num) my_csetup | p <- zpparamset , num <- sets ]
274
zptasklist :: [WorkSetup] zptasklist = [ WS my_ssetup (psetup_zp_ttbar01j) (rsetupGen p MLM (UserCutDef ucut) RunPGS 100000 num) my_csetup | p <- zpparamset , num <- sets ]
274
zptasklist = [ WS my_ssetup (psetup_zp_ttbar01j) (rsetupGen p MLM (UserCutDef ucut) RunPGS 100000 num) my_csetup | p <- zpparamset , num <- sets ]
248
false
true
0
10
128
67
35
32
null
null
adinapoli/xmonad-contrib
XMonad/Hooks/ManageHelpers.hs
bsd-3-clause
currentWs :: Query WorkspaceId currentWs = liftX (withWindowSet $ return . W.currentTag)
88
currentWs :: Query WorkspaceId currentWs = liftX (withWindowSet $ return . W.currentTag)
88
currentWs = liftX (withWindowSet $ return . W.currentTag)
57
false
true
0
8
11
30
15
15
null
null
LasVegasFunctionalProgrammingGroup/haskell-higher-rank-types
Main.hs
unlicense
priceMeal :: Pricer' -> Meal -> Int priceMeal pricer (Meal f d) = pricer f + pricer d
87
priceMeal :: Pricer' -> Meal -> Int priceMeal pricer (Meal f d) = pricer f + pricer d
85
priceMeal pricer (Meal f d) = pricer f + pricer d
49
false
true
0
7
19
42
20
22
null
null
bus000/Dikunt
src/Types/Internal.hs
bsd-3-clause
getClientCommand ClientNames{} = NAMES
38
getClientCommand ClientNames{} = NAMES
38
getClientCommand ClientNames{} = NAMES
38
false
false
1
5
3
16
6
10
null
null
ndmitchell/tagsoup
test/TagSoup/Generate/Desugar.hs
bsd-3-clause
fPat v x = err ("fPat",v,x)
27
fPat v x = err ("fPat",v,x)
27
fPat v x = err ("fPat",v,x)
27
false
false
0
6
5
23
12
11
null
null
pavelfatin/regex
Regex_Test.hs
gpl-3.0
testNot = TestCase $ do assertVariants "a(?!b)b" (mSeq [mChar 'a', mNot $ mAhead $ mChar 'b', mChar 'b']) "ab" [] assertVariants "a(?!a)b" (mSeq [mChar 'a', mNot $ mAhead $ mChar 'a', mChar 'b']) "ab" ["ab"] assertVariants "(.)(?!\\1)\\1" (mSeq [mGroup 1 $ mAny, mNot $ mAhead $ mRef 1, mRef 1]) "aa" []
315
testNot = TestCase $ do assertVariants "a(?!b)b" (mSeq [mChar 'a', mNot $ mAhead $ mChar 'b', mChar 'b']) "ab" [] assertVariants "a(?!a)b" (mSeq [mChar 'a', mNot $ mAhead $ mChar 'a', mChar 'b']) "ab" ["ab"] assertVariants "(.)(?!\\1)\\1" (mSeq [mGroup 1 $ mAny, mNot $ mAhead $ mRef 1, mRef 1]) "aa" []
315
testNot = TestCase $ do assertVariants "a(?!b)b" (mSeq [mChar 'a', mNot $ mAhead $ mChar 'b', mChar 'b']) "ab" [] assertVariants "a(?!a)b" (mSeq [mChar 'a', mNot $ mAhead $ mChar 'a', mChar 'b']) "ab" ["ab"] assertVariants "(.)(?!\\1)\\1" (mSeq [mGroup 1 $ mAny, mNot $ mAhead $ mRef 1, mRef 1]) "aa" []
315
false
false
0
13
63
153
74
79
null
null
brendanhay/gogol
gogol-commentanalyzer/gen/Network/Google/CommentAnalyzer/Types.hs
mpl-2.0
-- | View your email address userInfoEmailScope :: Proxy '["https://www.googleapis.com/auth/userinfo.email"] userInfoEmailScope = Proxy
135
userInfoEmailScope :: Proxy '["https://www.googleapis.com/auth/userinfo.email"] userInfoEmailScope = Proxy
106
userInfoEmailScope = Proxy
26
true
true
0
7
12
20
11
9
null
null
phischu/fragnix
app/CreateEnv.hs
bsd-3-clause
createInclude :: IO () createInclude = do putStrLn "Initializing .fragnix/include ..." hfiles <- getHFiles createDirectoryIfMissing True includePath forM_ hfiles $ \file -> do putStrLn $ " Copying " ++ file ++ "..." copyFile ("builtins" </> "include" </> file) (includePath </> file) return () -- Include the correct Builtin environment
357
createInclude :: IO () createInclude = do putStrLn "Initializing .fragnix/include ..." hfiles <- getHFiles createDirectoryIfMissing True includePath forM_ hfiles $ \file -> do putStrLn $ " Copying " ++ file ++ "..." copyFile ("builtins" </> "include" </> file) (includePath </> file) return () -- Include the correct Builtin environment
357
createInclude = do putStrLn "Initializing .fragnix/include ..." hfiles <- getHFiles createDirectoryIfMissing True includePath forM_ hfiles $ \file -> do putStrLn $ " Copying " ++ file ++ "..." copyFile ("builtins" </> "include" </> file) (includePath </> file) return () -- Include the correct Builtin environment
334
false
true
0
15
69
108
48
60
null
null
fmapfmapfmap/amazonka
amazonka-support/gen/Network/AWS/Support/DescribeTrustedAdvisorCheckSummaries.hs
mpl-2.0
-- | Creates a value of 'DescribeTrustedAdvisorCheckSummaries' with the minimum fields required to make a request. -- -- Use one of the following lenses to modify other fields as desired: -- -- * 'dtacsCheckIds' describeTrustedAdvisorCheckSummaries :: DescribeTrustedAdvisorCheckSummaries describeTrustedAdvisorCheckSummaries = DescribeTrustedAdvisorCheckSummaries' { _dtacsCheckIds = mempty }
409
describeTrustedAdvisorCheckSummaries :: DescribeTrustedAdvisorCheckSummaries describeTrustedAdvisorCheckSummaries = DescribeTrustedAdvisorCheckSummaries' { _dtacsCheckIds = mempty }
197
describeTrustedAdvisorCheckSummaries = DescribeTrustedAdvisorCheckSummaries' { _dtacsCheckIds = mempty }
116
true
true
0
7
60
34
18
16
null
null
sumitsahrawat/IHaskell
src/tests/IHaskell/Test/Completion.hs
mit
completionEventInDirectory :: String -> IO (String, [String]) completionEventInDirectory string = withHsDirectory $ const $ completionEvent string
146
completionEventInDirectory :: String -> IO (String, [String]) completionEventInDirectory string = withHsDirectory $ const $ completionEvent string
146
completionEventInDirectory string = withHsDirectory $ const $ completionEvent string
84
false
true
0
8
15
41
21
20
null
null
michaelfeathers/vih
rendering.hs
mit
render :: EditBuffer -> IO () render (EditBuffer topLine (x,y) contents) = do writeAt home $ window screenLines goto (x, y - topLine) where window = unlines . take yExtent . drop topLine screenLines = (lines contents) ++ (repeat "~") goto :: Location -> IO () goto (x,y) = putStr ("\ESC[" ++ show (y + 1) ++ "; " ++ show (x + 1) ++ "H") writeAt :: Location -> String -> IO () writeAt location xs = do goto location putStr xs
461
render :: EditBuffer -> IO () render (EditBuffer topLine (x,y) contents) = do writeAt home $ window screenLines goto (x, y - topLine) where window = unlines . take yExtent . drop topLine screenLines = (lines contents) ++ (repeat "~") goto :: Location -> IO () goto (x,y) = putStr ("\ESC[" ++ show (y + 1) ++ "; " ++ show (x + 1) ++ "H") writeAt :: Location -> String -> IO () writeAt location xs = do goto location putStr xs
461
render (EditBuffer topLine (x,y) contents) = do writeAt home $ window screenLines goto (x, y - topLine) where window = unlines . take yExtent . drop topLine screenLines = (lines contents) ++ (repeat "~") goto :: Location -> IO () goto (x,y) = putStr ("\ESC[" ++ show (y + 1) ++ "; " ++ show (x + 1) ++ "H") writeAt :: Location -> String -> IO () writeAt location xs = do goto location putStr xs
431
false
true
0
12
119
234
111
123
null
null
Erdwolf/autotool-bonn
src/EditDistance/CalculateTable.hs
gpl-2.0
table :: String -> String -> [[Int]] table s t = dt where n = length s m = length t d (i,j) | i==n = m-j | j==m = n-i | s!!i == t!!j = min3 (1 + dt !! i !! (j+1), 1 + dt !! (i+1) !! j, dt !! (i+1) !! (j+1)) | otherwise = 1 + min3 (dt !! i !! (j+1), dt !! (i+1) !! j, dt !! (i+1) !! (j+1)) dt = [ [ d (i,j) | j <- [0..m] ] | i <- [0..n] ] min3 (x,y,z) = min x (min y z)
567
table :: String -> String -> [[Int]] table s t = dt where n = length s m = length t d (i,j) | i==n = m-j | j==m = n-i | s!!i == t!!j = min3 (1 + dt !! i !! (j+1), 1 + dt !! (i+1) !! j, dt !! (i+1) !! (j+1)) | otherwise = 1 + min3 (dt !! i !! (j+1), dt !! (i+1) !! j, dt !! (i+1) !! (j+1)) dt = [ [ d (i,j) | j <- [0..m] ] | i <- [0..n] ] min3 (x,y,z) = min x (min y z)
567
table s t = dt where n = length s m = length t d (i,j) | i==n = m-j | j==m = n-i | s!!i == t!!j = min3 (1 + dt !! i !! (j+1), 1 + dt !! (i+1) !! j, dt !! (i+1) !! (j+1)) | otherwise = 1 + min3 (dt !! i !! (j+1), dt !! (i+1) !! j, dt !! (i+1) !! (j+1)) dt = [ [ d (i,j) | j <- [0..m] ] | i <- [0..n] ] min3 (x,y,z) = min x (min y z)
530
false
true
0
12
299
338
179
159
null
null
alexander-b/thug-beginners
lessonA/A1Nat.hs
gpl-3.0
fib :: Nat -> Nat -- No tutorial is complete without "Hallo, world!". But in functional -- programming, we tend to implement the fibonacci sequence instead! The nice -- thing about the fibonacci sequence is that its mathematical definition maps -- pretty perfectly to Haskell. -- -- The definition is as follows: -- fib n = fib (n - 1) + fib (n - 2) -- With two seeds: -- fib 0 = 0 -- fib 1 = 1 -- -- Now you give it a go, using our Nat type. fib Z = undefined
474
fib :: Nat -> Nat fib Z = undefined
43
fib Z = undefined
25
true
true
0
5
108
34
22
12
null
null
vTurbine/ghc
compiler/main/HscMain.hs
bsd-3-clause
hscFileFrontEnd :: ModSummary -> Hsc TcGblEnv hscFileFrontEnd mod_summary = do hpm <- hscParse' mod_summary hsc_env <- getHscEnv tcg_env <- tcRnModule' hsc_env mod_summary False hpm return tcg_env -------------------------------------------------------------- -- Safe Haskell -------------------------------------------------------------- -- Note [Safe Haskell Trust Check] -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -- Safe Haskell checks that an import is trusted according to the following -- rules for an import of module M that resides in Package P: -- -- * If M is recorded as Safe and all its trust dependencies are OK -- then M is considered safe. -- * If M is recorded as Trustworthy and P is considered trusted and -- all M's trust dependencies are OK then M is considered safe. -- -- By trust dependencies we mean that the check is transitive. So if -- a module M that is Safe relies on a module N that is trustworthy, -- importing module M will first check (according to the second case) -- that N is trusted before checking M is trusted. -- -- This is a minimal description, so please refer to the user guide -- for more details. The user guide is also considered the authoritative -- source in this matter, not the comments or code. -- Note [Safe Haskell Inference] -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -- Safe Haskell does Safe inference on modules that don't have any specific -- safe haskell mode flag. The basic approach to this is: -- * When deciding if we need to do a Safe language check, treat -- an unmarked module as having -XSafe mode specified. -- * For checks, don't throw errors but return them to the caller. -- * Caller checks if there are errors: -- * For modules explicitly marked -XSafe, we throw the errors. -- * For unmarked modules (inference mode), we drop the errors -- and mark the module as being Unsafe. -- -- It used to be that we only did safe inference on modules that had no Safe -- Haskell flags, but now we perform safe inference on all modules as we want -- to allow users to set the `-Wsafe`, `-Wunsafe` and -- `-Wtrustworthy-safe` flags on Trustworthy and Unsafe modules so that a -- user can ensure their assumptions are correct and see reasons for why a -- module is safe or unsafe. -- -- This is tricky as we must be careful when we should throw an error compared -- to just warnings. For checking safe imports we manage it as two steps. First -- we check any imports that are required to be safe, then we check all other -- imports to see if we can infer them to be safe. -- | Check that the safe imports of the module being compiled are valid. -- If not we either issue a compilation error if the module is explicitly -- using Safe Haskell, or mark the module as unsafe if we're in safe -- inference mode.
2,810
hscFileFrontEnd :: ModSummary -> Hsc TcGblEnv hscFileFrontEnd mod_summary = do hpm <- hscParse' mod_summary hsc_env <- getHscEnv tcg_env <- tcRnModule' hsc_env mod_summary False hpm return tcg_env -------------------------------------------------------------- -- Safe Haskell -------------------------------------------------------------- -- Note [Safe Haskell Trust Check] -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -- Safe Haskell checks that an import is trusted according to the following -- rules for an import of module M that resides in Package P: -- -- * If M is recorded as Safe and all its trust dependencies are OK -- then M is considered safe. -- * If M is recorded as Trustworthy and P is considered trusted and -- all M's trust dependencies are OK then M is considered safe. -- -- By trust dependencies we mean that the check is transitive. So if -- a module M that is Safe relies on a module N that is trustworthy, -- importing module M will first check (according to the second case) -- that N is trusted before checking M is trusted. -- -- This is a minimal description, so please refer to the user guide -- for more details. The user guide is also considered the authoritative -- source in this matter, not the comments or code. -- Note [Safe Haskell Inference] -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -- Safe Haskell does Safe inference on modules that don't have any specific -- safe haskell mode flag. The basic approach to this is: -- * When deciding if we need to do a Safe language check, treat -- an unmarked module as having -XSafe mode specified. -- * For checks, don't throw errors but return them to the caller. -- * Caller checks if there are errors: -- * For modules explicitly marked -XSafe, we throw the errors. -- * For unmarked modules (inference mode), we drop the errors -- and mark the module as being Unsafe. -- -- It used to be that we only did safe inference on modules that had no Safe -- Haskell flags, but now we perform safe inference on all modules as we want -- to allow users to set the `-Wsafe`, `-Wunsafe` and -- `-Wtrustworthy-safe` flags on Trustworthy and Unsafe modules so that a -- user can ensure their assumptions are correct and see reasons for why a -- module is safe or unsafe. -- -- This is tricky as we must be careful when we should throw an error compared -- to just warnings. For checking safe imports we manage it as two steps. First -- we check any imports that are required to be safe, then we check all other -- imports to see if we can infer them to be safe. -- | Check that the safe imports of the module being compiled are valid. -- If not we either issue a compilation error if the module is explicitly -- using Safe Haskell, or mark the module as unsafe if we're in safe -- inference mode.
2,810
hscFileFrontEnd mod_summary = do hpm <- hscParse' mod_summary hsc_env <- getHscEnv tcg_env <- tcRnModule' hsc_env mod_summary False hpm return tcg_env -------------------------------------------------------------- -- Safe Haskell -------------------------------------------------------------- -- Note [Safe Haskell Trust Check] -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -- Safe Haskell checks that an import is trusted according to the following -- rules for an import of module M that resides in Package P: -- -- * If M is recorded as Safe and all its trust dependencies are OK -- then M is considered safe. -- * If M is recorded as Trustworthy and P is considered trusted and -- all M's trust dependencies are OK then M is considered safe. -- -- By trust dependencies we mean that the check is transitive. So if -- a module M that is Safe relies on a module N that is trustworthy, -- importing module M will first check (according to the second case) -- that N is trusted before checking M is trusted. -- -- This is a minimal description, so please refer to the user guide -- for more details. The user guide is also considered the authoritative -- source in this matter, not the comments or code. -- Note [Safe Haskell Inference] -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -- Safe Haskell does Safe inference on modules that don't have any specific -- safe haskell mode flag. The basic approach to this is: -- * When deciding if we need to do a Safe language check, treat -- an unmarked module as having -XSafe mode specified. -- * For checks, don't throw errors but return them to the caller. -- * Caller checks if there are errors: -- * For modules explicitly marked -XSafe, we throw the errors. -- * For unmarked modules (inference mode), we drop the errors -- and mark the module as being Unsafe. -- -- It used to be that we only did safe inference on modules that had no Safe -- Haskell flags, but now we perform safe inference on all modules as we want -- to allow users to set the `-Wsafe`, `-Wunsafe` and -- `-Wtrustworthy-safe` flags on Trustworthy and Unsafe modules so that a -- user can ensure their assumptions are correct and see reasons for why a -- module is safe or unsafe. -- -- This is tricky as we must be careful when we should throw an error compared -- to just warnings. For checking safe imports we manage it as two steps. First -- we check any imports that are required to be safe, then we check all other -- imports to see if we can infer them to be safe. -- | Check that the safe imports of the module being compiled are valid. -- If not we either issue a compilation error if the module is explicitly -- using Safe Haskell, or mark the module as unsafe if we're in safe -- inference mode.
2,764
false
true
0
9
541
112
75
37
null
null
Gabriel439/Haskell-Pipes-ByteString-Library
src/Pipes/ByteString.hs
bsd-3-clause
_lines :: Monad m => Producer ByteString m x -> FreeT (Producer ByteString m) m x _lines p0 = PG.FreeT (go0 p0) where go0 p = do x <- next p case x of Left r -> return (PG.Pure r) Right (bs, p') -> if (BS.null bs) then go0 p' else return $ PG.Free $ go1 (yield bs >> p') go1 p = do p' <- p^.line return $ PG.FreeT $ do x <- nextByte p' case x of Left r -> return (PG.Pure r) Right (_, p'') -> go0 p''
592
_lines :: Monad m => Producer ByteString m x -> FreeT (Producer ByteString m) m x _lines p0 = PG.FreeT (go0 p0) where go0 p = do x <- next p case x of Left r -> return (PG.Pure r) Right (bs, p') -> if (BS.null bs) then go0 p' else return $ PG.Free $ go1 (yield bs >> p') go1 p = do p' <- p^.line return $ PG.FreeT $ do x <- nextByte p' case x of Left r -> return (PG.Pure r) Right (_, p'') -> go0 p''
592
_lines p0 = PG.FreeT (go0 p0) where go0 p = do x <- next p case x of Left r -> return (PG.Pure r) Right (bs, p') -> if (BS.null bs) then go0 p' else return $ PG.Free $ go1 (yield bs >> p') go1 p = do p' <- p^.line return $ PG.FreeT $ do x <- nextByte p' case x of Left r -> return (PG.Pure r) Right (_, p'') -> go0 p''
506
false
true
2
16
282
260
118
142
null
null
angerman/data-bitcode-edsl
src/EDSL/Monad/Internal.hs
bsd-3-clause
tellConst :: (HasCallStack, Monad m) => Val.Symbol -> BodyBuilderT m Val.Symbol tellConst c = do consts <- askConsts offset <- getsCtx cOffset let i = fromIntegral $ Set.size consts (c', consts') = insert' (Val.withIndex (\_ -> offset i) c) consts modifyCtx (\ctx -> ctx { consts = consts' }) return c'
318
tellConst :: (HasCallStack, Monad m) => Val.Symbol -> BodyBuilderT m Val.Symbol tellConst c = do consts <- askConsts offset <- getsCtx cOffset let i = fromIntegral $ Set.size consts (c', consts') = insert' (Val.withIndex (\_ -> offset i) c) consts modifyCtx (\ctx -> ctx { consts = consts' }) return c'
318
tellConst c = do consts <- askConsts offset <- getsCtx cOffset let i = fromIntegral $ Set.size consts (c', consts') = insert' (Val.withIndex (\_ -> offset i) c) consts modifyCtx (\ctx -> ctx { consts = consts' }) return c'
238
false
true
0
15
66
141
69
72
null
null
amutake/simple-actor
src/Control/Concurrent/Actor.hs
bsd-3-clause
getSelf :: ActorWorld r (ActorId r) getSelf = ask
49
getSelf :: ActorWorld r (ActorId r) getSelf = ask
49
getSelf = ask
13
false
true
1
7
8
26
11
15
null
null
brendanhay/gogol
gogol-firestore/gen/Network/Google/FireStore/Types/Product.hs
mpl-2.0
-- | A filter on a document field. fFieldFilter :: Lens' Filter (Maybe FieldFilter) fFieldFilter = lens _fFieldFilter (\ s a -> s{_fFieldFilter = a})
151
fFieldFilter :: Lens' Filter (Maybe FieldFilter) fFieldFilter = lens _fFieldFilter (\ s a -> s{_fFieldFilter = a})
116
fFieldFilter = lens _fFieldFilter (\ s a -> s{_fFieldFilter = a})
67
true
true
0
9
26
48
25
23
null
null
aauger/HaskellCoreUtils
HaskellCoreUtils/src/comm.hs
gpl-3.0
comp [] ys = ["\t" ++ y | y <- ys]
34
comp [] ys = ["\t" ++ y | y <- ys]
34
comp [] ys = ["\t" ++ y | y <- ys]
34
false
false
0
7
10
28
14
14
null
null
ezyang/ghc
compiler/typecheck/TcRnTypes.hs
bsd-3-clause
isTypeHoleCt _ = False
22
isTypeHoleCt _ = False
22
isTypeHoleCt _ = False
22
false
false
0
5
3
9
4
5
null
null
minad/intro
src/Intro.hs
mit
-- | Read an entire file strictly into a 'Text' using UTF-8 encoding. -- The decoding is done using 'decodeStringLenient'. Invalid characters are replaced -- by the Unicode replacement character '\FFFD'. -- -- __Note__: This function is lifted to the 'MonadIO' class. readFileUtf8 :: MonadIO m => FilePath -> m Text readFileUtf8 = map decodeStringLenient . readFile
365
readFileUtf8 :: MonadIO m => FilePath -> m Text readFileUtf8 = map decodeStringLenient . readFile
97
readFileUtf8 = map decodeStringLenient . readFile
49
true
true
0
7
56
37
20
17
null
null
svenssonjoel/GCDObsidian
Obsidian/GCDObsidian/CodeGen/CUDA.hs
bsd-3-clause
sbaseCExpr addr = cBinOp CAdd (cVar "sbase" (CPointer CWord8)) (cLiteral (Word32Val addr) CWord32) (CPointer CWord8)
178
sbaseCExpr addr = cBinOp CAdd (cVar "sbase" (CPointer CWord8)) (cLiteral (Word32Val addr) CWord32) (CPointer CWord8)
178
sbaseCExpr addr = cBinOp CAdd (cVar "sbase" (CPointer CWord8)) (cLiteral (Word32Val addr) CWord32) (CPointer CWord8)
178
false
false
0
9
76
52
25
27
null
null
tsahyt/midi-simple
src/Sound/MIDI/Serialize.hs
lgpl-3.0
vendorId (VendorIdLong a b) = word8 0x00 <> word8 a <> word8 b
62
vendorId (VendorIdLong a b) = word8 0x00 <> word8 a <> word8 b
62
vendorId (VendorIdLong a b) = word8 0x00 <> word8 a <> word8 b
62
false
false
0
7
12
34
15
19
null
null
WraithM/CoreCompiler
src/LLTest.hs
bsd-3-clause
main = do let parsed = parseProgram prog lifted = lambdaLift parsed printPretty parsed break printPretty (step1 parsed) break printPretty (step2 parsed) break printPretty lifted where break = putStrLn "--------------------------" printPretty = putStrLn . prettyProgram step1 = abstract . freeVars step2 = rename . step1
377
main = do let parsed = parseProgram prog lifted = lambdaLift parsed printPretty parsed break printPretty (step1 parsed) break printPretty (step2 parsed) break printPretty lifted where break = putStrLn "--------------------------" printPretty = putStrLn . prettyProgram step1 = abstract . freeVars step2 = rename . step1
377
main = do let parsed = parseProgram prog lifted = lambdaLift parsed printPretty parsed break printPretty (step1 parsed) break printPretty (step2 parsed) break printPretty lifted where break = putStrLn "--------------------------" printPretty = putStrLn . prettyProgram step1 = abstract . freeVars step2 = rename . step1
377
false
false
8
10
102
128
49
79
null
null
rueshyna/gogol
gogol-genomics/gen/Network/Google/Genomics/Types/Product.hs
mpl-2.0
-- | The reference set to which the reads in this read group set are aligned. rgsReferenceSetId :: Lens' ReadGroupSet (Maybe Text) rgsReferenceSetId = lens _rgsReferenceSetId (\ s a -> s{_rgsReferenceSetId = a})
219
rgsReferenceSetId :: Lens' ReadGroupSet (Maybe Text) rgsReferenceSetId = lens _rgsReferenceSetId (\ s a -> s{_rgsReferenceSetId = a})
141
rgsReferenceSetId = lens _rgsReferenceSetId (\ s a -> s{_rgsReferenceSetId = a})
88
true
true
0
9
40
48
25
23
null
null
joehillen/aura
src/Aura/Pacman.hs
gpl-3.0
powerPillCmd :: String powerPillCmd = "/usr/bin/powerpill"
58
powerPillCmd :: String powerPillCmd = "/usr/bin/powerpill"
58
powerPillCmd = "/usr/bin/powerpill"
35
false
true
0
4
5
11
6
5
null
null
xkollar/yaml
Data/Yaml/Parser.hs
bsd-2-clause
withSequence expected f (Alias an) = withAnchor an expected $ withSequence expected f
85
withSequence expected f (Alias an) = withAnchor an expected $ withSequence expected f
85
withSequence expected f (Alias an) = withAnchor an expected $ withSequence expected f
85
false
false
0
6
12
36
15
21
null
null
np/hlatex
Language/LaTeX/Builder/Beamer.hs
bsd-3-clause
usefonttheme = beamerPreambleCmdArgs "usefonttheme"
53
usefonttheme = beamerPreambleCmdArgs "usefonttheme"
53
usefonttheme = beamerPreambleCmdArgs "usefonttheme"
53
false
false
1
5
5
12
4
8
null
null
tolysz/prepare-ghcjs
spec-lts8/cabal/Cabal/Distribution/PackageDescription/Check.hs
bsd-3-clause
checkPackageFiles :: PackageDescription -> FilePath -> IO [PackageCheck] checkPackageFiles pkg root = checkPackageContent checkFilesIO pkg where checkFilesIO = CheckPackageContentOps { doesFileExist = System.doesFileExist . relative, doesDirectoryExist = System.doesDirectoryExist . relative, getDirectoryContents = System.Directory.getDirectoryContents . relative, getFileContents = \f -> openBinaryFile (relative f) ReadMode >>= hGetContents } relative path = root </> path -- | A record of operations needed to check the contents of packages. -- Used by 'checkPackageContent'. --
664
checkPackageFiles :: PackageDescription -> FilePath -> IO [PackageCheck] checkPackageFiles pkg root = checkPackageContent checkFilesIO pkg where checkFilesIO = CheckPackageContentOps { doesFileExist = System.doesFileExist . relative, doesDirectoryExist = System.doesDirectoryExist . relative, getDirectoryContents = System.Directory.getDirectoryContents . relative, getFileContents = \f -> openBinaryFile (relative f) ReadMode >>= hGetContents } relative path = root </> path -- | A record of operations needed to check the contents of packages. -- Used by 'checkPackageContent'. --
664
checkPackageFiles pkg root = checkPackageContent checkFilesIO pkg where checkFilesIO = CheckPackageContentOps { doesFileExist = System.doesFileExist . relative, doesDirectoryExist = System.doesDirectoryExist . relative, getDirectoryContents = System.Directory.getDirectoryContents . relative, getFileContents = \f -> openBinaryFile (relative f) ReadMode >>= hGetContents } relative path = root </> path -- | A record of operations needed to check the contents of packages. -- Used by 'checkPackageContent'. --
591
false
true
0
11
151
123
67
56
null
null
RocketPuppy/PupCollide
Test/TestServer.hs
gpl-3.0
loginExistNoRegister = bracketed $ \(g, u, pI, iQ, oQ, _, _, reconnect, port) -> do putStrLn $ "loginExistNoRegister on port: " ++ port let user = Username "user1" let login = Login user atomically $ writeThing iQ (lookupPriority login) login login' <- getEvent oQ -- are we actually logged in? assertEqual "User Exists" login login' users <- readTVarIO u players <- readTVarIO pI -- make sure initial data is correct assertNotEmpty "Initial users is empty!" users assertNotEmpty "Initial playerInfos is empty!" players assertFound "User doesn't exist!" ((==) user) users assertFound "Player doesn't exist!" (\(_, x, _) -> x == user) players -- actual test, connect with new client and try logging in putStrLn "Trying new connection..." (iQ', oQ', dc) <- reconnect atomically $ writeThing iQ' (lookupPriority login) login login2' <- getEvent oQ' users' <- readTVarIO u players' <- readTVarIO pI assertEqual "Users have changed!" users users' assertEqual "Players have changed!" players players' assertEqual "Did not receive proper event!" (Error UserExists) login2' dc -- |User exists, and we've already logged in
1,311
loginExistNoRegister = bracketed $ \(g, u, pI, iQ, oQ, _, _, reconnect, port) -> do putStrLn $ "loginExistNoRegister on port: " ++ port let user = Username "user1" let login = Login user atomically $ writeThing iQ (lookupPriority login) login login' <- getEvent oQ -- are we actually logged in? assertEqual "User Exists" login login' users <- readTVarIO u players <- readTVarIO pI -- make sure initial data is correct assertNotEmpty "Initial users is empty!" users assertNotEmpty "Initial playerInfos is empty!" players assertFound "User doesn't exist!" ((==) user) users assertFound "Player doesn't exist!" (\(_, x, _) -> x == user) players -- actual test, connect with new client and try logging in putStrLn "Trying new connection..." (iQ', oQ', dc) <- reconnect atomically $ writeThing iQ' (lookupPriority login) login login2' <- getEvent oQ' users' <- readTVarIO u players' <- readTVarIO pI assertEqual "Users have changed!" users users' assertEqual "Players have changed!" players players' assertEqual "Did not receive proper event!" (Error UserExists) login2' dc -- |User exists, and we've already logged in
1,311
loginExistNoRegister = bracketed $ \(g, u, pI, iQ, oQ, _, _, reconnect, port) -> do putStrLn $ "loginExistNoRegister on port: " ++ port let user = Username "user1" let login = Login user atomically $ writeThing iQ (lookupPriority login) login login' <- getEvent oQ -- are we actually logged in? assertEqual "User Exists" login login' users <- readTVarIO u players <- readTVarIO pI -- make sure initial data is correct assertNotEmpty "Initial users is empty!" users assertNotEmpty "Initial playerInfos is empty!" players assertFound "User doesn't exist!" ((==) user) users assertFound "Player doesn't exist!" (\(_, x, _) -> x == user) players -- actual test, connect with new client and try logging in putStrLn "Trying new connection..." (iQ', oQ', dc) <- reconnect atomically $ writeThing iQ' (lookupPriority login) login login2' <- getEvent oQ' users' <- readTVarIO u players' <- readTVarIO pI assertEqual "Users have changed!" users users' assertEqual "Players have changed!" players players' assertEqual "Did not receive proper event!" (Error UserExists) login2' dc -- |User exists, and we've already logged in
1,311
false
false
0
12
367
317
150
167
null
null
ckaestne/CIDE
other/CaseStudies/fgl/orig_fgl-5.4.1.1/Data/Graph/Inductive/Graph.hs
gpl-3.0
-- | Find all 'Node's that link to to the given 'Node'. pre :: Graph gr => gr a b -> Node -> [Node] pre = map snd .: context1l
127
pre :: Graph gr => gr a b -> Node -> [Node] pre = map snd .: context1l
70
pre = map snd .: context1l
26
true
true
2
10
30
51
23
28
null
null