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
DanielWaterworth/Idris-dev
src/IRTS/CodegenLLVM.hs
bsd-3-clause
conType :: Word64 -> Type conType nargs = StructureType False [ IntegerType 32 , ArrayType nargs (PointerType valueType (AddrSpace 0)) ]
184
conType :: Word64 -> Type conType nargs = StructureType False [ IntegerType 32 , ArrayType nargs (PointerType valueType (AddrSpace 0)) ]
184
conType nargs = StructureType False [ IntegerType 32 , ArrayType nargs (PointerType valueType (AddrSpace 0)) ]
158
false
true
0
10
68
57
26
31
null
null
ghc-android/ghc
testsuite/tests/ghci/should_run/ghcirun004.hs
bsd-3-clause
2897 = 2896
11
2897 = 2896
11
2897 = 2896
11
false
false
1
5
2
10
3
7
null
null
ygale/yesod
yesod-auth/Yesod/Auth/Email.hs
mit
getRegisterR :: YesodAuthEmail master => HandlerT Auth (HandlerT master IO) Html getRegisterR = registerHandler
111
getRegisterR :: YesodAuthEmail master => HandlerT Auth (HandlerT master IO) Html getRegisterR = registerHandler
111
getRegisterR = registerHandler
30
false
true
0
8
13
33
16
17
null
null
mrmonday/Idris-dev
src/IRTS/JavaScript/AST.hs
bsd-3-clause
compileJS' indent (JSString str) = "\"" `T.append` T.pack str `T.append` "\""
79
compileJS' indent (JSString str) = "\"" `T.append` T.pack str `T.append` "\""
79
compileJS' indent (JSString str) = "\"" `T.append` T.pack str `T.append` "\""
79
false
false
0
8
12
38
20
18
null
null
AaronFriel/eff-experiments
src/Eff/Internal/Eff1.hs
bsd-3-clause
th1 :: Member (Yield Int ()) r => Eff r () th1 = yieldInt 1 >> yieldInt 2
73
th1 :: Member (Yield Int ()) r => Eff r () th1 = yieldInt 1 >> yieldInt 2
73
th1 = yieldInt 1 >> yieldInt 2
30
false
true
0
10
17
52
23
29
null
null
shlevy/ghc
compiler/hsSyn/HsDecls.hs
bsd-3-clause
pprTyClDeclFlavour (SynDecl {}) = text "type"
49
pprTyClDeclFlavour (SynDecl {}) = text "type"
49
pprTyClDeclFlavour (SynDecl {}) = text "type"
49
false
false
0
7
9
19
9
10
null
null
jwiegley/ghc-release
libraries/bytestring/Data/ByteString/Builder/ASCII.hs
gpl-3.0
intDec :: Int -> Builder intDec = P.primBounded P.intDec
56
intDec :: Int -> Builder intDec = P.primBounded P.intDec
56
intDec = P.primBounded P.intDec
31
false
true
0
6
8
22
11
11
null
null
silky/Tidal
Sound/Tidal/Tempo.hs
gpl-3.0
serverApp :: MVar Tempo -> MVar ClientState -> WS.ServerApp serverApp tempoState clientState pending = do conn <- WS.acceptRequest pending tempo <- liftIO $ readMVar tempoState liftIO $ WS.sendTextData conn $ T.pack $ show tempo clients <- liftIO $ readMVar clientState liftIO $ modifyMVar_ clientState $ \s -> return $ addClient conn s serverLoop conn tempoState clientState
399
serverApp :: MVar Tempo -> MVar ClientState -> WS.ServerApp serverApp tempoState clientState pending = do conn <- WS.acceptRequest pending tempo <- liftIO $ readMVar tempoState liftIO $ WS.sendTextData conn $ T.pack $ show tempo clients <- liftIO $ readMVar clientState liftIO $ modifyMVar_ clientState $ \s -> return $ addClient conn s serverLoop conn tempoState clientState
399
serverApp tempoState clientState pending = do conn <- WS.acceptRequest pending tempo <- liftIO $ readMVar tempoState liftIO $ WS.sendTextData conn $ T.pack $ show tempo clients <- liftIO $ readMVar clientState liftIO $ modifyMVar_ clientState $ \s -> return $ addClient conn s serverLoop conn tempoState clientState
339
false
true
0
12
79
142
62
80
null
null
christiaanb/ghc
compiler/deSugar/Check.hs
bsd-3-clause
tidy_pat (ListPat ps ty Nothing) = unLoc $ foldr (\ x y -> mkPrefixConPat consDataCon [x,y] [ty]) (mkNilPat ty) (map tidy_lpat ps)
200
tidy_pat (ListPat ps ty Nothing) = unLoc $ foldr (\ x y -> mkPrefixConPat consDataCon [x,y] [ty]) (mkNilPat ty) (map tidy_lpat ps)
200
tidy_pat (ListPat ps ty Nothing) = unLoc $ foldr (\ x y -> mkPrefixConPat consDataCon [x,y] [ty]) (mkNilPat ty) (map tidy_lpat ps)
200
false
false
0
10
91
70
36
34
null
null
jaccokrijnen/leksah
src/IDE/TextEditor/CodeMirror.hs
gpl-2.0
setMode m = jss "mode" m
32
setMode m = jss "mode" m
32
setMode m = jss "mode" m
32
false
false
0
5
13
14
6
8
null
null
text-utf8/text
tests/Tests/Properties.hs
bsd-2-clause
tl_repeat n = (L.take m . L.repeat) `eq` (unpackS . TL.take (fromIntegral m) . TL.repeat) where m = fromIntegral (n :: Word8)
155
tl_repeat n = (L.take m . L.repeat) `eq` (unpackS . TL.take (fromIntegral m) . TL.repeat) where m = fromIntegral (n :: Word8)
155
tl_repeat n = (L.take m . L.repeat) `eq` (unpackS . TL.take (fromIntegral m) . TL.repeat) where m = fromIntegral (n :: Word8)
155
false
false
0
11
51
70
36
34
null
null
mreid/papersite
src/lib/Page.hs
mit
get :: String -> T -> Maybe String get key = lookup key . fields
64
get :: String -> T -> Maybe String get key = lookup key . fields
64
get key = lookup key . fields
29
false
true
0
7
14
36
16
20
null
null
uvNikita/SyntacticAnalyzer
src/Operation.hs
mit
inverse Div = Mul
18
inverse Div = Mul
18
inverse Div = Mul
18
false
false
1
5
4
13
4
9
null
null
kaliumxyz/learnings
haskell/baby.hs
mit
doubleMe x = x + x
18
doubleMe x = x + x
18
doubleMe x = x + x
18
false
false
3
5
5
18
6
12
null
null
nicball/orlin
src/Orlin/Frontend/TypeChecker.hs
mit
lookupSymbol :: String -> TypeChecker (Maybe (Type, Word)) lookupSymbol name = do st <- get return (iter st name 0) where iter (st:rest) name level = case lookup name st of Just t -> Just (t, level) Nothing -> iter rest name (level + 1) iter [] _ _ = Nothing
306
lookupSymbol :: String -> TypeChecker (Maybe (Type, Word)) lookupSymbol name = do st <- get return (iter st name 0) where iter (st:rest) name level = case lookup name st of Just t -> Just (t, level) Nothing -> iter rest name (level + 1) iter [] _ _ = Nothing
306
lookupSymbol name = do st <- get return (iter st name 0) where iter (st:rest) name level = case lookup name st of Just t -> Just (t, level) Nothing -> iter rest name (level + 1) iter [] _ _ = Nothing
247
false
true
1
11
98
141
69
72
null
null
fredyr/copilot-libraries
src/Copilot/Library/Voting.hs
bsd-3-clause
aMajority :: (P.Eq a, Typed a) => [Stream a] -- ^ Vote streams -> Stream a -- ^ Candidate stream -> Stream Bool -- ^ True if candidate holds majority aMajority [] _ = badUsage "aMajority: empty list not allowed"
250
aMajority :: (P.Eq a, Typed a) => [Stream a] -- ^ Vote streams -> Stream a -- ^ Candidate stream -> Stream Bool aMajority [] _ = badUsage "aMajority: empty list not allowed"
212
aMajority [] _ = badUsage "aMajority: empty list not allowed"
61
true
true
0
8
78
61
31
30
null
null
spoqa/nirum
src/Nirum/Docs/Html.hs
gpl-3.0
renderInline (Code code') = [qq|<code>{escape code'}</code>|]
61
renderInline (Code code') = [qq|<code>{escape code'}</code>|]
61
renderInline (Code code') = [qq|<code>{escape code'}</code>|]
61
false
false
0
7
5
19
11
8
null
null
TomMD/ghc
libraries/base/GHC/Exts.hs
bsd-3-clause
groupByFB :: ([a] -> lst -> lst) -> lst -> (a -> a -> Bool) -> [a] -> lst groupByFB c n eq xs0 = groupByFBCore xs0 where groupByFBCore [] = n groupByFBCore (x:xs) = c (x:ys) (groupByFBCore zs) where (ys, zs) = span (eq x) xs -- ----------------------------------------------------------------------------- -- tracing
340
groupByFB :: ([a] -> lst -> lst) -> lst -> (a -> a -> Bool) -> [a] -> lst groupByFB c n eq xs0 = groupByFBCore xs0 where groupByFBCore [] = n groupByFBCore (x:xs) = c (x:ys) (groupByFBCore zs) where (ys, zs) = span (eq x) xs -- ----------------------------------------------------------------------------- -- tracing
340
groupByFB c n eq xs0 = groupByFBCore xs0 where groupByFBCore [] = n groupByFBCore (x:xs) = c (x:ys) (groupByFBCore zs) where (ys, zs) = span (eq x) xs -- ----------------------------------------------------------------------------- -- tracing
266
false
true
1
11
74
150
74
76
null
null
pdmurray/haskell-book-ex
src/ch10/Exercises10.10.hs
bsd-3-clause
myMinimumBy f (x:xs) = foldl (\a b -> if f a b == LT then a else b) x xs
72
myMinimumBy f (x:xs) = foldl (\a b -> if f a b == LT then a else b) x xs
72
myMinimumBy f (x:xs) = foldl (\a b -> if f a b == LT then a else b) x xs
72
false
false
0
10
19
52
27
25
null
null
matthewleon/libmpd-haskell
src/Network/MPD/Commands/Database.hs
mit
-- | Update the server's database. -- -- If no path is given, the whole library will be scanned. Unreadable or -- non-existent paths are silently ignored. -- -- The update job id is returned. update :: MonadMPD m => Maybe Path -> m Integer update = A.runCommand . A.update
273
update :: MonadMPD m => Maybe Path -> m Integer update = A.runCommand . A.update
80
update = A.runCommand . A.update
32
true
true
0
7
50
42
23
19
null
null
DylanSp/zmachine-interpreter
src/ImmutableBytes.hs
mit
writeByte :: ImmutableBytes -> ByteAddress -> Word8 -> ImmutableBytes writeByte bytes addr@(ByteAddress address) value | isOutOfRange addr (size bytes) = error "ImmutableBytes.writeByte: Address is out of range" | otherwise = ImmutableBytes { originalBytes = originalBytes bytes, edits = Map.insert address value (edits bytes)}
412
writeByte :: ImmutableBytes -> ByteAddress -> Word8 -> ImmutableBytes writeByte bytes addr@(ByteAddress address) value | isOutOfRange addr (size bytes) = error "ImmutableBytes.writeByte: Address is out of range" | otherwise = ImmutableBytes { originalBytes = originalBytes bytes, edits = Map.insert address value (edits bytes)}
412
writeByte bytes addr@(ByteAddress address) value | isOutOfRange addr (size bytes) = error "ImmutableBytes.writeByte: Address is out of range" | otherwise = ImmutableBytes { originalBytes = originalBytes bytes, edits = Map.insert address value (edits bytes)}
342
false
true
0
10
127
100
49
51
null
null
adinapoli/api-tools
src/Data/API/Markdown.hs
bsd-3-clause
union_ :: MarkdownMethods -> APINode -> SpecUnion -> [MDComment] union_ mdm an su = summary_lines mdm an "union object" ++ mk_md_union_table mdm (suFields su)
162
union_ :: MarkdownMethods -> APINode -> SpecUnion -> [MDComment] union_ mdm an su = summary_lines mdm an "union object" ++ mk_md_union_table mdm (suFields su)
162
union_ mdm an su = summary_lines mdm an "union object" ++ mk_md_union_table mdm (suFields su)
97
false
true
0
8
27
59
28
31
null
null
vincenthz/hs-foundation
foundation/tests/Test/Foundation/Primitive/BlockN.hs
bsd-3-clause
createBlockSized :: CountOf Int -> B.Block Int createBlockSized n@(CountOf n') = B.create n (const n')
102
createBlockSized :: CountOf Int -> B.Block Int createBlockSized n@(CountOf n') = B.create n (const n')
102
createBlockSized n@(CountOf n') = B.create n (const n')
55
false
true
1
8
14
55
24
31
null
null
spatial-reasoning/zeno
src/compareGivenNetworks.hs
bsd-2-clause
checkNetworks = do -- dpNet0 <- loadBinaryNetwork ("bla2.net") :: IO (Network [String] (Set.Set Dipole72)) -- dpNet1 <- loadBinaryNetwork ("../testsuite/dipole/24/alleq.net") :: IO (Network [String] (Set.Set Dipole72)) -- dpNet2 <- loadBinaryNetwork ("../testsuite/dipole/24/consistent_01.net") :: IO (Network [String] (Set.Set Dipole72)) -- dpNet3 <- loadBinaryNetwork ("../testsuite/dipole/24/inconsistent_01.net") :: IO (Network [String] (Set.Set Dipole72)) -- let dpNet4 = forwardCircle 8 -- -- At a sizo of 12 this network overwhelms the backtracking of the -- -- oriented matroid method. -- let dpNet5 = circleWithTwoCollinearDipolesInside 12 -- let dpNet5 = circleWithTwoCollinearDipolesInside 11 -- let dpNets = map circleWithTwoCollinearDipolesInside [6..40] let dpNets = [] let ffNet1 = allLeft 8 ffNet2 <- loadNetwork ("../testsuite/flipflop/inconsistent/inconsistent_01.net") :: IO (Network [String] (Set.Set FlipFlop)) let ffNet3 = indianTent 8 ffNet4 <- loadNetwork ("../testsuite/flipflop/inconsistent/nomatroid.net") :: IO (Network [String] (Set.Set FlipFlop)) ffNet5 <- loadNetwork ("../testsuite/flipflop/inconsistent/triskilde.net") :: IO (Network [String] (Set.Set FlipFlop)) ffNet6 <- loadNetwork ("../testsuite/flipflop/inconsistent/triskilde_less.net") :: IO (Network [String] (Set.Set FlipFlop)) ffNet7 <- loadNetwork ("../testsuite/flipflop/inconsistent/desargues.net") :: IO (Network [String] (Set.Set FlipFlop)) ffNet8 <- loadNetwork ("../testsuite/flipflop/inconsistent/minimalStar.net") :: IO (Network [String] (Set.Set FlipFlop)) ffNet9 <- loadNetwork ("../testsuite/flipflop/inconsistent/pappos.net") :: IO (Network [String] (Set.Set FlipFlop)) ffNet10 <- loadNetwork ("../testsuite/flipflop/inconsistent/pappos_uniform.net") :: IO (Network [String] (Set.Set FlipFlop)) ffNet11 <- loadNetwork ("../testsuite/flipflop/inconsistent/tenA.net") :: IO (Network [String] (Set.Set FlipFlop)) ffNet12 <- loadNetwork ("../testsuite/flipflop/consistent/triskilde.net") :: IO (Network [String] (Set.Set FlipFlop)) ffNet13 <- loadNetwork ("../testsuite/flipflop/consistent/desargues.net") :: IO (Network [String] (Set.Set FlipFlop)) ffNet14 <- loadNetwork ("../testsuite/flipflop/consistent/minimalStar.net") :: IO (Network [String] (Set.Set FlipFlop)) ffNet15 <- loadNetwork ("../testsuite/flipflop/consistent/minimalStar.net") :: IO (Network [String] (Set.Set FlipFlop)) ffNet15 <- loadNetwork ("../testsuite/flipflop/consistent/pappos.net") :: IO (Network [String] (Set.Set FlipFlop)) -- ffNet16 <- loadNetwork ("../testsuite/flipflop/consistent/pappos_uniform.net") :: IO (Network [String] (Set.Set FlipFlop)) -- ffNet1 <- loadNetwork ("./test.net") :: IO (Network [String] (Set.Set FlipFlop)) -- let ffNets = [ffNet1] let ffNets = [ ffNet1 , ffNet2 , ffNet3 , ffNet4 , ffNet5 , ffNet6 , ffNet7 , ffNet8 , ffNet9 , ffNet10 , ffNet11 , ffNet12 , ffNet13 , ffNet14 , ffNet15 ] let dpAnswers = makeReadable 0 $ dpCheckConsistency dpNets let ffAnswers = makeReadable (length dpNets) $ ffCheckConsistency ffNets let showNetworks nets startNumber = foldl (\acc (net, k) -> acc ++ " === NETWORK No. " ++ show k ++ " ===\n\n" ++ showNonAtomicNet net ++ "\n\n" ) "" $ zip nets [startNumber..] putStrLn $ "\n === NEW TEST ===\n\n" ++ -- "Networks tested:\n\n" ++ -- showNetworks dpNets 1 ++ showNetworks ffNets (length dpNets + 1) ++ -- " === RESULTS ===\n\n" ++ "Number of Network: " ++ (intercalate " " $ map show [1..length dpNets + length ffNets]) ++ "\n" start <- getCurrentTime putStrLn $ "Algebraic Closure: " ++ dpAnswers!!0 ++ ffAnswers!!0 end <- getCurrentTime putStrLn $ show (end `diffUTCTime` start) ++ " elapsed.\n" start <- getCurrentTime putStrLn $ "Algebraic Reasoning: " ++ dpAnswers!!1 ++ ffAnswers!!1 end <- getCurrentTime putStrLn $ show (end `diffUTCTime` start) ++ " elapsed.\n" start <- getCurrentTime putStrLn $ "Triangle Consistency: " ++ dpAnswers!!2 ++ ffAnswers!!2 end <- getCurrentTime putStrLn $ show (end `diffUTCTime` start) ++ " elapsed.\n" start <- getCurrentTime putStrLn $ "Oriented Matroid: " ++ dpAnswers!!3 ++ ffAnswers!!3 end <- getCurrentTime putStrLn $ show (end `diffUTCTime` start) ++ " elapsed.\n" start <- getCurrentTime putStrLn $ "Biquadratic Polynomial: " ++ dpAnswers!!4 ++ ffAnswers!!4 end <- getCurrentTime putStrLn $ show (end `diffUTCTime` start) ++ " elapsed.\n\n" {- start <- getCurrentTime putStrLn $ "Algebraic Closure: " ++ ffAnswers!!0 end <- getCurrentTime putStrLn $ show (end `diffUTCTime` start) ++ " elapsed.\n" start <- getCurrentTime putStrLn $ "Algebraic Reasoning: " ++ ffAnswers!!1 end <- getCurrentTime putStrLn $ show (end `diffUTCTime` start) ++ " elapsed.\n" start <- getCurrentTime putStrLn $ "Triangle Consistency: " ++ ffAnswers!!2 end <- getCurrentTime putStrLn $ show (end `diffUTCTime` start) ++ " elapsed.\n" start <- getCurrentTime putStrLn $ "Oriented Matroid: " ++ ffAnswers!!3 end <- getCurrentTime putStrLn $ show (end `diffUTCTime` start) ++ " elapsed.\n" start <- getCurrentTime putStrLn $ "Biquadratic Polynomial: " ++ ffAnswers!!4 end <- getCurrentTime putStrLn $ show (end `diffUTCTime` start) ++ " elapsed.\n\n" -} return ()
5,930
checkNetworks = do -- dpNet0 <- loadBinaryNetwork ("bla2.net") :: IO (Network [String] (Set.Set Dipole72)) -- dpNet1 <- loadBinaryNetwork ("../testsuite/dipole/24/alleq.net") :: IO (Network [String] (Set.Set Dipole72)) -- dpNet2 <- loadBinaryNetwork ("../testsuite/dipole/24/consistent_01.net") :: IO (Network [String] (Set.Set Dipole72)) -- dpNet3 <- loadBinaryNetwork ("../testsuite/dipole/24/inconsistent_01.net") :: IO (Network [String] (Set.Set Dipole72)) -- let dpNet4 = forwardCircle 8 -- -- At a sizo of 12 this network overwhelms the backtracking of the -- -- oriented matroid method. -- let dpNet5 = circleWithTwoCollinearDipolesInside 12 -- let dpNet5 = circleWithTwoCollinearDipolesInside 11 -- let dpNets = map circleWithTwoCollinearDipolesInside [6..40] let dpNets = [] let ffNet1 = allLeft 8 ffNet2 <- loadNetwork ("../testsuite/flipflop/inconsistent/inconsistent_01.net") :: IO (Network [String] (Set.Set FlipFlop)) let ffNet3 = indianTent 8 ffNet4 <- loadNetwork ("../testsuite/flipflop/inconsistent/nomatroid.net") :: IO (Network [String] (Set.Set FlipFlop)) ffNet5 <- loadNetwork ("../testsuite/flipflop/inconsistent/triskilde.net") :: IO (Network [String] (Set.Set FlipFlop)) ffNet6 <- loadNetwork ("../testsuite/flipflop/inconsistent/triskilde_less.net") :: IO (Network [String] (Set.Set FlipFlop)) ffNet7 <- loadNetwork ("../testsuite/flipflop/inconsistent/desargues.net") :: IO (Network [String] (Set.Set FlipFlop)) ffNet8 <- loadNetwork ("../testsuite/flipflop/inconsistent/minimalStar.net") :: IO (Network [String] (Set.Set FlipFlop)) ffNet9 <- loadNetwork ("../testsuite/flipflop/inconsistent/pappos.net") :: IO (Network [String] (Set.Set FlipFlop)) ffNet10 <- loadNetwork ("../testsuite/flipflop/inconsistent/pappos_uniform.net") :: IO (Network [String] (Set.Set FlipFlop)) ffNet11 <- loadNetwork ("../testsuite/flipflop/inconsistent/tenA.net") :: IO (Network [String] (Set.Set FlipFlop)) ffNet12 <- loadNetwork ("../testsuite/flipflop/consistent/triskilde.net") :: IO (Network [String] (Set.Set FlipFlop)) ffNet13 <- loadNetwork ("../testsuite/flipflop/consistent/desargues.net") :: IO (Network [String] (Set.Set FlipFlop)) ffNet14 <- loadNetwork ("../testsuite/flipflop/consistent/minimalStar.net") :: IO (Network [String] (Set.Set FlipFlop)) ffNet15 <- loadNetwork ("../testsuite/flipflop/consistent/minimalStar.net") :: IO (Network [String] (Set.Set FlipFlop)) ffNet15 <- loadNetwork ("../testsuite/flipflop/consistent/pappos.net") :: IO (Network [String] (Set.Set FlipFlop)) -- ffNet16 <- loadNetwork ("../testsuite/flipflop/consistent/pappos_uniform.net") :: IO (Network [String] (Set.Set FlipFlop)) -- ffNet1 <- loadNetwork ("./test.net") :: IO (Network [String] (Set.Set FlipFlop)) -- let ffNets = [ffNet1] let ffNets = [ ffNet1 , ffNet2 , ffNet3 , ffNet4 , ffNet5 , ffNet6 , ffNet7 , ffNet8 , ffNet9 , ffNet10 , ffNet11 , ffNet12 , ffNet13 , ffNet14 , ffNet15 ] let dpAnswers = makeReadable 0 $ dpCheckConsistency dpNets let ffAnswers = makeReadable (length dpNets) $ ffCheckConsistency ffNets let showNetworks nets startNumber = foldl (\acc (net, k) -> acc ++ " === NETWORK No. " ++ show k ++ " ===\n\n" ++ showNonAtomicNet net ++ "\n\n" ) "" $ zip nets [startNumber..] putStrLn $ "\n === NEW TEST ===\n\n" ++ -- "Networks tested:\n\n" ++ -- showNetworks dpNets 1 ++ showNetworks ffNets (length dpNets + 1) ++ -- " === RESULTS ===\n\n" ++ "Number of Network: " ++ (intercalate " " $ map show [1..length dpNets + length ffNets]) ++ "\n" start <- getCurrentTime putStrLn $ "Algebraic Closure: " ++ dpAnswers!!0 ++ ffAnswers!!0 end <- getCurrentTime putStrLn $ show (end `diffUTCTime` start) ++ " elapsed.\n" start <- getCurrentTime putStrLn $ "Algebraic Reasoning: " ++ dpAnswers!!1 ++ ffAnswers!!1 end <- getCurrentTime putStrLn $ show (end `diffUTCTime` start) ++ " elapsed.\n" start <- getCurrentTime putStrLn $ "Triangle Consistency: " ++ dpAnswers!!2 ++ ffAnswers!!2 end <- getCurrentTime putStrLn $ show (end `diffUTCTime` start) ++ " elapsed.\n" start <- getCurrentTime putStrLn $ "Oriented Matroid: " ++ dpAnswers!!3 ++ ffAnswers!!3 end <- getCurrentTime putStrLn $ show (end `diffUTCTime` start) ++ " elapsed.\n" start <- getCurrentTime putStrLn $ "Biquadratic Polynomial: " ++ dpAnswers!!4 ++ ffAnswers!!4 end <- getCurrentTime putStrLn $ show (end `diffUTCTime` start) ++ " elapsed.\n\n" {- start <- getCurrentTime putStrLn $ "Algebraic Closure: " ++ ffAnswers!!0 end <- getCurrentTime putStrLn $ show (end `diffUTCTime` start) ++ " elapsed.\n" start <- getCurrentTime putStrLn $ "Algebraic Reasoning: " ++ ffAnswers!!1 end <- getCurrentTime putStrLn $ show (end `diffUTCTime` start) ++ " elapsed.\n" start <- getCurrentTime putStrLn $ "Triangle Consistency: " ++ ffAnswers!!2 end <- getCurrentTime putStrLn $ show (end `diffUTCTime` start) ++ " elapsed.\n" start <- getCurrentTime putStrLn $ "Oriented Matroid: " ++ ffAnswers!!3 end <- getCurrentTime putStrLn $ show (end `diffUTCTime` start) ++ " elapsed.\n" start <- getCurrentTime putStrLn $ "Biquadratic Polynomial: " ++ ffAnswers!!4 end <- getCurrentTime putStrLn $ show (end `diffUTCTime` start) ++ " elapsed.\n\n" -} return ()
5,930
checkNetworks = do -- dpNet0 <- loadBinaryNetwork ("bla2.net") :: IO (Network [String] (Set.Set Dipole72)) -- dpNet1 <- loadBinaryNetwork ("../testsuite/dipole/24/alleq.net") :: IO (Network [String] (Set.Set Dipole72)) -- dpNet2 <- loadBinaryNetwork ("../testsuite/dipole/24/consistent_01.net") :: IO (Network [String] (Set.Set Dipole72)) -- dpNet3 <- loadBinaryNetwork ("../testsuite/dipole/24/inconsistent_01.net") :: IO (Network [String] (Set.Set Dipole72)) -- let dpNet4 = forwardCircle 8 -- -- At a sizo of 12 this network overwhelms the backtracking of the -- -- oriented matroid method. -- let dpNet5 = circleWithTwoCollinearDipolesInside 12 -- let dpNet5 = circleWithTwoCollinearDipolesInside 11 -- let dpNets = map circleWithTwoCollinearDipolesInside [6..40] let dpNets = [] let ffNet1 = allLeft 8 ffNet2 <- loadNetwork ("../testsuite/flipflop/inconsistent/inconsistent_01.net") :: IO (Network [String] (Set.Set FlipFlop)) let ffNet3 = indianTent 8 ffNet4 <- loadNetwork ("../testsuite/flipflop/inconsistent/nomatroid.net") :: IO (Network [String] (Set.Set FlipFlop)) ffNet5 <- loadNetwork ("../testsuite/flipflop/inconsistent/triskilde.net") :: IO (Network [String] (Set.Set FlipFlop)) ffNet6 <- loadNetwork ("../testsuite/flipflop/inconsistent/triskilde_less.net") :: IO (Network [String] (Set.Set FlipFlop)) ffNet7 <- loadNetwork ("../testsuite/flipflop/inconsistent/desargues.net") :: IO (Network [String] (Set.Set FlipFlop)) ffNet8 <- loadNetwork ("../testsuite/flipflop/inconsistent/minimalStar.net") :: IO (Network [String] (Set.Set FlipFlop)) ffNet9 <- loadNetwork ("../testsuite/flipflop/inconsistent/pappos.net") :: IO (Network [String] (Set.Set FlipFlop)) ffNet10 <- loadNetwork ("../testsuite/flipflop/inconsistent/pappos_uniform.net") :: IO (Network [String] (Set.Set FlipFlop)) ffNet11 <- loadNetwork ("../testsuite/flipflop/inconsistent/tenA.net") :: IO (Network [String] (Set.Set FlipFlop)) ffNet12 <- loadNetwork ("../testsuite/flipflop/consistent/triskilde.net") :: IO (Network [String] (Set.Set FlipFlop)) ffNet13 <- loadNetwork ("../testsuite/flipflop/consistent/desargues.net") :: IO (Network [String] (Set.Set FlipFlop)) ffNet14 <- loadNetwork ("../testsuite/flipflop/consistent/minimalStar.net") :: IO (Network [String] (Set.Set FlipFlop)) ffNet15 <- loadNetwork ("../testsuite/flipflop/consistent/minimalStar.net") :: IO (Network [String] (Set.Set FlipFlop)) ffNet15 <- loadNetwork ("../testsuite/flipflop/consistent/pappos.net") :: IO (Network [String] (Set.Set FlipFlop)) -- ffNet16 <- loadNetwork ("../testsuite/flipflop/consistent/pappos_uniform.net") :: IO (Network [String] (Set.Set FlipFlop)) -- ffNet1 <- loadNetwork ("./test.net") :: IO (Network [String] (Set.Set FlipFlop)) -- let ffNets = [ffNet1] let ffNets = [ ffNet1 , ffNet2 , ffNet3 , ffNet4 , ffNet5 , ffNet6 , ffNet7 , ffNet8 , ffNet9 , ffNet10 , ffNet11 , ffNet12 , ffNet13 , ffNet14 , ffNet15 ] let dpAnswers = makeReadable 0 $ dpCheckConsistency dpNets let ffAnswers = makeReadable (length dpNets) $ ffCheckConsistency ffNets let showNetworks nets startNumber = foldl (\acc (net, k) -> acc ++ " === NETWORK No. " ++ show k ++ " ===\n\n" ++ showNonAtomicNet net ++ "\n\n" ) "" $ zip nets [startNumber..] putStrLn $ "\n === NEW TEST ===\n\n" ++ -- "Networks tested:\n\n" ++ -- showNetworks dpNets 1 ++ showNetworks ffNets (length dpNets + 1) ++ -- " === RESULTS ===\n\n" ++ "Number of Network: " ++ (intercalate " " $ map show [1..length dpNets + length ffNets]) ++ "\n" start <- getCurrentTime putStrLn $ "Algebraic Closure: " ++ dpAnswers!!0 ++ ffAnswers!!0 end <- getCurrentTime putStrLn $ show (end `diffUTCTime` start) ++ " elapsed.\n" start <- getCurrentTime putStrLn $ "Algebraic Reasoning: " ++ dpAnswers!!1 ++ ffAnswers!!1 end <- getCurrentTime putStrLn $ show (end `diffUTCTime` start) ++ " elapsed.\n" start <- getCurrentTime putStrLn $ "Triangle Consistency: " ++ dpAnswers!!2 ++ ffAnswers!!2 end <- getCurrentTime putStrLn $ show (end `diffUTCTime` start) ++ " elapsed.\n" start <- getCurrentTime putStrLn $ "Oriented Matroid: " ++ dpAnswers!!3 ++ ffAnswers!!3 end <- getCurrentTime putStrLn $ show (end `diffUTCTime` start) ++ " elapsed.\n" start <- getCurrentTime putStrLn $ "Biquadratic Polynomial: " ++ dpAnswers!!4 ++ ffAnswers!!4 end <- getCurrentTime putStrLn $ show (end `diffUTCTime` start) ++ " elapsed.\n\n" {- start <- getCurrentTime putStrLn $ "Algebraic Closure: " ++ ffAnswers!!0 end <- getCurrentTime putStrLn $ show (end `diffUTCTime` start) ++ " elapsed.\n" start <- getCurrentTime putStrLn $ "Algebraic Reasoning: " ++ ffAnswers!!1 end <- getCurrentTime putStrLn $ show (end `diffUTCTime` start) ++ " elapsed.\n" start <- getCurrentTime putStrLn $ "Triangle Consistency: " ++ ffAnswers!!2 end <- getCurrentTime putStrLn $ show (end `diffUTCTime` start) ++ " elapsed.\n" start <- getCurrentTime putStrLn $ "Oriented Matroid: " ++ ffAnswers!!3 end <- getCurrentTime putStrLn $ show (end `diffUTCTime` start) ++ " elapsed.\n" start <- getCurrentTime putStrLn $ "Biquadratic Polynomial: " ++ ffAnswers!!4 end <- getCurrentTime putStrLn $ show (end `diffUTCTime` start) ++ " elapsed.\n\n" -} return ()
5,930
false
false
1
19
1,438
1,122
561
561
null
null
prt2121/fp101x
natOp.hs
apache-2.0
add n (Succ m) = Succ (add m n)
36
add n (Succ m) = Succ (add m n)
36
add n (Succ m) = Succ (add m n)
36
false
false
0
6
13
30
13
17
null
null
kaoskorobase/mescaline
resources/hugs/packages/base/Data/IntSet.hs
gpl-3.0
split :: Int -> IntSet -> (IntSet,IntSet) split x t = case t of Bin p m l r | m < 0 -> if x >= 0 then let (lt,gt) = split' x l in (union r lt, gt) else let (lt,gt) = split' x r in (lt, union gt l) -- handle negative numbers. | otherwise -> split' x t Tip y | x>y -> (t,Nil) | x<y -> (Nil,t) | otherwise -> (Nil,Nil) Nil -> (Nil, Nil)
502
split :: Int -> IntSet -> (IntSet,IntSet) split x t = case t of Bin p m l r | m < 0 -> if x >= 0 then let (lt,gt) = split' x l in (union r lt, gt) else let (lt,gt) = split' x r in (lt, union gt l) -- handle negative numbers. | otherwise -> split' x t Tip y | x>y -> (t,Nil) | x<y -> (Nil,t) | otherwise -> (Nil,Nil) Nil -> (Nil, Nil)
502
split x t = case t of Bin p m l r | m < 0 -> if x >= 0 then let (lt,gt) = split' x l in (union r lt, gt) else let (lt,gt) = split' x r in (lt, union gt l) -- handle negative numbers. | otherwise -> split' x t Tip y | x>y -> (t,Nil) | x<y -> (Nil,t) | otherwise -> (Nil,Nil) Nil -> (Nil, Nil)
460
false
true
0
14
248
225
114
111
null
null
johanneshilden/liquid-epsilon
Util/HTML/Elements.hs
bsd-3-clause
i = makePar "i"
24
i = makePar "i"
24
i = makePar "i"
24
false
false
0
5
12
9
4
5
null
null
cirquit/quizlearner
resources/form/n_app_forms.hs
mit
t3 = ("t3 - true3", True)
25
t3 = ("t3 - true3", True)
25
t3 = ("t3 - true3", True)
25
false
false
0
5
5
12
7
5
null
null
jgm/citeproc
src/Citeproc/Types.hs
bsd-2-clause
variableType "PMCID" = StringVariable
37
variableType "PMCID" = StringVariable
37
variableType "PMCID" = StringVariable
37
false
false
0
5
3
9
4
5
null
null
spechub/Hets
Common/Doc.hs
gpl-2.0
quote = symbol "\'"
19
quote = symbol "\'"
19
quote = symbol "\'"
19
false
false
1
5
3
12
4
8
null
null
wellposed/hblas
src/Numerical/HBLAS/BLAS/Internal/Level1.hs
bsd-3-clause
rotmAbstraction :: (SM.Storable el, PrimMonad m, Show el) => String -> RotmFunFFI el -> RotmFunFFI el -> RotmFun el (PrimState m) m rotmAbstraction rotmName rotmSafeFFI rotmUnsafeFFI = rotm where shouldCallFast :: Bool shouldCallFast = True -- O(1) rotm n (MutableDenseVector _ adim astride abuff) (MutableDenseVector _ bdim bstride bbuff) (MutableDenseVector _ pdim _ pbuff) | isVectorBadWithNIncrement adim n astride = error $! vectorBadInfo rotmName "first matrix" adim n astride | isVectorBadWithNIncrement bdim n bstride = error $! vectorBadInfo rotmName "second matrix" bdim n bstride | pdim /= 5 = error $! rotmName ++ " param dimension is not 5" | otherwise = unsafeWithPrim abuff $ \ap -> unsafeWithPrim bbuff $ \bp -> unsafeWithPrim pbuff $ \pp -> do unsafePrimToPrim $! (if shouldCallFast then rotmUnsafeFFI else rotmSafeFFI) (fromIntegral n) ap (fromIntegral astride) bp (fromIntegral bstride) pp --{-# NOINLINE rotmgAbstraction #-} --rotmgAbstraction :: (SM.Storable el, PrimMonad m, Show el) => String -> -- RotmgFunFFI el -> RotmgFunFFI el -> -- RotmgFun el (PrimState m) m --rotmgAbstraction rotmgName rotmgSafeFFI rotmgUnsafeFFI = rotmg -- where -- shouldCallFast :: Bool -- shouldCallFast = True -- O(1) -- rotmg (MutableValue d1) -- (MutableValue d2) -- (MutableValue x1) -- y1 -- (MutableDenseVector _ pdim _ pbuff) -- | pdim /= 5 = error $! rotmgName ++ " param dimension is not 5" -- | otherwise = -- unsafeWithPrim d1 $ \d1p -> -- unsafeWithPrim d2 $ \d2p -> -- unsafeWithPrim x1 $ \x1p -> -- unsafeWithPrim pbuff $ \pp -> -- do unsafePrimToPrim $! (if shouldCallFast then rotmgUnsafeFFI else rotmgSafeFFI) d1p d2p x1p y1 pp
1,844
rotmAbstraction :: (SM.Storable el, PrimMonad m, Show el) => String -> RotmFunFFI el -> RotmFunFFI el -> RotmFun el (PrimState m) m rotmAbstraction rotmName rotmSafeFFI rotmUnsafeFFI = rotm where shouldCallFast :: Bool shouldCallFast = True -- O(1) rotm n (MutableDenseVector _ adim astride abuff) (MutableDenseVector _ bdim bstride bbuff) (MutableDenseVector _ pdim _ pbuff) | isVectorBadWithNIncrement adim n astride = error $! vectorBadInfo rotmName "first matrix" adim n astride | isVectorBadWithNIncrement bdim n bstride = error $! vectorBadInfo rotmName "second matrix" bdim n bstride | pdim /= 5 = error $! rotmName ++ " param dimension is not 5" | otherwise = unsafeWithPrim abuff $ \ap -> unsafeWithPrim bbuff $ \bp -> unsafeWithPrim pbuff $ \pp -> do unsafePrimToPrim $! (if shouldCallFast then rotmUnsafeFFI else rotmSafeFFI) (fromIntegral n) ap (fromIntegral astride) bp (fromIntegral bstride) pp --{-# NOINLINE rotmgAbstraction #-} --rotmgAbstraction :: (SM.Storable el, PrimMonad m, Show el) => String -> -- RotmgFunFFI el -> RotmgFunFFI el -> -- RotmgFun el (PrimState m) m --rotmgAbstraction rotmgName rotmgSafeFFI rotmgUnsafeFFI = rotmg -- where -- shouldCallFast :: Bool -- shouldCallFast = True -- O(1) -- rotmg (MutableValue d1) -- (MutableValue d2) -- (MutableValue x1) -- y1 -- (MutableDenseVector _ pdim _ pbuff) -- | pdim /= 5 = error $! rotmgName ++ " param dimension is not 5" -- | otherwise = -- unsafeWithPrim d1 $ \d1p -> -- unsafeWithPrim d2 $ \d2p -> -- unsafeWithPrim x1 $ \x1p -> -- unsafeWithPrim pbuff $ \pp -> -- do unsafePrimToPrim $! (if shouldCallFast then rotmgUnsafeFFI else rotmgSafeFFI) d1p d2p x1p y1 pp
1,844
rotmAbstraction rotmName rotmSafeFFI rotmUnsafeFFI = rotm where shouldCallFast :: Bool shouldCallFast = True -- O(1) rotm n (MutableDenseVector _ adim astride abuff) (MutableDenseVector _ bdim bstride bbuff) (MutableDenseVector _ pdim _ pbuff) | isVectorBadWithNIncrement adim n astride = error $! vectorBadInfo rotmName "first matrix" adim n astride | isVectorBadWithNIncrement bdim n bstride = error $! vectorBadInfo rotmName "second matrix" bdim n bstride | pdim /= 5 = error $! rotmName ++ " param dimension is not 5" | otherwise = unsafeWithPrim abuff $ \ap -> unsafeWithPrim bbuff $ \bp -> unsafeWithPrim pbuff $ \pp -> do unsafePrimToPrim $! (if shouldCallFast then rotmUnsafeFFI else rotmSafeFFI) (fromIntegral n) ap (fromIntegral astride) bp (fromIntegral bstride) pp --{-# NOINLINE rotmgAbstraction #-} --rotmgAbstraction :: (SM.Storable el, PrimMonad m, Show el) => String -> -- RotmgFunFFI el -> RotmgFunFFI el -> -- RotmgFun el (PrimState m) m --rotmgAbstraction rotmgName rotmgSafeFFI rotmgUnsafeFFI = rotmg -- where -- shouldCallFast :: Bool -- shouldCallFast = True -- O(1) -- rotmg (MutableValue d1) -- (MutableValue d2) -- (MutableValue x1) -- y1 -- (MutableDenseVector _ pdim _ pbuff) -- | pdim /= 5 = error $! rotmgName ++ " param dimension is not 5" -- | otherwise = -- unsafeWithPrim d1 $ \d1p -> -- unsafeWithPrim d2 $ \d2p -> -- unsafeWithPrim x1 $ \x1p -> -- unsafeWithPrim pbuff $ \pp -> -- do unsafePrimToPrim $! (if shouldCallFast then rotmgUnsafeFFI else rotmgSafeFFI) d1p d2p x1p y1 pp
1,708
false
true
0
17
454
330
171
159
null
null
tpsinnem/Idris-dev
src/Idris/Reflection.hs
bsd-3-clause
reifyTTNameType :: Term -> ElabD NameType reifyTTNameType t@(P _ n _) | n == reflm "Bound" = return $ Bound
107
reifyTTNameType :: Term -> ElabD NameType reifyTTNameType t@(P _ n _) | n == reflm "Bound" = return $ Bound
107
reifyTTNameType t@(P _ n _) | n == reflm "Bound" = return $ Bound
65
false
true
0
9
19
51
24
27
null
null
ekmett/ghc
compiler/llvmGen/LlvmCodeGen/CodeGen.hs
bsd-3-clause
-- ----------------------------------------------------------------------------- -- * Misc -- -- | Find CmmRegs that get assigned and allocate them on the stack -- -- Any register that gets written needs to be allcoated on the -- stack. This avoids having to map a CmmReg to an equivalent SSA form -- and avoids having to deal with Phi node insertion. This is also -- the approach recommended by LLVM developers. -- -- On the other hand, this is unecessarily verbose if the register in -- question is never written. Therefore we skip it where we can to -- save a few lines in the output and hopefully speed compilation up a -- bit. funPrologue :: LiveGlobalRegs -> [CmmBlock] -> LlvmM StmtData funPrologue live cmmBlocks = do trash <- getTrashRegs let getAssignedRegs :: CmmNode O O -> [CmmReg] getAssignedRegs (CmmAssign reg _) = [reg] -- Calls will trash all registers. Unfortunately, this needs them to -- be stack-allocated in the first place. getAssignedRegs (CmmUnsafeForeignCall _ rs _) = map CmmGlobal trash ++ map CmmLocal rs getAssignedRegs _ = [] getRegsBlock (_, body, _) = concatMap getAssignedRegs $ blockToList body assignedRegs = nub $ concatMap (getRegsBlock . blockSplit) cmmBlocks isLive r = r `elem` alwaysLive || r `elem` live dflags <- getDynFlags stmtss <- flip mapM assignedRegs $ \reg -> case reg of CmmLocal (LocalReg un _) -> do let (newv, stmts) = allocReg reg varInsert un (pLower $ getVarType newv) return stmts CmmGlobal r -> do let reg = lmGlobalRegVar dflags r arg = lmGlobalRegArg dflags r ty = (pLower . getVarType) reg trash = LMLitVar $ LMUndefLit ty rval = if isLive r then arg else trash alloc = Assignment reg $ Alloca (pLower $ getVarType reg) 1 markStackReg r return $ toOL [alloc, Store rval reg] return (concatOL stmtss, []) -- | Function epilogue. Load STG variables to use as argument for call. -- STG Liveness optimisation done here.
2,107
funPrologue :: LiveGlobalRegs -> [CmmBlock] -> LlvmM StmtData funPrologue live cmmBlocks = do trash <- getTrashRegs let getAssignedRegs :: CmmNode O O -> [CmmReg] getAssignedRegs (CmmAssign reg _) = [reg] -- Calls will trash all registers. Unfortunately, this needs them to -- be stack-allocated in the first place. getAssignedRegs (CmmUnsafeForeignCall _ rs _) = map CmmGlobal trash ++ map CmmLocal rs getAssignedRegs _ = [] getRegsBlock (_, body, _) = concatMap getAssignedRegs $ blockToList body assignedRegs = nub $ concatMap (getRegsBlock . blockSplit) cmmBlocks isLive r = r `elem` alwaysLive || r `elem` live dflags <- getDynFlags stmtss <- flip mapM assignedRegs $ \reg -> case reg of CmmLocal (LocalReg un _) -> do let (newv, stmts) = allocReg reg varInsert un (pLower $ getVarType newv) return stmts CmmGlobal r -> do let reg = lmGlobalRegVar dflags r arg = lmGlobalRegArg dflags r ty = (pLower . getVarType) reg trash = LMLitVar $ LMUndefLit ty rval = if isLive r then arg else trash alloc = Assignment reg $ Alloca (pLower $ getVarType reg) 1 markStackReg r return $ toOL [alloc, Store rval reg] return (concatOL stmtss, []) -- | Function epilogue. Load STG variables to use as argument for call. -- STG Liveness optimisation done here.
1,473
funPrologue live cmmBlocks = do trash <- getTrashRegs let getAssignedRegs :: CmmNode O O -> [CmmReg] getAssignedRegs (CmmAssign reg _) = [reg] -- Calls will trash all registers. Unfortunately, this needs them to -- be stack-allocated in the first place. getAssignedRegs (CmmUnsafeForeignCall _ rs _) = map CmmGlobal trash ++ map CmmLocal rs getAssignedRegs _ = [] getRegsBlock (_, body, _) = concatMap getAssignedRegs $ blockToList body assignedRegs = nub $ concatMap (getRegsBlock . blockSplit) cmmBlocks isLive r = r `elem` alwaysLive || r `elem` live dflags <- getDynFlags stmtss <- flip mapM assignedRegs $ \reg -> case reg of CmmLocal (LocalReg un _) -> do let (newv, stmts) = allocReg reg varInsert un (pLower $ getVarType newv) return stmts CmmGlobal r -> do let reg = lmGlobalRegVar dflags r arg = lmGlobalRegArg dflags r ty = (pLower . getVarType) reg trash = LMLitVar $ LMUndefLit ty rval = if isLive r then arg else trash alloc = Assignment reg $ Alloca (pLower $ getVarType reg) 1 markStackReg r return $ toOL [alloc, Store rval reg] return (concatOL stmtss, []) -- | Function epilogue. Load STG variables to use as argument for call. -- STG Liveness optimisation done here.
1,411
true
true
0
22
542
448
228
220
null
null
kmicklas/pyrec
src/Pyrec/Misc.hs
mit
(<$$$>) :: (Functor f, Functor f1, Functor f2) => (a -> b) -> f (f1 (f2 a)) -> f (f1 (f2 b)) (<$$$>) = fmap . fmap . fmap
132
(<$$$>) :: (Functor f, Functor f1, Functor f2) => (a -> b) -> f (f1 (f2 a)) -> f (f1 (f2 b)) (<$$$>) = fmap . fmap . fmap
132
(<$$$>) = fmap . fmap . fmap
28
false
true
1
13
39
95
48
47
null
null
mightymoose/liquidhaskell
tests/todo/AbsRefNameClash.hs
bsd-3-clause
-@ data Heap a <p :: a -> a -> Prop> = Empty | Node { pri :: a , rnk :: Nat , left :: {v: Heap<p> (a<p pri>) | ValidRank v} , right :: {v: Heap<p> (a<p pri>) | ValidRank v} } @-} {-@ predicate ValidRank V = okRank V && realRank V = rank V @-} {-@ type PHeap a = {v:OHeap a | ValidRank v} @-} {-@ type OHeap a = Heap <{\root v -> root <= v}> a @-} {-@ measure okRank :: Heap a -> Prop okRank (Empty) = true okRank (Node p k l r) = (realRank l >= realRank r && k = 1 + realRank l + realRank r ) @-} {-@ measure realRank :: Heap a -> Int realRank (Empty) = 0 realRank (Node p k l r) = (1 + realRank l + realRank r) @-} {-@ measure rank @-} {-@ rank :: h:PHeap a -> {v:Nat | v = realRank h} @-} rank Empty = 0
879
rank Empty = 0
23
rank Empty = 0
23
true
false
41
14
341
413
229
184
null
null
fffej/HS-Poker
LookupPatternMatch.hs
bsd-3-clause
getValueFromProduct 110789 = 2249
33
getValueFromProduct 110789 = 2249
33
getValueFromProduct 110789 = 2249
33
false
false
0
5
3
9
4
5
null
null
lueck/htcf
src/HTCF/ConfigParser.hs
gpl-3.0
pcTcfSentenceIdPrefix :: IOSArrow XmlTree Config pcTcfSentenceIdPrefix = hasName "tcf" >>> getChildren >>> hasName "sentenceIdPrefix" >>> getAttrValue "prefix" >>> arr (TcfSentenceIdPrefix . defaultOnNull defaultTcfSentenceIdPrefix)
238
pcTcfSentenceIdPrefix :: IOSArrow XmlTree Config pcTcfSentenceIdPrefix = hasName "tcf" >>> getChildren >>> hasName "sentenceIdPrefix" >>> getAttrValue "prefix" >>> arr (TcfSentenceIdPrefix . defaultOnNull defaultTcfSentenceIdPrefix)
238
pcTcfSentenceIdPrefix = hasName "tcf" >>> getChildren >>> hasName "sentenceIdPrefix" >>> getAttrValue "prefix" >>> arr (TcfSentenceIdPrefix . defaultOnNull defaultTcfSentenceIdPrefix)
189
false
true
0
9
28
54
25
29
null
null
ghc-android/ghc
compiler/codeGen/StgCmmPrim.hs
bsd-3-clause
shouldInlinePrimOp _ CopySmallMutableArrayOp [src, src_off, dst, dst_off, (CmmLit (CmmInt n _))] = Just $ \ [] -> doCopySmallMutableArrayOp src src_off dst dst_off (fromInteger n)
191
shouldInlinePrimOp _ CopySmallMutableArrayOp [src, src_off, dst, dst_off, (CmmLit (CmmInt n _))] = Just $ \ [] -> doCopySmallMutableArrayOp src src_off dst dst_off (fromInteger n)
191
shouldInlinePrimOp _ CopySmallMutableArrayOp [src, src_off, dst, dst_off, (CmmLit (CmmInt n _))] = Just $ \ [] -> doCopySmallMutableArrayOp src src_off dst dst_off (fromInteger n)
191
false
false
0
10
35
70
37
33
null
null
wilbowma/accelerate
Data/Array/Accelerate/CUDA/CodeGen.hs
bsd-3-clause
codeGenIntegralTex (TypeCInt _) = [CTypeDef (internalIdent "TexCInt") internalNode]
89
codeGenIntegralTex (TypeCInt _) = [CTypeDef (internalIdent "TexCInt") internalNode]
89
codeGenIntegralTex (TypeCInt _) = [CTypeDef (internalIdent "TexCInt") internalNode]
89
false
false
0
8
13
29
14
15
null
null
SAdams601/HaRe
old/refactorer/RefacDupTrans.hs
bsd-3-clause
pruneCloneClass _ _ = []
24
pruneCloneClass _ _ = []
24
pruneCloneClass _ _ = []
24
false
false
1
6
4
14
6
8
null
null
Philonous/pontarius-xmpp
source/Network/Xmpp/Lens.hs
bsd-3-clause
-- SessionConfiguration ----------------------- streamConfigurationL :: Lens SessionConfiguration StreamConfiguration streamConfigurationL inj sc@SessionConfiguration{sessionStreamConfiguration = x} = (\x' -> sc{sessionStreamConfiguration = x'}) <$> inj x
259
streamConfigurationL :: Lens SessionConfiguration StreamConfiguration streamConfigurationL inj sc@SessionConfiguration{sessionStreamConfiguration = x} = (\x' -> sc{sessionStreamConfiguration = x'}) <$> inj x
211
streamConfigurationL inj sc@SessionConfiguration{sessionStreamConfiguration = x} = (\x' -> sc{sessionStreamConfiguration = x'}) <$> inj x
141
true
true
0
9
25
58
32
26
null
null
the-real-blackh/hexpat
Text/XML/Expat/Internal/Namespaced.hs
bsd-3-clause
nodeWithQualifiers :: (NodeClass n c, GenericXMLString text, Ord text, Functor c) => Int -> PrefixNsMap text -> n c (NName text) text -> n c (QName text) text nodeWithQualifiers cntr bindings = modifyElement namespaceify where namespaceify (nname, nattrs, nchildren) = (qname, qattrs, qchildren) where for = flip map ffor = flip fmap (nsAtts, otherAtts) = L.partition ((== Just xmlnsUri) . nnNamespace . fst) nattrs (dfAtt, normalAtts) = L.partition ((== NName Nothing xmlns) . fst) otherAtts nsMap = M.fromList $ for nsAtts $ \((NName _ lp), uri) -> (Just uri, Just lp) dfMap = M.fromList $ for dfAtt $ \(_, uri) -> (Just uri, Just xmlns) chldBs = M.unions [dfMap, nsMap, bindings] trans (i, bs, as) (NName nspace qual) = case nspace `M.lookup` bs of Nothing -> let pfx = gxFromString $ "ns" ++ show i bsN = M.insert nspace (Just pfx) bs asN = (NName (Just xmlnsUri) pfx, DM.fromJust nspace) : as in trans (i+1, bsN, asN) (NName nspace qual) Just pfx -> ((i, bs, as), QName pfx qual) transAt ibs (nn, v) = let (ibs', qn) = trans ibs nn in (ibs', (qn, v)) ((i', bs', as'), qname) = trans (cntr, chldBs, []) nname ((i'', bs'', as''), qNsAtts) = L.mapAccumL transAt (i', bs', as') nsAtts ((i''', bs''', as'''), qDfAtt) = L.mapAccumL transAt (i'', bs'', as'') dfAtt ((i'''', bs'''', as''''), qNormalAtts) = L.mapAccumL transAt (i''', bs''', as''') normalAtts (_, qas) = L.mapAccumL transAt (i'''', bs'''', as'''') as'''' qattrs = concat [qNsAtts, qDfAtt, qNormalAtts, qas] qchildren = ffor nchildren $ nodeWithQualifiers i'''' bs''''
2,018
nodeWithQualifiers :: (NodeClass n c, GenericXMLString text, Ord text, Functor c) => Int -> PrefixNsMap text -> n c (NName text) text -> n c (QName text) text nodeWithQualifiers cntr bindings = modifyElement namespaceify where namespaceify (nname, nattrs, nchildren) = (qname, qattrs, qchildren) where for = flip map ffor = flip fmap (nsAtts, otherAtts) = L.partition ((== Just xmlnsUri) . nnNamespace . fst) nattrs (dfAtt, normalAtts) = L.partition ((== NName Nothing xmlns) . fst) otherAtts nsMap = M.fromList $ for nsAtts $ \((NName _ lp), uri) -> (Just uri, Just lp) dfMap = M.fromList $ for dfAtt $ \(_, uri) -> (Just uri, Just xmlns) chldBs = M.unions [dfMap, nsMap, bindings] trans (i, bs, as) (NName nspace qual) = case nspace `M.lookup` bs of Nothing -> let pfx = gxFromString $ "ns" ++ show i bsN = M.insert nspace (Just pfx) bs asN = (NName (Just xmlnsUri) pfx, DM.fromJust nspace) : as in trans (i+1, bsN, asN) (NName nspace qual) Just pfx -> ((i, bs, as), QName pfx qual) transAt ibs (nn, v) = let (ibs', qn) = trans ibs nn in (ibs', (qn, v)) ((i', bs', as'), qname) = trans (cntr, chldBs, []) nname ((i'', bs'', as''), qNsAtts) = L.mapAccumL transAt (i', bs', as') nsAtts ((i''', bs''', as'''), qDfAtt) = L.mapAccumL transAt (i'', bs'', as'') dfAtt ((i'''', bs'''', as''''), qNormalAtts) = L.mapAccumL transAt (i''', bs''', as''') normalAtts (_, qas) = L.mapAccumL transAt (i'''', bs'''', as'''') as'''' qattrs = concat [qNsAtts, qDfAtt, qNormalAtts, qas] qchildren = ffor nchildren $ nodeWithQualifiers i'''' bs''''
2,018
nodeWithQualifiers cntr bindings = modifyElement namespaceify where namespaceify (nname, nattrs, nchildren) = (qname, qattrs, qchildren) where for = flip map ffor = flip fmap (nsAtts, otherAtts) = L.partition ((== Just xmlnsUri) . nnNamespace . fst) nattrs (dfAtt, normalAtts) = L.partition ((== NName Nothing xmlns) . fst) otherAtts nsMap = M.fromList $ for nsAtts $ \((NName _ lp), uri) -> (Just uri, Just lp) dfMap = M.fromList $ for dfAtt $ \(_, uri) -> (Just uri, Just xmlns) chldBs = M.unions [dfMap, nsMap, bindings] trans (i, bs, as) (NName nspace qual) = case nspace `M.lookup` bs of Nothing -> let pfx = gxFromString $ "ns" ++ show i bsN = M.insert nspace (Just pfx) bs asN = (NName (Just xmlnsUri) pfx, DM.fromJust nspace) : as in trans (i+1, bsN, asN) (NName nspace qual) Just pfx -> ((i, bs, as), QName pfx qual) transAt ibs (nn, v) = let (ibs', qn) = trans ibs nn in (ibs', (qn, v)) ((i', bs', as'), qname) = trans (cntr, chldBs, []) nname ((i'', bs'', as''), qNsAtts) = L.mapAccumL transAt (i', bs', as') nsAtts ((i''', bs''', as'''), qDfAtt) = L.mapAccumL transAt (i'', bs'', as'') dfAtt ((i'''', bs'''', as''''), qNormalAtts) = L.mapAccumL transAt (i''', bs''', as''') normalAtts (_, qas) = L.mapAccumL transAt (i'''', bs'''', as'''') as'''' qattrs = concat [qNsAtts, qDfAtt, qNormalAtts, qas] qchildren = ffor nchildren $ nodeWithQualifiers i'''' bs''''
1,780
false
true
0
18
739
761
414
347
null
null
JustinUnger/haskell-book
ch24/ch24-ipv6.hs
mit
showAddr6 :: IPAddress6 -> String showAddr6 = concat . intersperse ":" . map showWord16 . addr6ToWords
102
showAddr6 :: IPAddress6 -> String showAddr6 = concat . intersperse ":" . map showWord16 . addr6ToWords
102
showAddr6 = concat . intersperse ":" . map showWord16 . addr6ToWords
68
false
true
0
8
15
33
16
17
null
null
sorki/odrive
src/LDrive/Tests/CANOpen.hs
bsd-3-clause
app :: (e -> ClockConfig) -> (e -> TestCAN) -> (e -> ColoredLEDs) -> Tower e () app tocc totestcan toleds = do can <- fmap totestcan getEnv leds <- fmap toleds getEnv ldriveTowerDeps (res, req, _, _) <- canTower tocc (testCAN can) 1000000 (testCANRX can) (testCANTX can) attrs@Cia402Attrs{..} <- towerCia402Attrs initCia402Attrs od@ObjDict{..} <- objDictTower attrs canopenTower res req (canOpenLEDs leds) od periodic <- period (Milliseconds 250) monitor "simplecontroller" $ do handler systemInit "init" $ do callback $ const $ do let emptyID = CANFilterID32 (fromRep 0) (fromRep 0) False False canFilterInit (testCANFilters can) [CANFilterBank CANFIFO0 CANFilterMask $ CANFilter32 emptyID emptyID] [] ledSetup $ greenLED leds ledSetup $ redLED leds ledOn $ redLED leds where canOpenLEDs leds = CANOpenLEDs { leds_init = ledSetup (greenLED leds) >> ledSetup (redLED leds) , leds_module = hw_moduledef , leds_err_on = ledOn $ redLED leds , leds_err_off = ledOff $ redLED leds , leds_run_on = ledOn $ greenLED leds , leds_run_off = ledOff $ greenLED leds }
1,289
app :: (e -> ClockConfig) -> (e -> TestCAN) -> (e -> ColoredLEDs) -> Tower e () app tocc totestcan toleds = do can <- fmap totestcan getEnv leds <- fmap toleds getEnv ldriveTowerDeps (res, req, _, _) <- canTower tocc (testCAN can) 1000000 (testCANRX can) (testCANTX can) attrs@Cia402Attrs{..} <- towerCia402Attrs initCia402Attrs od@ObjDict{..} <- objDictTower attrs canopenTower res req (canOpenLEDs leds) od periodic <- period (Milliseconds 250) monitor "simplecontroller" $ do handler systemInit "init" $ do callback $ const $ do let emptyID = CANFilterID32 (fromRep 0) (fromRep 0) False False canFilterInit (testCANFilters can) [CANFilterBank CANFIFO0 CANFilterMask $ CANFilter32 emptyID emptyID] [] ledSetup $ greenLED leds ledSetup $ redLED leds ledOn $ redLED leds where canOpenLEDs leds = CANOpenLEDs { leds_init = ledSetup (greenLED leds) >> ledSetup (redLED leds) , leds_module = hw_moduledef , leds_err_on = ledOn $ redLED leds , leds_err_off = ledOff $ redLED leds , leds_run_on = ledOn $ greenLED leds , leds_run_off = ledOff $ greenLED leds }
1,289
app tocc totestcan toleds = do can <- fmap totestcan getEnv leds <- fmap toleds getEnv ldriveTowerDeps (res, req, _, _) <- canTower tocc (testCAN can) 1000000 (testCANRX can) (testCANTX can) attrs@Cia402Attrs{..} <- towerCia402Attrs initCia402Attrs od@ObjDict{..} <- objDictTower attrs canopenTower res req (canOpenLEDs leds) od periodic <- period (Milliseconds 250) monitor "simplecontroller" $ do handler systemInit "init" $ do callback $ const $ do let emptyID = CANFilterID32 (fromRep 0) (fromRep 0) False False canFilterInit (testCANFilters can) [CANFilterBank CANFIFO0 CANFilterMask $ CANFilter32 emptyID emptyID] [] ledSetup $ greenLED leds ledSetup $ redLED leds ledOn $ redLED leds where canOpenLEDs leds = CANOpenLEDs { leds_init = ledSetup (greenLED leds) >> ledSetup (redLED leds) , leds_module = hw_moduledef , leds_err_on = ledOn $ redLED leds , leds_err_off = ledOff $ redLED leds , leds_run_on = ledOn $ greenLED leds , leds_run_off = ledOff $ greenLED leds }
1,197
false
true
0
21
395
436
208
228
null
null
pparkkin/eta
compiler/ETA/Main/DynFlags.hs
bsd-3-clause
-- | These @-f\<blah\>@ flags can all be reversed with @-fno-\<blah\>@ fLangFlags :: [FlagSpec ExtensionFlag] fLangFlags = [ -- See Note [Updating flag description in the User's Guide] -- See Note [Supporting CLI completion] flagSpec' "th" Opt_TemplateHaskell (\on -> deprecatedForExtension "TemplateHaskell" on >> checkTemplateHaskellOk on), flagSpec' "fi" Opt_ForeignFunctionInterface (deprecatedForExtension "ForeignFunctionInterface"), flagSpec' "ffi" Opt_ForeignFunctionInterface (deprecatedForExtension "ForeignFunctionInterface"), flagSpec' "arrows" Opt_Arrows (deprecatedForExtension "Arrows"), flagSpec' "implicit-prelude" Opt_ImplicitPrelude (deprecatedForExtension "ImplicitPrelude"), flagSpec' "bang-patterns" Opt_BangPatterns (deprecatedForExtension "BangPatterns"), flagSpec' "monomorphism-restriction" Opt_MonomorphismRestriction (deprecatedForExtension "MonomorphismRestriction"), flagSpec' "mono-pat-binds" Opt_MonoPatBinds (deprecatedForExtension "MonoPatBinds"), flagSpec' "extended-default-rules" Opt_ExtendedDefaultRules (deprecatedForExtension "ExtendedDefaultRules"), flagSpec' "implicit-params" Opt_ImplicitParams (deprecatedForExtension "ImplicitParams"), flagSpec' "scoped-type-variables" Opt_ScopedTypeVariables (deprecatedForExtension "ScopedTypeVariables"), flagSpec' "parr" Opt_ParallelArrays (deprecatedForExtension "ParallelArrays"), flagSpec' "PArr" Opt_ParallelArrays (deprecatedForExtension "ParallelArrays"), flagSpec' "allow-overlapping-instances" Opt_OverlappingInstances (deprecatedForExtension "OverlappingInstances"), flagSpec' "allow-undecidable-instances" Opt_UndecidableInstances (deprecatedForExtension "UndecidableInstances"), flagSpec' "allow-incoherent-instances" Opt_IncoherentInstances (deprecatedForExtension "IncoherentInstances") ]
2,161
fLangFlags :: [FlagSpec ExtensionFlag] fLangFlags = [ -- See Note [Updating flag description in the User's Guide] -- See Note [Supporting CLI completion] flagSpec' "th" Opt_TemplateHaskell (\on -> deprecatedForExtension "TemplateHaskell" on >> checkTemplateHaskellOk on), flagSpec' "fi" Opt_ForeignFunctionInterface (deprecatedForExtension "ForeignFunctionInterface"), flagSpec' "ffi" Opt_ForeignFunctionInterface (deprecatedForExtension "ForeignFunctionInterface"), flagSpec' "arrows" Opt_Arrows (deprecatedForExtension "Arrows"), flagSpec' "implicit-prelude" Opt_ImplicitPrelude (deprecatedForExtension "ImplicitPrelude"), flagSpec' "bang-patterns" Opt_BangPatterns (deprecatedForExtension "BangPatterns"), flagSpec' "monomorphism-restriction" Opt_MonomorphismRestriction (deprecatedForExtension "MonomorphismRestriction"), flagSpec' "mono-pat-binds" Opt_MonoPatBinds (deprecatedForExtension "MonoPatBinds"), flagSpec' "extended-default-rules" Opt_ExtendedDefaultRules (deprecatedForExtension "ExtendedDefaultRules"), flagSpec' "implicit-params" Opt_ImplicitParams (deprecatedForExtension "ImplicitParams"), flagSpec' "scoped-type-variables" Opt_ScopedTypeVariables (deprecatedForExtension "ScopedTypeVariables"), flagSpec' "parr" Opt_ParallelArrays (deprecatedForExtension "ParallelArrays"), flagSpec' "PArr" Opt_ParallelArrays (deprecatedForExtension "ParallelArrays"), flagSpec' "allow-overlapping-instances" Opt_OverlappingInstances (deprecatedForExtension "OverlappingInstances"), flagSpec' "allow-undecidable-instances" Opt_UndecidableInstances (deprecatedForExtension "UndecidableInstances"), flagSpec' "allow-incoherent-instances" Opt_IncoherentInstances (deprecatedForExtension "IncoherentInstances") ]
2,090
fLangFlags = [ -- See Note [Updating flag description in the User's Guide] -- See Note [Supporting CLI completion] flagSpec' "th" Opt_TemplateHaskell (\on -> deprecatedForExtension "TemplateHaskell" on >> checkTemplateHaskellOk on), flagSpec' "fi" Opt_ForeignFunctionInterface (deprecatedForExtension "ForeignFunctionInterface"), flagSpec' "ffi" Opt_ForeignFunctionInterface (deprecatedForExtension "ForeignFunctionInterface"), flagSpec' "arrows" Opt_Arrows (deprecatedForExtension "Arrows"), flagSpec' "implicit-prelude" Opt_ImplicitPrelude (deprecatedForExtension "ImplicitPrelude"), flagSpec' "bang-patterns" Opt_BangPatterns (deprecatedForExtension "BangPatterns"), flagSpec' "monomorphism-restriction" Opt_MonomorphismRestriction (deprecatedForExtension "MonomorphismRestriction"), flagSpec' "mono-pat-binds" Opt_MonoPatBinds (deprecatedForExtension "MonoPatBinds"), flagSpec' "extended-default-rules" Opt_ExtendedDefaultRules (deprecatedForExtension "ExtendedDefaultRules"), flagSpec' "implicit-params" Opt_ImplicitParams (deprecatedForExtension "ImplicitParams"), flagSpec' "scoped-type-variables" Opt_ScopedTypeVariables (deprecatedForExtension "ScopedTypeVariables"), flagSpec' "parr" Opt_ParallelArrays (deprecatedForExtension "ParallelArrays"), flagSpec' "PArr" Opt_ParallelArrays (deprecatedForExtension "ParallelArrays"), flagSpec' "allow-overlapping-instances" Opt_OverlappingInstances (deprecatedForExtension "OverlappingInstances"), flagSpec' "allow-undecidable-instances" Opt_UndecidableInstances (deprecatedForExtension "UndecidableInstances"), flagSpec' "allow-incoherent-instances" Opt_IncoherentInstances (deprecatedForExtension "IncoherentInstances") ]
2,051
true
true
0
10
497
290
147
143
null
null
dmbarbour/awelon
hsrc/ABC/Imperative/Operations.hs
bsd-3-clause
-- | block literals require TWO encodings of the same program. -- -- The first is the raw ABC code for the program (as a string) -- The second is the Haskell encoding -- -- The two encodings must be equivalent up to performance. That is, -- it must always be possible to interpret the code instead of run -- the block, and the only difference should be performance. The ABC -- code can be used to recover performance when composing lots of -- small blocks. -- -- The ABC encoding becomes useful for metaprogramming, where -- a developer composes lots of blocks at runtime. The result -- can be optimized and JIT'd. -- -- -- To keep the Haskell encoding tight, the program is -- provided as a string rather than a bulky list of [Op]. bl :: (Monad m) => String -> Prog m -> Prog m bl s p = return . (P (B b)) where b = Block { b_aff = False, b_rel = False, b_prog = p , b_code = S.fromList (read s) } -- | text literals are relatively trivial. They quote a text value, -- which has type `µT.(1+(Chr*T))` where Chr is a small integer in -- range 0..0x10ffff. We translate the given string into the target -- text value.
1,147
bl :: (Monad m) => String -> Prog m -> Prog m bl s p = return . (P (B b)) where b = Block { b_aff = False, b_rel = False, b_prog = p , b_code = S.fromList (read s) } -- | text literals are relatively trivial. They quote a text value, -- which has type `µT.(1+(Chr*T))` where Chr is a small integer in -- range 0..0x10ffff. We translate the given string into the target -- text value.
403
bl s p = return . (P (B b)) where b = Block { b_aff = False, b_rel = False, b_prog = p , b_code = S.fromList (read s) } -- | text literals are relatively trivial. They quote a text value, -- which has type `µT.(1+(Chr*T))` where Chr is a small integer in -- range 0..0x10ffff. We translate the given string into the target -- text value.
357
true
true
2
10
247
134
77
57
null
null
drcabana/euler-fp
source/hs/P28.hs
epl-1.0
sumOfCorners n = 4*n*n - 6*n + 6
36
sumOfCorners n = 4*n*n - 6*n + 6
36
sumOfCorners n = 4*n*n - 6*n + 6
36
false
false
6
5
11
40
14
26
null
null
fmapfmapfmap/amazonka
amazonka-cloudwatch-logs/gen/Network/AWS/CloudWatchLogs/Types/Product.hs
mpl-2.0
-- | Undocumented member. mfFilterPattern :: Lens' MetricFilter (Maybe Text) mfFilterPattern = lens _mfFilterPattern (\ s a -> s{_mfFilterPattern = a})
151
mfFilterPattern :: Lens' MetricFilter (Maybe Text) mfFilterPattern = lens _mfFilterPattern (\ s a -> s{_mfFilterPattern = a})
125
mfFilterPattern = lens _mfFilterPattern (\ s a -> s{_mfFilterPattern = a})
74
true
true
0
9
20
46
25
21
null
null
a143753/AOJ
CGL_2_A.hs
apache-2.0
vnorm (x,y) = x*x+y*y
21
vnorm (x,y) = x*x+y*y
21
vnorm (x,y) = x*x+y*y
21
false
false
3
5
3
32
14
18
null
null
plaimi/tempuhs-server
src/Tempuhs/Server/Requests/Clock.hs
agpl-3.0
postClock :: ConnectionPool -> ActionE () -- | 'postClock' inserts a 'Clock'. postClock p = do n <- paramE "name" runDatabase p $ liftAE . jsonKey =<< insert (Clock n Nothing)
179
postClock :: ConnectionPool -> ActionE () postClock p = do n <- paramE "name" runDatabase p $ liftAE . jsonKey =<< insert (Clock n Nothing)
143
postClock p = do n <- paramE "name" runDatabase p $ liftAE . jsonKey =<< insert (Clock n Nothing)
101
true
true
0
11
34
68
30
38
null
null
nikki-and-the-robots/nikki
src/Editor/Menu.hs
lgpl-3.0
fileExists app save path metaData objects = menuAppState app menuType (Just save) ( MenuItem (p "no") (const save) : MenuItem (p "yes") (const writeAnyway) : []) 0 where menuType = NormalMenu (p "saving level") (Just (pVerbatim path <> p " already exists")) writeAnyway = appState (busyMessage $ p "saving level...") $ io $ do writeObjectsToDisk path metaData objects return $ getMainMenu app
446
fileExists app save path metaData objects = menuAppState app menuType (Just save) ( MenuItem (p "no") (const save) : MenuItem (p "yes") (const writeAnyway) : []) 0 where menuType = NormalMenu (p "saving level") (Just (pVerbatim path <> p " already exists")) writeAnyway = appState (busyMessage $ p "saving level...") $ io $ do writeObjectsToDisk path metaData objects return $ getMainMenu app
446
fileExists app save path metaData objects = menuAppState app menuType (Just save) ( MenuItem (p "no") (const save) : MenuItem (p "yes") (const writeAnyway) : []) 0 where menuType = NormalMenu (p "saving level") (Just (pVerbatim path <> p " already exists")) writeAnyway = appState (busyMessage $ p "saving level...") $ io $ do writeObjectsToDisk path metaData objects return $ getMainMenu app
446
false
false
0
11
115
165
78
87
null
null
JoshuaGross/haskell-learning-log
Code/Haskellbook/Reader/src/Functions.hs
mit
frooty :: Num a => [a] -> ([a], Int) frooty r = bar (foo r) r
61
frooty :: Num a => [a] -> ([a], Int) frooty r = bar (foo r) r
61
frooty r = bar (foo r) r
24
false
true
0
8
15
48
25
23
null
null
ComputationWithBoundedResources/ara-inference
doc/tpdb_trs/Haskell/basic_haskell/concat_1.hs
mit
foldr :: (a -> b -> b) -> b -> (List a) -> b; foldr f z Nil = z
73
foldr :: (a -> b -> b) -> b -> (List a) -> b foldr f z Nil = z
72
foldr f z Nil = z
17
false
true
0
9
29
48
25
23
null
null
randrade23/html-render
src/HTMLRender/HTMLPretty.hs
mit
ppHTML :: Document -> String ppHTML (Doc vs) = wrapBold ("% " ++ t) ++ (unlines $ map ppValue vs) where t = (if null $ findTitle vs then "" else (findTitle vs) !! 0) ++ "\n"
177
ppHTML :: Document -> String ppHTML (Doc vs) = wrapBold ("% " ++ t) ++ (unlines $ map ppValue vs) where t = (if null $ findTitle vs then "" else (findTitle vs) !! 0) ++ "\n"
177
ppHTML (Doc vs) = wrapBold ("% " ++ t) ++ (unlines $ map ppValue vs) where t = (if null $ findTitle vs then "" else (findTitle vs) !! 0) ++ "\n"
148
false
true
1
10
40
99
47
52
null
null
ssaavedra/liquidhaskell
tests/pos/RelativeComplete.hs
bsd-3-clause
{-@ LIQUID "--no-termination" @-} -- Here p and q of `app` will be instantiated to -- p , q := \v -> i <= v main i = app (check i) i
135
main i = app (check i) i
24
main i = app (check i) i
24
true
false
0
7
34
23
12
11
null
null
bjpop/blip
blipcompiler/src/Blip/Compiler/Compile.hs
bsd-3-clause
compileExpr expr@(AST.Float {}) = compileConstantEmit $ constantToPyObject expr
82
compileExpr expr@(AST.Float {}) = compileConstantEmit $ constantToPyObject expr
82
compileExpr expr@(AST.Float {}) = compileConstantEmit $ constantToPyObject expr
82
false
false
0
9
10
28
14
14
null
null
AlexeyRaga/eta
compiler/ETA/Main/HscTypes.hs
bsd-3-clause
hptAnns hsc_env Nothing = hptAllThings (md_anns . hm_details) hsc_env
69
hptAnns hsc_env Nothing = hptAllThings (md_anns . hm_details) hsc_env
69
hptAnns hsc_env Nothing = hptAllThings (md_anns . hm_details) hsc_env
69
false
false
0
7
8
23
11
12
null
null
nushio3/ghc
compiler/coreSyn/CoreUtils.hs
bsd-3-clause
exprIsCheap' good_app (Case e _ _ alts) = exprIsCheap' good_app e && and [exprIsCheap' good_app rhs | (_,_,rhs) <- alts]
162
exprIsCheap' good_app (Case e _ _ alts) = exprIsCheap' good_app e && and [exprIsCheap' good_app rhs | (_,_,rhs) <- alts]
162
exprIsCheap' good_app (Case e _ _ alts) = exprIsCheap' good_app e && and [exprIsCheap' good_app rhs | (_,_,rhs) <- alts]
162
false
false
0
10
61
60
30
30
null
null
DNoved1/distill
src/Distill/Expr/Representation.hs
mit
parseProduct :: Parser (Type' String) parseProduct = label' "product type" $ withSource $ do symbol tokens "(&" factors <- flip sepBy (symbol tokens "&") $ choice [ try $ do x <- identifier tokens symbol tokens ":" t <- parseExpr return (x, t) , do t <- parseExpr return ("%No-Name%", t) ] symbol tokens "&)" case length factors of 0 -> return UnitT 1 -> fail "Product must have 0, 2, or more factors." _ -> do let tail' = snd (last factors) let body' = init factors return (unsplitProduct body' tail')
674
parseProduct :: Parser (Type' String) parseProduct = label' "product type" $ withSource $ do symbol tokens "(&" factors <- flip sepBy (symbol tokens "&") $ choice [ try $ do x <- identifier tokens symbol tokens ":" t <- parseExpr return (x, t) , do t <- parseExpr return ("%No-Name%", t) ] symbol tokens "&)" case length factors of 0 -> return UnitT 1 -> fail "Product must have 0, 2, or more factors." _ -> do let tail' = snd (last factors) let body' = init factors return (unsplitProduct body' tail')
674
parseProduct = label' "product type" $ withSource $ do symbol tokens "(&" factors <- flip sepBy (symbol tokens "&") $ choice [ try $ do x <- identifier tokens symbol tokens ":" t <- parseExpr return (x, t) , do t <- parseExpr return ("%No-Name%", t) ] symbol tokens "&)" case length factors of 0 -> return UnitT 1 -> fail "Product must have 0, 2, or more factors." _ -> do let tail' = snd (last factors) let body' = init factors return (unsplitProduct body' tail')
636
false
true
0
18
263
218
98
120
null
null
bitemyapp/ghc
compiler/typecheck/TcEvidence.hs
bsd-3-clause
mkTcNthCo :: Int -> TcCoercion -> TcCoercion mkTcNthCo n (TcRefl r ty) = TcRefl r (tyConAppArgN n ty)
101
mkTcNthCo :: Int -> TcCoercion -> TcCoercion mkTcNthCo n (TcRefl r ty) = TcRefl r (tyConAppArgN n ty)
101
mkTcNthCo n (TcRefl r ty) = TcRefl r (tyConAppArgN n ty)
56
false
true
0
7
17
45
22
23
null
null
Oscarzhao/haskell
functional_program_design/ch05/sudoku_orig.hs
apache-2.0
cols :: Matrix a -> Matrix a cols [xs] = [[x] | x <- xs]
57
cols :: Matrix a -> Matrix a cols [xs] = [[x] | x <- xs]
56
cols [xs] = [[x] | x <- xs]
27
false
true
0
8
15
46
22
24
null
null
antalsz/hs-to-coq
src/lib/HsToCoq/ConvertHaskell/TypeInfo.hs
mit
store' lens qid@(Qualified mi _) x = do TypeInfoT (use (processedModules.contains mi)) >>= \case False -> liftIO $ do hPutStrLn stderr $ "Cannot store information about " ++ showP qid --exitFailure True -> TypeInfoT $ modify $ lens . at qid ?~ x
289
store' lens qid@(Qualified mi _) x = do TypeInfoT (use (processedModules.contains mi)) >>= \case False -> liftIO $ do hPutStrLn stderr $ "Cannot store information about " ++ showP qid --exitFailure True -> TypeInfoT $ modify $ lens . at qid ?~ x
289
store' lens qid@(Qualified mi _) x = do TypeInfoT (use (processedModules.contains mi)) >>= \case False -> liftIO $ do hPutStrLn stderr $ "Cannot store information about " ++ showP qid --exitFailure True -> TypeInfoT $ modify $ lens . at qid ?~ x
289
false
false
1
18
86
111
49
62
null
null
melted/idris-java
src/IRTS/Java/JTypes.hs
bsd-3-clause
sourceTypes (LExternal n) | n == sUN "prim__readFile" = [worldType, objectType] | n == sUN "prim__writeFile" = [worldType, objectType, stringType] | n == sUN "prim__stdin" = [] | n == sUN "prim__stdout" = [] | n == sUN "prim__stderr" = [] -- see comment below on managed pointers | n == sUN "prim__eqManagedPtr" = [objectType, objectType] | n == sUN "prim__eqPtr" = [objectType, objectType] | n == sUN "prim__vm" = [threadType] | n == sUN "prim__null" = [] -- @bgaster -- i can't see any reason to support managed pointers in the Java -- runtime, infact it seems to be counter to fact that Java is -- managing our allocations and lifetimes. thus the runtime will raise -- an exception if called | n == sUN "prim__registerPtr" = [objectType, integerType] | otherwise = []
960
sourceTypes (LExternal n) | n == sUN "prim__readFile" = [worldType, objectType] | n == sUN "prim__writeFile" = [worldType, objectType, stringType] | n == sUN "prim__stdin" = [] | n == sUN "prim__stdout" = [] | n == sUN "prim__stderr" = [] -- see comment below on managed pointers | n == sUN "prim__eqManagedPtr" = [objectType, objectType] | n == sUN "prim__eqPtr" = [objectType, objectType] | n == sUN "prim__vm" = [threadType] | n == sUN "prim__null" = [] -- @bgaster -- i can't see any reason to support managed pointers in the Java -- runtime, infact it seems to be counter to fact that Java is -- managing our allocations and lifetimes. thus the runtime will raise -- an exception if called | n == sUN "prim__registerPtr" = [objectType, integerType] | otherwise = []
960
sourceTypes (LExternal n) | n == sUN "prim__readFile" = [worldType, objectType] | n == sUN "prim__writeFile" = [worldType, objectType, stringType] | n == sUN "prim__stdin" = [] | n == sUN "prim__stdout" = [] | n == sUN "prim__stderr" = [] -- see comment below on managed pointers | n == sUN "prim__eqManagedPtr" = [objectType, objectType] | n == sUN "prim__eqPtr" = [objectType, objectType] | n == sUN "prim__vm" = [threadType] | n == sUN "prim__null" = [] -- @bgaster -- i can't see any reason to support managed pointers in the Java -- runtime, infact it seems to be counter to fact that Java is -- managing our allocations and lifetimes. thus the runtime will raise -- an exception if called | n == sUN "prim__registerPtr" = [objectType, integerType] | otherwise = []
960
false
false
0
9
323
255
124
131
null
null
skeskinen/FTGL
Graphics/Rendering/FTGL.hs
bsd-2-clause
marshalCharMap EncodingBig5= encodeTag 'b' 'i' 'g' '5'
54
marshalCharMap EncodingBig5= encodeTag 'b' 'i' 'g' '5'
54
marshalCharMap EncodingBig5= encodeTag 'b' 'i' 'g' '5'
54
false
false
0
5
6
18
8
10
null
null
haskell-tinc/hpack
src/Hpack/Render.hs
mit
renderSystemBuildTool :: (String, VersionConstraint) -> String renderSystemBuildTool (name, constraint) = name ++ renderVersionConstraint constraint
148
renderSystemBuildTool :: (String, VersionConstraint) -> String renderSystemBuildTool (name, constraint) = name ++ renderVersionConstraint constraint
148
renderSystemBuildTool (name, constraint) = name ++ renderVersionConstraint constraint
85
false
true
0
6
13
37
20
17
null
null
Paow/encore
src/types/Typechecker/Typechecker.hs
bsd-3-clause
checkSubordinateReturn :: Name -> Type -> Type -> TypecheckM () checkSubordinateReturn name returnType targetType = do subordReturn <- isSubordinateType returnType targetIsEncaps <- isEncapsulatedType targetType when subordReturn $ unless targetIsEncaps $ tcError $ SubordinateReturnError name
320
checkSubordinateReturn :: Name -> Type -> Type -> TypecheckM () checkSubordinateReturn name returnType targetType = do subordReturn <- isSubordinateType returnType targetIsEncaps <- isEncapsulatedType targetType when subordReturn $ unless targetIsEncaps $ tcError $ SubordinateReturnError name
320
checkSubordinateReturn name returnType targetType = do subordReturn <- isSubordinateType returnType targetIsEncaps <- isEncapsulatedType targetType when subordReturn $ unless targetIsEncaps $ tcError $ SubordinateReturnError name
256
false
true
0
11
60
84
36
48
null
null
madjestic/b1
tests/B1/Data/Price/GoogleTest.hs
bsd-3-clause
case_parseGoogleCsv_badFormat :: Assertion case_parseGoogleCsv_badFormat = let csv = foldl (++) "" ([headers] ++ goodLines ++ [badFormat]) in assertEqual "" (Right "Invalid CSV format") (parseGoogleCsv csv)
210
case_parseGoogleCsv_badFormat :: Assertion case_parseGoogleCsv_badFormat = let csv = foldl (++) "" ([headers] ++ goodLines ++ [badFormat]) in assertEqual "" (Right "Invalid CSV format") (parseGoogleCsv csv)
210
case_parseGoogleCsv_badFormat = let csv = foldl (++) "" ([headers] ++ goodLines ++ [badFormat]) in assertEqual "" (Right "Invalid CSV format") (parseGoogleCsv csv)
167
false
true
0
13
28
67
35
32
null
null
tpsinnem/Idris-dev
src/Idris/Providers.hs
bsd-3-clause
ermod :: Name ermod = sNS (sUN "Error") ["Providers", "Prelude"]
64
ermod :: Name ermod = sNS (sUN "Error") ["Providers", "Prelude"]
64
ermod = sNS (sUN "Error") ["Providers", "Prelude"]
50
false
true
0
7
9
34
16
18
null
null
nfjinjing/miku
src/Network/Miku/DSL.hs
bsd-3-clause
json :: ByteString -> AppMonad' json x = do modify - setContentType "text/json" modify - setBody - x
104
json :: ByteString -> AppMonad' json x = do modify - setContentType "text/json" modify - setBody - x
104
json x = do modify - setContentType "text/json" modify - setBody - x
72
false
true
0
8
21
45
19
26
null
null
sol/aeson
tests/UnitTests.hs
bsd-3-clause
utcTimeGood :: Assertion utcTimeGood = do let ts1 = "2015-01-01T12:13:00.00Z" :: LT.Text let ts2 = "2015-01-01T12:13:00Z" :: LT.Text -- 'T' between date and time is not required, can be space let ts3 = "2015-01-03 12:13:00.00Z" :: LT.Text let ts4 = "2015-01-03 12:13:00.125Z" :: LT.Text let (Just (t1 :: UTCTime)) = parseWithAeson ts1 let (Just (t2 :: UTCTime)) = parseWithAeson ts2 let (Just (t3 :: UTCTime)) = parseWithAeson ts3 let (Just (t4 :: UTCTime)) = parseWithAeson ts4 assertEqual "utctime" (parseWithRead "%FT%T%QZ" ts1) t1 assertEqual "utctime" (parseWithRead "%FT%T%QZ" ts2) t2 assertEqual "utctime" (parseWithRead "%F %T%QZ" ts3) t3 assertEqual "utctime" (parseWithRead "%F %T%QZ" ts4) t4 -- Time zones. Both +HHMM and +HH:MM are allowed for timezone -- offset, and MM may be omitted. let ts5 = "2015-01-01T12:30:00.00+00" :: LT.Text let ts6 = "2015-01-01T12:30:00.00+01:15" :: LT.Text let ts7 = "2015-01-01T12:30:00.00-02" :: LT.Text let ts8 = "2015-01-01T22:00:00.00-03" :: LT.Text let ts9 = "2015-01-01T22:00:00.00-04:30" :: LT.Text let (Just (t5 :: UTCTime)) = parseWithAeson ts5 let (Just (t6 :: UTCTime)) = parseWithAeson ts6 let (Just (t7 :: UTCTime)) = parseWithAeson ts7 let (Just (t8 :: UTCTime)) = parseWithAeson ts8 let (Just (t9 :: UTCTime)) = parseWithAeson ts9 assertEqual "utctime" (parseWithRead "%FT%T%QZ" "2015-01-01T12:30:00.00Z") t5 assertEqual "utctime" (parseWithRead "%FT%T%QZ" "2015-01-01T11:15:00.00Z") t6 assertEqual "utctime" (parseWithRead "%FT%T%QZ" "2015-01-01T14:30:00Z") t7 -- ts8 wraps around to the next day in UTC assertEqual "utctime" (parseWithRead "%FT%T%QZ" "2015-01-02T01:00:00Z") t8 assertEqual "utctime" (parseWithRead "%FT%T%QZ" "2015-01-02T02:30:00Z") t9 -- Seconds in Time can be omitted let ts10 = "2015-01-03T12:13Z" :: LT.Text let ts11 = "2015-01-03 12:13Z" :: LT.Text let ts12 = "2015-01-01T12:30-02" :: LT.Text let (Just (t10 :: UTCTime)) = parseWithAeson ts10 let (Just (t11 :: UTCTime)) = parseWithAeson ts11 let (Just (t12 :: UTCTime)) = parseWithAeson ts12 assertEqual "utctime" (parseWithRead "%FT%H:%MZ" ts10) t10 assertEqual "utctime" (parseWithRead "%F %H:%MZ" ts11) t11 assertEqual "utctime" (parseWithRead "%FT%T%QZ" "2015-01-01T14:30:00Z") t12 where parseWithRead :: String -> LT.Text -> UTCTime parseWithRead f s = fromMaybe (error "parseTime input malformed") . parseTime defaultTimeLocale f . LT.unpack $ s parseWithAeson :: LT.Text -> Maybe UTCTime parseWithAeson s = decode . LT.encodeUtf8 $ LT.concat ["\"", s, "\""] -- Test that a few non-timezone qualified timestamp formats get -- rejected if decoding to UTCTime.
2,720
utcTimeGood :: Assertion utcTimeGood = do let ts1 = "2015-01-01T12:13:00.00Z" :: LT.Text let ts2 = "2015-01-01T12:13:00Z" :: LT.Text -- 'T' between date and time is not required, can be space let ts3 = "2015-01-03 12:13:00.00Z" :: LT.Text let ts4 = "2015-01-03 12:13:00.125Z" :: LT.Text let (Just (t1 :: UTCTime)) = parseWithAeson ts1 let (Just (t2 :: UTCTime)) = parseWithAeson ts2 let (Just (t3 :: UTCTime)) = parseWithAeson ts3 let (Just (t4 :: UTCTime)) = parseWithAeson ts4 assertEqual "utctime" (parseWithRead "%FT%T%QZ" ts1) t1 assertEqual "utctime" (parseWithRead "%FT%T%QZ" ts2) t2 assertEqual "utctime" (parseWithRead "%F %T%QZ" ts3) t3 assertEqual "utctime" (parseWithRead "%F %T%QZ" ts4) t4 -- Time zones. Both +HHMM and +HH:MM are allowed for timezone -- offset, and MM may be omitted. let ts5 = "2015-01-01T12:30:00.00+00" :: LT.Text let ts6 = "2015-01-01T12:30:00.00+01:15" :: LT.Text let ts7 = "2015-01-01T12:30:00.00-02" :: LT.Text let ts8 = "2015-01-01T22:00:00.00-03" :: LT.Text let ts9 = "2015-01-01T22:00:00.00-04:30" :: LT.Text let (Just (t5 :: UTCTime)) = parseWithAeson ts5 let (Just (t6 :: UTCTime)) = parseWithAeson ts6 let (Just (t7 :: UTCTime)) = parseWithAeson ts7 let (Just (t8 :: UTCTime)) = parseWithAeson ts8 let (Just (t9 :: UTCTime)) = parseWithAeson ts9 assertEqual "utctime" (parseWithRead "%FT%T%QZ" "2015-01-01T12:30:00.00Z") t5 assertEqual "utctime" (parseWithRead "%FT%T%QZ" "2015-01-01T11:15:00.00Z") t6 assertEqual "utctime" (parseWithRead "%FT%T%QZ" "2015-01-01T14:30:00Z") t7 -- ts8 wraps around to the next day in UTC assertEqual "utctime" (parseWithRead "%FT%T%QZ" "2015-01-02T01:00:00Z") t8 assertEqual "utctime" (parseWithRead "%FT%T%QZ" "2015-01-02T02:30:00Z") t9 -- Seconds in Time can be omitted let ts10 = "2015-01-03T12:13Z" :: LT.Text let ts11 = "2015-01-03 12:13Z" :: LT.Text let ts12 = "2015-01-01T12:30-02" :: LT.Text let (Just (t10 :: UTCTime)) = parseWithAeson ts10 let (Just (t11 :: UTCTime)) = parseWithAeson ts11 let (Just (t12 :: UTCTime)) = parseWithAeson ts12 assertEqual "utctime" (parseWithRead "%FT%H:%MZ" ts10) t10 assertEqual "utctime" (parseWithRead "%F %H:%MZ" ts11) t11 assertEqual "utctime" (parseWithRead "%FT%T%QZ" "2015-01-01T14:30:00Z") t12 where parseWithRead :: String -> LT.Text -> UTCTime parseWithRead f s = fromMaybe (error "parseTime input malformed") . parseTime defaultTimeLocale f . LT.unpack $ s parseWithAeson :: LT.Text -> Maybe UTCTime parseWithAeson s = decode . LT.encodeUtf8 $ LT.concat ["\"", s, "\""] -- Test that a few non-timezone qualified timestamp formats get -- rejected if decoding to UTCTime.
2,720
utcTimeGood = do let ts1 = "2015-01-01T12:13:00.00Z" :: LT.Text let ts2 = "2015-01-01T12:13:00Z" :: LT.Text -- 'T' between date and time is not required, can be space let ts3 = "2015-01-03 12:13:00.00Z" :: LT.Text let ts4 = "2015-01-03 12:13:00.125Z" :: LT.Text let (Just (t1 :: UTCTime)) = parseWithAeson ts1 let (Just (t2 :: UTCTime)) = parseWithAeson ts2 let (Just (t3 :: UTCTime)) = parseWithAeson ts3 let (Just (t4 :: UTCTime)) = parseWithAeson ts4 assertEqual "utctime" (parseWithRead "%FT%T%QZ" ts1) t1 assertEqual "utctime" (parseWithRead "%FT%T%QZ" ts2) t2 assertEqual "utctime" (parseWithRead "%F %T%QZ" ts3) t3 assertEqual "utctime" (parseWithRead "%F %T%QZ" ts4) t4 -- Time zones. Both +HHMM and +HH:MM are allowed for timezone -- offset, and MM may be omitted. let ts5 = "2015-01-01T12:30:00.00+00" :: LT.Text let ts6 = "2015-01-01T12:30:00.00+01:15" :: LT.Text let ts7 = "2015-01-01T12:30:00.00-02" :: LT.Text let ts8 = "2015-01-01T22:00:00.00-03" :: LT.Text let ts9 = "2015-01-01T22:00:00.00-04:30" :: LT.Text let (Just (t5 :: UTCTime)) = parseWithAeson ts5 let (Just (t6 :: UTCTime)) = parseWithAeson ts6 let (Just (t7 :: UTCTime)) = parseWithAeson ts7 let (Just (t8 :: UTCTime)) = parseWithAeson ts8 let (Just (t9 :: UTCTime)) = parseWithAeson ts9 assertEqual "utctime" (parseWithRead "%FT%T%QZ" "2015-01-01T12:30:00.00Z") t5 assertEqual "utctime" (parseWithRead "%FT%T%QZ" "2015-01-01T11:15:00.00Z") t6 assertEqual "utctime" (parseWithRead "%FT%T%QZ" "2015-01-01T14:30:00Z") t7 -- ts8 wraps around to the next day in UTC assertEqual "utctime" (parseWithRead "%FT%T%QZ" "2015-01-02T01:00:00Z") t8 assertEqual "utctime" (parseWithRead "%FT%T%QZ" "2015-01-02T02:30:00Z") t9 -- Seconds in Time can be omitted let ts10 = "2015-01-03T12:13Z" :: LT.Text let ts11 = "2015-01-03 12:13Z" :: LT.Text let ts12 = "2015-01-01T12:30-02" :: LT.Text let (Just (t10 :: UTCTime)) = parseWithAeson ts10 let (Just (t11 :: UTCTime)) = parseWithAeson ts11 let (Just (t12 :: UTCTime)) = parseWithAeson ts12 assertEqual "utctime" (parseWithRead "%FT%H:%MZ" ts10) t10 assertEqual "utctime" (parseWithRead "%F %H:%MZ" ts11) t11 assertEqual "utctime" (parseWithRead "%FT%T%QZ" "2015-01-01T14:30:00Z") t12 where parseWithRead :: String -> LT.Text -> UTCTime parseWithRead f s = fromMaybe (error "parseTime input malformed") . parseTime defaultTimeLocale f . LT.unpack $ s parseWithAeson :: LT.Text -> Maybe UTCTime parseWithAeson s = decode . LT.encodeUtf8 $ LT.concat ["\"", s, "\""] -- Test that a few non-timezone qualified timestamp formats get -- rejected if decoding to UTCTime.
2,695
false
true
0
13
478
816
388
428
null
null
capitanbatata/marlows-parconc-exercises
parconc-ch07/test/ChanSpec.hs
gpl-3.0
spec :: Spec spec = do let testList = [0..100] describe "Unbounded channels" $ do it "buffers items" $ do ch <- newChan a <- async $ mapM_ (writeChan ch) testList receivedList <- mapM (const (readChan ch)) testList wait a receivedList `shouldBe` testList it "supports multiple readers/writers" $ do ch <- newChan a0 <- async $ mapM_ (writeChan ch) (filter even testList) a1 <- async $ mapM_ (writeChan ch) (filter (not . even) testList) a2 <- async $ mapM (const (readChan ch)) (filter even testList) receivedList <- mapM (const (readChan ch)) (filter (not . even) testList) wait a0; wait a1; wait a2 let receivedSet = Set.fromList receivedList testSet = Set.fromList testList receivedSet `shouldSatisfy` (`Set.isSubsetOf` testSet) describe "Multicast channels" $ do it "allows two processes to read the same items" $ do ch <- newChan chDup <- dupChan ch a0 <- async $ mapM_ (writeChan ch) testList a1 <- async $ mapM (const (readChan ch)) testList receivedList <- mapM (const (readChan chDup)) testList wait a0; wait a1 receivedList `shouldBe` testList describe "unGetChan" $ do it "puts back a values at the front of the channel" $ do let val = 33 ch <- newChan a0 <- async $ mapM_ (writeChan ch) [val, val] rVal <- readChan ch wait a0 unGetChan ch val rVal `shouldBe` val --expectationFailure "TODO: write this unit test" rVal2 <- readChan ch rVal2 `shouldBe` val -- There is no known implementation of 'unGetChan' based on the -- representation of Chan given in chapter 7 that avoids this problem. it "deadlocks on an empty channel when other process is waiting\ \ (see page 139 for further explanation)" $ (do let val = 10 ch <- newChan :: IO (Chan Int) forkIO $ do readChan ch; return () -- Yield the control to the other thread to allow `readChan` to occur -- first. yield unGetChan ch val ) `shouldThrow` deadlockException
2,159
spec :: Spec spec = do let testList = [0..100] describe "Unbounded channels" $ do it "buffers items" $ do ch <- newChan a <- async $ mapM_ (writeChan ch) testList receivedList <- mapM (const (readChan ch)) testList wait a receivedList `shouldBe` testList it "supports multiple readers/writers" $ do ch <- newChan a0 <- async $ mapM_ (writeChan ch) (filter even testList) a1 <- async $ mapM_ (writeChan ch) (filter (not . even) testList) a2 <- async $ mapM (const (readChan ch)) (filter even testList) receivedList <- mapM (const (readChan ch)) (filter (not . even) testList) wait a0; wait a1; wait a2 let receivedSet = Set.fromList receivedList testSet = Set.fromList testList receivedSet `shouldSatisfy` (`Set.isSubsetOf` testSet) describe "Multicast channels" $ do it "allows two processes to read the same items" $ do ch <- newChan chDup <- dupChan ch a0 <- async $ mapM_ (writeChan ch) testList a1 <- async $ mapM (const (readChan ch)) testList receivedList <- mapM (const (readChan chDup)) testList wait a0; wait a1 receivedList `shouldBe` testList describe "unGetChan" $ do it "puts back a values at the front of the channel" $ do let val = 33 ch <- newChan a0 <- async $ mapM_ (writeChan ch) [val, val] rVal <- readChan ch wait a0 unGetChan ch val rVal `shouldBe` val --expectationFailure "TODO: write this unit test" rVal2 <- readChan ch rVal2 `shouldBe` val -- There is no known implementation of 'unGetChan' based on the -- representation of Chan given in chapter 7 that avoids this problem. it "deadlocks on an empty channel when other process is waiting\ \ (see page 139 for further explanation)" $ (do let val = 10 ch <- newChan :: IO (Chan Int) forkIO $ do readChan ch; return () -- Yield the control to the other thread to allow `readChan` to occur -- first. yield unGetChan ch val ) `shouldThrow` deadlockException
2,159
spec = do let testList = [0..100] describe "Unbounded channels" $ do it "buffers items" $ do ch <- newChan a <- async $ mapM_ (writeChan ch) testList receivedList <- mapM (const (readChan ch)) testList wait a receivedList `shouldBe` testList it "supports multiple readers/writers" $ do ch <- newChan a0 <- async $ mapM_ (writeChan ch) (filter even testList) a1 <- async $ mapM_ (writeChan ch) (filter (not . even) testList) a2 <- async $ mapM (const (readChan ch)) (filter even testList) receivedList <- mapM (const (readChan ch)) (filter (not . even) testList) wait a0; wait a1; wait a2 let receivedSet = Set.fromList receivedList testSet = Set.fromList testList receivedSet `shouldSatisfy` (`Set.isSubsetOf` testSet) describe "Multicast channels" $ do it "allows two processes to read the same items" $ do ch <- newChan chDup <- dupChan ch a0 <- async $ mapM_ (writeChan ch) testList a1 <- async $ mapM (const (readChan ch)) testList receivedList <- mapM (const (readChan chDup)) testList wait a0; wait a1 receivedList `shouldBe` testList describe "unGetChan" $ do it "puts back a values at the front of the channel" $ do let val = 33 ch <- newChan a0 <- async $ mapM_ (writeChan ch) [val, val] rVal <- readChan ch wait a0 unGetChan ch val rVal `shouldBe` val --expectationFailure "TODO: write this unit test" rVal2 <- readChan ch rVal2 `shouldBe` val -- There is no known implementation of 'unGetChan' based on the -- representation of Chan given in chapter 7 that avoids this problem. it "deadlocks on an empty channel when other process is waiting\ \ (see page 139 for further explanation)" $ (do let val = 10 ch <- newChan :: IO (Chan Int) forkIO $ do readChan ch; return () -- Yield the control to the other thread to allow `readChan` to occur -- first. yield unGetChan ch val ) `shouldThrow` deadlockException
2,146
false
true
0
19
638
674
310
364
null
null
ezyang/ghc
testsuite/tests/codeGen/should_run/CmmSwitchTest64.hs
bsd-3-clause
ah 2# = 43#
11
ah 2# = 43#
11
ah 2# = 43#
11
false
false
0
5
3
9
4
5
null
null
intolerable/GroupProject
src/Emulator/CPU/Instructions/THUMB/Opcodes.hs
bsd-2-clause
functionFromOpcode :: IsSystem s m => ThumbOpcode -> (RegisterName -> RegisterName -> m ()) functionFromOpcode op = case op of T_AND -> tAnd T_EOR -> tEor T_LSL -> tLsl T_LSR -> tLsr T_ASR -> tAsr T_ADC -> tAdc T_SBC -> tSbc T_ROR -> tRor T_TST -> tTst T_NEG -> tNeg T_CMP -> tCmp T_CMN -> tCmn T_ORR -> tOrr T_MUL -> tMul T_BIC -> tBic T_MVN -> tMvn T_MOV -> error "Mov passed to THUMB ALU operation" T_ADD -> error "Add passed to THUMB ALU operation"
488
functionFromOpcode :: IsSystem s m => ThumbOpcode -> (RegisterName -> RegisterName -> m ()) functionFromOpcode op = case op of T_AND -> tAnd T_EOR -> tEor T_LSL -> tLsl T_LSR -> tLsr T_ASR -> tAsr T_ADC -> tAdc T_SBC -> tSbc T_ROR -> tRor T_TST -> tTst T_NEG -> tNeg T_CMP -> tCmp T_CMN -> tCmn T_ORR -> tOrr T_MUL -> tMul T_BIC -> tBic T_MVN -> tMvn T_MOV -> error "Mov passed to THUMB ALU operation" T_ADD -> error "Add passed to THUMB ALU operation"
488
functionFromOpcode op = case op of T_AND -> tAnd T_EOR -> tEor T_LSL -> tLsl T_LSR -> tLsr T_ASR -> tAsr T_ADC -> tAdc T_SBC -> tSbc T_ROR -> tRor T_TST -> tTst T_NEG -> tNeg T_CMP -> tCmp T_CMN -> tCmn T_ORR -> tOrr T_MUL -> tMul T_BIC -> tBic T_MVN -> tMvn T_MOV -> error "Mov passed to THUMB ALU operation" T_ADD -> error "Add passed to THUMB ALU operation"
396
false
true
0
11
121
161
79
82
null
null
nh2/haskell-ordnub
MiniSet.hs
mit
ordNubStrictAcc :: Ord a => [a] -> [a] ordNubStrictAcc = go empty where go !_ [] = [] go !s (x : xs) = if member x s then go s xs else x : go (insert x s) xs
189
ordNubStrictAcc :: Ord a => [a] -> [a] ordNubStrictAcc = go empty where go !_ [] = [] go !s (x : xs) = if member x s then go s xs else x : go (insert x s) xs
189
ordNubStrictAcc = go empty where go !_ [] = [] go !s (x : xs) = if member x s then go s xs else x : go (insert x s) xs
150
false
true
3
9
71
114
52
62
null
null
fffej/HS-Poker
LookupPatternMatch.hs
bsd-3-clause
getValueFromProduct 83030 = 4609
32
getValueFromProduct 83030 = 4609
32
getValueFromProduct 83030 = 4609
32
false
false
0
5
3
9
4
5
null
null
wavewave/lhc-analysis-collection
lib/HEP/Physics/Analysis/ATLAS/SUSY/SUSY_1to2L2to6JMET_8TeV.hs
gpl-3.0
-- | preselection object for hard lepton analysis preselectionHard :: PhyEventNoTau -> PhyEventNoTauNoBJet preselectionHard ev = let alljs = (map (\case JO_Jet j ->j ; JO_BJet b -> bJet2Jet b) . view jetBJets) ev es = filter (\e -> pt e > 10 && abs (eta e) < 2.47) . view electrons $ ev ms = filter (\m -> pt m > 10 && abs (eta m) < 2.4) . view muons $ ev js = filter (\j -> pt j > 20 && abs (eta j) < 2.8) alljs in ( set electrons es . set muons ms . set jets js . set eventId (view eventId ev) . set photons (view photons ev) . set missingET (view missingET ev) ) def
629
preselectionHard :: PhyEventNoTau -> PhyEventNoTauNoBJet preselectionHard ev = let alljs = (map (\case JO_Jet j ->j ; JO_BJet b -> bJet2Jet b) . view jetBJets) ev es = filter (\e -> pt e > 10 && abs (eta e) < 2.47) . view electrons $ ev ms = filter (\m -> pt m > 10 && abs (eta m) < 2.4) . view muons $ ev js = filter (\j -> pt j > 20 && abs (eta j) < 2.8) alljs in ( set electrons es . set muons ms . set jets js . set eventId (view eventId ev) . set photons (view photons ev) . set missingET (view missingET ev) ) def
579
preselectionHard ev = let alljs = (map (\case JO_Jet j ->j ; JO_BJet b -> bJet2Jet b) . view jetBJets) ev es = filter (\e -> pt e > 10 && abs (eta e) < 2.47) . view electrons $ ev ms = filter (\m -> pt m > 10 && abs (eta m) < 2.4) . view muons $ ev js = filter (\j -> pt j > 20 && abs (eta j) < 2.8) alljs in ( set electrons es . set muons ms . set jets js . set eventId (view eventId ev) . set photons (view photons ev) . set missingET (view missingET ev) ) def
522
true
true
0
18
182
302
144
158
null
null
ArthurClune/pastewatch
src/PasteWatch/Sites.hs
gpl-3.0
getNewPastes Slexy = getNewPastes' "http://slexy.org/recent" (css "div[class=main] tr a" ! "href") (\u -> "http://slexy.org/raw/" ++ drop 6 u)
182
getNewPastes Slexy = getNewPastes' "http://slexy.org/recent" (css "div[class=main] tr a" ! "href") (\u -> "http://slexy.org/raw/" ++ drop 6 u)
182
getNewPastes Slexy = getNewPastes' "http://slexy.org/recent" (css "div[class=main] tr a" ! "href") (\u -> "http://slexy.org/raw/" ++ drop 6 u)
182
false
false
0
9
57
43
21
22
null
null
uuhan/Idris-dev
src/Idris/Unlit.hs
bsd-3-clause
check :: FilePath -> Int -> [(LineType, String)] -> TC () check f l (a:b:cs) = do chkAdj f l (fst a) (fst b) check f (l+1) (b:cs)
153
check :: FilePath -> Int -> [(LineType, String)] -> TC () check f l (a:b:cs) = do chkAdj f l (fst a) (fst b) check f (l+1) (b:cs)
153
check f l (a:b:cs) = do chkAdj f l (fst a) (fst b) check f (l+1) (b:cs)
95
false
true
0
9
51
103
52
51
null
null
ideas-edu/ideas
src/Ideas/Common/Exercise.hs
apache-2.0
diffEnvironment :: HasEnvironment a => Derivation s a -> Derivation (s, Environment) a diffEnvironment = updateSteps $ \old a new -> let keep x = not (getId x == newId "location" || x `elem` list) list = bindings old in (a, makeEnvironment $ filter keep $ bindings new)
286
diffEnvironment :: HasEnvironment a => Derivation s a -> Derivation (s, Environment) a diffEnvironment = updateSteps $ \old a new -> let keep x = not (getId x == newId "location" || x `elem` list) list = bindings old in (a, makeEnvironment $ filter keep $ bindings new)
285
diffEnvironment = updateSteps $ \old a new -> let keep x = not (getId x == newId "location" || x `elem` list) list = bindings old in (a, makeEnvironment $ filter keep $ bindings new)
198
false
true
0
16
64
125
60
65
null
null
energyflowanalysis/efa-2.1
test/EFA/Test/Signal.hs
bsd-3-clause
------------------------------------------------------------------- prop_functor_identity :: Val Double -> Bool prop_functor_identity x = fmap id x == x
154
prop_functor_identity :: Val Double -> Bool prop_functor_identity x = fmap id x == x
84
prop_functor_identity x = fmap id x == x
40
true
true
1
7
16
41
17
24
null
null
Michaelt293/Lipid-Haskell
src/Lipid/Parsers/CombinedRadyl/Glycerophospholipid.hs
gpl-3.0
pgP :: Parser a -> Parser (PG a) pgP p = PG <$> (string "PG " *> twoCombinedRadylsP p)
86
pgP :: Parser a -> Parser (PG a) pgP p = PG <$> (string "PG " *> twoCombinedRadylsP p)
86
pgP p = PG <$> (string "PG " *> twoCombinedRadylsP p)
53
false
true
0
9
18
51
23
28
null
null
martijnbastiaan/sprockell
src/Sprockell/System.hs
mit
memDevice mem (addr, WriteReq value) = return (mem <~= (addr, value), Nothing)
78
memDevice mem (addr, WriteReq value) = return (mem <~= (addr, value), Nothing)
78
memDevice mem (addr, WriteReq value) = return (mem <~= (addr, value), Nothing)
78
false
false
0
8
11
39
21
18
null
null
Deewiant/haschoo
Haschoo/Evaluator/Standard/Numeric.hs
bsd-3-clause
isInteger (ScmComplex (a:+b)) = b == 0 && a == fromInteger (round a)
68
isInteger (ScmComplex (a:+b)) = b == 0 && a == fromInteger (round a)
68
isInteger (ScmComplex (a:+b)) = b == 0 && a == fromInteger (round a)
68
false
false
0
8
12
44
21
23
null
null
CloudI/CloudI
src/api/haskell/external/binary-0.8.7.0/tests/Action.hs
mit
gen_actions :: Bool -> Gen [Action] gen_actions genFail = do acts <- sized (go False) return acts where go :: Bool -> Int -> Gen [Action] go _ 0 = return [] go inTry s = oneof $ [ do n <- choose (0,10) (:) (GetByteString n) <$> go inTry (s-1) , do n <- choose (0,10) (:) (GetByteStringL n) <$> go inTry (s-1) , do n <- choose (0,10) (:) (Skip n) <$> go inTry (s-1) , do (:) BytesRead <$> go inTry (s-1) , do t1 <- go True (s `div` 2) t2 <- go inTry (s `div` 2) (:) (Try t1 t2) <$> go inTry (s `div` 2) , do t <- go inTry (s`div`2) (:) (LookAhead t) <$> go inTry (s-1) , do t <- go inTry (s`div`2) b <- arbitrary (:) (LookAheadM b t) <$> go inTry (s-1) , do t <- go inTry (s`div`2) b <- arbitrary (:) (LookAheadE b t) <$> go inTry (s-1) , do t <- go inTry (s`div`2) Positive n <- arbitrary :: Gen (Positive Int) (:) (Label ("some label: " ++ show n) t) <$> go inTry (s-1) , do t <- resize (s`div`2) (gen_isolate (genFail || inTry)) (:) t <$> go inTry (s-1) ] ++ [frequency [(if inTry || genFail then 1 else 0, return [Fail]) ,(9 , go inTry s)]]
1,723
gen_actions :: Bool -> Gen [Action] gen_actions genFail = do acts <- sized (go False) return acts where go :: Bool -> Int -> Gen [Action] go _ 0 = return [] go inTry s = oneof $ [ do n <- choose (0,10) (:) (GetByteString n) <$> go inTry (s-1) , do n <- choose (0,10) (:) (GetByteStringL n) <$> go inTry (s-1) , do n <- choose (0,10) (:) (Skip n) <$> go inTry (s-1) , do (:) BytesRead <$> go inTry (s-1) , do t1 <- go True (s `div` 2) t2 <- go inTry (s `div` 2) (:) (Try t1 t2) <$> go inTry (s `div` 2) , do t <- go inTry (s`div`2) (:) (LookAhead t) <$> go inTry (s-1) , do t <- go inTry (s`div`2) b <- arbitrary (:) (LookAheadM b t) <$> go inTry (s-1) , do t <- go inTry (s`div`2) b <- arbitrary (:) (LookAheadE b t) <$> go inTry (s-1) , do t <- go inTry (s`div`2) Positive n <- arbitrary :: Gen (Positive Int) (:) (Label ("some label: " ++ show n) t) <$> go inTry (s-1) , do t <- resize (s`div`2) (gen_isolate (genFail || inTry)) (:) t <$> go inTry (s-1) ] ++ [frequency [(if inTry || genFail then 1 else 0, return [Fail]) ,(9 , go inTry s)]]
1,723
gen_actions genFail = do acts <- sized (go False) return acts where go :: Bool -> Int -> Gen [Action] go _ 0 = return [] go inTry s = oneof $ [ do n <- choose (0,10) (:) (GetByteString n) <$> go inTry (s-1) , do n <- choose (0,10) (:) (GetByteStringL n) <$> go inTry (s-1) , do n <- choose (0,10) (:) (Skip n) <$> go inTry (s-1) , do (:) BytesRead <$> go inTry (s-1) , do t1 <- go True (s `div` 2) t2 <- go inTry (s `div` 2) (:) (Try t1 t2) <$> go inTry (s `div` 2) , do t <- go inTry (s`div`2) (:) (LookAhead t) <$> go inTry (s-1) , do t <- go inTry (s`div`2) b <- arbitrary (:) (LookAheadM b t) <$> go inTry (s-1) , do t <- go inTry (s`div`2) b <- arbitrary (:) (LookAheadE b t) <$> go inTry (s-1) , do t <- go inTry (s`div`2) Positive n <- arbitrary :: Gen (Positive Int) (:) (Label ("some label: " ++ show n) t) <$> go inTry (s-1) , do t <- resize (s`div`2) (gen_isolate (genFail || inTry)) (:) t <$> go inTry (s-1) ] ++ [frequency [(if inTry || genFail then 1 else 0, return [Fail]) ,(9 , go inTry s)]]
1,687
false
true
0
16
902
730
374
356
null
null
ancientlanguage/haskell-analysis
prepare/src/Prepare/Decompose.hs
mit
decomposeChar '\x1E9B' = "\x017F\x0307"
39
decomposeChar '\x1E9B' = "\x017F\x0307"
39
decomposeChar '\x1E9B' = "\x017F\x0307"
39
false
false
1
5
3
13
4
9
null
null
shadwstalkr/GrahamScanDemo
test.hs
gpl-3.0
evaluate points = do start <- getCurrentTime grahamScan points `deepseq` return () end <- getCurrentTime hPutStrLn stderr . show $ diffUTCTime end start
160
evaluate points = do start <- getCurrentTime grahamScan points `deepseq` return () end <- getCurrentTime hPutStrLn stderr . show $ diffUTCTime end start
160
evaluate points = do start <- getCurrentTime grahamScan points `deepseq` return () end <- getCurrentTime hPutStrLn stderr . show $ diffUTCTime end start
160
false
false
1
10
30
63
26
37
null
null
phischu/fragnix
tests/packages/scotty/Data.Vector.Primitive.hs
bsd-3-clause
dropWhile = G.dropWhile
23
dropWhile = G.dropWhile
23
dropWhile = G.dropWhile
23
false
false
1
6
2
12
4
8
null
null
cdparks/mini-core
src/MiniCore/Template.hs
mit
-- Convert a binary arithmetic function into a function on nodes fromBinary :: (Int -> Int -> Int) -> (Node -> Node -> Node) fromBinary f (NNum x) (NNum y) = NNum $ f x y
170
fromBinary :: (Int -> Int -> Int) -> (Node -> Node -> Node) fromBinary f (NNum x) (NNum y) = NNum $ f x y
105
fromBinary f (NNum x) (NNum y) = NNum $ f x y
45
true
true
0
10
35
71
35
36
null
null
vizziv/qsim
src/Job.hs
bsd-3-clause
repeated :: Int -> (a -> a) -> a -> a repeated n f x = foldl' (flip ($)) x (replicate n f)
90
repeated :: Int -> (a -> a) -> a -> a repeated n f x = foldl' (flip ($)) x (replicate n f)
90
repeated n f x = foldl' (flip ($)) x (replicate n f)
52
false
true
0
8
22
60
31
29
null
null
haskell/haddock
haddock-api/src/Haddock/Backends/Xhtml/Layout.hs
bsd-2-clause
divContent = sectionDiv "content"
42
divContent = sectionDiv "content"
42
divContent = sectionDiv "content"
42
false
false
0
5
12
9
4
5
null
null
narurien/ganeti-ceph
src/Ganeti/Utils.hs
gpl-2.0
recombineEithers :: (Show a, Show b) => [a] -> [b] -> [Bool] -> Result [Either a b] recombineEithers lefts rights trail = foldM recombiner ([], lefts, rights) trail >>= checker where checker (eithers, [], []) = Ok eithers checker (_, lefts', rights') = Bad $ "Inconsistent results after recombination, l'=" ++ show lefts' ++ ", r'=" ++ show rights' recombiner (es, l:ls, rs) False = Ok (Left l:es, ls, rs) recombiner (es, ls, r:rs) True = Ok (Right r:es, ls, rs) recombiner (_, ls, rs) t = Bad $ "Inconsistent trail log: l=" ++ show ls ++ ", r=" ++ show rs ++ ",t=" ++ show t -- | Default hints for the resolver
785
recombineEithers :: (Show a, Show b) => [a] -> [b] -> [Bool] -> Result [Either a b] recombineEithers lefts rights trail = foldM recombiner ([], lefts, rights) trail >>= checker where checker (eithers, [], []) = Ok eithers checker (_, lefts', rights') = Bad $ "Inconsistent results after recombination, l'=" ++ show lefts' ++ ", r'=" ++ show rights' recombiner (es, l:ls, rs) False = Ok (Left l:es, ls, rs) recombiner (es, ls, r:rs) True = Ok (Right r:es, ls, rs) recombiner (_, ls, rs) t = Bad $ "Inconsistent trail log: l=" ++ show ls ++ ", r=" ++ show rs ++ ",t=" ++ show t -- | Default hints for the resolver
785
recombineEithers lefts rights trail = foldM recombiner ([], lefts, rights) trail >>= checker where checker (eithers, [], []) = Ok eithers checker (_, lefts', rights') = Bad $ "Inconsistent results after recombination, l'=" ++ show lefts' ++ ", r'=" ++ show rights' recombiner (es, l:ls, rs) False = Ok (Left l:es, ls, rs) recombiner (es, ls, r:rs) True = Ok (Right r:es, ls, rs) recombiner (_, ls, rs) t = Bad $ "Inconsistent trail log: l=" ++ show ls ++ ", r=" ++ show rs ++ ",t=" ++ show t -- | Default hints for the resolver
681
false
true
0
12
287
289
153
136
null
null
timtylin/scholdoc
src/Text/Pandoc/Readers/Markdown.hs
gpl-2.0
atxClosing :: MarkdownParser Attr atxClosing = try $ do attr' <- option nullAttr (guardEnabled Ext_mmd_header_identifiers >> mmdHeaderIdentifier) skipMany (char '#') skipSpaces attr <- option attr' (guardEnabled Ext_header_attributes >> attributes) blanklines return attr
309
atxClosing :: MarkdownParser Attr atxClosing = try $ do attr' <- option nullAttr (guardEnabled Ext_mmd_header_identifiers >> mmdHeaderIdentifier) skipMany (char '#') skipSpaces attr <- option attr' (guardEnabled Ext_header_attributes >> attributes) blanklines return attr
309
atxClosing = try $ do attr' <- option nullAttr (guardEnabled Ext_mmd_header_identifiers >> mmdHeaderIdentifier) skipMany (char '#') skipSpaces attr <- option attr' (guardEnabled Ext_header_attributes >> attributes) blanklines return attr
275
false
true
0
12
69
86
38
48
null
null
wavewave/madgraph-auto-dataset
src/HEP/Automation/MadGraph/Dataset/Set20110330set2.hs
gpl-3.0
sets :: [Int] sets = [1]
24
sets :: [Int] sets = [1]
24
sets = [1]
10
false
true
0
5
5
17
10
7
null
null
rahulmutt/ghcvm
compiler/Eta/DeSugar/Coverage.hs
bsd-3-clause
addTickLStmts' :: (Maybe (Bool -> BoxLabel)) -> [ExprLStmt Id] -> TM a -> TM ([ExprLStmt Id], a) addTickLStmts' isGuard lstmts res = bindLocals (collectLStmtsBinders lstmts) $ do { lstmts' <- mapM (liftL (addTickStmt isGuard)) lstmts ; a <- res ; return (lstmts', a) }
303
addTickLStmts' :: (Maybe (Bool -> BoxLabel)) -> [ExprLStmt Id] -> TM a -> TM ([ExprLStmt Id], a) addTickLStmts' isGuard lstmts res = bindLocals (collectLStmtsBinders lstmts) $ do { lstmts' <- mapM (liftL (addTickStmt isGuard)) lstmts ; a <- res ; return (lstmts', a) }
303
addTickLStmts' isGuard lstmts res = bindLocals (collectLStmtsBinders lstmts) $ do { lstmts' <- mapM (liftL (addTickStmt isGuard)) lstmts ; a <- res ; return (lstmts', a) }
191
false
true
0
13
78
127
64
63
null
null
peteg/ADHOC
Apps/Cache/Tests/030_cache_bugfinder.hs
gpl-2.0
proc_writeP i = "pw" ++ show i
30
proc_writeP i = "pw" ++ show i
30
proc_writeP i = "pw" ++ show i
30
false
false
0
6
6
16
7
9
null
null
kawu/dawg-new
src/Data/DAWG/Dynamic/State/Trans/Vect.hs
bsd-2-clause
printTrans' :: Trans' -> IO () printTrans' Trans'{..} = forM_ [0..size'-1] $ \i -> do print (symv' I.! i, stiv' I.! i) ------------------------------------------------------------------ -- Conversion ------------------------------------------------------------------ -- | Translate map to its pure version.
314
printTrans' :: Trans' -> IO () printTrans' Trans'{..} = forM_ [0..size'-1] $ \i -> do print (symv' I.! i, stiv' I.! i) ------------------------------------------------------------------ -- Conversion ------------------------------------------------------------------ -- | Translate map to its pure version.
314
printTrans' Trans'{..} = forM_ [0..size'-1] $ \i -> do print (symv' I.! i, stiv' I.! i) ------------------------------------------------------------------ -- Conversion ------------------------------------------------------------------ -- | Translate map to its pure version.
283
false
true
0
11
41
78
41
37
null
null
Bodigrim/arithmoi
test-suite/Math/NumberTheory/Moduli/ClassTests.hs
mit
someModAbsSignumProperty :: Integer -> Positive Natural -> Bool someModAbsSignumProperty x (Positive m) = z == abs z * signum z where z = x `modulo` m
156
someModAbsSignumProperty :: Integer -> Positive Natural -> Bool someModAbsSignumProperty x (Positive m) = z == abs z * signum z where z = x `modulo` m
156
someModAbsSignumProperty x (Positive m) = z == abs z * signum z where z = x `modulo` m
92
false
true
1
7
31
64
30
34
null
null
christiaanb/ghc
compiler/prelude/PrelNames.hs
bsd-3-clause
monadPlusClassKey, randomClassKey, randomGenClassKey :: Unique monadPlusClassKey = mkPreludeClassUnique 30
112
monadPlusClassKey, randomClassKey, randomGenClassKey :: Unique monadPlusClassKey = mkPreludeClassUnique 30
112
monadPlusClassKey = mkPreludeClassUnique 30
49
false
true
0
5
14
18
11
7
null
null
HIPERFIT/language-c-quote
Language/C/Parser/Tokens.hs
bsd-3-clause
tokenStrings :: [(Token, String)] tokenStrings = [(Tlparen, "("), (Trparen, ")"), (Tlbrack, "["), (Trbrack, "]"), (Tlbrace, "{"), (Trbrace, "}"), (Tcomma, ","), (Tsemi, ";"), (Tcolon, ":"), (Tquestion, "?"), (Tdot, "."), (Tarrow, "->"), (Tellipses, "..."), (Tplus, "+"), (Tminus, "-"), (Tstar, "*"), (Tdiv, "/"), (Tmod, "%"), (Tnot, "~"), (Tand, "&"), (Tor, "|"), (Txor, "^"), (Tlsh, "<<"), (Trsh, ">>"), (Tinc, "++"), (Tdec, "--"), (Tlnot, "!"), (Tland, "&&"), (Tlor, "||"), (Teq, "=="), (Tne, "!="), (Tlt, "<"), (Tgt, ">"), (Tle, "<="), (Tge, ">="), (Tassign, "="), (Tadd_assign, "+="), (Tsub_assign, "-="), (Tmul_assign, "*="), (Tdiv_assign, "/="), (Tmod_assign, "%="), (Tlsh_assign, "<<="), (Trsh_assign, ">>="), (Tand_assign, "&="), (Tor_assign, "|="), (Txor_assign, "^="), -- -- Keywords -- (Tauto, "auto"), (Tbreak, "break"), (Tcase, "case"), (Tchar, "char"), (Tconst, "const"), (Tcontinue, "continue"), (Tdefault, "default"), (Tdo, "do"), (Tdouble, "double"), (Telse, "else"), (Tenum, "enum"), (Textern, "extern"), (Tfloat, "float"), (Tfor, "for"), (Tgoto, "goto"), (Tif, "if"), (Tinline, "inline"), (Tint, "int"), (Tlong, "long"), (Tregister, "register"), (Trestrict, "restrict"), (Treturn, "return"), (Tshort, "short"), (Tsigned, "signed"), (Tsizeof, "sizeof"), (Tstatic, "static"), (Tstruct, "struct"), (Tswitch, "switch"), (Ttypedef, "typedef"), (Tunion, "union"), (Tunsigned, "unsigned"), (Tvoid, "void"), (Tvolatile, "volatile"), (Twhile, "while"), (TBool, "_Bool"), (TComplex, "_TComplex"), (TImaginary, "_TImaginary"), -- -- GCC extensions -- (Tasm, "asm"), (Tattribute, "__attribute__"), (Tbuiltin_va_arg, "__builtin_va_arg"), (Tbuiltin_va_list, "__builtin_va_list"), (Textension, "__extension__"), (Ttypeof, "typeof"), -- -- CUDA extensions -- (Tdevice, "__device__"), (Tglobal, "__global__"), (Thost, "__host__"), (Tconstant, "__constant__"), (Tshared, "__shared__"), (Tnoinline, "__noinline__") ]
3,976
tokenStrings :: [(Token, String)] tokenStrings = [(Tlparen, "("), (Trparen, ")"), (Tlbrack, "["), (Trbrack, "]"), (Tlbrace, "{"), (Trbrace, "}"), (Tcomma, ","), (Tsemi, ";"), (Tcolon, ":"), (Tquestion, "?"), (Tdot, "."), (Tarrow, "->"), (Tellipses, "..."), (Tplus, "+"), (Tminus, "-"), (Tstar, "*"), (Tdiv, "/"), (Tmod, "%"), (Tnot, "~"), (Tand, "&"), (Tor, "|"), (Txor, "^"), (Tlsh, "<<"), (Trsh, ">>"), (Tinc, "++"), (Tdec, "--"), (Tlnot, "!"), (Tland, "&&"), (Tlor, "||"), (Teq, "=="), (Tne, "!="), (Tlt, "<"), (Tgt, ">"), (Tle, "<="), (Tge, ">="), (Tassign, "="), (Tadd_assign, "+="), (Tsub_assign, "-="), (Tmul_assign, "*="), (Tdiv_assign, "/="), (Tmod_assign, "%="), (Tlsh_assign, "<<="), (Trsh_assign, ">>="), (Tand_assign, "&="), (Tor_assign, "|="), (Txor_assign, "^="), -- -- Keywords -- (Tauto, "auto"), (Tbreak, "break"), (Tcase, "case"), (Tchar, "char"), (Tconst, "const"), (Tcontinue, "continue"), (Tdefault, "default"), (Tdo, "do"), (Tdouble, "double"), (Telse, "else"), (Tenum, "enum"), (Textern, "extern"), (Tfloat, "float"), (Tfor, "for"), (Tgoto, "goto"), (Tif, "if"), (Tinline, "inline"), (Tint, "int"), (Tlong, "long"), (Tregister, "register"), (Trestrict, "restrict"), (Treturn, "return"), (Tshort, "short"), (Tsigned, "signed"), (Tsizeof, "sizeof"), (Tstatic, "static"), (Tstruct, "struct"), (Tswitch, "switch"), (Ttypedef, "typedef"), (Tunion, "union"), (Tunsigned, "unsigned"), (Tvoid, "void"), (Tvolatile, "volatile"), (Twhile, "while"), (TBool, "_Bool"), (TComplex, "_TComplex"), (TImaginary, "_TImaginary"), -- -- GCC extensions -- (Tasm, "asm"), (Tattribute, "__attribute__"), (Tbuiltin_va_arg, "__builtin_va_arg"), (Tbuiltin_va_list, "__builtin_va_list"), (Textension, "__extension__"), (Ttypeof, "typeof"), -- -- CUDA extensions -- (Tdevice, "__device__"), (Tglobal, "__global__"), (Thost, "__host__"), (Tconstant, "__constant__"), (Tshared, "__shared__"), (Tnoinline, "__noinline__") ]
3,976
tokenStrings = [(Tlparen, "("), (Trparen, ")"), (Tlbrack, "["), (Trbrack, "]"), (Tlbrace, "{"), (Trbrace, "}"), (Tcomma, ","), (Tsemi, ";"), (Tcolon, ":"), (Tquestion, "?"), (Tdot, "."), (Tarrow, "->"), (Tellipses, "..."), (Tplus, "+"), (Tminus, "-"), (Tstar, "*"), (Tdiv, "/"), (Tmod, "%"), (Tnot, "~"), (Tand, "&"), (Tor, "|"), (Txor, "^"), (Tlsh, "<<"), (Trsh, ">>"), (Tinc, "++"), (Tdec, "--"), (Tlnot, "!"), (Tland, "&&"), (Tlor, "||"), (Teq, "=="), (Tne, "!="), (Tlt, "<"), (Tgt, ">"), (Tle, "<="), (Tge, ">="), (Tassign, "="), (Tadd_assign, "+="), (Tsub_assign, "-="), (Tmul_assign, "*="), (Tdiv_assign, "/="), (Tmod_assign, "%="), (Tlsh_assign, "<<="), (Trsh_assign, ">>="), (Tand_assign, "&="), (Tor_assign, "|="), (Txor_assign, "^="), -- -- Keywords -- (Tauto, "auto"), (Tbreak, "break"), (Tcase, "case"), (Tchar, "char"), (Tconst, "const"), (Tcontinue, "continue"), (Tdefault, "default"), (Tdo, "do"), (Tdouble, "double"), (Telse, "else"), (Tenum, "enum"), (Textern, "extern"), (Tfloat, "float"), (Tfor, "for"), (Tgoto, "goto"), (Tif, "if"), (Tinline, "inline"), (Tint, "int"), (Tlong, "long"), (Tregister, "register"), (Trestrict, "restrict"), (Treturn, "return"), (Tshort, "short"), (Tsigned, "signed"), (Tsizeof, "sizeof"), (Tstatic, "static"), (Tstruct, "struct"), (Tswitch, "switch"), (Ttypedef, "typedef"), (Tunion, "union"), (Tunsigned, "unsigned"), (Tvoid, "void"), (Tvolatile, "volatile"), (Twhile, "while"), (TBool, "_Bool"), (TComplex, "_TComplex"), (TImaginary, "_TImaginary"), -- -- GCC extensions -- (Tasm, "asm"), (Tattribute, "__attribute__"), (Tbuiltin_va_arg, "__builtin_va_arg"), (Tbuiltin_va_list, "__builtin_va_list"), (Textension, "__extension__"), (Ttypeof, "typeof"), -- -- CUDA extensions -- (Tdevice, "__device__"), (Tglobal, "__global__"), (Thost, "__host__"), (Tconstant, "__constant__"), (Tshared, "__shared__"), (Tnoinline, "__noinline__") ]
3,942
false
true
0
8
2,270
891
592
299
null
null
ekmett/ghc
includes/CodeGen.Platform.hs
bsd-3-clause
callerSaves CurrentNursery = True
36
callerSaves CurrentNursery = True
36
callerSaves CurrentNursery = True
36
false
false
0
5
6
9
4
5
null
null