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
Athas/Sindre
Sindre/Runtime.hs
mit
composeI :: ObjectRef -> Widget s im -> Sindre im (SpaceNeed, s) composeI k s = runObjectM (widgetCompose s) k $ objectState $ widgetObject s
141
composeI :: ObjectRef -> Widget s im -> Sindre im (SpaceNeed, s) composeI k s = runObjectM (widgetCompose s) k $ objectState $ widgetObject s
141
composeI k s = runObjectM (widgetCompose s) k $ objectState $ widgetObject s
76
false
true
0
9
24
67
31
36
null
null
ssaavedra/liquidhaskell
tests/todo/baffled.hs
bsd-3-clause
{-@ lAssert :: {v:Bool | Prop v} -> a -> a @-} lAssert True x = x
68
lAssert True x = x
18
lAssert True x = x
18
true
false
1
5
19
17
6
11
null
null
infotroph/pandoc
src/Text/Pandoc/Readers/LaTeX.hs
gpl-2.0
acute 'o' = "ó"
15
acute 'o' = "ó"
15
acute 'o' = "ó"
15
false
false
1
5
3
13
4
9
null
null
nomeata/ghc
compiler/main/DriverPhases.hs
bsd-3-clause
extcoreish_suffixes = [ "hcr" ]
40
extcoreish_suffixes = [ "hcr" ]
40
extcoreish_suffixes = [ "hcr" ]
40
false
false
0
5
13
9
5
4
null
null
rad1al/hutton_exercises
notes_ch12.hs
gpl-2.0
eval' (Div x y) = case eval' x of Nothing -> Nothing Just n -> case eval' y of Nothing -> Nothing Just m -> safediv n m {- > eval' (Div (Val 1) (Val 0)) Nothing > eval' (Div (Div (Val 10) (Val 2)) (Val 5)) Just 1 > eval' (Div (Div (Val 0) (Val 2)) (Val 5)) Just 0 > eval' (Div (Div (Val 2) (Val 0)) (Val 5)) Nothing -} {- The following function is not type correct: eval'' :: Expr -> Maybe Int eval'' (Val n) = pure n eval'' (Div x y) = pure safediv <*> eval'' x <*> eval'' y ghci states: Couldn't match type ‘Maybe Int’ with ‘Int’ ------------------------------------------------------- (>>=) :: Maybe a -> (a -> Maybe b) -> Maybe b mx >>= f = case mx of Nothing -> Nothing Just x -> f x -}
808
eval' (Div x y) = case eval' x of Nothing -> Nothing Just n -> case eval' y of Nothing -> Nothing Just m -> safediv n m {- > eval' (Div (Val 1) (Val 0)) Nothing > eval' (Div (Div (Val 10) (Val 2)) (Val 5)) Just 1 > eval' (Div (Div (Val 0) (Val 2)) (Val 5)) Just 0 > eval' (Div (Div (Val 2) (Val 0)) (Val 5)) Nothing -} {- The following function is not type correct: eval'' :: Expr -> Maybe Int eval'' (Val n) = pure n eval'' (Div x y) = pure safediv <*> eval'' x <*> eval'' y ghci states: Couldn't match type ‘Maybe Int’ with ‘Int’ ------------------------------------------------------- (>>=) :: Maybe a -> (a -> Maybe b) -> Maybe b mx >>= f = case mx of Nothing -> Nothing Just x -> f x -}
808
eval' (Div x y) = case eval' x of Nothing -> Nothing Just n -> case eval' y of Nothing -> Nothing Just m -> safediv n m {- > eval' (Div (Val 1) (Val 0)) Nothing > eval' (Div (Div (Val 10) (Val 2)) (Val 5)) Just 1 > eval' (Div (Div (Val 0) (Val 2)) (Val 5)) Just 0 > eval' (Div (Div (Val 2) (Val 0)) (Val 5)) Nothing -} {- The following function is not type correct: eval'' :: Expr -> Maybe Int eval'' (Val n) = pure n eval'' (Div x y) = pure safediv <*> eval'' x <*> eval'' y ghci states: Couldn't match type ‘Maybe Int’ with ‘Int’ ------------------------------------------------------- (>>=) :: Maybe a -> (a -> Maybe b) -> Maybe b mx >>= f = case mx of Nothing -> Nothing Just x -> f x -}
808
false
false
0
11
260
69
32
37
null
null
Chase-C/Flocking-Haskell
src/Octree.hs
gpl-2.0
splitWith :: Octree -> (Octree -> Bool) -> Octree splitWith (Node cen len cnt i j k l m n o p) f = Node cen len cnt (s i) (s j) (s k) (s l) (s m) (s n) (s o) (s p) where s tree = splitWith tree f
199
splitWith :: Octree -> (Octree -> Bool) -> Octree splitWith (Node cen len cnt i j k l m n o p) f = Node cen len cnt (s i) (s j) (s k) (s l) (s m) (s n) (s o) (s p) where s tree = splitWith tree f
199
splitWith (Node cen len cnt i j k l m n o p) f = Node cen len cnt (s i) (s j) (s k) (s l) (s m) (s n) (s o) (s p) where s tree = splitWith tree f
149
false
true
1
10
54
152
72
80
null
null
UCSD-PL/RefScript
tests/test.hs
bsd-3-clause
knownToFail = []
16
knownToFail = []
16
knownToFail = []
16
false
false
0
5
2
8
4
4
null
null
zjhmale/Ntha
src/Ntha/Core/Ast.hs
bsd-3-clause
tab :: EIndent -> String tab i = intercalate "" $ take i $ repeat "\t"
70
tab :: EIndent -> String tab i = intercalate "" $ take i $ repeat "\t"
70
tab i = intercalate "" $ take i $ repeat "\t"
45
false
true
0
7
15
35
16
19
null
null
spechub/Hets
SoftFOL/MathServParsing.hs
gpl-2.0
getProblem :: Element -> String -> MWProvingProblem getProblem e s = case filterElementName (isMWnode s) e of Nothing -> UnknownProvingProblem Just po -> getProblemAttr po
175
getProblem :: Element -> String -> MWProvingProblem getProblem e s = case filterElementName (isMWnode s) e of Nothing -> UnknownProvingProblem Just po -> getProblemAttr po
175
getProblem e s = case filterElementName (isMWnode s) e of Nothing -> UnknownProvingProblem Just po -> getProblemAttr po
123
false
true
3
8
28
58
27
31
null
null
glguy/s5s
Main.hs
bsd-3-clause
readyForClientRequest :: Configuration -> Socket -> GetContext -> SockAddr -> IO () readyForClientRequest config s cxt who = do req <- recvGet s cxt mbDst <- resolveSocksAddress config (requestDst req) case mbDst of Nothing -> do info config "Connection failed" sendSerialized s (errorResponse SocksErrorHostUnreachable) Just dst -> do handleClientRequest (requestCommand req) config s who dst ------------------------------------------------------------------------ -- Request modes ------------------------------------------------------------------------
593
readyForClientRequest :: Configuration -> Socket -> GetContext -> SockAddr -> IO () readyForClientRequest config s cxt who = do req <- recvGet s cxt mbDst <- resolveSocksAddress config (requestDst req) case mbDst of Nothing -> do info config "Connection failed" sendSerialized s (errorResponse SocksErrorHostUnreachable) Just dst -> do handleClientRequest (requestCommand req) config s who dst ------------------------------------------------------------------------ -- Request modes ------------------------------------------------------------------------
593
readyForClientRequest config s cxt who = do req <- recvGet s cxt mbDst <- resolveSocksAddress config (requestDst req) case mbDst of Nothing -> do info config "Connection failed" sendSerialized s (errorResponse SocksErrorHostUnreachable) Just dst -> do handleClientRequest (requestCommand req) config s who dst ------------------------------------------------------------------------ -- Request modes ------------------------------------------------------------------------
509
false
true
0
15
96
139
64
75
null
null
akhileshs/stack
src/System/Process/Read.hs
bsd-3-clause
doesExecutableExist :: MonadIO m => EnvOverride -> String -> m Bool doesExecutableExist menv name = liftM isJust $ findExecutable menv name
139
doesExecutableExist :: MonadIO m => EnvOverride -> String -> m Bool doesExecutableExist menv name = liftM isJust $ findExecutable menv name
139
doesExecutableExist menv name = liftM isJust $ findExecutable menv name
71
false
true
0
8
20
46
21
25
null
null
lamefun/haddock
haddock-api/src/Haddock/Backends/LaTeX.hs
bsd-2-clause
ppBang _ = char '!'
26
ppBang _ = char '!'
26
ppBang _ = char '!'
26
false
false
0
5
11
12
5
7
null
null
micxjo/hs-advent
src/Advent/Day9.hs
bsd-3-clause
pathDistance :: Graph -> Path -> Int pathDistance graph path = sum (map distance path) where distance c = M.findWithDefault (maxBound :: Int) c graph
151
pathDistance :: Graph -> Path -> Int pathDistance graph path = sum (map distance path) where distance c = M.findWithDefault (maxBound :: Int) c graph
151
pathDistance graph path = sum (map distance path) where distance c = M.findWithDefault (maxBound :: Int) c graph
114
false
true
0
7
26
60
30
30
null
null
iu-parfunc/containers
Data/Map/Base.hs
bsd-3-clause
-- | /O(n)/. A strict version of 'foldl'. Each application of the operator is -- evaluated before using the result in the next application. This -- function is strict in the starting value. foldl' :: (a -> b -> a) -> a -> Map k b -> a foldl' f z = go z where STRICT_1_OF_2(go) go z' Tip = z' go z' (Bin _ _ x l r) = go (f (go z' l) x) r
363
foldl' :: (a -> b -> a) -> a -> Map k b -> a foldl' f z = go z where STRICT_1_OF_2(go) go z' Tip = z' go z' (Bin _ _ x l r) = go (f (go z' l) x) r
173
foldl' f z = go z where STRICT_1_OF_2(go) go z' Tip = z' go z' (Bin _ _ x l r) = go (f (go z' l) x) r
128
true
true
1
9
103
129
59
70
null
null
michaxm/haskell-hdfs-thrift-client
src-gen-thrift/ThriftHadoopFileSystem.hs
bsd-3-clause
to_ListStatus_args _ = P.error "not a struct"
45
to_ListStatus_args _ = P.error "not a struct"
45
to_ListStatus_args _ = P.error "not a struct"
45
false
false
0
6
6
14
6
8
null
null
glguy/irc-core
hookup/src/Hookup.hs
isc
defaultTlsParams :: TlsParams defaultTlsParams = TlsParams { tpClientCertificate = Nothing , tpClientPrivateKey = Nothing , tpClientPrivateKeyPassword = Nothing , tpServerCertificate = Nothing -- use system provided CAs , tpCipherSuite = "HIGH" , tpCipherSuiteTls13 = Nothing , tpVerify = VerifyDefault }
345
defaultTlsParams :: TlsParams defaultTlsParams = TlsParams { tpClientCertificate = Nothing , tpClientPrivateKey = Nothing , tpClientPrivateKeyPassword = Nothing , tpServerCertificate = Nothing -- use system provided CAs , tpCipherSuite = "HIGH" , tpCipherSuiteTls13 = Nothing , tpVerify = VerifyDefault }
345
defaultTlsParams = TlsParams { tpClientCertificate = Nothing , tpClientPrivateKey = Nothing , tpClientPrivateKeyPassword = Nothing , tpServerCertificate = Nothing -- use system provided CAs , tpCipherSuite = "HIGH" , tpCipherSuiteTls13 = Nothing , tpVerify = VerifyDefault }
315
false
true
0
7
80
60
37
23
null
null
sheganinans/applicative-nestedmap
src/Data/Nested/Forest.hs
bsd-3-clause
singleton ∷ Foldable φ ⇒ φ (κ,α) → Forest κ α singleton = singletonForest
73
singleton ∷ Foldable φ ⇒ φ (κ,α) → Forest κ α singleton = singletonForest
73
singleton = singletonForest
27
false
true
0
8
13
36
18
18
null
null
jrahm/Beowulf
Beowulf/Style/Colors.hs
bsd-2-clause
cyan :: ColorT cyan = Hex 0x00FFFF
34
cyan :: ColorT cyan = Hex 0x00FFFF
34
cyan = Hex 0x00FFFF
19
false
true
0
5
6
14
7
7
null
null
DanielWaterworth/Idris-dev
src/Idris/REPL.hs
bsd-3-clause
-- RmProof and AddProof not supported! ideslaveProcess fn (ShowProof n') = process stdout fn (ShowProof n')
107
ideslaveProcess fn (ShowProof n') = process stdout fn (ShowProof n')
68
ideslaveProcess fn (ShowProof n') = process stdout fn (ShowProof n')
68
true
false
0
7
15
31
15
16
null
null
CalumMcCall/hokey
src/Hokey/Hand.hs
gpl-3.0
hasStraightInner :: [Card] -> [Card] hasStraightInner (v:w:x:y:z:zs) | getNextLowerRank vr == wr && getNextLowerRank wr == xr && getNextLowerRank xr == yr && getNextLowerRank yr == zr = (v:w:x:y:z:[]) | otherwise = hasStraightInner (w:x:y:z:zs) where vr = getRank v wr = getRank w xr = getRank x yr = getRank y zr = getRank z
431
hasStraightInner :: [Card] -> [Card] hasStraightInner (v:w:x:y:z:zs) | getNextLowerRank vr == wr && getNextLowerRank wr == xr && getNextLowerRank xr == yr && getNextLowerRank yr == zr = (v:w:x:y:z:[]) | otherwise = hasStraightInner (w:x:y:z:zs) where vr = getRank v wr = getRank w xr = getRank x yr = getRank y zr = getRank z
431
hasStraightInner (v:w:x:y:z:zs) | getNextLowerRank vr == wr && getNextLowerRank wr == xr && getNextLowerRank xr == yr && getNextLowerRank yr == zr = (v:w:x:y:z:[]) | otherwise = hasStraightInner (w:x:y:z:zs) where vr = getRank v wr = getRank w xr = getRank x yr = getRank y zr = getRank z
394
false
true
0
15
160
191
94
97
null
null
johwerm/cube-solver
src/Transform.hs
mit
transform :: Pos -> Transform -> Pos transform pos (T trans rot) = translate (rotate pos rot) trans
99
transform :: Pos -> Transform -> Pos transform pos (T trans rot) = translate (rotate pos rot) trans
99
transform pos (T trans rot) = translate (rotate pos rot) trans
62
false
true
0
10
17
50
23
27
null
null
recursion-ninja/megaparsec
bench/speed/Main.hs
bsd-2-clause
-- | Render an 'Integer' with the number of digits linearly dependent on the -- argument. mkInt :: Int -> Text mkInt n = (T.pack . show) ((10 :: Integer) ^ (n `quot` 100))
172
mkInt :: Int -> Text mkInt n = (T.pack . show) ((10 :: Integer) ^ (n `quot` 100))
81
mkInt n = (T.pack . show) ((10 :: Integer) ^ (n `quot` 100))
60
true
true
0
9
34
54
31
23
null
null
ghcjs/ghcjs-base
test/Tests/Properties.hs
mit
j_Ord s = (compare s) `eq` (compare (J.pack s) . J.pack)
66
j_Ord s = (compare s) `eq` (compare (J.pack s) . J.pack)
66
j_Ord s = (compare s) `eq` (compare (J.pack s) . J.pack)
66
false
false
0
11
20
41
21
20
null
null
sinelaw/infernu
src/Infernu/Pretty.hs
gpl-2.0
prettyType (TCons (TName name) ts) = angles $ pretty name <> colon <+> hsep (map pretty ts)
91
prettyType (TCons (TName name) ts) = angles $ pretty name <> colon <+> hsep (map pretty ts)
91
prettyType (TCons (TName name) ts) = angles $ pretty name <> colon <+> hsep (map pretty ts)
91
false
false
0
8
16
50
23
27
null
null
jwiegley/ghc-release
libraries/containers/Data/Sequence.hs
gpl-3.0
addDigits1 m1 (Two a b) c (Four d e f g) m2 = appendTree3 m1 (node3 a b c) (node2 d e) (node2 f g) m2
105
addDigits1 m1 (Two a b) c (Four d e f g) m2 = appendTree3 m1 (node3 a b c) (node2 d e) (node2 f g) m2
105
addDigits1 m1 (Two a b) c (Four d e f g) m2 = appendTree3 m1 (node3 a b c) (node2 d e) (node2 f g) m2
105
false
false
0
7
29
74
36
38
null
null
anttisalonen/economics
src/Utility.hs
mit
factors :: UtilityFunction -> Price -> Price -> Flt -> (Quantity, Quantity) factors (CobbDouglas a) px py i = (fst (cobbDouglasDemand' a i) px, snd (cobbDouglasDemand' a i) py)
176
factors :: UtilityFunction -> Price -> Price -> Flt -> (Quantity, Quantity) factors (CobbDouglas a) px py i = (fst (cobbDouglasDemand' a i) px, snd (cobbDouglasDemand' a i) py)
176
factors (CobbDouglas a) px py i = (fst (cobbDouglasDemand' a i) px, snd (cobbDouglasDemand' a i) py)
100
false
true
0
12
28
86
42
44
null
null
veniversum/fractal-haskell
src/generateStatic.hs
bsd-3-clause
-- Outputs test gradient -- Test reference images draw 1 = createPngColor size (drawColorZoom 1 (-0.75,0))
106
draw 1 = createPngColor size (drawColorZoom 1 (-0.75,0))
56
draw 1 = createPngColor size (drawColorZoom 1 (-0.75,0))
56
true
false
1
9
15
36
17
19
null
null
HJvT/hdirect
src/Parser.hs
bsd-3-clause
happyReduction_142 (HappyAbsSyn34 happy_var_3) _ (HappyAbsSyn34 happy_var_1) = HappyAbsSyn34 (Binary Gt happy_var_1 happy_var_3 )
182
happyReduction_142 (HappyAbsSyn34 happy_var_3) _ (HappyAbsSyn34 happy_var_1) = HappyAbsSyn34 (Binary Gt happy_var_1 happy_var_3 )
182
happyReduction_142 (HappyAbsSyn34 happy_var_3) _ (HappyAbsSyn34 happy_var_1) = HappyAbsSyn34 (Binary Gt happy_var_1 happy_var_3 )
182
false
false
0
7
65
38
18
20
null
null
event/spim
AddPIObject.hs
agpl-3.0
digest (Just s) = show (foldr ((+) . Char.ord) 0 s)
52
digest (Just s) = show (foldr ((+) . Char.ord) 0 s)
52
digest (Just s) = show (foldr ((+) . Char.ord) 0 s)
52
false
false
0
10
11
39
20
19
null
null
UweSchmidt/ppl2
src/PPL2/CodeGen/TypedExpr.hs
mit
tOpr :: Prism' (TypedExOp v) Mnemonic tOpr = prism TOpr (\ case TOpr n -> Right n x -> Left x )
119
tOpr :: Prism' (TypedExOp v) Mnemonic tOpr = prism TOpr (\ case TOpr n -> Right n x -> Left x )
119
tOpr = prism TOpr (\ case TOpr n -> Right n x -> Left x )
81
false
true
0
9
45
54
25
29
null
null
OS2World/DEV-UTIL-HUGS
libraries/Text/Html.hs
bsd-3-clause
sub = tag "SUB"
32
sub = tag "SUB"
32
sub = tag "SUB"
32
false
false
0
5
20
9
4
5
null
null
alios/nauticlib
src/Data/ISO8211/Parser.hs
bsd-3-clause
dsMultiDimStruct t = error $ "not a Multi Dim Structure: " ++ show t
68
dsMultiDimStruct t = error $ "not a Multi Dim Structure: " ++ show t
68
dsMultiDimStruct t = error $ "not a Multi Dim Structure: " ++ show t
68
false
false
0
6
13
20
9
11
null
null
forste/haReFork
tools/base/pretty/PrettySymbols.hs
bsd-3-clause
--star = kwIfUnicode '\x2605' "*" -- not present in times --moon = kwIfUnicode '\x263e' "C" -- not present in times star = kw "*"
138
star = kw "*"
16
star = kw "*"
16
true
false
1
5
32
15
6
9
null
null
GaloisInc/halvm-ghc
compiler/basicTypes/BasicTypes.hs
bsd-3-clause
isRec NonRecursive = False
26
isRec NonRecursive = False
26
isRec NonRecursive = False
26
false
false
1
5
3
13
4
9
null
null
akegalj/snowdrift
Model/Project.hs
agpl-3.0
-- | Abstract fetching Project Admins, TeamMembers, etc. Not exported. fetchProjectRoleDB :: Role -> ProjectId -> DB [UserId] fetchProjectRoleDB role project_id = fmap unwrapValues $ select $ from $ \pur -> do where_ $ pur ^. ProjectUserRoleProject ==. val project_id &&. pur ^. ProjectUserRoleRole ==. val role return (pur ^. ProjectUserRoleUser) -- -- | Fetch all Project VolunteerApplications.
433
fetchProjectRoleDB :: Role -> ProjectId -> DB [UserId] fetchProjectRoleDB role project_id = fmap unwrapValues $ select $ from $ \pur -> do where_ $ pur ^. ProjectUserRoleProject ==. val project_id &&. pur ^. ProjectUserRoleRole ==. val role return (pur ^. ProjectUserRoleUser) -- -- | Fetch all Project VolunteerApplications.
362
fetchProjectRoleDB role project_id = fmap unwrapValues $ select $ from $ \pur -> do where_ $ pur ^. ProjectUserRoleProject ==. val project_id &&. pur ^. ProjectUserRoleRole ==. val role return (pur ^. ProjectUserRoleUser) -- -- | Fetch all Project VolunteerApplications.
307
true
true
0
14
94
99
49
50
null
null
juodaspaulius/clafer
src/Language/Clafer/JSONMetaData.hs
mit
readCfrScopeFile :: QNameMaps -> FilePath -> IO (Maybe [ (UID, Integer) ]) readCfrScopeFile qNameMaps modelName = do let cfrScopeFileName = replaceExtension modelName ".cfr-scope" exists <- doesFileExist cfrScopeFileName if exists then do scopesInJSON <- readFile cfrScopeFileName return $ Just $ parseJSONScopes qNameMaps scopesInJSON else return Nothing
412
readCfrScopeFile :: QNameMaps -> FilePath -> IO (Maybe [ (UID, Integer) ]) readCfrScopeFile qNameMaps modelName = do let cfrScopeFileName = replaceExtension modelName ".cfr-scope" exists <- doesFileExist cfrScopeFileName if exists then do scopesInJSON <- readFile cfrScopeFileName return $ Just $ parseJSONScopes qNameMaps scopesInJSON else return Nothing
412
readCfrScopeFile qNameMaps modelName = do let cfrScopeFileName = replaceExtension modelName ".cfr-scope" exists <- doesFileExist cfrScopeFileName if exists then do scopesInJSON <- readFile cfrScopeFileName return $ Just $ parseJSONScopes qNameMaps scopesInJSON else return Nothing
330
false
true
0
12
101
111
51
60
null
null
ghc-android/ghc
compiler/typecheck/TcRnTypes.hs
bsd-3-clause
pprCtO PatOrigin = ptext (sLit "a pattern")
55
pprCtO PatOrigin = ptext (sLit "a pattern")
55
pprCtO PatOrigin = ptext (sLit "a pattern")
55
false
false
1
7
18
22
8
14
null
null
acowley/ghc
compiler/types/Type.hs
bsd-3-clause
seqType (ForAllTy tv ty) = seqType (tyVarKind tv) `seq` seqType ty
67
seqType (ForAllTy tv ty) = seqType (tyVarKind tv) `seq` seqType ty
67
seqType (ForAllTy tv ty) = seqType (tyVarKind tv) `seq` seqType ty
67
false
false
0
8
11
36
17
19
null
null
shlevy/ghc
compiler/llvmGen/Llvm/Types.hs
bsd-3-clause
llvmWidthInBits _ LMMetadata = panic "llvmWidthInBits: Meta-data has no runtime representation!"
106
llvmWidthInBits _ LMMetadata = panic "llvmWidthInBits: Meta-data has no runtime representation!"
106
llvmWidthInBits _ LMMetadata = panic "llvmWidthInBits: Meta-data has no runtime representation!"
106
false
false
0
5
20
14
6
8
null
null
thoughtpolice/binary-serialise-cbor
bench/Real/Load.hs
bsd-3-clause
emptyBenchmark :: Benchmark emptyBenchmark = mempty
51
emptyBenchmark :: Benchmark emptyBenchmark = mempty
51
emptyBenchmark = mempty
23
false
true
0
4
5
11
6
5
null
null
GaloisInc/stack
src/Stack/Package.hs
bsd-3-clause
flagMap :: [Flag] -> Map FlagName Bool flagMap = M.fromList . map pair where pair :: Flag -> (FlagName, Bool) pair (MkFlag (fromCabalFlagName -> name) _desc def _manual) = (name,def)
192
flagMap :: [Flag] -> Map FlagName Bool flagMap = M.fromList . map pair where pair :: Flag -> (FlagName, Bool) pair (MkFlag (fromCabalFlagName -> name) _desc def _manual) = (name,def)
192
flagMap = M.fromList . map pair where pair :: Flag -> (FlagName, Bool) pair (MkFlag (fromCabalFlagName -> name) _desc def _manual) = (name,def)
153
false
true
2
9
39
83
44
39
null
null
shockkolate/containers
Data/IntSet/Base.hs
bsd-3-clause
equal Nil Nil = True
20
equal Nil Nil = True
20
equal Nil Nil = True
20
false
false
0
5
4
11
5
6
null
null
ktvoelker/brick
programs/LayerDemo.hs
bsd-3-clause
appEvent st _ = M.continue st
29
appEvent st _ = M.continue st
29
appEvent st _ = M.continue st
29
false
false
0
6
5
18
7
11
null
null
pasberth/LeatherScript-prototype
Language/LeatherScript/LeatherShield.hs
mit
match UnitTy UnitTy = True
26
match UnitTy UnitTy = True
26
match UnitTy UnitTy = True
26
false
false
0
5
4
11
5
6
null
null
sighingnow/Functional-99-Problems
Haskell/15.hs
mit
{-- - Problem 15 (**) Replicate the elements of a list a given number of times. Example: * (repli '(a b c) 3) (A A A B B B C C C) Example in Haskell: > repli "abc" 3 "aaabbbccc" --} repli :: [a] -> Int -> [a] repli xs n = concatMap (replicate n) xs
289
repli :: [a] -> Int -> [a] repli xs n = concatMap (replicate n) xs
66
repli xs n = concatMap (replicate n) xs
39
true
true
0
7
96
42
22
20
null
null
spockwangs/scheme.in.haskell
list10.hs
unlicense
apply (Func params varargs body closure) args = if num params /= num args && varargs == Nothing then throwError $ NumArgs (num params) args else (liftIO $ bindVars closure $ zip params args) >>= bindVarArgs varargs >>= evalBody where remainingArgs = drop (length params) args num = toInteger . length evalBody env = liftM last $ mapM (eval env) body bindVarArgs arg env = case arg of Just argName -> liftIO $ bindVars env [(argName, List $ remainingArgs)] Nothing -> return env -- | Primitive functions.
587
apply (Func params varargs body closure) args = if num params /= num args && varargs == Nothing then throwError $ NumArgs (num params) args else (liftIO $ bindVars closure $ zip params args) >>= bindVarArgs varargs >>= evalBody where remainingArgs = drop (length params) args num = toInteger . length evalBody env = liftM last $ mapM (eval env) body bindVarArgs arg env = case arg of Just argName -> liftIO $ bindVars env [(argName, List $ remainingArgs)] Nothing -> return env -- | Primitive functions.
587
apply (Func params varargs body closure) args = if num params /= num args && varargs == Nothing then throwError $ NumArgs (num params) args else (liftIO $ bindVars closure $ zip params args) >>= bindVarArgs varargs >>= evalBody where remainingArgs = drop (length params) args num = toInteger . length evalBody env = liftM last $ mapM (eval env) body bindVarArgs arg env = case arg of Just argName -> liftIO $ bindVars env [(argName, List $ remainingArgs)] Nothing -> return env -- | Primitive functions.
587
false
false
2
12
170
210
99
111
null
null
guibou/avlTree
src/Avl/Internal.hs
bsd-3-clause
foldAvl op acc (Node v _ suba subb) = foldAvl op (foldAvl op (op acc v) suba) subb
82
foldAvl op acc (Node v _ suba subb) = foldAvl op (foldAvl op (op acc v) suba) subb
82
foldAvl op acc (Node v _ suba subb) = foldAvl op (foldAvl op (op acc v) suba) subb
82
false
false
0
9
17
53
24
29
null
null
ehlemur/HMeans
Test/MNIST/testKMeans2.hs
gpl-3.0
runHungarian :: [Int] -> [Int] -> ([(Int, Int)], Double) runHungarian x y = hungarian m 10 10 where m = foldr' ($) (take 100 $ repeat 0) $ fmap addAllExcept $ zip x y
175
runHungarian :: [Int] -> [Int] -> ([(Int, Int)], Double) runHungarian x y = hungarian m 10 10 where m = foldr' ($) (take 100 $ repeat 0) $ fmap addAllExcept $ zip x y
174
runHungarian x y = hungarian m 10 10 where m = foldr' ($) (take 100 $ repeat 0) $ fmap addAllExcept $ zip x y
117
false
true
1
11
42
105
51
54
null
null
termite2/debug
Debug/CodeWin.hs
bsd-3-clause
tmFindMBs :: F.Template -> [Pos] tmFindMBs tm = concat $ map (statFindMBs . F.procStatement) (F.tmProcess tm) ++ map methFindMBs (F.tmMethod tm)
144
tmFindMBs :: F.Template -> [Pos] tmFindMBs tm = concat $ map (statFindMBs . F.procStatement) (F.tmProcess tm) ++ map methFindMBs (F.tmMethod tm)
144
tmFindMBs tm = concat $ map (statFindMBs . F.procStatement) (F.tmProcess tm) ++ map methFindMBs (F.tmMethod tm)
111
false
true
0
10
20
66
33
33
null
null
pairyo/elm-compiler
src/Optimize/Patterns/DecisionTree.hs
bsd-3-clause
isComplete :: VariantDict -> [Test] -> Bool isComplete variantDict tests = case head tests of Constructor var -> getArity variantDict var == length tests Literal (L.Boolean _) -> length tests == 2 _ -> False
247
isComplete :: VariantDict -> [Test] -> Bool isComplete variantDict tests = case head tests of Constructor var -> getArity variantDict var == length tests Literal (L.Boolean _) -> length tests == 2 _ -> False
247
isComplete variantDict tests = case head tests of Constructor var -> getArity variantDict var == length tests Literal (L.Boolean _) -> length tests == 2 _ -> False
203
false
true
0
11
74
85
40
45
null
null
Sword-Smith/hfasto
src/AMD64CodeGenerator.hs
mit
ppAMD64 (AMD64.INT hex) = "int " ++ hex
41
ppAMD64 (AMD64.INT hex) = "int " ++ hex
41
ppAMD64 (AMD64.INT hex) = "int " ++ hex
41
false
false
0
8
9
21
10
11
null
null
Fisbang/fisbang-api
src/Api/Appliance.hs
bsd-3-clause
-- | The server that runs the ApplianceAPI applianceServer :: ServerT ApplianceAPI App applianceServer = allAppliances :<|> createAppliance :<|> singleAppliance :<|> deleteAppliance :<|> updateAppliance :<|> getApplianceDevice :<|> postApplianceDevice :<|> deleteApplianceDevice
278
applianceServer :: ServerT ApplianceAPI App applianceServer = allAppliances :<|> createAppliance :<|> singleAppliance :<|> deleteAppliance :<|> updateAppliance :<|> getApplianceDevice :<|> postApplianceDevice :<|> deleteApplianceDevice
235
applianceServer = allAppliances :<|> createAppliance :<|> singleAppliance :<|> deleteAppliance :<|> updateAppliance :<|> getApplianceDevice :<|> postApplianceDevice :<|> deleteApplianceDevice
191
true
true
0
11
29
45
23
22
null
null
toonn/wyah
src/PolyCEnv.hs
bsd-2-clause
extends :: Env -> [(Name, Scheme)] -> Env extends env xs = env { types = Map.union (Map.fromList xs) (types env) }
114
extends :: Env -> [(Name, Scheme)] -> Env extends env xs = env { types = Map.union (Map.fromList xs) (types env) }
114
extends env xs = env { types = Map.union (Map.fromList xs) (types env) }
72
false
true
0
10
21
62
33
29
null
null
olorin/amazonka
amazonka-s3/test/Test/AWS/Gen/S3.hs
mpl-2.0
testDeleteObjectsResponse :: DeleteObjectsResponse -> TestTree testDeleteObjectsResponse = res "DeleteObjectsResponse" "fixture/DeleteObjectsResponse.proto" s3 (Proxy :: Proxy DeleteObjects)
206
testDeleteObjectsResponse :: DeleteObjectsResponse -> TestTree testDeleteObjectsResponse = res "DeleteObjectsResponse" "fixture/DeleteObjectsResponse.proto" s3 (Proxy :: Proxy DeleteObjects)
206
testDeleteObjectsResponse = res "DeleteObjectsResponse" "fixture/DeleteObjectsResponse.proto" s3 (Proxy :: Proxy DeleteObjects)
143
false
true
0
6
30
36
17
19
null
null
qpliu/esolang
DGOL/hs/compiler/CodeGen/Runtime.hs
gpl-3.0
debugAddr :: Operand debugAddr = functionRef debugAddrName [MetadataType,MetadataType,MetadataType] void
104
debugAddr :: Operand debugAddr = functionRef debugAddrName [MetadataType,MetadataType,MetadataType] void
104
debugAddr = functionRef debugAddrName [MetadataType,MetadataType,MetadataType] void
83
false
true
0
6
8
35
16
19
null
null
leftaroundabout/timed-media
Media/Timed/Audio/Stream.hs
gpl-3.0
loadAudio :: FilePath -> IO [Audio] loadAudio fPath = do (SF.Info nFr sr nChan _ _ _, Just (buf :: BV.Buffer Double)) <- SF.readFile fPath let bufv = BV.fromBuffer buf nSpl = Arr.length bufv len | nSpl == nFr * nChan = fromIntegral nFr / fromIntegral sr ldlAudio = ceiling $ logBase 2 len nTot = sr * 2^ldlAudio silence = Arr.replicate (nTot-nFr) 0 return [ Audio ldlAudio . fromUniformSampled def $ chanv <> silence | i <- [0..nChan-1] , let chanv = Arr.generate nFr $ \j -> bufv Arr.! (j*nChan + i) ]
597
loadAudio :: FilePath -> IO [Audio] loadAudio fPath = do (SF.Info nFr sr nChan _ _ _, Just (buf :: BV.Buffer Double)) <- SF.readFile fPath let bufv = BV.fromBuffer buf nSpl = Arr.length bufv len | nSpl == nFr * nChan = fromIntegral nFr / fromIntegral sr ldlAudio = ceiling $ logBase 2 len nTot = sr * 2^ldlAudio silence = Arr.replicate (nTot-nFr) 0 return [ Audio ldlAudio . fromUniformSampled def $ chanv <> silence | i <- [0..nChan-1] , let chanv = Arr.generate nFr $ \j -> bufv Arr.! (j*nChan + i) ]
597
loadAudio fPath = do (SF.Info nFr sr nChan _ _ _, Just (buf :: BV.Buffer Double)) <- SF.readFile fPath let bufv = BV.fromBuffer buf nSpl = Arr.length bufv len | nSpl == nFr * nChan = fromIntegral nFr / fromIntegral sr ldlAudio = ceiling $ logBase 2 len nTot = sr * 2^ldlAudio silence = Arr.replicate (nTot-nFr) 0 return [ Audio ldlAudio . fromUniformSampled def $ chanv <> silence | i <- [0..nChan-1] , let chanv = Arr.generate nFr $ \j -> bufv Arr.! (j*nChan + i) ]
561
false
true
0
18
188
256
125
131
null
null
keithodulaigh/Hets
Common/Lib/Tabular.hs
gpl-2.0
renderColumns :: [Int] -- ^ max width for each column -> Header String -> String renderColumns is h = "| " ++ coreLine ++ " |" where coreLine = concatMap helper $ flattenHeader $ zipHeader 0 is h padLeft (l, s) = replicate (l - length s) ' ' ++ s helper = either hsep padLeft hsep :: Properties -> String hsep NoLine = " " hsep SingleLine = " | " hsep DoubleLine = " || "
414
renderColumns :: [Int] -- ^ max width for each column -> Header String -> String renderColumns is h = "| " ++ coreLine ++ " |" where coreLine = concatMap helper $ flattenHeader $ zipHeader 0 is h padLeft (l, s) = replicate (l - length s) ' ' ++ s helper = either hsep padLeft hsep :: Properties -> String hsep NoLine = " " hsep SingleLine = " | " hsep DoubleLine = " || "
414
renderColumns is h = "| " ++ coreLine ++ " |" where coreLine = concatMap helper $ flattenHeader $ zipHeader 0 is h padLeft (l, s) = replicate (l - length s) ' ' ++ s helper = either hsep padLeft hsep :: Properties -> String hsep NoLine = " " hsep SingleLine = " | " hsep DoubleLine = " || "
305
false
true
8
9
120
169
73
96
null
null
krisajenkins/kashmir
src/Kashmir/Github/Api.hs
epl-1.0
makeGithubUrl :: Sitemap -> Text makeGithubUrl uri = server <> toUrl uri
72
makeGithubUrl :: Sitemap -> Text makeGithubUrl uri = server <> toUrl uri
72
makeGithubUrl uri = server <> toUrl uri
39
false
true
0
7
11
30
13
17
null
null
alexbiehl/hoop
hadoop-protos/src/Hadoop/Protos/YarnServerResourceManagerRecoveryProtos/RMAppAttemptStateProto.hs
mit
toMaybe'Enum 12 = Prelude'.Just RMATTEMPT_LAUNCHED_UNMANAGED_SAVING
67
toMaybe'Enum 12 = Prelude'.Just RMATTEMPT_LAUNCHED_UNMANAGED_SAVING
67
toMaybe'Enum 12 = Prelude'.Just RMATTEMPT_LAUNCHED_UNMANAGED_SAVING
67
false
false
1
6
4
17
6
11
null
null
mfpi/OpenGL
Graphics/Rendering/OpenGL/GL/BufferObjects.hs
bsd-3-clause
bindBufferBase' :: BufferTarget -> BufferIndex -> BufferObject -> IO () bindBufferBase' t i (BufferObject b) = glBindBufferBase (marshalBufferTarget t) i b
155
bindBufferBase' :: BufferTarget -> BufferIndex -> BufferObject -> IO () bindBufferBase' t i (BufferObject b) = glBindBufferBase (marshalBufferTarget t) i b
155
bindBufferBase' t i (BufferObject b) = glBindBufferBase (marshalBufferTarget t) i b
83
false
true
0
9
20
54
26
28
null
null
dmwit/sgf
Data/SGF/Parse.hs
bsd-3-clause
clipDate :: PartialDate -> PartialDate clipDate (y@Year {}) = Year . min 9999 . max 0 . year $ y
97
clipDate :: PartialDate -> PartialDate clipDate (y@Year {}) = Year . min 9999 . max 0 . year $ y
97
clipDate (y@Year {}) = Year . min 9999 . max 0 . year $ y
58
false
true
0
9
20
50
25
25
null
null
mihaimaruseac/petulant-octo-avenger
src-draw/Args.hs
mit
buildParserHelper :: String -> Parser a -> ParserInfo a buildParserHelper d = flip info (buildMod d) . (helper <*>)
115
buildParserHelper :: String -> Parser a -> ParserInfo a buildParserHelper d = flip info (buildMod d) . (helper <*>)
115
buildParserHelper d = flip info (buildMod d) . (helper <*>)
59
false
true
0
8
18
47
23
24
null
null
DougBurke/swish
src/Swish/RDF/Graph.hs
lgpl-2.1
-- | @rdfd:constraint@. resRdfdConstraint :: RDFLabel resRdfdConstraint = Res rdfdConstraint
100
resRdfdConstraint :: RDFLabel resRdfdConstraint = Res rdfdConstraint
76
resRdfdConstraint = Res rdfdConstraint
46
true
true
1
5
17
18
8
10
null
null
bitemyapp/ghc
compiler/hsSyn/HsPat.hs
bsd-3-clause
pprParendPat :: (OutputableBndr name) => Pat name -> SDoc pprParendPat p | hsPatNeedsParens p = parens (pprPat p) | otherwise = pprPat p
160
pprParendPat :: (OutputableBndr name) => Pat name -> SDoc pprParendPat p | hsPatNeedsParens p = parens (pprPat p) | otherwise = pprPat p
160
pprParendPat p | hsPatNeedsParens p = parens (pprPat p) | otherwise = pprPat p
102
false
true
1
8
46
63
28
35
null
null
esengie/fpl-exploration-tool
src/langGenerator/GeneratorTemplates/LangTemplate.hs
bsd-3-clause
rem4 (F (F (F (B )))) = Left "There is var at 4"
48
rem4 (F (F (F (B )))) = Left "There is var at 4"
48
rem4 (F (F (F (B )))) = Left "There is var at 4"
48
false
false
0
12
12
33
16
17
null
null
tjakway/ghcjvm
compiler/main/DynFlags.hs
bsd-3-clause
-- | Define a new flag for GHCi with an effect. flagGhciSpec' :: String -> flag -> (TurnOnFlag -> DynP ()) -> (Deprecation, FlagSpec flag) flagGhciSpec' name flag act = (NotDeprecated, FlagSpec name flag act OnlyGhci)
231
flagGhciSpec' :: String -> flag -> (TurnOnFlag -> DynP ()) -> (Deprecation, FlagSpec flag) flagGhciSpec' name flag act = (NotDeprecated, FlagSpec name flag act OnlyGhci)
183
flagGhciSpec' name flag act = (NotDeprecated, FlagSpec name flag act OnlyGhci)
78
true
true
0
12
49
73
36
37
null
null
chreekat/fast-tags
src/FastTags.hs
bsd-3-clause
isTypeName :: Text -> Bool isTypeName x = case headt x of Just c -> Char.isUpper c || c == ':' _ -> False
114
isTypeName :: Text -> Bool isTypeName x = case headt x of Just c -> Char.isUpper c || c == ':' _ -> False
114
isTypeName x = case headt x of Just c -> Char.isUpper c || c == ':' _ -> False
86
false
true
0
11
32
59
26
33
null
null
keera-studios/hsQt
Qtc/Gui/QLineEdit.hs
bsd-2-clause
cursorPosition :: QLineEdit a -> (()) -> IO (Int) cursorPosition x0 () = withIntResult $ withObjectPtr x0 $ \cobj_x0 -> qtc_QLineEdit_cursorPosition cobj_x0
166
cursorPosition :: QLineEdit a -> (()) -> IO (Int) cursorPosition x0 () = withIntResult $ withObjectPtr x0 $ \cobj_x0 -> qtc_QLineEdit_cursorPosition cobj_x0
166
cursorPosition x0 () = withIntResult $ withObjectPtr x0 $ \cobj_x0 -> qtc_QLineEdit_cursorPosition cobj_x0
116
false
true
0
8
31
59
29
30
null
null
ssaavedra/liquidhaskell
src/Language/Haskell/Liquid/Bare/RTEnv.hs
bsd-3-clause
fromAliasSymbol :: AliasTable t -> Symbol -> (ModName, RTAlias Symbol t) fromAliasSymbol table sym = fromMaybe err $ M.lookup sym table where err = panic Nothing $ "fromAliasSymbol: Dangling alias symbol: " ++ show sym
226
fromAliasSymbol :: AliasTable t -> Symbol -> (ModName, RTAlias Symbol t) fromAliasSymbol table sym = fromMaybe err $ M.lookup sym table where err = panic Nothing $ "fromAliasSymbol: Dangling alias symbol: " ++ show sym
226
fromAliasSymbol table sym = fromMaybe err $ M.lookup sym table where err = panic Nothing $ "fromAliasSymbol: Dangling alias symbol: " ++ show sym
153
false
true
0
8
42
74
35
39
null
null
eryx67/haskell-libtorrent
src/Network/Libtorrent/Rss.hs
bsd-3-clause
newFeedSettings :: MonadIO m => m FeedSettings newFeedSettings = liftIO $ fromPtr [CU.exp| feed_settings * { new feed_settings() } |]
136
newFeedSettings :: MonadIO m => m FeedSettings newFeedSettings = liftIO $ fromPtr [CU.exp| feed_settings * { new feed_settings() } |]
136
newFeedSettings = liftIO $ fromPtr [CU.exp| feed_settings * { new feed_settings() } |]
88
false
true
0
7
22
34
18
16
null
null
mpickering/HaRe
src/Language/Haskell/Refact/Utils/MonadFunctions.hs
bsd-3-clause
setRefactStreamModified :: RefacResult -> RefactGhc () setRefactStreamModified rr = do st <- get let (Just tm) = rsModule st put $ st { rsModule = Just (tm { rsStreamModified = rr })} return ()
201
setRefactStreamModified :: RefacResult -> RefactGhc () setRefactStreamModified rr = do st <- get let (Just tm) = rsModule st put $ st { rsModule = Just (tm { rsStreamModified = rr })} return ()
201
setRefactStreamModified rr = do st <- get let (Just tm) = rsModule st put $ st { rsModule = Just (tm { rsStreamModified = rr })} return ()
146
false
true
0
14
41
91
42
49
null
null
yliu120/K3
examples/analysis/FusionHarness.hs
apache-2.0
foldMapProg :: String foldMapProg = "\ \ declare c : collection {a:int} @Collection \ \ trigger t : () = \\_ -> ( \ \ let x = ((c.fold (\\acc -> \\r -> \ \ if true then (acc.insert {a:r.a+1}; acc) \ \ else acc) \ \ (empty {a:int} @Collection)) \ \ .map (\\r -> r.a+2)) \ \ in \ \ c.insert {a:5}; c.iterate (\\_ -> ()) \ \ ) \ \ "
734
foldMapProg :: String foldMapProg = "\ \ declare c : collection {a:int} @Collection \ \ trigger t : () = \\_ -> ( \ \ let x = ((c.fold (\\acc -> \\r -> \ \ if true then (acc.insert {a:r.a+1}; acc) \ \ else acc) \ \ (empty {a:int} @Collection)) \ \ .map (\\r -> r.a+2)) \ \ in \ \ c.insert {a:5}; c.iterate (\\_ -> ()) \ \ ) \ \ "
734
foldMapProg = "\ \ declare c : collection {a:int} @Collection \ \ trigger t : () = \\_ -> ( \ \ let x = ((c.fold (\\acc -> \\r -> \ \ if true then (acc.insert {a:r.a+1}; acc) \ \ else acc) \ \ (empty {a:int} @Collection)) \ \ .map (\\r -> r.a+2)) \ \ in \ \ c.insert {a:5}; c.iterate (\\_ -> ()) \ \ ) \ \ "
712
false
true
0
6
477
18
7
11
null
null
brendanhay/gogol
gogol-shopping-content/gen/Network/Google/Resource/Content/Orders/Updateshipment.hs
mpl-2.0
-- | Legacy upload protocol for media (e.g. \"media\", \"multipart\"). ouUploadType :: Lens' OrdersUpdateshipment (Maybe Text) ouUploadType = lens _ouUploadType (\ s a -> s{_ouUploadType = a})
194
ouUploadType :: Lens' OrdersUpdateshipment (Maybe Text) ouUploadType = lens _ouUploadType (\ s a -> s{_ouUploadType = a})
123
ouUploadType = lens _ouUploadType (\ s a -> s{_ouUploadType = a})
67
true
true
0
9
28
48
25
23
null
null
klangner/radium
src/Radium/Element.hs
bsd-2-clause
-- | Number of covalent bounds in element -- -- > let e = element 8 -- > covalentBounds e == 2 covalentBounds :: Element -> Int covalentBounds e = min n (8 - n) where n = valenceElectrons e -- The problem here is that (n-1) d is very close to n s
249
covalentBounds :: Element -> Int covalentBounds e = min n (8 - n) where n = valenceElectrons e -- The problem here is that (n-1) d is very close to n s
154
covalentBounds e = min n (8 - n) where n = valenceElectrons e -- The problem here is that (n-1) d is very close to n s
121
true
true
0
7
56
46
25
21
null
null
green-haskell/ghc
compiler/typecheck/TcSplice.hs
bsd-3-clause
tcUntypedBracket x _ _ = failTH x "Template Haskell bracket"
60
tcUntypedBracket x _ _ = failTH x "Template Haskell bracket"
60
tcUntypedBracket x _ _ = failTH x "Template Haskell bracket"
60
false
false
0
5
9
18
8
10
null
null
ulricha/algebra-sql
src/Database/Algebra/Table/Typing.hs
bsd-3-clause
tyNullOp :: MonadError String m => NullOp -> m (S.Set TypedAttr) tyNullOp op = case op of LitTable (_, schema) -> pure $ S.fromList schema TableRef (_, attrs, _) -> pure $ S.fromList attrs
210
tyNullOp :: MonadError String m => NullOp -> m (S.Set TypedAttr) tyNullOp op = case op of LitTable (_, schema) -> pure $ S.fromList schema TableRef (_, attrs, _) -> pure $ S.fromList attrs
210
tyNullOp op = case op of LitTable (_, schema) -> pure $ S.fromList schema TableRef (_, attrs, _) -> pure $ S.fromList attrs
145
false
true
0
10
55
93
46
47
null
null
nedervold/origami
src/Data/Origami/Internal/THUtils.hs
bsd-3-clause
-- | Splits a 'Type' into the list of type applications that comprise -- it. @appTs . unAppTs == id@ (although @unAppTs . appTs@ may not -- @== id@ if any of the arguments are applications themselves. unAppTs :: Type -> [Type] unAppTs = reverse . go where go (AppT t1 t2) = t2 : go t1 go t = [t] -- | Returns the 'nameBase' of the 'Name' with the first character -- upper-cased
391
unAppTs :: Type -> [Type] unAppTs = reverse . go where go (AppT t1 t2) = t2 : go t1 go t = [t] -- | Returns the 'nameBase' of the 'Name' with the first character -- upper-cased
189
unAppTs = reverse . go where go (AppT t1 t2) = t2 : go t1 go t = [t] -- | Returns the 'nameBase' of the 'Name' with the first character -- upper-cased
163
true
true
0
9
88
63
35
28
null
null
ghcjs/ghcjs-base
test/Tests/Properties.hs
mit
sf_foldl' p f z = (L.foldl' f z . L.filter p) `eqP` (S.foldl' f z . S.filter p) where _types = f :: Char -> Char -> Char
147
sf_foldl' p f z = (L.foldl' f z . L.filter p) `eqP` (S.foldl' f z . S.filter p) where _types = f :: Char -> Char -> Char
147
sf_foldl' p f z = (L.foldl' f z . L.filter p) `eqP` (S.foldl' f z . S.filter p) where _types = f :: Char -> Char -> Char
147
false
false
0
9
54
76
38
38
null
null
geophf/1HaskellADay
exercises/HAD/Y2020/M11/D17/Solution.hs
mit
{-- >>> readCapitals (capitalDir ++ capitalsJSON) >>> let caps = it --} -- How many country-infos thingies are there? {-- >>> Map.size caps 767 --} {-- 2. Now, load the airbase map and `capitalize` it. But we don't want to do that. What we want to do is filter out the `countries` that don't have airbases. Let's do that, instead. >>> A.loadBases (A.workingDir ++ A.file) >>> let bases = it >>> let mappedBases = A.byICAO bases --} countrySet :: Map Icao AirBase -> Set Country countrySet = Set.fromList . map A.country . Map.elems
544
countrySet :: Map Icao AirBase -> Set Country countrySet = Set.fromList . map A.country . Map.elems
99
countrySet = Set.fromList . map A.country . Map.elems
53
true
true
0
8
105
44
23
21
null
null
nevrenato/Hets_Fork
CommonLogic/AS_CommonLogic.der.hs
gpl-2.0
printTextMeta :: TEXT_META -> Doc printTextMeta tm = pretty $ getText tm
72
printTextMeta :: TEXT_META -> Doc printTextMeta tm = pretty $ getText tm
72
printTextMeta tm = pretty $ getText tm
38
false
true
0
7
11
30
13
17
null
null
dylex/hsaml2
SAML2/Core/Assertions.hs
apache-2.0
xpBaseID :: XP.PU id -> XP.PU (BaseID id) xpBaseID idp = [XP.biCase|((n, s), i) <-> BaseID n s i|] XP.>$< (XP.xpAttrImplied "NameQualifier" XS.xpString XP.>*< XP.xpAttrImplied "SPNameQualifier" XS.xpString XP.>*< idp)
230
xpBaseID :: XP.PU id -> XP.PU (BaseID id) xpBaseID idp = [XP.biCase|((n, s), i) <-> BaseID n s i|] XP.>$< (XP.xpAttrImplied "NameQualifier" XS.xpString XP.>*< XP.xpAttrImplied "SPNameQualifier" XS.xpString XP.>*< idp)
230
xpBaseID idp = [XP.biCase|((n, s), i) <-> BaseID n s i|] XP.>$< (XP.xpAttrImplied "NameQualifier" XS.xpString XP.>*< XP.xpAttrImplied "SPNameQualifier" XS.xpString XP.>*< idp)
188
false
true
2
10
41
80
40
40
null
null
GaloisInc/mistral
src/Mistral/TypeCheck/Patterns.hs
bsd-3-clause
match :: [(Expr,Type)] -> [([P.Pattern],Match Pattern)] -> Match Pattern -> TC (Match Pattern) match args arms err = case args of (s,sty):args' -- when matching a tuple literal against a tuple pattern, go ahead and -- unroll the pattern and the literal | EMkTuple es <- s , Just arms' <- mapM (unpackTuple (length es)) arms -> do let tupleArgs = [ (e,ty) | (ty,e) <- es ] match (tupleArgs ++ args') arms' err -- the variable rule: all leading patterns are variables, or wildcards, -- allowing the pattern match to be translated into a renaming. | Just arms' <- mapM varRule arms -> match args' (map (rename s sty) arms') err -- the constructor rule: all leading patterns are constructor patterns. -- group similar constructors together, preserving matching order | Just arms' <- mapM constructorRule arms -> do cons <- mapM (matchCon sty args' err) (groupCons arms') return (MCase s sty (foldr MSplit err cons)) -- all leading patterns are literals. group similar literals together, -- preserving matching order, generating sub-matches | Just arms' <- mapM litRule arms -> do ms <- mapM (matchLit args' err) (groupLits arms') return (MCase s sty (foldr MSplit err ms)) -- gather all tuple patterns together. as tuple patterns are irrefutable, -- this boils down to one case. | Just arms' <- mapM tupleRule arms -> do body <- matchTuple sty args' err arms' return (MCase s sty body) -- the mixture rule: the set of leading patterns are a combination of -- variable introductions, wildcards, and constructor patterns. | otherwise -> mixtureRule args arms err -- no arguments left, and all patterns are empty [] | (pats,ms) <- unzip arms , all null pats -> return (foldr1 MSplit ms) -- something went wrong _ -> tcPanic [ "pattern matching bug", show args, show arms ] where -- rename the expression being cased over in the body of the current arm. rename s sty (Just n, ps, m) = (ps, MRename n s sty m) rename _ _ (_, ps, m) = (ps, m) -- attempt to unpack a pattern as a tuple match, unrolling the match into -- left-to-right matches. unpackTuple arity (ps,m) = case ps of P.PTuple qs:rest -> return (qs ++ rest, m) P.PWildcard:rest -> return (replicate arity P.PWildcard ++ rest,m) _ -> Nothing -- check to see if the variable rule will apply to this branch varRule (ps,m) = case ps of P.PVar n : rest -> Just (Just n, rest, m) P.PWildcard : rest -> Just (Nothing,rest, m) _ -> Nothing -- the pattern begins with a constructor constructorRule (ps,m) = case ps of P.PCon n qs : rest -> Just ((n,qs), (rest, m)) _ -> Nothing -- the pattern is a literal litRule (ps,m) = case ps of P.PLit lit : rest -> Just (lit, (rest,m)) _ -> Nothing tupleRule (ps,m) = case ps of P.PTuple qs : rest -> Just (qs, (rest,m)) _ -> Nothing -- group similar constructors together, preserving the matching order. groupCons as = case as of -- group like-patterns together arm@((n,qs), _) : rest -> let (likes,others) = partition (isCon n) rest in (n, length qs, map extendPats (arm:likes)) : groupCons others [] -> [] where isCon n ((n',_),_) = n == n' extendPats ((_,qs),(ps,m)) = (qs ++ ps, m) -- group similar literals together, preserving the matching order groupLits as = case as of arm@(lit, _) : rest -> let (likes,others) = partition (sameLit lit) rest in (lit, map dropLit (arm:likes)) : groupLits others [] -> [] where sameLit l (l',_) = l == l' dropLit (_,arm) = arm -- | Turn a group of construtor patterns into a single match.
3,868
match :: [(Expr,Type)] -> [([P.Pattern],Match Pattern)] -> Match Pattern -> TC (Match Pattern) match args arms err = case args of (s,sty):args' -- when matching a tuple literal against a tuple pattern, go ahead and -- unroll the pattern and the literal | EMkTuple es <- s , Just arms' <- mapM (unpackTuple (length es)) arms -> do let tupleArgs = [ (e,ty) | (ty,e) <- es ] match (tupleArgs ++ args') arms' err -- the variable rule: all leading patterns are variables, or wildcards, -- allowing the pattern match to be translated into a renaming. | Just arms' <- mapM varRule arms -> match args' (map (rename s sty) arms') err -- the constructor rule: all leading patterns are constructor patterns. -- group similar constructors together, preserving matching order | Just arms' <- mapM constructorRule arms -> do cons <- mapM (matchCon sty args' err) (groupCons arms') return (MCase s sty (foldr MSplit err cons)) -- all leading patterns are literals. group similar literals together, -- preserving matching order, generating sub-matches | Just arms' <- mapM litRule arms -> do ms <- mapM (matchLit args' err) (groupLits arms') return (MCase s sty (foldr MSplit err ms)) -- gather all tuple patterns together. as tuple patterns are irrefutable, -- this boils down to one case. | Just arms' <- mapM tupleRule arms -> do body <- matchTuple sty args' err arms' return (MCase s sty body) -- the mixture rule: the set of leading patterns are a combination of -- variable introductions, wildcards, and constructor patterns. | otherwise -> mixtureRule args arms err -- no arguments left, and all patterns are empty [] | (pats,ms) <- unzip arms , all null pats -> return (foldr1 MSplit ms) -- something went wrong _ -> tcPanic [ "pattern matching bug", show args, show arms ] where -- rename the expression being cased over in the body of the current arm. rename s sty (Just n, ps, m) = (ps, MRename n s sty m) rename _ _ (_, ps, m) = (ps, m) -- attempt to unpack a pattern as a tuple match, unrolling the match into -- left-to-right matches. unpackTuple arity (ps,m) = case ps of P.PTuple qs:rest -> return (qs ++ rest, m) P.PWildcard:rest -> return (replicate arity P.PWildcard ++ rest,m) _ -> Nothing -- check to see if the variable rule will apply to this branch varRule (ps,m) = case ps of P.PVar n : rest -> Just (Just n, rest, m) P.PWildcard : rest -> Just (Nothing,rest, m) _ -> Nothing -- the pattern begins with a constructor constructorRule (ps,m) = case ps of P.PCon n qs : rest -> Just ((n,qs), (rest, m)) _ -> Nothing -- the pattern is a literal litRule (ps,m) = case ps of P.PLit lit : rest -> Just (lit, (rest,m)) _ -> Nothing tupleRule (ps,m) = case ps of P.PTuple qs : rest -> Just (qs, (rest,m)) _ -> Nothing -- group similar constructors together, preserving the matching order. groupCons as = case as of -- group like-patterns together arm@((n,qs), _) : rest -> let (likes,others) = partition (isCon n) rest in (n, length qs, map extendPats (arm:likes)) : groupCons others [] -> [] where isCon n ((n',_),_) = n == n' extendPats ((_,qs),(ps,m)) = (qs ++ ps, m) -- group similar literals together, preserving the matching order groupLits as = case as of arm@(lit, _) : rest -> let (likes,others) = partition (sameLit lit) rest in (lit, map dropLit (arm:likes)) : groupLits others [] -> [] where sameLit l (l',_) = l == l' dropLit (_,arm) = arm -- | Turn a group of construtor patterns into a single match.
3,868
match args arms err = case args of (s,sty):args' -- when matching a tuple literal against a tuple pattern, go ahead and -- unroll the pattern and the literal | EMkTuple es <- s , Just arms' <- mapM (unpackTuple (length es)) arms -> do let tupleArgs = [ (e,ty) | (ty,e) <- es ] match (tupleArgs ++ args') arms' err -- the variable rule: all leading patterns are variables, or wildcards, -- allowing the pattern match to be translated into a renaming. | Just arms' <- mapM varRule arms -> match args' (map (rename s sty) arms') err -- the constructor rule: all leading patterns are constructor patterns. -- group similar constructors together, preserving matching order | Just arms' <- mapM constructorRule arms -> do cons <- mapM (matchCon sty args' err) (groupCons arms') return (MCase s sty (foldr MSplit err cons)) -- all leading patterns are literals. group similar literals together, -- preserving matching order, generating sub-matches | Just arms' <- mapM litRule arms -> do ms <- mapM (matchLit args' err) (groupLits arms') return (MCase s sty (foldr MSplit err ms)) -- gather all tuple patterns together. as tuple patterns are irrefutable, -- this boils down to one case. | Just arms' <- mapM tupleRule arms -> do body <- matchTuple sty args' err arms' return (MCase s sty body) -- the mixture rule: the set of leading patterns are a combination of -- variable introductions, wildcards, and constructor patterns. | otherwise -> mixtureRule args arms err -- no arguments left, and all patterns are empty [] | (pats,ms) <- unzip arms , all null pats -> return (foldr1 MSplit ms) -- something went wrong _ -> tcPanic [ "pattern matching bug", show args, show arms ] where -- rename the expression being cased over in the body of the current arm. rename s sty (Just n, ps, m) = (ps, MRename n s sty m) rename _ _ (_, ps, m) = (ps, m) -- attempt to unpack a pattern as a tuple match, unrolling the match into -- left-to-right matches. unpackTuple arity (ps,m) = case ps of P.PTuple qs:rest -> return (qs ++ rest, m) P.PWildcard:rest -> return (replicate arity P.PWildcard ++ rest,m) _ -> Nothing -- check to see if the variable rule will apply to this branch varRule (ps,m) = case ps of P.PVar n : rest -> Just (Just n, rest, m) P.PWildcard : rest -> Just (Nothing,rest, m) _ -> Nothing -- the pattern begins with a constructor constructorRule (ps,m) = case ps of P.PCon n qs : rest -> Just ((n,qs), (rest, m)) _ -> Nothing -- the pattern is a literal litRule (ps,m) = case ps of P.PLit lit : rest -> Just (lit, (rest,m)) _ -> Nothing tupleRule (ps,m) = case ps of P.PTuple qs : rest -> Just (qs, (rest,m)) _ -> Nothing -- group similar constructors together, preserving the matching order. groupCons as = case as of -- group like-patterns together arm@((n,qs), _) : rest -> let (likes,others) = partition (isCon n) rest in (n, length qs, map extendPats (arm:likes)) : groupCons others [] -> [] where isCon n ((n',_),_) = n == n' extendPats ((_,qs),(ps,m)) = (qs ++ ps, m) -- group similar literals together, preserving the matching order groupLits as = case as of arm@(lit, _) : rest -> let (likes,others) = partition (sameLit lit) rest in (lit, map dropLit (arm:likes)) : groupLits others [] -> [] where sameLit l (l',_) = l == l' dropLit (_,arm) = arm -- | Turn a group of construtor patterns into a single match.
3,767
false
true
15
14
1,063
1,223
643
580
null
null
rrnewton/accelerate
Data/Array/Accelerate/Trafo/Algebra.hs
bsd-3-clause
evalMaxBound (NonNumBoundedType ty) | NonNumDict <- nonNumDict ty = maxBound
82
evalMaxBound (NonNumBoundedType ty) | NonNumDict <- nonNumDict ty = maxBound
82
evalMaxBound (NonNumBoundedType ty) | NonNumDict <- nonNumDict ty = maxBound
82
false
false
0
9
15
29
12
17
null
null
batterseapower/supercompilation-by-evaluation
Core/Parser.hs
bsd-3-clause
specialConDataCon LHE.ListCon = nilDataCon
42
specialConDataCon LHE.ListCon = nilDataCon
42
specialConDataCon LHE.ListCon = nilDataCon
42
false
false
0
6
3
11
5
6
null
null
rueshyna/gogol
gogol-youtube/gen/Network/Google/YouTube/Types/Product.hs
mpl-2.0
-- | The number of audio channels that the stream contains. vfdasChannelCount :: Lens' VideoFileDetailsAudioStream (Maybe Word32) vfdasChannelCount = lens _vfdasChannelCount (\ s a -> s{_vfdasChannelCount = a}) . mapping _Coerce
242
vfdasChannelCount :: Lens' VideoFileDetailsAudioStream (Maybe Word32) vfdasChannelCount = lens _vfdasChannelCount (\ s a -> s{_vfdasChannelCount = a}) . mapping _Coerce
182
vfdasChannelCount = lens _vfdasChannelCount (\ s a -> s{_vfdasChannelCount = a}) . mapping _Coerce
112
true
true
0
10
44
55
28
27
null
null
sol/pandoc
src/Text/Pandoc/Readers/LaTeX.hs
gpl-2.0
emptyGroup :: GenParser Char st Inline emptyGroup = try $ do char '{' spaces char '}' return $ Str "" -- nonescaped special characters
143
emptyGroup :: GenParser Char st Inline emptyGroup = try $ do char '{' spaces char '}' return $ Str "" -- nonescaped special characters
143
emptyGroup = try $ do char '{' spaces char '}' return $ Str "" -- nonescaped special characters
104
false
true
0
9
32
48
21
27
null
null
christiaanb/ghc
compiler/deSugar/Check.hs
bsd-3-clause
compare_cons _ _ = panic "Check.compare_cons: Not ConPatOut with RealDataCon"
77
compare_cons _ _ = panic "Check.compare_cons: Not ConPatOut with RealDataCon"
77
compare_cons _ _ = panic "Check.compare_cons: Not ConPatOut with RealDataCon"
77
false
false
0
5
9
14
6
8
null
null
Copilot-Language/sbv-for-copilot
Data/SBV/Examples/CodeGeneration/GCD.hs
bsd-3-clause
sgcdIsCorrect :: SWord8 -> SWord8 -> SWord8 -> SBool sgcdIsCorrect x y k = ite (y .== 0) -- if y is 0 (k' .== x) -- then k' must be x, nothing else to prove by definition (isCommonDivisor k' &&& -- otherwise, k' is a common divisor and (isCommonDivisor k ==> k' .>= k)) -- if k is a common divisor as well, then k' is at least as large as k where k' = sgcd x y isCommonDivisor a = z1 .== 0 &&& z2 .== 0 where (_, z1) = x `sQuotRem` a (_, z2) = y `sQuotRem` a ----------------------------------------------------------------------------- -- * Code generation ----------------------------------------------------------------------------- {- $VerificationIntro Now that we have proof our 'sgcd' implementation is correct, we can go ahead and generate C code for it. -} -- | This call will generate the required C files. The following is the function -- body generated for 'sgcd'. (We are not showing the generated header, @Makefile@, -- and the driver programs for brevity.) Note that the generated function is -- a constant time algorithm for GCD. It is not necessarily fastest, but it will take -- precisely the same amount of time for all values of @x@ and @y@. -- -- > /* File: "sgcd.c". Automatically generated by SBV. Do not edit! */ -- > -- > #include <inttypes.h> -- > #include <stdint.h> -- > #include <stdbool.h> -- > #include "sgcd.h" -- > -- > SWord8 sgcd(const SWord8 x, const SWord8 y) -- > { -- > const SWord8 s0 = x; -- > const SWord8 s1 = y; -- > const SBool s3 = s1 == 0; -- > const SWord8 s4 = (s1 == 0) ? s0 : (s0 % s1); -- > const SWord8 s5 = s3 ? s0 : s4; -- > const SBool s6 = 0 == s5; -- > const SWord8 s7 = (s5 == 0) ? s1 : (s1 % s5); -- > const SWord8 s8 = s6 ? s1 : s7; -- > const SBool s9 = 0 == s8; -- > const SWord8 s10 = (s8 == 0) ? s5 : (s5 % s8); -- > const SWord8 s11 = s9 ? s5 : s10; -- > const SBool s12 = 0 == s11; -- > const SWord8 s13 = (s11 == 0) ? s8 : (s8 % s11); -- > const SWord8 s14 = s12 ? s8 : s13; -- > const SBool s15 = 0 == s14; -- > const SWord8 s16 = (s14 == 0) ? s11 : (s11 % s14); -- > const SWord8 s17 = s15 ? s11 : s16; -- > const SBool s18 = 0 == s17; -- > const SWord8 s19 = (s17 == 0) ? s14 : (s14 % s17); -- > const SWord8 s20 = s18 ? s14 : s19; -- > const SBool s21 = 0 == s20; -- > const SWord8 s22 = (s20 == 0) ? s17 : (s17 % s20); -- > const SWord8 s23 = s21 ? s17 : s22; -- > const SBool s24 = 0 == s23; -- > const SWord8 s25 = (s23 == 0) ? s20 : (s20 % s23); -- > const SWord8 s26 = s24 ? s20 : s25; -- > const SBool s27 = 0 == s26; -- > const SWord8 s28 = (s26 == 0) ? s23 : (s23 % s26); -- > const SWord8 s29 = s27 ? s23 : s28; -- > const SBool s30 = 0 == s29; -- > const SWord8 s31 = (s29 == 0) ? s26 : (s26 % s29); -- > const SWord8 s32 = s30 ? s26 : s31; -- > const SBool s33 = 0 == s32; -- > const SWord8 s34 = (s32 == 0) ? s29 : (s29 % s32); -- > const SWord8 s35 = s33 ? s29 : s34; -- > const SBool s36 = 0 == s35; -- > const SWord8 s37 = s36 ? s32 : s35; -- > const SWord8 s38 = s33 ? s29 : s37; -- > const SWord8 s39 = s30 ? s26 : s38; -- > const SWord8 s40 = s27 ? s23 : s39; -- > const SWord8 s41 = s24 ? s20 : s40; -- > const SWord8 s42 = s21 ? s17 : s41; -- > const SWord8 s43 = s18 ? s14 : s42; -- > const SWord8 s44 = s15 ? s11 : s43; -- > const SWord8 s45 = s12 ? s8 : s44; -- > const SWord8 s46 = s9 ? s5 : s45; -- > const SWord8 s47 = s6 ? s1 : s46; -- > const SWord8 s48 = s3 ? s0 : s47; -- > -- > return s48; -- > }
3,690
sgcdIsCorrect :: SWord8 -> SWord8 -> SWord8 -> SBool sgcdIsCorrect x y k = ite (y .== 0) -- if y is 0 (k' .== x) -- then k' must be x, nothing else to prove by definition (isCommonDivisor k' &&& -- otherwise, k' is a common divisor and (isCommonDivisor k ==> k' .>= k)) -- if k is a common divisor as well, then k' is at least as large as k where k' = sgcd x y isCommonDivisor a = z1 .== 0 &&& z2 .== 0 where (_, z1) = x `sQuotRem` a (_, z2) = y `sQuotRem` a ----------------------------------------------------------------------------- -- * Code generation ----------------------------------------------------------------------------- {- $VerificationIntro Now that we have proof our 'sgcd' implementation is correct, we can go ahead and generate C code for it. -} -- | This call will generate the required C files. The following is the function -- body generated for 'sgcd'. (We are not showing the generated header, @Makefile@, -- and the driver programs for brevity.) Note that the generated function is -- a constant time algorithm for GCD. It is not necessarily fastest, but it will take -- precisely the same amount of time for all values of @x@ and @y@. -- -- > /* File: "sgcd.c". Automatically generated by SBV. Do not edit! */ -- > -- > #include <inttypes.h> -- > #include <stdint.h> -- > #include <stdbool.h> -- > #include "sgcd.h" -- > -- > SWord8 sgcd(const SWord8 x, const SWord8 y) -- > { -- > const SWord8 s0 = x; -- > const SWord8 s1 = y; -- > const SBool s3 = s1 == 0; -- > const SWord8 s4 = (s1 == 0) ? s0 : (s0 % s1); -- > const SWord8 s5 = s3 ? s0 : s4; -- > const SBool s6 = 0 == s5; -- > const SWord8 s7 = (s5 == 0) ? s1 : (s1 % s5); -- > const SWord8 s8 = s6 ? s1 : s7; -- > const SBool s9 = 0 == s8; -- > const SWord8 s10 = (s8 == 0) ? s5 : (s5 % s8); -- > const SWord8 s11 = s9 ? s5 : s10; -- > const SBool s12 = 0 == s11; -- > const SWord8 s13 = (s11 == 0) ? s8 : (s8 % s11); -- > const SWord8 s14 = s12 ? s8 : s13; -- > const SBool s15 = 0 == s14; -- > const SWord8 s16 = (s14 == 0) ? s11 : (s11 % s14); -- > const SWord8 s17 = s15 ? s11 : s16; -- > const SBool s18 = 0 == s17; -- > const SWord8 s19 = (s17 == 0) ? s14 : (s14 % s17); -- > const SWord8 s20 = s18 ? s14 : s19; -- > const SBool s21 = 0 == s20; -- > const SWord8 s22 = (s20 == 0) ? s17 : (s17 % s20); -- > const SWord8 s23 = s21 ? s17 : s22; -- > const SBool s24 = 0 == s23; -- > const SWord8 s25 = (s23 == 0) ? s20 : (s20 % s23); -- > const SWord8 s26 = s24 ? s20 : s25; -- > const SBool s27 = 0 == s26; -- > const SWord8 s28 = (s26 == 0) ? s23 : (s23 % s26); -- > const SWord8 s29 = s27 ? s23 : s28; -- > const SBool s30 = 0 == s29; -- > const SWord8 s31 = (s29 == 0) ? s26 : (s26 % s29); -- > const SWord8 s32 = s30 ? s26 : s31; -- > const SBool s33 = 0 == s32; -- > const SWord8 s34 = (s32 == 0) ? s29 : (s29 % s32); -- > const SWord8 s35 = s33 ? s29 : s34; -- > const SBool s36 = 0 == s35; -- > const SWord8 s37 = s36 ? s32 : s35; -- > const SWord8 s38 = s33 ? s29 : s37; -- > const SWord8 s39 = s30 ? s26 : s38; -- > const SWord8 s40 = s27 ? s23 : s39; -- > const SWord8 s41 = s24 ? s20 : s40; -- > const SWord8 s42 = s21 ? s17 : s41; -- > const SWord8 s43 = s18 ? s14 : s42; -- > const SWord8 s44 = s15 ? s11 : s43; -- > const SWord8 s45 = s12 ? s8 : s44; -- > const SWord8 s46 = s9 ? s5 : s45; -- > const SWord8 s47 = s6 ? s1 : s46; -- > const SWord8 s48 = s3 ? s0 : s47; -- > -- > return s48; -- > }
3,690
sgcdIsCorrect x y k = ite (y .== 0) -- if y is 0 (k' .== x) -- then k' must be x, nothing else to prove by definition (isCommonDivisor k' &&& -- otherwise, k' is a common divisor and (isCommonDivisor k ==> k' .>= k)) -- if k is a common divisor as well, then k' is at least as large as k where k' = sgcd x y isCommonDivisor a = z1 .== 0 &&& z2 .== 0 where (_, z1) = x `sQuotRem` a (_, z2) = y `sQuotRem` a ----------------------------------------------------------------------------- -- * Code generation ----------------------------------------------------------------------------- {- $VerificationIntro Now that we have proof our 'sgcd' implementation is correct, we can go ahead and generate C code for it. -} -- | This call will generate the required C files. The following is the function -- body generated for 'sgcd'. (We are not showing the generated header, @Makefile@, -- and the driver programs for brevity.) Note that the generated function is -- a constant time algorithm for GCD. It is not necessarily fastest, but it will take -- precisely the same amount of time for all values of @x@ and @y@. -- -- > /* File: "sgcd.c". Automatically generated by SBV. Do not edit! */ -- > -- > #include <inttypes.h> -- > #include <stdint.h> -- > #include <stdbool.h> -- > #include "sgcd.h" -- > -- > SWord8 sgcd(const SWord8 x, const SWord8 y) -- > { -- > const SWord8 s0 = x; -- > const SWord8 s1 = y; -- > const SBool s3 = s1 == 0; -- > const SWord8 s4 = (s1 == 0) ? s0 : (s0 % s1); -- > const SWord8 s5 = s3 ? s0 : s4; -- > const SBool s6 = 0 == s5; -- > const SWord8 s7 = (s5 == 0) ? s1 : (s1 % s5); -- > const SWord8 s8 = s6 ? s1 : s7; -- > const SBool s9 = 0 == s8; -- > const SWord8 s10 = (s8 == 0) ? s5 : (s5 % s8); -- > const SWord8 s11 = s9 ? s5 : s10; -- > const SBool s12 = 0 == s11; -- > const SWord8 s13 = (s11 == 0) ? s8 : (s8 % s11); -- > const SWord8 s14 = s12 ? s8 : s13; -- > const SBool s15 = 0 == s14; -- > const SWord8 s16 = (s14 == 0) ? s11 : (s11 % s14); -- > const SWord8 s17 = s15 ? s11 : s16; -- > const SBool s18 = 0 == s17; -- > const SWord8 s19 = (s17 == 0) ? s14 : (s14 % s17); -- > const SWord8 s20 = s18 ? s14 : s19; -- > const SBool s21 = 0 == s20; -- > const SWord8 s22 = (s20 == 0) ? s17 : (s17 % s20); -- > const SWord8 s23 = s21 ? s17 : s22; -- > const SBool s24 = 0 == s23; -- > const SWord8 s25 = (s23 == 0) ? s20 : (s20 % s23); -- > const SWord8 s26 = s24 ? s20 : s25; -- > const SBool s27 = 0 == s26; -- > const SWord8 s28 = (s26 == 0) ? s23 : (s23 % s26); -- > const SWord8 s29 = s27 ? s23 : s28; -- > const SBool s30 = 0 == s29; -- > const SWord8 s31 = (s29 == 0) ? s26 : (s26 % s29); -- > const SWord8 s32 = s30 ? s26 : s31; -- > const SBool s33 = 0 == s32; -- > const SWord8 s34 = (s32 == 0) ? s29 : (s29 % s32); -- > const SWord8 s35 = s33 ? s29 : s34; -- > const SBool s36 = 0 == s35; -- > const SWord8 s37 = s36 ? s32 : s35; -- > const SWord8 s38 = s33 ? s29 : s37; -- > const SWord8 s39 = s30 ? s26 : s38; -- > const SWord8 s40 = s27 ? s23 : s39; -- > const SWord8 s41 = s24 ? s20 : s40; -- > const SWord8 s42 = s21 ? s17 : s41; -- > const SWord8 s43 = s18 ? s14 : s42; -- > const SWord8 s44 = s15 ? s11 : s43; -- > const SWord8 s45 = s12 ? s8 : s44; -- > const SWord8 s46 = s9 ? s5 : s45; -- > const SWord8 s47 = s6 ? s1 : s46; -- > const SWord8 s48 = s3 ? s0 : s47; -- > -- > return s48; -- > }
3,637
false
true
1
11
1,087
221
151
70
null
null
tpajenka/shift
src/Main.hs
bsd-3-clause
initSettings :: Scenario sc => [ScenarioState sc] -> GameSettings sc initSettings s = let uic = UserInputControl { keysLeft = map (keyFromName . stringToGlib) ["Left", "a", "A"] , keysRight = map (keyFromName . stringToGlib) ["Right", "d", "D"] , keysUp = map (keyFromName . stringToGlib) ["Up", "w", "W"] , keysDown = map (keyFromName . stringToGlib) ["Down", "s", "S"] , keysQuit = map (keyFromName . stringToGlib) ["Escape"] , keysUndo = map (keyFromName . stringToGlib) ["minus", "KP_Subtract"] , keysRedo = map (keyFromName . stringToGlib) ["plus", "KP_Add"] , keysReset = map (keyFromName . stringToGlib) ["r", "R"] , keysNext = map (keyFromName . stringToGlib) ["n", "N"] , keysPrev = map (keyFromName . stringToGlib) ["p", "P"] , keysLoad = map (keyFromName . stringToGlib) ["o", "O"] , movementMode = MovementEnabled } sc = ScenarioSettings { scenarioPool = s , currentScenario = 0 } in GameSettings sc uic NoChangeStalled
1,332
initSettings :: Scenario sc => [ScenarioState sc] -> GameSettings sc initSettings s = let uic = UserInputControl { keysLeft = map (keyFromName . stringToGlib) ["Left", "a", "A"] , keysRight = map (keyFromName . stringToGlib) ["Right", "d", "D"] , keysUp = map (keyFromName . stringToGlib) ["Up", "w", "W"] , keysDown = map (keyFromName . stringToGlib) ["Down", "s", "S"] , keysQuit = map (keyFromName . stringToGlib) ["Escape"] , keysUndo = map (keyFromName . stringToGlib) ["minus", "KP_Subtract"] , keysRedo = map (keyFromName . stringToGlib) ["plus", "KP_Add"] , keysReset = map (keyFromName . stringToGlib) ["r", "R"] , keysNext = map (keyFromName . stringToGlib) ["n", "N"] , keysPrev = map (keyFromName . stringToGlib) ["p", "P"] , keysLoad = map (keyFromName . stringToGlib) ["o", "O"] , movementMode = MovementEnabled } sc = ScenarioSettings { scenarioPool = s , currentScenario = 0 } in GameSettings sc uic NoChangeStalled
1,332
initSettings s = let uic = UserInputControl { keysLeft = map (keyFromName . stringToGlib) ["Left", "a", "A"] , keysRight = map (keyFromName . stringToGlib) ["Right", "d", "D"] , keysUp = map (keyFromName . stringToGlib) ["Up", "w", "W"] , keysDown = map (keyFromName . stringToGlib) ["Down", "s", "S"] , keysQuit = map (keyFromName . stringToGlib) ["Escape"] , keysUndo = map (keyFromName . stringToGlib) ["minus", "KP_Subtract"] , keysRedo = map (keyFromName . stringToGlib) ["plus", "KP_Add"] , keysReset = map (keyFromName . stringToGlib) ["r", "R"] , keysNext = map (keyFromName . stringToGlib) ["n", "N"] , keysPrev = map (keyFromName . stringToGlib) ["p", "P"] , keysLoad = map (keyFromName . stringToGlib) ["o", "O"] , movementMode = MovementEnabled } sc = ScenarioSettings { scenarioPool = s , currentScenario = 0 } in GameSettings sc uic NoChangeStalled
1,263
false
true
0
13
541
352
201
151
null
null
mainland/dph
dph-lifted-vseg/Data/Array/Parallel/PArray/Scalar.hs
bsd-3-clause
from :: Scalar a => PData a -> U.Array a from = fromScalarPData
69
from :: Scalar a => PData a -> U.Array a from = fromScalarPData
69
from = fromScalarPData
25
false
true
0
8
18
30
14
16
null
null
LambdaHack/LambdaHack
engine-src/Game/LambdaHack/Client/UI/HumanCmd.hs
bsd-3-clause
categoryDescription :: CmdCategory -> Text categoryDescription CmdDashboard = "Dashboard"
89
categoryDescription :: CmdCategory -> Text categoryDescription CmdDashboard = "Dashboard"
89
categoryDescription CmdDashboard = "Dashboard"
46
false
true
0
5
8
18
9
9
null
null
devyn/haPaws
Language/HaPaws/CPaws.hs
bsd-3-clause
lexIdentifier :: Text -> SourcePosition -> [(Token, SourcePosition)] lexIdentifier text origin = buildIdentifier "" text origin where buildIdentifier i text (line, column) = case Text.uncons text of Just (ch, rest) -- Terminate on whitespace or special chars. "origin" is where -- this identifier started. | isSpace ch || ch `elem` "(){}\"“”" -> (Symbol i, origin) : lexExpression text (line, column) -- Add anything else to the identifier. | otherwise -> buildIdentifier (i `Text.snoc` ch) rest (line, column + 1) -- Terminate on everything else (end of input) _ -> (Symbol i, origin) : lexExpression text (line, column)
845
lexIdentifier :: Text -> SourcePosition -> [(Token, SourcePosition)] lexIdentifier text origin = buildIdentifier "" text origin where buildIdentifier i text (line, column) = case Text.uncons text of Just (ch, rest) -- Terminate on whitespace or special chars. "origin" is where -- this identifier started. | isSpace ch || ch `elem` "(){}\"“”" -> (Symbol i, origin) : lexExpression text (line, column) -- Add anything else to the identifier. | otherwise -> buildIdentifier (i `Text.snoc` ch) rest (line, column + 1) -- Terminate on everything else (end of input) _ -> (Symbol i, origin) : lexExpression text (line, column)
845
lexIdentifier text origin = buildIdentifier "" text origin where buildIdentifier i text (line, column) = case Text.uncons text of Just (ch, rest) -- Terminate on whitespace or special chars. "origin" is where -- this identifier started. | isSpace ch || ch `elem` "(){}\"“”" -> (Symbol i, origin) : lexExpression text (line, column) -- Add anything else to the identifier. | otherwise -> buildIdentifier (i `Text.snoc` ch) rest (line, column + 1) -- Terminate on everything else (end of input) _ -> (Symbol i, origin) : lexExpression text (line, column)
776
false
true
0
13
320
203
107
96
null
null
google/ghc-source-gen
src/GHC/SourceGen/Name/Internal.hs
bsd-3-clause
exportOccName :: OccNameStr -> OccName exportOccName (OccNameStr Value s) = mkVarOccFS s
88
exportOccName :: OccNameStr -> OccName exportOccName (OccNameStr Value s) = mkVarOccFS s
88
exportOccName (OccNameStr Value s) = mkVarOccFS s
49
false
true
0
7
11
29
14
15
null
null
snoyberg/ghc
compiler/utils/Binary.hs
bsd-3-clause
lazyGet :: Binary a => BinHandle -> IO a lazyGet bh = do p <- get bh -- a BinPtr p_a <- tellBin bh a <- unsafeInterleaveIO $ do -- NB: Use a fresh off_r variable in the child thread, for thread -- safety. off_r <- newFastMutInt getAt bh { _off_r = off_r } p_a seekBin bh p -- skip over the object for now return a -- ----------------------------------------------------------------------------- -- UserData -- -----------------------------------------------------------------------------
540
lazyGet :: Binary a => BinHandle -> IO a lazyGet bh = do p <- get bh -- a BinPtr p_a <- tellBin bh a <- unsafeInterleaveIO $ do -- NB: Use a fresh off_r variable in the child thread, for thread -- safety. off_r <- newFastMutInt getAt bh { _off_r = off_r } p_a seekBin bh p -- skip over the object for now return a -- ----------------------------------------------------------------------------- -- UserData -- -----------------------------------------------------------------------------
540
lazyGet bh = do p <- get bh -- a BinPtr p_a <- tellBin bh a <- unsafeInterleaveIO $ do -- NB: Use a fresh off_r variable in the child thread, for thread -- safety. off_r <- newFastMutInt getAt bh { _off_r = off_r } p_a seekBin bh p -- skip over the object for now return a -- ----------------------------------------------------------------------------- -- UserData -- -----------------------------------------------------------------------------
499
false
true
0
14
125
108
50
58
null
null
Xingtao/RLHask
src/Chapter5MC.hs
bsd-3-clause
getSensableActs :: Racetrack -> (Int, Int) -> [RTAct] getSensableActs racetrack (hor, ver) = let maxV = _maxVelocity racetrack in filter (\(aHor, aVer) -> (aHor + hor <= maxV) && (aVer + ver <= maxV) && (aHor + hor >= negate maxV) && (aVer + ver >= negate maxV) ) (_acts racetrack)
330
getSensableActs :: Racetrack -> (Int, Int) -> [RTAct] getSensableActs racetrack (hor, ver) = let maxV = _maxVelocity racetrack in filter (\(aHor, aVer) -> (aHor + hor <= maxV) && (aVer + ver <= maxV) && (aHor + hor >= negate maxV) && (aVer + ver >= negate maxV) ) (_acts racetrack)
330
getSensableActs racetrack (hor, ver) = let maxV = _maxVelocity racetrack in filter (\(aHor, aVer) -> (aHor + hor <= maxV) && (aVer + ver <= maxV) && (aHor + hor >= negate maxV) && (aVer + ver >= negate maxV) ) (_acts racetrack)
276
false
true
0
15
99
140
74
66
null
null
MajronMan/Himage
src/Filters/General.hs
bsd-3-clause
-- | -- Applies given filter to given image (in Array D type) applyFilter :: Filter -> Array D DIM2 RGBA8 -> Array D DIM2 RGBA8 applyFilter f matrix = zip4 rArray' gArray' bArray' alphaArray where [rArray', gArray', bArray'] = Prelude.map ( fromDouble . normalize (sumStencilToNormalize f) . delay . (mapStencil2 (BoundConst 0) f) . toDouble) [rArray, gArray, bArray] (rArray, gArray, bArray, alphaArray) = unzip4 matrix -- | -- Applies given filter to given image (in Array D type) nth times
597
applyFilter :: Filter -> Array D DIM2 RGBA8 -> Array D DIM2 RGBA8 applyFilter f matrix = zip4 rArray' gArray' bArray' alphaArray where [rArray', gArray', bArray'] = Prelude.map ( fromDouble . normalize (sumStencilToNormalize f) . delay . (mapStencil2 (BoundConst 0) f) . toDouble) [rArray, gArray, bArray] (rArray, gArray, bArray, alphaArray) = unzip4 matrix -- | -- Applies given filter to given image (in Array D type) nth times
532
applyFilter f matrix = zip4 rArray' gArray' bArray' alphaArray where [rArray', gArray', bArray'] = Prelude.map ( fromDouble . normalize (sumStencilToNormalize f) . delay . (mapStencil2 (BoundConst 0) f) . toDouble) [rArray, gArray, bArray] (rArray, gArray, bArray, alphaArray) = unzip4 matrix -- | -- Applies given filter to given image (in Array D type) nth times
465
true
true
1
13
185
146
78
68
null
null
thoughtpolice/binary-serialise-cbor
Data/Binary/Serialise/CBOR/Encoding.hs
bsd-3-clause
encodeBreak :: Encoding encodeBreak = Encoding TkBreak
54
encodeBreak :: Encoding encodeBreak = Encoding TkBreak
54
encodeBreak = Encoding TkBreak
30
false
true
0
5
6
14
7
7
null
null
mariefarrell/Hets
Comorphisms/HasCASL2THFP_P.hs
gpl-2.0
insLast :: THFCons.Type -> THFCons.Type -> THFCons.Type insLast it t = case t of MapType t1 t2 -> MapType t1 (insLast it t2) t1 -> MapType t1 it
152
insLast :: THFCons.Type -> THFCons.Type -> THFCons.Type insLast it t = case t of MapType t1 t2 -> MapType t1 (insLast it t2) t1 -> MapType t1 it
152
insLast it t = case t of MapType t1 t2 -> MapType t1 (insLast it t2) t1 -> MapType t1 it
96
false
true
0
10
35
69
33
36
null
null
brendanhay/gogol
gogol-spanner/gen/Network/Google/Spanner/Types/Product.hs
mpl-2.0
-- | The total number of mutations for the transaction. Knowing the -- \`mutation_count\` value can help you maximize the number of mutations -- in a transaction and minimize the number of API round trips. You can -- also monitor this value to prevent transactions from exceeding the -- system -- [limit](https:\/\/cloud.google.com\/spanner\/quotas#limits_for_creating_reading_updating_and_deleting_data). -- If the number of mutations exceeds the limit, the server returns -- [INVALID_ARGUMENT](https:\/\/cloud.google.com\/spanner\/docs\/reference\/rest\/v1\/Code#ENUM_VALUES.INVALID_ARGUMENT). csMutationCount :: Lens' CommitStats (Maybe Int64) csMutationCount = lens _csMutationCount (\ s a -> s{_csMutationCount = a}) . mapping _Coerce
753
csMutationCount :: Lens' CommitStats (Maybe Int64) csMutationCount = lens _csMutationCount (\ s a -> s{_csMutationCount = a}) . mapping _Coerce
157
csMutationCount = lens _csMutationCount (\ s a -> s{_csMutationCount = a}) . mapping _Coerce
106
true
true
2
8
99
66
35
31
null
null
helino/wham
src/Wham/SignBoolExc.hs
bsd-3-clause
ErrorT `and` NoneT = NoneT
26
ErrorT `and` NoneT = NoneT
26
ErrorT `and` NoneT = NoneT
26
false
false
0
5
4
14
7
7
null
null