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
ivan-m/testbench
src/TestBench/Evaluate.hs
mit
percent :: Double -> String percent p = printf "%.3f%%" (p * 100)
65
percent :: Double -> String percent p = printf "%.3f%%" (p * 100)
65
percent p = printf "%.3f%%" (p * 100)
37
false
true
0
7
12
30
15
15
null
null
ghc-android/ghc
testsuite/tests/ghci/should_run/ghcirun004.hs
bsd-3-clause
538 = 537
9
538 = 537
9
538 = 537
9
false
false
1
5
2
10
3
7
null
null
JoseD92/EasyGL
src/EasyGL/Shader.hs
bsd-3-clause
linkShaders :: Maybe Handle -> [GL.Shader] -> IO Shader linkShaders mhandle shaders = do active <- empty mapM_ (GL.attachShader (program active)) shaders bindEasyGLShaderAttrib (program active) GL.linkProgram (program active) mapM_ (mensajes mhandle . GL.shaderInfoLog) shaders mapM_ GL.deleteObjectName shaders -- flags shaders for deletion mensajes mhandle $ GL.programInfoLog (program active) return active {-| Frees the memory and invalidates the name associated with the shader -}
517
linkShaders :: Maybe Handle -> [GL.Shader] -> IO Shader linkShaders mhandle shaders = do active <- empty mapM_ (GL.attachShader (program active)) shaders bindEasyGLShaderAttrib (program active) GL.linkProgram (program active) mapM_ (mensajes mhandle . GL.shaderInfoLog) shaders mapM_ GL.deleteObjectName shaders -- flags shaders for deletion mensajes mhandle $ GL.programInfoLog (program active) return active {-| Frees the memory and invalidates the name associated with the shader -}
516
linkShaders mhandle shaders = do active <- empty mapM_ (GL.attachShader (program active)) shaders bindEasyGLShaderAttrib (program active) GL.linkProgram (program active) mapM_ (mensajes mhandle . GL.shaderInfoLog) shaders mapM_ GL.deleteObjectName shaders -- flags shaders for deletion mensajes mhandle $ GL.programInfoLog (program active) return active {-| Frees the memory and invalidates the name associated with the shader -}
460
false
true
0
11
94
149
67
82
null
null
ChristianSi/lytspel
src/dictbuilder.hs
isc
addRedirects :: CI2ExtendedMap -> [Text] -> CI2ExtendedMap addRedirects m texts | not $ null listedWords || null unlistedWords = foldl' insertRedirects m unlistedWords | otherwise = m where (listedWords, unlistedWords) = partition inDict texts inDict = flip Map.member m . CI.mk insertRedirects :: CI2ExtendedMap -> Text -> CI2ExtendedMap insertRedirects m' text = Map.insert (CI.mk text) (Right . Redirect . head $ listedWords) m' -- |Write the phonetic dictionary into a line file. -- If there is just a single pronunciations, the entry is written as -- 'word: pron'. If the pronunciation of a word depends on which POS -- (part-of-speed) it is, it is written as 'word/n: pron1; v: pron2' -- (where "n", "v" etc. are POS tags). -- Redirects are written as 'word:> target', e.g. 'colour:> color'.
880
addRedirects :: CI2ExtendedMap -> [Text] -> CI2ExtendedMap addRedirects m texts | not $ null listedWords || null unlistedWords = foldl' insertRedirects m unlistedWords | otherwise = m where (listedWords, unlistedWords) = partition inDict texts inDict = flip Map.member m . CI.mk insertRedirects :: CI2ExtendedMap -> Text -> CI2ExtendedMap insertRedirects m' text = Map.insert (CI.mk text) (Right . Redirect . head $ listedWords) m' -- |Write the phonetic dictionary into a line file. -- If there is just a single pronunciations, the entry is written as -- 'word: pron'. If the pronunciation of a word depends on which POS -- (part-of-speed) it is, it is written as 'word/n: pron1; v: pron2' -- (where "n", "v" etc. are POS tags). -- Redirects are written as 'word:> target', e.g. 'colour:> color'.
880
addRedirects m texts | not $ null listedWords || null unlistedWords = foldl' insertRedirects m unlistedWords | otherwise = m where (listedWords, unlistedWords) = partition inDict texts inDict = flip Map.member m . CI.mk insertRedirects :: CI2ExtendedMap -> Text -> CI2ExtendedMap insertRedirects m' text = Map.insert (CI.mk text) (Right . Redirect . head $ listedWords) m' -- |Write the phonetic dictionary into a line file. -- If there is just a single pronunciations, the entry is written as -- 'word: pron'. If the pronunciation of a word depends on which POS -- (part-of-speed) it is, it is written as 'word/n: pron1; v: pron2' -- (where "n", "v" etc. are POS tags). -- Redirects are written as 'word:> target', e.g. 'colour:> color'.
821
false
true
1
10
210
160
82
78
null
null
gcampax/ghc
compiler/deSugar/Check.hs
bsd-3-clause
tidy_pat (ParPat p) = tidy_pat (unLoc p)
46
tidy_pat (ParPat p) = tidy_pat (unLoc p)
46
tidy_pat (ParPat p) = tidy_pat (unLoc p)
46
false
false
0
7
12
24
11
13
null
null
Bodigrim/arithmoi
test-suite/Math/NumberTheory/Moduli/PrimitiveRootTests.hs
mit
isPrimitiveRoot'Property1 :: forall a. (Euclidean a, Integral a, UniqueFactorisation a) => AnySign a -> Positive Natural -> Bool isPrimitiveRoot'Property1 (AnySign n) (Positive m) = case someNatVal m of SomeNat (_ :: Proxy m) -> case cyclicGroup :: Maybe (CyclicGroup a m) of Nothing -> True Just cg -> case isPrimitiveRoot cg (fromIntegral n) of Nothing -> True Just rt -> gcd m (unMod (multElement (unPrimitiveRoot rt))) == 1
457
isPrimitiveRoot'Property1 :: forall a. (Euclidean a, Integral a, UniqueFactorisation a) => AnySign a -> Positive Natural -> Bool isPrimitiveRoot'Property1 (AnySign n) (Positive m) = case someNatVal m of SomeNat (_ :: Proxy m) -> case cyclicGroup :: Maybe (CyclicGroup a m) of Nothing -> True Just cg -> case isPrimitiveRoot cg (fromIntegral n) of Nothing -> True Just rt -> gcd m (unMod (multElement (unPrimitiveRoot rt))) == 1
457
isPrimitiveRoot'Property1 (AnySign n) (Positive m) = case someNatVal m of SomeNat (_ :: Proxy m) -> case cyclicGroup :: Maybe (CyclicGroup a m) of Nothing -> True Just cg -> case isPrimitiveRoot cg (fromIntegral n) of Nothing -> True Just rt -> gcd m (unMod (multElement (unPrimitiveRoot rt))) == 1
320
false
true
0
21
97
190
90
100
null
null
haskell-opengl/OpenGLRaw
src/Graphics/GL/Functions/F09.hs
bsd-3-clause
-- glGenFramebuffersEXT -------------------------------------------------------- -- | This command is an alias for 'glGenFramebuffers'. glGenFramebuffersEXT :: MonadIO m => GLsizei -- ^ @n@. -> Ptr GLuint -- ^ @framebuffers@ pointing to @n@ elements of type @GLuint@. -> m () glGenFramebuffersEXT v1 v2 = liftIO $ dyn200 ptr_glGenFramebuffersEXT v1 v2
360
glGenFramebuffersEXT :: MonadIO m => GLsizei -- ^ @n@. -> Ptr GLuint -- ^ @framebuffers@ pointing to @n@ elements of type @GLuint@. -> m () glGenFramebuffersEXT v1 v2 = liftIO $ dyn200 ptr_glGenFramebuffersEXT v1 v2
223
glGenFramebuffersEXT v1 v2 = liftIO $ dyn200 ptr_glGenFramebuffersEXT v1 v2
75
true
true
0
10
55
58
28
30
null
null
bitonic/yaml
test/Data/YamlSpec.hs
bsd-2-clause
caseEmptyInput :: Assertion caseEmptyInput = D.decode B8.empty @?= (Nothing :: Maybe D.Value)
93
caseEmptyInput :: Assertion caseEmptyInput = D.decode B8.empty @?= (Nothing :: Maybe D.Value)
93
caseEmptyInput = D.decode B8.empty @?= (Nothing :: Maybe D.Value)
65
false
true
0
8
11
33
17
16
null
null
aeyakovenko/rbm
Test/MLP.hs
mit
prop_backProp3 :: Bool prop_backProp3 = runIdentity $ do let input = M.fromList (1,2) [1,1] let output = M.fromList (1,2) [1,1] let mlp = M.fromList (2,2) [-1,-1, -1,-1] let train (umlp,_) _ = P.backPropagate umlp 0.1 input output (_,e1) <- foldM train ([mlp,mlp],1) $ [0::Int] (_,e2) <- foldM train ([mlp,mlp],1) $ [0..100::Int] return $ e2 < e1
398
prop_backProp3 :: Bool prop_backProp3 = runIdentity $ do let input = M.fromList (1,2) [1,1] let output = M.fromList (1,2) [1,1] let mlp = M.fromList (2,2) [-1,-1, -1,-1] let train (umlp,_) _ = P.backPropagate umlp 0.1 input output (_,e1) <- foldM train ([mlp,mlp],1) $ [0::Int] (_,e2) <- foldM train ([mlp,mlp],1) $ [0..100::Int] return $ e2 < e1
398
prop_backProp3 = runIdentity $ do let input = M.fromList (1,2) [1,1] let output = M.fromList (1,2) [1,1] let mlp = M.fromList (2,2) [-1,-1, -1,-1] let train (umlp,_) _ = P.backPropagate umlp 0.1 input output (_,e1) <- foldM train ([mlp,mlp],1) $ [0::Int] (_,e2) <- foldM train ([mlp,mlp],1) $ [0..100::Int] return $ e2 < e1
375
false
true
0
13
107
237
128
109
null
null
urbanslug/ghc
compiler/coreSyn/CoreFVs.hs
bsd-3-clause
ruleLhsFreeIds :: CoreRule -> VarSet -- ^ This finds all locally-defined free Ids on the left hand side of a rule ruleLhsFreeIds (BuiltinRule {}) = noFVs
153
ruleLhsFreeIds :: CoreRule -> VarSet ruleLhsFreeIds (BuiltinRule {}) = noFVs
76
ruleLhsFreeIds (BuiltinRule {}) = noFVs
39
true
true
0
6
25
31
15
16
null
null
pxqr/udev
src/System/UDev/Device.hs
bsd-3-clause
-- | Get the kernel driver name. getDriver :: Device -> ByteString getDriver dev = unsafePerformIO $ do packCString =<< c_getDriver dev
137
getDriver :: Device -> ByteString getDriver dev = unsafePerformIO $ do packCString =<< c_getDriver dev
104
getDriver dev = unsafePerformIO $ do packCString =<< c_getDriver dev
70
true
true
0
10
23
39
17
22
null
null
ganeti/ganeti
src/Ganeti/Constants.hs
bsd-2-clause
ndsParameterTypes :: Map String VType ndsParameterTypes = Map.fromList [(ndExclusiveStorage, VTypeBool), (ndOobProgram, VTypeString), (ndOvs, VTypeBool), (ndOvsLink, VTypeMaybeString), (ndOvsName, VTypeMaybeString), (ndSpindleCount, VTypeInt), (ndSshPort, VTypeInt), (ndCpuSpeed, VTypeFloat)]
317
ndsParameterTypes :: Map String VType ndsParameterTypes = Map.fromList [(ndExclusiveStorage, VTypeBool), (ndOobProgram, VTypeString), (ndOvs, VTypeBool), (ndOvsLink, VTypeMaybeString), (ndOvsName, VTypeMaybeString), (ndSpindleCount, VTypeInt), (ndSshPort, VTypeInt), (ndCpuSpeed, VTypeFloat)]
317
ndsParameterTypes = Map.fromList [(ndExclusiveStorage, VTypeBool), (ndOobProgram, VTypeString), (ndOvs, VTypeBool), (ndOvsLink, VTypeMaybeString), (ndOvsName, VTypeMaybeString), (ndSpindleCount, VTypeInt), (ndSshPort, VTypeInt), (ndCpuSpeed, VTypeFloat)]
279
false
true
0
6
48
93
58
35
null
null
conal/shady-examples
src/SurfaceExamples.hs
agpl-3.0
a1d :: SB a1d t = hfSurf (\ q -> sin (2*t + 7 * magnitude q) / 3)
65
a1d :: SB a1d t = hfSurf (\ q -> sin (2*t + 7 * magnitude q) / 3)
65
a1d t = hfSurf (\ q -> sin (2*t + 7 * magnitude q) / 3)
55
false
true
0
13
18
50
25
25
null
null
urv/fixhs
src/Data/FIX/Spec/FIX43.hs
lgpl-2.1
tContAmtValue :: FIXTag tContAmtValue = FIXTag { tName = "ContAmtValue" , tnum = 520 , tparser = toFIXDouble , arbitraryValue = FIXDouble <$> (return (-2.112 :: Double)) }
184
tContAmtValue :: FIXTag tContAmtValue = FIXTag { tName = "ContAmtValue" , tnum = 520 , tparser = toFIXDouble , arbitraryValue = FIXDouble <$> (return (-2.112 :: Double)) }
184
tContAmtValue = FIXTag { tName = "ContAmtValue" , tnum = 520 , tparser = toFIXDouble , arbitraryValue = FIXDouble <$> (return (-2.112 :: Double)) }
160
false
true
0
12
40
59
34
25
null
null
zhenyavinogradov/ml-labs
src/Lab1/Main.hs
gpl-3.0
plotWithK :: ChipsDataset -> IO () plotWithK input = do toFile def "tmp/knn.png" chart (accs,f1s) <- (unzip <$>) $ forM (kfold 5 input) $ \(trainSet, testSet) -> pure $ (\x y -> (accuracy x y, f1 (bool C0 C1) x y)) (knn pars trainSet) testSet print accs print f1s putStrLn $ "accuracy = " ++ show (average accs) putStrLn $ "f1 = " ++ show (average f1s) where pars = (minkowskiMetric 2.0, 7) chart = do setColors [opaque pink, withOpacity forestgreen 0.5] setShapes [PointShapePolygon 4 True] plot (points "Random C0" $ coord2 g0) plot (points "Random C1" $ coord2 g1) setColors [opaque blue, opaque red] setShapes [PointShapeCircle] plot (points "C0" $ coord2 cl0) plot (points "C1" $ coord2 cl1) knnBasic = knn pars input ps = [-1,-0.99..1.35] somePoints = [V3 a b (a**2+b**2) | a <- ps, b <- ps] cl0 = map fst $ filter ((== C0) . snd) input cl1 = map fst $ filter ((== C1) . snd) input g = graph knnBasic somePoints g0 = map fst $ filter ((== C0) . snd) g g1 = map fst $ filter ((== C1) . snd) g coord2 = map (\(V3 x y _) -> (x, y))
1,189
plotWithK :: ChipsDataset -> IO () plotWithK input = do toFile def "tmp/knn.png" chart (accs,f1s) <- (unzip <$>) $ forM (kfold 5 input) $ \(trainSet, testSet) -> pure $ (\x y -> (accuracy x y, f1 (bool C0 C1) x y)) (knn pars trainSet) testSet print accs print f1s putStrLn $ "accuracy = " ++ show (average accs) putStrLn $ "f1 = " ++ show (average f1s) where pars = (minkowskiMetric 2.0, 7) chart = do setColors [opaque pink, withOpacity forestgreen 0.5] setShapes [PointShapePolygon 4 True] plot (points "Random C0" $ coord2 g0) plot (points "Random C1" $ coord2 g1) setColors [opaque blue, opaque red] setShapes [PointShapeCircle] plot (points "C0" $ coord2 cl0) plot (points "C1" $ coord2 cl1) knnBasic = knn pars input ps = [-1,-0.99..1.35] somePoints = [V3 a b (a**2+b**2) | a <- ps, b <- ps] cl0 = map fst $ filter ((== C0) . snd) input cl1 = map fst $ filter ((== C1) . snd) input g = graph knnBasic somePoints g0 = map fst $ filter ((== C0) . snd) g g1 = map fst $ filter ((== C1) . snd) g coord2 = map (\(V3 x y _) -> (x, y))
1,189
plotWithK input = do toFile def "tmp/knn.png" chart (accs,f1s) <- (unzip <$>) $ forM (kfold 5 input) $ \(trainSet, testSet) -> pure $ (\x y -> (accuracy x y, f1 (bool C0 C1) x y)) (knn pars trainSet) testSet print accs print f1s putStrLn $ "accuracy = " ++ show (average accs) putStrLn $ "f1 = " ++ show (average f1s) where pars = (minkowskiMetric 2.0, 7) chart = do setColors [opaque pink, withOpacity forestgreen 0.5] setShapes [PointShapePolygon 4 True] plot (points "Random C0" $ coord2 g0) plot (points "Random C1" $ coord2 g1) setColors [opaque blue, opaque red] setShapes [PointShapeCircle] plot (points "C0" $ coord2 cl0) plot (points "C1" $ coord2 cl1) knnBasic = knn pars input ps = [-1,-0.99..1.35] somePoints = [V3 a b (a**2+b**2) | a <- ps, b <- ps] cl0 = map fst $ filter ((== C0) . snd) input cl1 = map fst $ filter ((== C1) . snd) input g = graph knnBasic somePoints g0 = map fst $ filter ((== C0) . snd) g g1 = map fst $ filter ((== C1) . snd) g coord2 = map (\(V3 x y _) -> (x, y))
1,154
false
true
10
17
353
575
283
292
null
null
thomasathorne/h-chu
src/Data.hs
bsd-3-clause
valid (Play Triple [c,d,e]) | a <- value c, a == value d = a == value e
71
valid (Play Triple [c,d,e]) | a <- value c, a == value d = a == value e
71
valid (Play Triple [c,d,e]) | a <- value c, a == value d = a == value e
71
false
false
0
9
17
58
27
31
null
null
keera-studios/hsQt
Qtc/Gui/QPixmapCache.hs
bsd-2-clause
qPixmapCacheCacheLimit :: (()) -> IO (Int) qPixmapCacheCacheLimit () = withIntResult $ qtc_QPixmapCache_cacheLimit
120
qPixmapCacheCacheLimit :: (()) -> IO (Int) qPixmapCacheCacheLimit () = withIntResult $ qtc_QPixmapCache_cacheLimit
120
qPixmapCacheCacheLimit () = withIntResult $ qtc_QPixmapCache_cacheLimit
77
false
true
2
8
17
41
19
22
null
null
qsn/rhcalc
src/Operators.hs
mit
eitherToStack (Right ss) = ss
29
eitherToStack (Right ss) = ss
29
eitherToStack (Right ss) = ss
29
false
false
0
7
4
15
7
8
null
null
srenatus/avus
src/Avus/CVSSv2.hs
mit
fromRc RcC = 1.0
17
fromRc RcC = 1.0
17
fromRc RcC = 1.0
17
false
false
0
5
4
9
4
5
null
null
kmate/HaRe
old/testing/demote/WhereIn4AST.hs
bsd-3-clause
sq :: Int -> Int -> Int sq pow z = z ^ pow
44
sq :: Int -> Int -> Int sq pow z = z ^ pow
42
sq pow z = z ^ pow
18
false
true
0
6
15
28
14
14
null
null
edofic/core.js
src/Immediate/GenerateJs.hs
mit
genLiteral (LiteralRational (e :% d)) = JS.CallExpr() (JS.DotRef() (jsInt e) $ JS.Id() "div") [jsInt d]
103
genLiteral (LiteralRational (e :% d)) = JS.CallExpr() (JS.DotRef() (jsInt e) $ JS.Id() "div") [jsInt d]
103
genLiteral (LiteralRational (e :% d)) = JS.CallExpr() (JS.DotRef() (jsInt e) $ JS.Id() "div") [jsInt d]
103
false
false
0
10
14
71
34
37
null
null
michaelochurch/jatek
Games/Nim.hs
mit
nimUpdate _ _ _ = error "Illegal action configuration."
55
nimUpdate _ _ _ = error "Illegal action configuration."
55
nimUpdate _ _ _ = error "Illegal action configuration."
55
false
false
0
5
8
16
7
9
null
null
AndrewSinclair/aoc-haskell
test/Day4Spec.hs
mit
input = "yzbqklnj"
18
input = "yzbqklnj"
18
input = "yzbqklnj"
18
false
false
1
5
2
10
3
7
null
null
rfranek/duckling
Duckling/Numeral/NB/Rules.hs
bsd-3-clause
ruleIntegerNumeric :: Rule ruleIntegerNumeric = Rule { name = "integer (numeric)" , pattern = [ regex "(\\d{1,18})" ] , prod = \tokens -> case tokens of (Token RegexMatch (GroupMatch (match:_)):_) -> do v <- toInteger <$> parseInt match integer v _ -> Nothing }
305
ruleIntegerNumeric :: Rule ruleIntegerNumeric = Rule { name = "integer (numeric)" , pattern = [ regex "(\\d{1,18})" ] , prod = \tokens -> case tokens of (Token RegexMatch (GroupMatch (match:_)):_) -> do v <- toInteger <$> parseInt match integer v _ -> Nothing }
305
ruleIntegerNumeric = Rule { name = "integer (numeric)" , pattern = [ regex "(\\d{1,18})" ] , prod = \tokens -> case tokens of (Token RegexMatch (GroupMatch (match:_)):_) -> do v <- toInteger <$> parseInt match integer v _ -> Nothing }
278
false
true
0
18
87
107
55
52
null
null
higgsd/euler
hs/122.hs
bsd-2-clause
genPath xs ys ds = genPath xs (tail ys) ds2 where z = head xs + head ys ds2 = genMult z xs ds -- if path is an improvement, search it
148
genPath xs ys ds = genPath xs (tail ys) ds2 where z = head xs + head ys ds2 = genMult z xs ds -- if path is an improvement, search it
148
genPath xs ys ds = genPath xs (tail ys) ds2 where z = head xs + head ys ds2 = genMult z xs ds -- if path is an improvement, search it
148
false
false
1
7
46
57
27
30
null
null
GaloisInc/halvm-ghc
compiler/basicTypes/IdInfo.hs
bsd-3-clause
ppArityInfo :: Int -> SDoc ppArityInfo 0 = empty
48
ppArityInfo :: Int -> SDoc ppArityInfo 0 = empty
48
ppArityInfo 0 = empty
21
false
true
0
5
8
18
9
9
null
null
abakst/symmetry
checker/include/SymMapQC.hs
mit
put :: (Ord k) => Map_t k v -> k -> v -> Map_t k v put (M m) k v = M (Map.insert k v m)
87
put :: (Ord k) => Map_t k v -> k -> v -> Map_t k v put (M m) k v = M (Map.insert k v m)
87
put (M m) k v = M (Map.insert k v m)
36
false
true
0
12
26
74
35
39
null
null
jwoudenberg/elm-editor-tools
src/ElmTools/ParseModule.hs
bsd-3-clause
commentContentsAndEnd :: DefParser () commentContentsAndEnd = dump $ manyTill (try comment <|> dump anyChar) commentBlockEnd
126
commentContentsAndEnd :: DefParser () commentContentsAndEnd = dump $ manyTill (try comment <|> dump anyChar) commentBlockEnd
126
commentContentsAndEnd = dump $ manyTill (try comment <|> dump anyChar) commentBlockEnd
88
false
true
0
9
16
38
18
20
null
null
mb21/qua-kit
apps/hs/qua-server/src/Model/Session.hs
mit
userSessionResultSourceId :: SessionLens Text userSessionResultSourceId = textSessionLens "lis_result_sourcedid"
112
userSessionResultSourceId :: SessionLens Text userSessionResultSourceId = textSessionLens "lis_result_sourcedid"
112
userSessionResultSourceId = textSessionLens "lis_result_sourcedid"
66
false
true
0
5
7
17
8
9
null
null
d3sformal/bacon-core
src/Utils/Versioned.hs
mit
getDefaultVersion :: VersionMap -> Int getDefaultVersion = defaultVersion
73
getDefaultVersion :: VersionMap -> Int getDefaultVersion = defaultVersion
73
getDefaultVersion = defaultVersion
34
false
true
0
7
7
22
9
13
null
null
ndmitchell/qed
v1/Util.hs
bsd-3-clause
delFst :: Eq a => a -> [(a,b)] -> [(a,b)] delFst x = filter ((/=) x . fst)
74
delFst :: Eq a => a -> [(a,b)] -> [(a,b)] delFst x = filter ((/=) x . fst)
74
delFst x = filter ((/=) x . fst)
32
false
true
0
11
17
68
35
33
null
null
Axure/elm-compiler
src/Validate.hs
bsd-3-clause
both :: (Source.Expr, Source.Expr) -> Result.Result wrn Error.Error (Valid.Expr, Valid.Expr) both (expr1, expr2) = (,) <$> expression expr1 <*> expression expr2
172
both :: (Source.Expr, Source.Expr) -> Result.Result wrn Error.Error (Valid.Expr, Valid.Expr) both (expr1, expr2) = (,) <$> expression expr1 <*> expression expr2
172
both (expr1, expr2) = (,) <$> expression expr1 <*> expression expr2
71
false
true
0
9
32
76
39
37
null
null
ilyasergey/GHC-XAppFix
compiler/nativeGen/PPC/CodeGen.hs
bsd-3-clause
selExpr64 :: CmmExpr -> NatM ChildCode64 iselExpr64 (CmmLoad addrTree ty) | isWord64 ty = do (hi_addr, lo_addr, addr_code) <- getI64Amodes addrTree (rlo, rhi) <- getNewRegPairNat II32 let mov_hi = LD II32 rhi hi_addr mov_lo = LD II32 rlo lo_addr return $ ChildCode64 (addr_code `snocOL` mov_lo `snocOL` mov_hi) rlo
371
iselExpr64 :: CmmExpr -> NatM ChildCode64 iselExpr64 (CmmLoad addrTree ty) | isWord64 ty = do (hi_addr, lo_addr, addr_code) <- getI64Amodes addrTree (rlo, rhi) <- getNewRegPairNat II32 let mov_hi = LD II32 rhi hi_addr mov_lo = LD II32 rlo lo_addr return $ ChildCode64 (addr_code `snocOL` mov_lo `snocOL` mov_hi) rlo
371
iselExpr64 (CmmLoad addrTree ty) | isWord64 ty = do (hi_addr, lo_addr, addr_code) <- getI64Amodes addrTree (rlo, rhi) <- getNewRegPairNat II32 let mov_hi = LD II32 rhi hi_addr mov_lo = LD II32 rlo lo_addr return $ ChildCode64 (addr_code `snocOL` mov_lo `snocOL` mov_hi) rlo
322
false
true
0
12
104
128
63
65
null
null
sdiehl/ghc
hadrian/src/Packages.hs
bsd-3-clause
-- TODO: Can we extract this information from Cabal files? -- | Some program packages should not be linked with Haskell main function. nonHsMainPackage :: Package -> Bool nonHsMainPackage = (`elem` [ghc, hp2ps, iserv, touchy, unlit])
233
nonHsMainPackage :: Package -> Bool nonHsMainPackage = (`elem` [ghc, hp2ps, iserv, touchy, unlit])
98
nonHsMainPackage = (`elem` [ghc, hp2ps, iserv, touchy, unlit])
62
true
true
0
7
35
45
26
19
null
null
lpeterse/crprover
Parser.hs
gpl-2.0
reservedOp = P.reservedOp lexer
31
reservedOp = P.reservedOp lexer
31
reservedOp = P.reservedOp lexer
31
false
false
0
6
3
11
5
6
null
null
TorosFanny/kaleidoscope
src/chapter7/Lexer.hs
mit
reservedOp = Tok.reservedOp lexer
33
reservedOp = Tok.reservedOp lexer
33
reservedOp = Tok.reservedOp lexer
33
false
false
0
6
3
11
5
6
null
null
DavidAlphaFox/ghc
libraries/Cabal/Cabal/Distribution/Simple/Command.hs
bsd-3-clause
commandParseArgs :: CommandUI flags -> Bool -- ^ Is the command a global or subcommand? -> [String] -> CommandParse (flags -> flags, [String]) commandParseArgs command global args = let options = addCommonFlags ParseArgs $ commandGetOpts ParseArgs command order | global = GetOpt.RequireOrder | otherwise = GetOpt.Permute in case GetOpt.getOpt' order options args of (flags, _, _, _) | any listFlag flags -> CommandList (commandListOptions command) | any helpFlag flags -> CommandHelp (commandHelp command) where listFlag (Left ListOptionsFlag) = True; listFlag _ = False helpFlag (Left HelpFlag) = True; helpFlag _ = False (flags, opts, opts', []) | global || null opts' -> CommandReadyToGo (accum flags, mix opts opts') | otherwise -> CommandErrors (unrecognised opts') (_, _, _, errs) -> CommandErrors errs where -- Note: It is crucial to use reverse function composition here or to -- reverse the flags here as we want to process the flags left to right -- but data flow in function composition is right to left. accum flags = foldr (flip (.)) id [ f | Right f <- flags ] unrecognised opts = [ "unrecognized " ++ "'" ++ (commandName command) ++ "'" ++ " option `" ++ opt ++ "'\n" | opt <- opts ] -- For unrecognised global flags we put them in the position just after -- the command, if there is one. This gives us a chance to parse them -- as sub-command rather than global flags. mix [] ys = ys mix (x:xs) ys = x:ys++xs
1,769
commandParseArgs :: CommandUI flags -> Bool -- ^ Is the command a global or subcommand? -> [String] -> CommandParse (flags -> flags, [String]) commandParseArgs command global args = let options = addCommonFlags ParseArgs $ commandGetOpts ParseArgs command order | global = GetOpt.RequireOrder | otherwise = GetOpt.Permute in case GetOpt.getOpt' order options args of (flags, _, _, _) | any listFlag flags -> CommandList (commandListOptions command) | any helpFlag flags -> CommandHelp (commandHelp command) where listFlag (Left ListOptionsFlag) = True; listFlag _ = False helpFlag (Left HelpFlag) = True; helpFlag _ = False (flags, opts, opts', []) | global || null opts' -> CommandReadyToGo (accum flags, mix opts opts') | otherwise -> CommandErrors (unrecognised opts') (_, _, _, errs) -> CommandErrors errs where -- Note: It is crucial to use reverse function composition here or to -- reverse the flags here as we want to process the flags left to right -- but data flow in function composition is right to left. accum flags = foldr (flip (.)) id [ f | Right f <- flags ] unrecognised opts = [ "unrecognized " ++ "'" ++ (commandName command) ++ "'" ++ " option `" ++ opt ++ "'\n" | opt <- opts ] -- For unrecognised global flags we put them in the position just after -- the command, if there is one. This gives us a chance to parse them -- as sub-command rather than global flags. mix [] ys = ys mix (x:xs) ys = x:ys++xs
1,769
commandParseArgs command global args = let options = addCommonFlags ParseArgs $ commandGetOpts ParseArgs command order | global = GetOpt.RequireOrder | otherwise = GetOpt.Permute in case GetOpt.getOpt' order options args of (flags, _, _, _) | any listFlag flags -> CommandList (commandListOptions command) | any helpFlag flags -> CommandHelp (commandHelp command) where listFlag (Left ListOptionsFlag) = True; listFlag _ = False helpFlag (Left HelpFlag) = True; helpFlag _ = False (flags, opts, opts', []) | global || null opts' -> CommandReadyToGo (accum flags, mix opts opts') | otherwise -> CommandErrors (unrecognised opts') (_, _, _, errs) -> CommandErrors errs where -- Note: It is crucial to use reverse function composition here or to -- reverse the flags here as we want to process the flags left to right -- but data flow in function composition is right to left. accum flags = foldr (flip (.)) id [ f | Right f <- flags ] unrecognised opts = [ "unrecognized " ++ "'" ++ (commandName command) ++ "'" ++ " option `" ++ opt ++ "'\n" | opt <- opts ] -- For unrecognised global flags we put them in the position just after -- the command, if there is one. This gives us a chance to parse them -- as sub-command rather than global flags. mix [] ys = ys mix (x:xs) ys = x:ys++xs
1,570
false
true
8
14
590
467
225
242
null
null
Southern-Exposure-Seed-Exchange/southernexposure.com
server/src/StoneEdge.hs
gpl-3.0
renderStoneEdgeTax :: StoneEdgeTax -> Xml Elem renderStoneEdgeTax StoneEdgeTax {..} = xelem "Tax" $ xelems [ xelemWithText "TaxAmount" $ renderStoneEdgeCents setAmount , maybeXelemTextWith "TaxRate" renderScientific setRate , maybeXelemTextWith "TaxShipping" renderBoolAsYesNo setShippingTaxed , maybeXelemTextWith "TaxExempt" renderBoolAsYesNo setTaxExempt , maybeXelemText "TaxID" setTaxId ]
469
renderStoneEdgeTax :: StoneEdgeTax -> Xml Elem renderStoneEdgeTax StoneEdgeTax {..} = xelem "Tax" $ xelems [ xelemWithText "TaxAmount" $ renderStoneEdgeCents setAmount , maybeXelemTextWith "TaxRate" renderScientific setRate , maybeXelemTextWith "TaxShipping" renderBoolAsYesNo setShippingTaxed , maybeXelemTextWith "TaxExempt" renderBoolAsYesNo setTaxExempt , maybeXelemText "TaxID" setTaxId ]
469
renderStoneEdgeTax StoneEdgeTax {..} = xelem "Tax" $ xelems [ xelemWithText "TaxAmount" $ renderStoneEdgeCents setAmount , maybeXelemTextWith "TaxRate" renderScientific setRate , maybeXelemTextWith "TaxShipping" renderBoolAsYesNo setShippingTaxed , maybeXelemTextWith "TaxExempt" renderBoolAsYesNo setTaxExempt , maybeXelemText "TaxID" setTaxId ]
422
false
true
0
9
115
88
42
46
null
null
tazjin/hs-pkpass
Passbook/Types.hs
bsd-3-clause
-- |Correctly renders a @PassDate@ in JSON (ISO 8601) jsonPassdate = toJSON . formatTime defaultTimeLocale timeFormat
117
jsonPassdate = toJSON . formatTime defaultTimeLocale timeFormat
63
jsonPassdate = toJSON . formatTime defaultTimeLocale timeFormat
63
true
false
0
6
15
16
8
8
null
null
ardumont/haskell-lab
src/Scratch.hs
gpl-2.0
combinations :: Occurrences -> [Occurrences] combinations = foldl' comb [[]] where comb :: [Occurrences] -> (Char, Int) -> [Occurrences] comb ss ci = ss ++ [sub ++ [c] | sub <- ss, c <- subOccurrences ci] subOccurrences :: (Char, Int) -> Occurrences subOccurrences (c, n) = [(c, i) | i <- [1..n]]
324
combinations :: Occurrences -> [Occurrences] combinations = foldl' comb [[]] where comb :: [Occurrences] -> (Char, Int) -> [Occurrences] comb ss ci = ss ++ [sub ++ [c] | sub <- ss, c <- subOccurrences ci] subOccurrences :: (Char, Int) -> Occurrences subOccurrences (c, n) = [(c, i) | i <- [1..n]]
324
combinations = foldl' comb [[]] where comb :: [Occurrences] -> (Char, Int) -> [Occurrences] comb ss ci = ss ++ [sub ++ [c] | sub <- ss, c <- subOccurrences ci] subOccurrences :: (Char, Int) -> Occurrences subOccurrences (c, n) = [(c, i) | i <- [1..n]]
279
false
true
5
10
79
144
81
63
null
null
jeannekamikaze/Spear
Spear/Window.hs
mit
toGLFWkey KEY_Z = GLFW.CharKey 'Z'
34
toGLFWkey KEY_Z = GLFW.CharKey 'Z'
34
toGLFWkey KEY_Z = GLFW.CharKey 'Z'
34
false
false
1
6
4
17
6
11
null
null
JacquesCarette/literate-scientific-software
code/drasil-gool/GOOL/Drasil/LanguageRenderer/CppRenderer.hs
bsd-2-clause
addAlgorithmImportVS :: VS a -> VS a addAlgorithmImportVS = (>>) $ modify (addLangImportVS algorithmImport)
107
addAlgorithmImportVS :: VS a -> VS a addAlgorithmImportVS = (>>) $ modify (addLangImportVS algorithmImport)
107
addAlgorithmImportVS = (>>) $ modify (addLangImportVS algorithmImport)
70
false
true
0
8
13
41
19
22
null
null
filopodia/open
dampf/lib/Dampf/Nginx/Types.hs
mit
pShowServer :: Server -> String pShowServer = render . pprServer
64
pShowServer :: Server -> String pShowServer = render . pprServer
64
pShowServer = render . pprServer
32
false
true
0
5
9
19
10
9
null
null
shicks/shsh
System/Console/ShSh/Options.hs
bsd-3-clause
swop :: [(String,Char)] swop = map (\(a,b)->(b,a)) options
58
swop :: [(String,Char)] swop = map (\(a,b)->(b,a)) options
58
swop = map (\(a,b)->(b,a)) options
34
false
true
0
8
7
52
28
24
null
null
nikai3d/ce-challenges
easy/simple_or_trump.hs
bsd-3-clause
cardval 'Q' = 12
16
cardval 'Q' = 12
16
cardval 'Q' = 12
16
false
false
0
5
3
9
4
5
null
null
nushio3/formura
attic/n-d-array.hs
mit
uhead (Sh1 xs) = uhead xs
25
uhead (Sh1 xs) = uhead xs
25
uhead (Sh1 xs) = uhead xs
25
false
false
0
6
5
19
8
11
null
null
ghc-android/ghc
testsuite/tests/simplCore/prog003/OneShot1.hs
bsd-3-clause
baz :: Int -> Int -> Int baz y = oneShot (\x -> x+y)
52
baz :: Int -> Int -> Int baz y = oneShot (\x -> x+y)
52
baz y = oneShot (\x -> x+y)
27
false
true
0
8
13
37
19
18
null
null
aleksj/lamdu
bottlelib/Graphics/UI/Bottle/Animation.hs
gpl-3.0
mapIdentities :: (AnimId -> AnimId) -> Frame -> Frame mapIdentities f = fSubImages %~ Map.mapKeys f
99
mapIdentities :: (AnimId -> AnimId) -> Frame -> Frame mapIdentities f = fSubImages %~ Map.mapKeys f
99
mapIdentities f = fSubImages %~ Map.mapKeys f
45
false
true
0
7
15
38
19
19
null
null
smurphy8/shakespeare-dynamic
shakespeare-dynamic-opheilia/src/Shakespeare/Dynamic/Opheilia/Parser.hs
mit
contentCaret :: ParsecT String a Identity (Content, Bool) contentCaret = do x <- parseCaret case x of Left str -> return (ContentRaw str, null str) Right deref -> return (ContentEmbed deref, False)
221
contentCaret :: ParsecT String a Identity (Content, Bool) contentCaret = do x <- parseCaret case x of Left str -> return (ContentRaw str, null str) Right deref -> return (ContentEmbed deref, False)
221
contentCaret = do x <- parseCaret case x of Left str -> return (ContentRaw str, null str) Right deref -> return (ContentEmbed deref, False)
163
false
true
0
12
55
85
41
44
null
null
vasily-kirichenko/haskell-book
src/Libraries/Queues.hs
bsd-3-clause
push :: a -> Queue a -> Queue a push a (Queue e d) = Queue (a:e) d
66
push :: a -> Queue a -> Queue a push a (Queue e d) = Queue (a:e) d
66
push a (Queue e d) = Queue (a:e) d
34
false
true
0
10
17
54
25
29
null
null
rubik/stack
src/Stack/Config.hs
bsd-3-clause
getDefaultGHCVariant :: (MonadIO m, MonadBaseControl IO m, MonadCatch m, MonadLogger m) => EnvOverride -> Platform -> m GHCVariant getDefaultGHCVariant menv (Platform _ Linux) = do isGMP4 <- getIsGMP4 menv return (if isGMP4 then GHCGMP4 else GHCStandard)
270
getDefaultGHCVariant :: (MonadIO m, MonadBaseControl IO m, MonadCatch m, MonadLogger m) => EnvOverride -> Platform -> m GHCVariant getDefaultGHCVariant menv (Platform _ Linux) = do isGMP4 <- getIsGMP4 menv return (if isGMP4 then GHCGMP4 else GHCStandard)
270
getDefaultGHCVariant menv (Platform _ Linux) = do isGMP4 <- getIsGMP4 menv return (if isGMP4 then GHCGMP4 else GHCStandard)
131
false
true
0
9
51
91
45
46
null
null
brendanhay/gogol
gogol-logging/gen/Network/Google/Logging/Types/Product.hs
mpl-2.0
-- | Optional. A filter specifying which log entries to copy. The filter must -- be no more than 20k characters. An empty filter matches all log entries. clerFilter :: Lens' CopyLogEntriesRequest (Maybe Text) clerFilter = lens _clerFilter (\ s a -> s{_clerFilter = a})
270
clerFilter :: Lens' CopyLogEntriesRequest (Maybe Text) clerFilter = lens _clerFilter (\ s a -> s{_clerFilter = a})
116
clerFilter = lens _clerFilter (\ s a -> s{_clerFilter = a})
61
true
true
0
9
46
49
26
23
null
null
suhailshergill/liboleg
Control/ExtensibleDS.hs
bsd-3-clause
sto_handler (cnt,st) (InFX k a) f | Just (l,v) <- prSet a = sto_handler (cnt, \l' -> if l' == l then v else st l') (k (inL l)) f
132
sto_handler (cnt,st) (InFX k a) f | Just (l,v) <- prSet a = sto_handler (cnt, \l' -> if l' == l then v else st l') (k (inL l)) f
132
sto_handler (cnt,st) (InFX k a) f | Just (l,v) <- prSet a = sto_handler (cnt, \l' -> if l' == l then v else st l') (k (inL l)) f
132
false
false
0
10
33
94
48
46
null
null
vincenthz/hs-foundation
basement/Basement/Sized/List.hs
bsd-3-clause
-- | Unzip a list of tuple, to 2 List of the deconstructed tuples unzip :: ListN n (a,b) -> (ListN n a, ListN n b) unzip l = (map fst l, map snd l)
147
unzip :: ListN n (a,b) -> (ListN n a, ListN n b) unzip l = (map fst l, map snd l)
81
unzip l = (map fst l, map snd l)
32
true
true
0
9
34
68
33
35
null
null
beni55/hspec
test/HelperSpec.hs
mit
main :: IO () main = hspec spec
31
main :: IO () main = hspec spec
31
main = hspec spec
17
false
true
1
6
7
22
9
13
null
null
5outh/BeFun
src/FunctionProcesses.hs
mit
swap (BefungeState is (x:y:xs) loc dir m r) = Right $ BefungeState is (y:x:xs) loc dir m r
90
swap (BefungeState is (x:y:xs) loc dir m r) = Right $ BefungeState is (y:x:xs) loc dir m r
90
swap (BefungeState is (x:y:xs) loc dir m r) = Right $ BefungeState is (y:x:xs) loc dir m r
90
false
false
0
10
17
64
32
32
null
null
pjones/xmonad-test
vendor/xmonad-contrib/XMonad/Actions/DynamicWorkspaceGroups.hs
bsd-2-clause
-- | Prompt for a workspace group to forget. promptWSGroupForget :: XPConfig -> String -> X () promptWSGroupForget xp s = do gs <- fmap (M.keys . unWSG) XS.get mkXPrompt (WSGPrompt s) xp (mkComplFunFromList' gs) forgetWSGroup
229
promptWSGroupForget :: XPConfig -> String -> X () promptWSGroupForget xp s = do gs <- fmap (M.keys . unWSG) XS.get mkXPrompt (WSGPrompt s) xp (mkComplFunFromList' gs) forgetWSGroup
184
promptWSGroupForget xp s = do gs <- fmap (M.keys . unWSG) XS.get mkXPrompt (WSGPrompt s) xp (mkComplFunFromList' gs) forgetWSGroup
134
true
true
0
11
39
77
37
40
null
null
AlexanderPankiv/ghc
compiler/hsSyn/HsBinds.hs
bsd-3-clause
ppr_monobind :: (OutputableBndr idL, OutputableBndr idR) => HsBindLR idL idR -> SDoc ppr_monobind (PatBind { pat_lhs = pat, pat_rhs = grhss }) = pprPatBind pat grhss
168
ppr_monobind :: (OutputableBndr idL, OutputableBndr idR) => HsBindLR idL idR -> SDoc ppr_monobind (PatBind { pat_lhs = pat, pat_rhs = grhss }) = pprPatBind pat grhss
167
ppr_monobind (PatBind { pat_lhs = pat, pat_rhs = grhss }) = pprPatBind pat grhss
82
false
true
0
9
28
61
32
29
null
null
jrockway/c2hs
src/C2HS/Gen/Bind.hs
gpl-2.0
applyBin _ CDivOp (FloatResult x) (FloatResult y) = return $ FloatResult (x / y)
104
applyBin _ CDivOp (FloatResult x) (FloatResult y) = return $ FloatResult (x / y)
104
applyBin _ CDivOp (FloatResult x) (FloatResult y) = return $ FloatResult (x / y)
104
false
false
0
8
37
41
20
21
null
null
mfpi/OpenGLRaw
src/Graphics/Rendering/OpenGL/Raw/Core31/Tokens.hs
bsd-3-clause
gl_DRAW_BUFFER13 :: GLenum gl_DRAW_BUFFER13 = 0x8832
52
gl_DRAW_BUFFER13 :: GLenum gl_DRAW_BUFFER13 = 0x8832
52
gl_DRAW_BUFFER13 = 0x8832
25
false
true
0
4
5
11
6
5
null
null
urbanslug/ghc
testsuite/tests/codeGen/should_run/CmmSwitchTestGen.hs
bsd-3-clause
genMain :: [Spec] -> String genMain specs = unlines $ "main = do" : [ " " ++ checkName n | (n,_,_) <- specs ]
112
genMain :: [Spec] -> String genMain specs = unlines $ "main = do" : [ " " ++ checkName n | (n,_,_) <- specs ]
112
genMain specs = unlines $ "main = do" : [ " " ++ checkName n | (n,_,_) <- specs ]
84
false
true
0
9
27
56
30
26
null
null
fehu/haskell-java-bridge-fork
src/Foreign/Java/Bindings/Typomatic.hs
mit
printJniType :: JavaType -> String printJniType t = case t of JBoolean -> "JNI.boolean" JChar -> "JNI.char" JByte -> "JNI.byte" JShort -> "JNI.short" JInt -> "JNI.int" JLong -> "JNI.long" JFloat -> "JNI.float" JDouble -> "JNI.double" JObj n -> "JNI.object \"" ++ n ++ "\"" -- arrays are treated as objects: JArr c -> "JNIS.object' \"[" ++ printJniRawType c ++ "\""
430
printJniType :: JavaType -> String printJniType t = case t of JBoolean -> "JNI.boolean" JChar -> "JNI.char" JByte -> "JNI.byte" JShort -> "JNI.short" JInt -> "JNI.int" JLong -> "JNI.long" JFloat -> "JNI.float" JDouble -> "JNI.double" JObj n -> "JNI.object \"" ++ n ++ "\"" -- arrays are treated as objects: JArr c -> "JNIS.object' \"[" ++ printJniRawType c ++ "\""
430
printJniType t = case t of JBoolean -> "JNI.boolean" JChar -> "JNI.char" JByte -> "JNI.byte" JShort -> "JNI.short" JInt -> "JNI.int" JLong -> "JNI.long" JFloat -> "JNI.float" JDouble -> "JNI.double" JObj n -> "JNI.object \"" ++ n ++ "\"" -- arrays are treated as objects: JArr c -> "JNIS.object' \"[" ++ printJniRawType c ++ "\""
395
false
true
14
6
125
113
51
62
null
null
tolysz/prepare-ghcjs
spec-lts8/aeson/Data/Aeson/TH.hs
bsd-3-clause
(<^>) :: ExpQ -> ExpQ -> ExpQ (<^>) a b = infixApp a [|(E.><)|] b
65
(<^>) :: ExpQ -> ExpQ -> ExpQ (<^>) a b = infixApp a [|(E.><)|] b
65
(<^>) a b = infixApp a [|(E.><)|] b
35
false
true
0
6
14
42
23
19
null
null
kawamuray/ganeti
src/Ganeti/Query/Exec.hs
gpl-2.0
isForkSupported :: IO Bool isForkSupported = return $ not rtsSupportsBoundThreads
81
isForkSupported :: IO Bool isForkSupported = return $ not rtsSupportsBoundThreads
81
isForkSupported = return $ not rtsSupportsBoundThreads
54
false
true
0
6
9
21
10
11
null
null
brendanhay/gogol
gogol-remotebuildexecution/gen/Network/Google/RemoteBuildExecution/Types/Product.hs
mpl-2.0
-- | The minimal number of workers. Must be greater than 0. gdravaMinSize :: Lens' GoogleDevtoolsRemotebuildexecutionAdminV1alphaAutoscale (Maybe Int64) gdravaMinSize = lens _gdravaMinSize (\ s a -> s{_gdravaMinSize = a}) . mapping _Coerce
253
gdravaMinSize :: Lens' GoogleDevtoolsRemotebuildexecutionAdminV1alphaAutoscale (Maybe Int64) gdravaMinSize = lens _gdravaMinSize (\ s a -> s{_gdravaMinSize = a}) . mapping _Coerce
193
gdravaMinSize = lens _gdravaMinSize (\ s a -> s{_gdravaMinSize = a}) . mapping _Coerce
100
true
true
0
10
45
55
28
27
null
null
bixuanzju/fcore
lib/Desugar.hs
bsd-2-clause
decisionTree :: (TVarMap t, VarMap t e) -> [CheckedExpr] -> [[Pattern]] -> [CheckedExpr] -> [[(Name, Type, LExpr (Name,Type) Type)]] -> F.Expr t e decisionTree (d,g) = go where -- no pattern left. Then the first expr will be the result go [] _ branches binds = desugarExpr (d,g) $ noLoc $ LetOut NonRec (head binds) (head branches) go exprs pats branches binds | all isWildcardOrVar patshead = go (tail exprs) (map tail pats) branches (zipWith (\pat bind -> case head pat of PVar nam ty -> (nam, ty, curExp'):bind _ -> bind ) pats binds) | null missingconstrs = F.Case (desugarExpr (d,g) curExp') (map makeNewAltFromCtr appearconstrs) | otherwise = F.Case (desugarExpr (d,g) curExp') (map makeNewAltFromCtr appearconstrs ++ makeDefault) where patshead = map head pats curExp' = head exprs (appearconstrs, missingconstrs) = constrInfo patshead makeNewAltFromCtr ctr@(Constructor name params) = let len = length params - 1 Datatype dtnam _ _ = last params ctrclass = '$': dtnam ++ ".$" ++ dtnam ++ '$':name curExp = noLoc $ JMethod (NonStatic (noLoc $ JField (Static ctrclass) "class" (JClass $ "Class<" ++ ctrclass++ ">"))) "cast" [curExp'] ctrclass javafieldexprs = zipWith (\num pam -> noLoc $ JField (NonStatic curExp) (fieldtag ++ show num) pam) [1..len] params exprs' = javafieldexprs ++ tail exprs (pats', branches', binds') = unzip3 $ foldr (\(curPattern:rest, branch, bind) acc -> let nextPats = extractorsubpattern name len curPattern ++ rest in case curPattern of PWildcard -> ( nextPats, branch, bind) :acc PVar nam ty -> (nextPats, branch, (nam, ty, curExp): bind) :acc PConstr (Constructor nam _) _ | nam /= name -> acc | otherwise -> (nextPats, branch, bind):acc) [] (zip3 pats branches binds) in F.ConstrAlt (desugarConstructor d ctr) (go exprs' pats' branches' binds') makeDefault = let (pats', branches', binds') = unzip3 $ foldr (\(curPattern:rest, branch, bind) acc -> case curPattern of PWildcard -> (rest , branch, bind) :acc PVar nam ty -> (rest, branch, (nam, ty, curExp'): bind) :acc _ -> acc) [] (zip3 pats branches binds) in [F.Default $ go (tail exprs) pats' branches' binds']
3,666
decisionTree :: (TVarMap t, VarMap t e) -> [CheckedExpr] -> [[Pattern]] -> [CheckedExpr] -> [[(Name, Type, LExpr (Name,Type) Type)]] -> F.Expr t e decisionTree (d,g) = go where -- no pattern left. Then the first expr will be the result go [] _ branches binds = desugarExpr (d,g) $ noLoc $ LetOut NonRec (head binds) (head branches) go exprs pats branches binds | all isWildcardOrVar patshead = go (tail exprs) (map tail pats) branches (zipWith (\pat bind -> case head pat of PVar nam ty -> (nam, ty, curExp'):bind _ -> bind ) pats binds) | null missingconstrs = F.Case (desugarExpr (d,g) curExp') (map makeNewAltFromCtr appearconstrs) | otherwise = F.Case (desugarExpr (d,g) curExp') (map makeNewAltFromCtr appearconstrs ++ makeDefault) where patshead = map head pats curExp' = head exprs (appearconstrs, missingconstrs) = constrInfo patshead makeNewAltFromCtr ctr@(Constructor name params) = let len = length params - 1 Datatype dtnam _ _ = last params ctrclass = '$': dtnam ++ ".$" ++ dtnam ++ '$':name curExp = noLoc $ JMethod (NonStatic (noLoc $ JField (Static ctrclass) "class" (JClass $ "Class<" ++ ctrclass++ ">"))) "cast" [curExp'] ctrclass javafieldexprs = zipWith (\num pam -> noLoc $ JField (NonStatic curExp) (fieldtag ++ show num) pam) [1..len] params exprs' = javafieldexprs ++ tail exprs (pats', branches', binds') = unzip3 $ foldr (\(curPattern:rest, branch, bind) acc -> let nextPats = extractorsubpattern name len curPattern ++ rest in case curPattern of PWildcard -> ( nextPats, branch, bind) :acc PVar nam ty -> (nextPats, branch, (nam, ty, curExp): bind) :acc PConstr (Constructor nam _) _ | nam /= name -> acc | otherwise -> (nextPats, branch, bind):acc) [] (zip3 pats branches binds) in F.ConstrAlt (desugarConstructor d ctr) (go exprs' pats' branches' binds') makeDefault = let (pats', branches', binds') = unzip3 $ foldr (\(curPattern:rest, branch, bind) acc -> case curPattern of PWildcard -> (rest , branch, bind) :acc PVar nam ty -> (rest, branch, (nam, ty, curExp'): bind) :acc _ -> acc) [] (zip3 pats branches binds) in [F.Default $ go (tail exprs) pats' branches' binds']
3,666
decisionTree (d,g) = go where -- no pattern left. Then the first expr will be the result go [] _ branches binds = desugarExpr (d,g) $ noLoc $ LetOut NonRec (head binds) (head branches) go exprs pats branches binds | all isWildcardOrVar patshead = go (tail exprs) (map tail pats) branches (zipWith (\pat bind -> case head pat of PVar nam ty -> (nam, ty, curExp'):bind _ -> bind ) pats binds) | null missingconstrs = F.Case (desugarExpr (d,g) curExp') (map makeNewAltFromCtr appearconstrs) | otherwise = F.Case (desugarExpr (d,g) curExp') (map makeNewAltFromCtr appearconstrs ++ makeDefault) where patshead = map head pats curExp' = head exprs (appearconstrs, missingconstrs) = constrInfo patshead makeNewAltFromCtr ctr@(Constructor name params) = let len = length params - 1 Datatype dtnam _ _ = last params ctrclass = '$': dtnam ++ ".$" ++ dtnam ++ '$':name curExp = noLoc $ JMethod (NonStatic (noLoc $ JField (Static ctrclass) "class" (JClass $ "Class<" ++ ctrclass++ ">"))) "cast" [curExp'] ctrclass javafieldexprs = zipWith (\num pam -> noLoc $ JField (NonStatic curExp) (fieldtag ++ show num) pam) [1..len] params exprs' = javafieldexprs ++ tail exprs (pats', branches', binds') = unzip3 $ foldr (\(curPattern:rest, branch, bind) acc -> let nextPats = extractorsubpattern name len curPattern ++ rest in case curPattern of PWildcard -> ( nextPats, branch, bind) :acc PVar nam ty -> (nextPats, branch, (nam, ty, curExp): bind) :acc PConstr (Constructor nam _) _ | nam /= name -> acc | otherwise -> (nextPats, branch, bind):acc) [] (zip3 pats branches binds) in F.ConstrAlt (desugarConstructor d ctr) (go exprs' pats' branches' binds') makeDefault = let (pats', branches', binds') = unzip3 $ foldr (\(curPattern:rest, branch, bind) acc -> case curPattern of PWildcard -> (rest , branch, bind) :acc PVar nam ty -> (rest, branch, (nam, ty, curExp'): bind) :acc _ -> acc) [] (zip3 pats branches binds) in [F.Default $ go (tail exprs) pats' branches' binds']
3,518
false
true
7
24
1,898
958
502
456
null
null
fizruk/ffi-dsl
examples/free/DSL.hs
bsd-3-clause
-- | Input command. input :: DSL String input = liftF $ Input id
64
input :: DSL String input = liftF $ Input id
44
input = liftF $ Input id
24
true
true
1
6
13
25
11
14
null
null
hferreiro/replay
compiler/cmm/CLabel.hs
bsd-3-clause
mkBitmapLabel :: Unique -> CLabel mkLargeSRTLabel uniq = LargeSRTLabel uniq
88
mkBitmapLabel :: Unique -> CLabel mkLargeSRTLabel uniq = LargeSRTLabel uniq
88
mkLargeSRTLabel uniq = LargeSRTLabel uniq
52
false
true
0
5
22
21
10
11
null
null
brendanhay/gogol
gogol-sourcerepo/gen/Network/Google/Resource/SourceRepo/Projects/UpdateConfig.hs
mpl-2.0
-- | Legacy upload protocol for media (e.g. \"media\", \"multipart\"). pucUploadType :: Lens' ProjectsUpdateConfig (Maybe Text) pucUploadType = lens _pucUploadType (\ s a -> s{_pucUploadType = a})
204
pucUploadType :: Lens' ProjectsUpdateConfig (Maybe Text) pucUploadType = lens _pucUploadType (\ s a -> s{_pucUploadType = a})
133
pucUploadType = lens _pucUploadType (\ s a -> s{_pucUploadType = a})
76
true
true
1
9
34
52
25
27
null
null
ezyang/ghc
testsuite/tests/stranal/sigs/T12370.hs
bsd-3-clause
foo :: (Int, Int) -> Int foo (x,y) = x + y
42
foo :: (Int, Int) -> Int foo (x,y) = x + y
42
foo (x,y) = x + y
17
false
true
0
6
11
34
19
15
null
null
joashc/neuralnet
neuralNet.hs
gpl-2.0
randomLayer :: Int -> Int -> IO Layer randomLayer numNeurons numWeights = do ns <- replicateM numNeurons $ randomNeuron numWeights return $ Layer ns
157
randomLayer :: Int -> Int -> IO Layer randomLayer numNeurons numWeights = do ns <- replicateM numNeurons $ randomNeuron numWeights return $ Layer ns
157
randomLayer numNeurons numWeights = do ns <- replicateM numNeurons $ randomNeuron numWeights return $ Layer ns
119
false
true
0
10
32
59
25
34
null
null
silky/ImplicitCAD
Graphics/Implicit/Export/Render/RefineSegs.hs
gpl-2.0
-- detail adds new points to a polyline to add more detail. detail :: Int -> ℝ -> (ℝ2 -> ℝ) -> [ℝ2] -> [ℝ2] detail n res obj [p1, p2] | n < 2 = let mid = centroid [p1,p2] midval = obj mid in if abs midval < res / 40 then [p1, p2] else let normal = (\(a,b) -> (b, -a)) $ normalized (p2 ^-^ p1) derivN = -(obj (mid ^-^ (normal ^* (midval/2))) - midval) * (2/midval) in if abs derivN > 0.5 && abs derivN < 2 && abs (midval/derivN) < 3*res then let mid' = mid ^-^ (normal ^* (midval / derivN)) in detail (n+1) res obj [p1, mid'] ++ tail (detail (n+1) res obj [mid', p2] ) else let derivX = (obj (mid ^+^ (res/100, 0)) - midval)*100/res derivY = (obj (mid ^+^ (0, res/100)) - midval)*100/res derivNormSq = derivX**2 + derivY**2 in if abs derivNormSq > 0.09 && abs derivNormSq < 4 && abs (midval/sqrt derivNormSq) < 3*res then let (dX, dY) = (- derivX*midval/derivNormSq, - derivY*midval/derivNormSq) mid' = mid ^+^ (dX, dY) midval' = obj mid' posRatio = midval/(midval - midval') mid'' = mid ^+^ (dX*posRatio, dY*posRatio) in detail (n+1) res obj [p1, mid''] ++ tail (detail (n+1) res obj [mid'', p2] ) else [p1, p2]
1,283
detail :: Int -> ℝ -> (ℝ2 -> ℝ) -> [ℝ2] -> [ℝ2] detail n res obj [p1, p2] | n < 2 = let mid = centroid [p1,p2] midval = obj mid in if abs midval < res / 40 then [p1, p2] else let normal = (\(a,b) -> (b, -a)) $ normalized (p2 ^-^ p1) derivN = -(obj (mid ^-^ (normal ^* (midval/2))) - midval) * (2/midval) in if abs derivN > 0.5 && abs derivN < 2 && abs (midval/derivN) < 3*res then let mid' = mid ^-^ (normal ^* (midval / derivN)) in detail (n+1) res obj [p1, mid'] ++ tail (detail (n+1) res obj [mid', p2] ) else let derivX = (obj (mid ^+^ (res/100, 0)) - midval)*100/res derivY = (obj (mid ^+^ (0, res/100)) - midval)*100/res derivNormSq = derivX**2 + derivY**2 in if abs derivNormSq > 0.09 && abs derivNormSq < 4 && abs (midval/sqrt derivNormSq) < 3*res then let (dX, dY) = (- derivX*midval/derivNormSq, - derivY*midval/derivNormSq) mid' = mid ^+^ (dX, dY) midval' = obj mid' posRatio = midval/(midval - midval') mid'' = mid ^+^ (dX*posRatio, dY*posRatio) in detail (n+1) res obj [p1, mid''] ++ tail (detail (n+1) res obj [mid'', p2] ) else [p1, p2]
1,222
detail n res obj [p1, p2] | n < 2 = let mid = centroid [p1,p2] midval = obj mid in if abs midval < res / 40 then [p1, p2] else let normal = (\(a,b) -> (b, -a)) $ normalized (p2 ^-^ p1) derivN = -(obj (mid ^-^ (normal ^* (midval/2))) - midval) * (2/midval) in if abs derivN > 0.5 && abs derivN < 2 && abs (midval/derivN) < 3*res then let mid' = mid ^-^ (normal ^* (midval / derivN)) in detail (n+1) res obj [p1, mid'] ++ tail (detail (n+1) res obj [mid', p2] ) else let derivX = (obj (mid ^+^ (res/100, 0)) - midval)*100/res derivY = (obj (mid ^+^ (0, res/100)) - midval)*100/res derivNormSq = derivX**2 + derivY**2 in if abs derivNormSq > 0.09 && abs derivNormSq < 4 && abs (midval/sqrt derivNormSq) < 3*res then let (dX, dY) = (- derivX*midval/derivNormSq, - derivY*midval/derivNormSq) mid' = mid ^+^ (dX, dY) midval' = obj mid' posRatio = midval/(midval - midval') mid'' = mid ^+^ (dX*posRatio, dY*posRatio) in detail (n+1) res obj [p1, mid''] ++ tail (detail (n+1) res obj [mid'', p2] ) else [p1, p2]
1,174
true
true
0
24
386
666
355
311
null
null
tonicebrian/sgf
Data/SGF/Types.hs
bsd-3-clause
-- function instances of Eq, Ord, Show, Read {{{ mapFromFunction f = Map.fromList [(k, f k) | k <- [minBound..maxBound]]
120
mapFromFunction f = Map.fromList [(k, f k) | k <- [minBound..maxBound]]
71
mapFromFunction f = Map.fromList [(k, f k) | k <- [minBound..maxBound]]
71
true
false
0
9
19
40
21
19
null
null
input-output-hk/pos-haskell-prototype
core/test/Test/Pos/Core/Gen.hs
mit
genVssMaxTTL :: Gen VssMaxTTL genVssMaxTTL = VssMaxTTL <$> genWord32
68
genVssMaxTTL :: Gen VssMaxTTL genVssMaxTTL = VssMaxTTL <$> genWord32
68
genVssMaxTTL = VssMaxTTL <$> genWord32
38
false
true
0
5
8
18
9
9
null
null
NorfairKing/eden
src/Test.hs
gpl-2.0
test TargetAllProblems = testProblems
40
test TargetAllProblems = testProblems
40
test TargetAllProblems = testProblems
40
false
false
0
5
6
9
4
5
null
null
andreasfrom/truths
Main.hs
mit
main :: IO () main = putStrLn "Enter a proposition (or \"exit\"):" >> getArgs >>= fltr >>= \(t,f) -> forever $ do prop <- readline "> " case prop of Nothing -> return () Just "exit" -> exitSuccess Just line -> addHistory line >> case parseInput (T.pack line) of Left e -> print e Right prop' -> case prop' of Single p -> print $ defaultTable (showBool t f) p Context p -> putStrLn $ T.unpack $ contextTable p Latex p -> putStrLn $ T.unpack $ latexTable p Tableau tab -> renderTab "semtab.svg" tab Equivalence p q -> case equivalent (showBool t f) p q of Left e -> putStrLn $ T.unpack e Right () -> putStrLn $ T.unpack t where fltr [x,y] = return (T.pack x, T.pack y) fltr _ = return ("T", "F")
799
main :: IO () main = putStrLn "Enter a proposition (or \"exit\"):" >> getArgs >>= fltr >>= \(t,f) -> forever $ do prop <- readline "> " case prop of Nothing -> return () Just "exit" -> exitSuccess Just line -> addHistory line >> case parseInput (T.pack line) of Left e -> print e Right prop' -> case prop' of Single p -> print $ defaultTable (showBool t f) p Context p -> putStrLn $ T.unpack $ contextTable p Latex p -> putStrLn $ T.unpack $ latexTable p Tableau tab -> renderTab "semtab.svg" tab Equivalence p q -> case equivalent (showBool t f) p q of Left e -> putStrLn $ T.unpack e Right () -> putStrLn $ T.unpack t where fltr [x,y] = return (T.pack x, T.pack y) fltr _ = return ("T", "F")
799
main = putStrLn "Enter a proposition (or \"exit\"):" >> getArgs >>= fltr >>= \(t,f) -> forever $ do prop <- readline "> " case prop of Nothing -> return () Just "exit" -> exitSuccess Just line -> addHistory line >> case parseInput (T.pack line) of Left e -> print e Right prop' -> case prop' of Single p -> print $ defaultTable (showBool t f) p Context p -> putStrLn $ T.unpack $ contextTable p Latex p -> putStrLn $ T.unpack $ latexTable p Tableau tab -> renderTab "semtab.svg" tab Equivalence p q -> case equivalent (showBool t f) p q of Left e -> putStrLn $ T.unpack e Right () -> putStrLn $ T.unpack t where fltr [x,y] = return (T.pack x, T.pack y) fltr _ = return ("T", "F")
785
false
true
0
25
240
351
162
189
null
null
dmjio/lifted-async
src/Control/Concurrent/Async/Lifted.hs
bsd-3-clause
-- | Generalized version of 'A.withAsync'. withAsync :: MonadBaseControl IO m => m a -> (Async (StM m a) -> m b) -> m b withAsync = withAsyncUsing async
160
withAsync :: MonadBaseControl IO m => m a -> (Async (StM m a) -> m b) -> m b withAsync = withAsyncUsing async
117
withAsync = withAsyncUsing async
32
true
true
0
13
36
64
29
35
null
null
alang9/deque
Data/Deque/NonCat.hs
bsd-3-clause
toFringe a@B5{} b@B5{} = RX a b
31
toFringe a@B5{} b@B5{} = RX a b
31
toFringe a@B5{} b@B5{} = RX a b
31
false
false
0
7
6
30
15
15
null
null
micknelso/language-c
src/Language/CFamily/C/Analysis/AstAnalysis.hs
bsd-3-clause
ctCExpr fn (CUnary _ e1 _) = ctCExpr fn e1
50
ctCExpr fn (CUnary _ e1 _) = ctCExpr fn e1
50
ctCExpr fn (CUnary _ e1 _) = ctCExpr fn e1
50
false
false
0
7
17
26
12
14
null
null
vikraman/ghc
compiler/coreSyn/CoreUnfold.hs
bsd-3-clause
computeDiscount :: DynFlags -> [Int] -> Int -> [ArgSummary] -> CallCtxt -> Int computeDiscount dflags arg_discounts res_discount arg_infos cont_info -- We multiple the raw discounts (args_discount and result_discount) -- ty opt_UnfoldingKeenessFactor because the former have to do with -- *size* whereas the discounts imply that there's some extra -- *efficiency* to be gained (e.g. beta reductions, case reductions) -- by inlining. = 10 -- Discount of 10 because the result replaces the call -- so we count 10 for the function itself + 10 * length actual_arg_discounts -- Discount of 10 for each arg supplied, -- because the result replaces the call + round (ufKeenessFactor dflags * fromIntegral (total_arg_discount + res_discount')) where actual_arg_discounts = zipWith mk_arg_discount arg_discounts arg_infos total_arg_discount = sum actual_arg_discounts mk_arg_discount _ TrivArg = 0 mk_arg_discount _ NonTrivArg = 10 mk_arg_discount discount ValueArg = discount res_discount' | LT <- arg_discounts `compareLength` arg_infos = res_discount -- Over-saturated | otherwise = case cont_info of BoringCtxt -> 0 CaseCtxt -> res_discount -- Presumably a constructor ValAppCtxt -> res_discount -- Presumably a function _ -> 40 `min` res_discount -- ToDo: this 40 `min` res_discount doesn't seem right -- for DiscArgCtxt it shouldn't matter because the function will -- get the arg discount for any non-triv arg -- for RuleArgCtxt we do want to be keener to inline; but not only -- constructor results -- for RhsCtxt I suppose that exposing a data con is good in general -- And 40 seems very arbitrary -- -- res_discount can be very large when a function returns -- constructors; but we only want to invoke that large discount -- when there's a case continuation. -- Otherwise we, rather arbitrarily, threshold it. Yuk. -- But we want to aovid inlining large functions that return -- constructors into contexts that are simply "interesting"
2,502
computeDiscount :: DynFlags -> [Int] -> Int -> [ArgSummary] -> CallCtxt -> Int computeDiscount dflags arg_discounts res_discount arg_infos cont_info -- We multiple the raw discounts (args_discount and result_discount) -- ty opt_UnfoldingKeenessFactor because the former have to do with -- *size* whereas the discounts imply that there's some extra -- *efficiency* to be gained (e.g. beta reductions, case reductions) -- by inlining. = 10 -- Discount of 10 because the result replaces the call -- so we count 10 for the function itself + 10 * length actual_arg_discounts -- Discount of 10 for each arg supplied, -- because the result replaces the call + round (ufKeenessFactor dflags * fromIntegral (total_arg_discount + res_discount')) where actual_arg_discounts = zipWith mk_arg_discount arg_discounts arg_infos total_arg_discount = sum actual_arg_discounts mk_arg_discount _ TrivArg = 0 mk_arg_discount _ NonTrivArg = 10 mk_arg_discount discount ValueArg = discount res_discount' | LT <- arg_discounts `compareLength` arg_infos = res_discount -- Over-saturated | otherwise = case cont_info of BoringCtxt -> 0 CaseCtxt -> res_discount -- Presumably a constructor ValAppCtxt -> res_discount -- Presumably a function _ -> 40 `min` res_discount -- ToDo: this 40 `min` res_discount doesn't seem right -- for DiscArgCtxt it shouldn't matter because the function will -- get the arg discount for any non-triv arg -- for RuleArgCtxt we do want to be keener to inline; but not only -- constructor results -- for RhsCtxt I suppose that exposing a data con is good in general -- And 40 seems very arbitrary -- -- res_discount can be very large when a function returns -- constructors; but we only want to invoke that large discount -- when there's a case continuation. -- Otherwise we, rather arbitrarily, threshold it. Yuk. -- But we want to aovid inlining large functions that return -- constructors into contexts that are simply "interesting"
2,502
computeDiscount dflags arg_discounts res_discount arg_infos cont_info -- We multiple the raw discounts (args_discount and result_discount) -- ty opt_UnfoldingKeenessFactor because the former have to do with -- *size* whereas the discounts imply that there's some extra -- *efficiency* to be gained (e.g. beta reductions, case reductions) -- by inlining. = 10 -- Discount of 10 because the result replaces the call -- so we count 10 for the function itself + 10 * length actual_arg_discounts -- Discount of 10 for each arg supplied, -- because the result replaces the call + round (ufKeenessFactor dflags * fromIntegral (total_arg_discount + res_discount')) where actual_arg_discounts = zipWith mk_arg_discount arg_discounts arg_infos total_arg_discount = sum actual_arg_discounts mk_arg_discount _ TrivArg = 0 mk_arg_discount _ NonTrivArg = 10 mk_arg_discount discount ValueArg = discount res_discount' | LT <- arg_discounts `compareLength` arg_infos = res_discount -- Over-saturated | otherwise = case cont_info of BoringCtxt -> 0 CaseCtxt -> res_discount -- Presumably a constructor ValAppCtxt -> res_discount -- Presumably a function _ -> 40 `min` res_discount -- ToDo: this 40 `min` res_discount doesn't seem right -- for DiscArgCtxt it shouldn't matter because the function will -- get the arg discount for any non-triv arg -- for RuleArgCtxt we do want to be keener to inline; but not only -- constructor results -- for RhsCtxt I suppose that exposing a data con is good in general -- And 40 seems very arbitrary -- -- res_discount can be very large when a function returns -- constructors; but we only want to invoke that large discount -- when there's a case continuation. -- Otherwise we, rather arbitrarily, threshold it. Yuk. -- But we want to aovid inlining large functions that return -- constructors into contexts that are simply "interesting"
2,407
false
true
4
10
861
232
128
104
null
null
andreagenso/java2scala
test/J2s/Scanner/Test.hs
apache-2.0
tss30 = scanner (path ++ "workspaceclipse_haskell/java2scala/test/J2s/Parser/30primitiveType.java")
99
tss30 = scanner (path ++ "workspaceclipse_haskell/java2scala/test/J2s/Parser/30primitiveType.java")
99
tss30 = scanner (path ++ "workspaceclipse_haskell/java2scala/test/J2s/Parser/30primitiveType.java")
99
false
false
1
7
5
20
8
12
null
null
florianpilz/autotool
src/Spielbaum/Spielbaum.hs
gpl-2.0
-- aus der Liste ( Knoten, Nachfolger ( Knoten ) ) und der anfänglich leeren Liste -- von SpielbaumLabels wird die Liste der SpielbaumLabel berechnet renameNodes :: [ ( String , [ String ] ) ] -> [ SpielbaumLabel ] -> [ SpielbaumLabel ] renameNodes ordered old | ordered == [] = [] | otherwise = if (( snd $ head ordered) == [] ) then new_label : renameNodes (tail ordered) (new_label:old) else if ( berechenbares_label ) then (berechne_label) : renameNodes (tail ordered) (berechne_label:old) else (renameNodes ((tail ordered)++[head ordered]) old) where new_label = SpielbaumLabel { label = fst $ head ordered , gv = V , grundy = 0 } berechenbares_label = and (map2 is_in (snd $ head ordered) old) berechne_label = SpielbaumLabel { label = fst $ head ordered , gv = berechne_gv , grundy = berechne_gr } right_labels = map2 right_label (snd $ head ordered) old berechne_gr = mex ( map grundy right_labels ) berechne_gv = if ( [G] == ( setToList $ mkSet ( map gv right_labels ) ) ) then V else G -- erzeugt aus der Knoten- und Nachfolgerliste und der Liste der SpielbaumLabel -- die Liste der Kanten im Graphen, indem die Suchfunktion auf die Liste gemapt wird
1,702
renameNodes :: [ ( String , [ String ] ) ] -> [ SpielbaumLabel ] -> [ SpielbaumLabel ] renameNodes ordered old | ordered == [] = [] | otherwise = if (( snd $ head ordered) == [] ) then new_label : renameNodes (tail ordered) (new_label:old) else if ( berechenbares_label ) then (berechne_label) : renameNodes (tail ordered) (berechne_label:old) else (renameNodes ((tail ordered)++[head ordered]) old) where new_label = SpielbaumLabel { label = fst $ head ordered , gv = V , grundy = 0 } berechenbares_label = and (map2 is_in (snd $ head ordered) old) berechne_label = SpielbaumLabel { label = fst $ head ordered , gv = berechne_gv , grundy = berechne_gr } right_labels = map2 right_label (snd $ head ordered) old berechne_gr = mex ( map grundy right_labels ) berechne_gv = if ( [G] == ( setToList $ mkSet ( map gv right_labels ) ) ) then V else G -- erzeugt aus der Knoten- und Nachfolgerliste und der Liste der SpielbaumLabel -- die Liste der Kanten im Graphen, indem die Suchfunktion auf die Liste gemapt wird
1,552
renameNodes ordered old | ordered == [] = [] | otherwise = if (( snd $ head ordered) == [] ) then new_label : renameNodes (tail ordered) (new_label:old) else if ( berechenbares_label ) then (berechne_label) : renameNodes (tail ordered) (berechne_label:old) else (renameNodes ((tail ordered)++[head ordered]) old) where new_label = SpielbaumLabel { label = fst $ head ordered , gv = V , grundy = 0 } berechenbares_label = and (map2 is_in (snd $ head ordered) old) berechne_label = SpielbaumLabel { label = fst $ head ordered , gv = berechne_gv , grundy = berechne_gr } right_labels = map2 right_label (snd $ head ordered) old berechne_gr = mex ( map grundy right_labels ) berechne_gv = if ( [G] == ( setToList $ mkSet ( map gv right_labels ) ) ) then V else G -- erzeugt aus der Knoten- und Nachfolgerliste und der Liste der SpielbaumLabel -- die Liste der Kanten im Graphen, indem die Suchfunktion auf die Liste gemapt wird
1,465
true
true
0
14
745
354
193
161
null
null
ksaveljev/chip-8-emulator
Chip8/Emulator/SDL.hs
mit
decTimer :: STRef RealWorld Word8 -> IO () decTimer timer = do v <- stToIO $ readSTRef timer when (v > 0) (stToIO $ writeSTRef timer (v - 1))
149
decTimer :: STRef RealWorld Word8 -> IO () decTimer timer = do v <- stToIO $ readSTRef timer when (v > 0) (stToIO $ writeSTRef timer (v - 1))
149
decTimer timer = do v <- stToIO $ readSTRef timer when (v > 0) (stToIO $ writeSTRef timer (v - 1))
106
false
true
0
13
36
80
37
43
null
null
reflex-frp/reflex-dom
reflex-dom-core/src/Reflex/Dom/Main.hs
bsd-3-clause
mainWidgetWithHead :: (forall x. Widget x ()) -> (forall x. Widget x ()) -> JSM () mainWidgetWithHead h b = withJSContextSingletonMono $ \jsSing -> do doc <- currentDocumentUnchecked headElement <- getHeadUnchecked doc attachWidget headElement jsSing h body <- getBodyUnchecked doc attachWidget body jsSing b
320
mainWidgetWithHead :: (forall x. Widget x ()) -> (forall x. Widget x ()) -> JSM () mainWidgetWithHead h b = withJSContextSingletonMono $ \jsSing -> do doc <- currentDocumentUnchecked headElement <- getHeadUnchecked doc attachWidget headElement jsSing h body <- getBodyUnchecked doc attachWidget body jsSing b
320
mainWidgetWithHead h b = withJSContextSingletonMono $ \jsSing -> do doc <- currentDocumentUnchecked headElement <- getHeadUnchecked doc attachWidget headElement jsSing h body <- getBodyUnchecked doc attachWidget body jsSing b
237
false
true
0
11
55
119
55
64
null
null
ssaavedra/liquidhaskell
benchmarks/containers-0.5.0.0/Data/Map/Base1.hs
bsd-3-clause
-- | /O(n*log n)/. Build a map from a list of key\/value pairs with a combining function. See also 'fromAscListWith'. -- -- > fromListWith (++) [(5,"a"), (5,"b"), (3,"b"), (3,"a"), (5,"a")] == fromList [(3, "ab"), (5, "aba")] -- > fromListWith (++) [] == empty fromListWith :: Ord k => (a -> a -> a) -> [(k,a)] -> Map k a fromListWith f xs = fromListWithKey (\_ x y -> f x y) xs
381
fromListWith :: Ord k => (a -> a -> a) -> [(k,a)] -> Map k a fromListWith f xs = fromListWithKey (\_ x y -> f x y) xs
119
fromListWith f xs = fromListWithKey (\_ x y -> f x y) xs
58
true
true
0
10
74
88
45
43
null
null
nshimaza/cisco-spark-api
webex-teams-api/app/Main.hs
mit
{- Common command line option parsers -} countParser :: Int -> Parser Int countParser defaultCount = option auto ( long "count" <> short 'c' <> metavar "MAX_ITEMS" <> value (if defaultCount == def then maxBound else defaultCount) <> help "Maximum number of items to print" )
310
countParser :: Int -> Parser Int countParser defaultCount = option auto ( long "count" <> short 'c' <> metavar "MAX_ITEMS" <> value (if defaultCount == def then maxBound else defaultCount) <> help "Maximum number of items to print" )
265
countParser defaultCount = option auto ( long "count" <> short 'c' <> metavar "MAX_ITEMS" <> value (if defaultCount == def then maxBound else defaultCount) <> help "Maximum number of items to print" )
232
true
true
0
12
81
82
38
44
null
null
kisp/ksquant2
MeasureSiblingMerge.hs
gpl-3.0
converge :: (a -> a -> Bool) -> [a] -> a converge p (x:ys@(y:_)) | p x y = y | otherwise = converge p ys
116
converge :: (a -> a -> Bool) -> [a] -> a converge p (x:ys@(y:_)) | p x y = y | otherwise = converge p ys
116
converge p (x:ys@(y:_)) | p x y = y | otherwise = converge p ys
75
false
true
1
10
37
78
40
38
null
null
nushio3/ghc
compiler/prelude/PrelNames.hs
bsd-3-clause
realFloatClassName = clsQual gHC_FLOAT (fsLit "RealFloat") realFloatClassKey
76
realFloatClassName = clsQual gHC_FLOAT (fsLit "RealFloat") realFloatClassKey
76
realFloatClassName = clsQual gHC_FLOAT (fsLit "RealFloat") realFloatClassKey
76
false
false
0
7
6
19
9
10
null
null
dmbarbour/awelon
hsrc/AO/Code.hs
bsd-3-clause
- characters '"' and '\n' may not be part of inline text inlinableChr :: Char -> Bool inlinableChr c = not ('\n' == c || '"' == c)
131
inlinableChr :: Char -> Bool inlinableChr c = not ('\n' == c || '"' == c)
73
inlinableChr c = not ('\n' == c || '"' == c)
44
true
true
1
9
28
46
24
22
null
null
shlevy/ghc
compiler/hsSyn/HsDecls.hs
bsd-3-clause
hsConDeclArgTys :: HsConDeclDetails pass -> [LBangType pass] hsConDeclArgTys (PrefixCon tys) = tys
101
hsConDeclArgTys :: HsConDeclDetails pass -> [LBangType pass] hsConDeclArgTys (PrefixCon tys) = tys
101
hsConDeclArgTys (PrefixCon tys) = tys
40
false
true
0
7
14
33
16
17
null
null
qpliu/esolang
01_/hs/compiler2/GenLLVM.hs
gpl-3.0
writeNewLocal :: String -> GenLLVM Local writeNewLocal code = do writeCode " " local <- newLocal writeLocal local (" = " ++ code) return local
158
writeNewLocal :: String -> GenLLVM Local writeNewLocal code = do writeCode " " local <- newLocal writeLocal local (" = " ++ code) return local
158
writeNewLocal code = do writeCode " " local <- newLocal writeLocal local (" = " ++ code) return local
117
false
true
0
9
40
55
24
31
null
null
tolysz/prepare-ghcjs
spec-lts8/base/Data/OldList.hs
bsd-3-clause
-- | The '\\' function is list difference (non-associative). -- In the result of @xs@ '\\' @ys@, the first occurrence of each element of -- @ys@ in turn (if any) has been removed from @xs@. Thus -- -- > (xs ++ ys) \\ xs == ys. -- -- It is a special case of 'deleteFirstsBy', which allows the programmer -- to supply their own equality test. (\\) :: (Eq a) => [a] -> [a] -> [a] (\\) = foldl (flip delete)
444
(\\) :: (Eq a) => [a] -> [a] -> [a] (\\) = foldl (flip delete)
101
(\\) = foldl (flip delete)
46
true
true
0
8
121
58
37
21
null
null
gabesoft/kapi
src/Persistence/Xandar/Common.hs
bsd-3-clause
userIndices :: [Index] userIndices = [ Index { iColl = recordCollection userDefinition , iKey = ["email" =: (1 :: Int)] , iName = "email_unique" , iUnique = True , iDropDups = True , iExpireAfterSeconds = Nothing } ]
248
userIndices :: [Index] userIndices = [ Index { iColl = recordCollection userDefinition , iKey = ["email" =: (1 :: Int)] , iName = "email_unique" , iUnique = True , iDropDups = True , iExpireAfterSeconds = Nothing } ]
248
userIndices = [ Index { iColl = recordCollection userDefinition , iKey = ["email" =: (1 :: Int)] , iName = "email_unique" , iUnique = True , iDropDups = True , iExpireAfterSeconds = Nothing } ]
225
false
true
0
10
69
71
44
27
null
null
brendanhay/gogol
gogol-games-management/gen/Network/Google/Resource/GamesManagement/Achievements/ResetAllForAllPlayers.hs
mpl-2.0
-- | OAuth access token. arafapAccessToken :: Lens' AchievementsResetAllForAllPlayers (Maybe Text) arafapAccessToken = lens _arafapAccessToken (\ s a -> s{_arafapAccessToken = a})
187
arafapAccessToken :: Lens' AchievementsResetAllForAllPlayers (Maybe Text) arafapAccessToken = lens _arafapAccessToken (\ s a -> s{_arafapAccessToken = a})
162
arafapAccessToken = lens _arafapAccessToken (\ s a -> s{_arafapAccessToken = a})
88
true
true
1
9
29
51
25
26
null
null
nickng/gong
StuffParams.hs
apache-2.0
twored' = do t <- twored return $ pprintEqn t -- -- Testing stuff -- --eqnl :: [(String,[String],GoType)] -> GoType -> Eqn --eqnl l t = EqnSys (bind (rec (map (\(s,c,t1) -> (string2Name s ,Embed(bind (map string2Name c) t1) )) l)) t) --testSubst = tvar "s" "c" -- test1 = eqn "t" "c" (Send (namify "c") (tvar "t" "c")) (new "c" (tvar "t" "c")) -- -- Testing re-use of a in eq s. Should be free [OK] -- test2 = eqnl [("t",["a"] , (Send (namify "a") (tvar "t" "a")) ) , -- ("s" ,["b"] ,(Recv (namify "a") (tvar "s" "b")) ) ] (new "c" (Par (tvar "t" "c") (tvar "s" "c"))) -- -- Baseline for recursive stuff [OK] -- test3 = eqnl [("t",["a"] , (Send (namify "a") (tvar "t" "a")) ) , -- ("s" ,["b"] ,(Recv (namify "b") (tvar "s" "b")) ) ] (new "c" (Par (tvar "t" "c") (tvar "s" "c"))) -- -- Testing mutually recursive binders [OK] -- test4 = eqnl [("t",["a"] , (Send (namify "a") (tvar "s" "a")) ) , -- ("s" ,["b"] ,(Recv (namify "b") (tvar "t" "b")) ) ] (new "c" (Par (tvar "t" "c") (tvar "s" "c"))) -- -- Testing for free "a" in main [OK] -- test5 = eqnl [("t",["a"] , (Send (namify "a") (tvar "t" "a")) ) , -- ("s" ,["b"] ,(Recv (namify "b") (tvar "s" "b")) ) ] (new "c" (Par (tvar "t" "a") (tvar "s" "c"))) -- -- Testing for free rec var in main [OK] -- test6 = eqnl [("t",["a"] , (Send (namify "a") (tvar "t" "a")) ) , -- ("s" ,["b"] ,(Recv (namify "b") (tvar "s" "b")) ) ] (new "c" (Par (tvar "d" "a") (tvar "s" "c"))) -- -- All should be aeq to test3 [OK All] -- test3aeq1 = eqnl [("t",["a"] , (Send (namify "a") (tvar "t" "a")) ) , -- ("s" ,["b"] ,(Recv (namify "b") (tvar "s" "b")) ) ] (new "d" (Par (tvar "t" "d") (tvar "s" "d"))) -- test3aeq2 = eqnl [("xpto",["a"] , (Send (namify "a") (tvar "xpto" "a")) ) , -- ("s" ,["b"] ,(Recv (namify "b") (tvar "s" "b")) ) ] (new "d" (Par (tvar "xpto" "d") (tvar "s" "d"))) -- test3aeq3 = eqnl [("t",["b"] , (Send (namify "b") (tvar "t" "b")) ) , -- ("s" ,["b"] ,(Recv (namify "b") (tvar "s" "b")) ) ] (new "d" (Par (tvar "t" "d") (tvar "s" "d"))) -- -- Won't be -- test3aeq4 = eqnl [("s" ,["b"] ,(Recv (namify "b") (tvar "s" "b")) ) , -- ("t",["a"] , (Send (namify "a") (tvar "t" "a")) ) ] (new "c" (Par (tvar "t" "c") (tvar "s" "c"))) -- Unfolding Test -- --(Bind (Rec [(Name GoType, Embed (Bind [Name String] GoType))]) GoType)
2,438
twored' = do t <- twored return $ pprintEqn t -- -- Testing stuff -- --eqnl :: [(String,[String],GoType)] -> GoType -> Eqn --eqnl l t = EqnSys (bind (rec (map (\(s,c,t1) -> (string2Name s ,Embed(bind (map string2Name c) t1) )) l)) t) --testSubst = tvar "s" "c" -- test1 = eqn "t" "c" (Send (namify "c") (tvar "t" "c")) (new "c" (tvar "t" "c")) -- -- Testing re-use of a in eq s. Should be free [OK] -- test2 = eqnl [("t",["a"] , (Send (namify "a") (tvar "t" "a")) ) , -- ("s" ,["b"] ,(Recv (namify "a") (tvar "s" "b")) ) ] (new "c" (Par (tvar "t" "c") (tvar "s" "c"))) -- -- Baseline for recursive stuff [OK] -- test3 = eqnl [("t",["a"] , (Send (namify "a") (tvar "t" "a")) ) , -- ("s" ,["b"] ,(Recv (namify "b") (tvar "s" "b")) ) ] (new "c" (Par (tvar "t" "c") (tvar "s" "c"))) -- -- Testing mutually recursive binders [OK] -- test4 = eqnl [("t",["a"] , (Send (namify "a") (tvar "s" "a")) ) , -- ("s" ,["b"] ,(Recv (namify "b") (tvar "t" "b")) ) ] (new "c" (Par (tvar "t" "c") (tvar "s" "c"))) -- -- Testing for free "a" in main [OK] -- test5 = eqnl [("t",["a"] , (Send (namify "a") (tvar "t" "a")) ) , -- ("s" ,["b"] ,(Recv (namify "b") (tvar "s" "b")) ) ] (new "c" (Par (tvar "t" "a") (tvar "s" "c"))) -- -- Testing for free rec var in main [OK] -- test6 = eqnl [("t",["a"] , (Send (namify "a") (tvar "t" "a")) ) , -- ("s" ,["b"] ,(Recv (namify "b") (tvar "s" "b")) ) ] (new "c" (Par (tvar "d" "a") (tvar "s" "c"))) -- -- All should be aeq to test3 [OK All] -- test3aeq1 = eqnl [("t",["a"] , (Send (namify "a") (tvar "t" "a")) ) , -- ("s" ,["b"] ,(Recv (namify "b") (tvar "s" "b")) ) ] (new "d" (Par (tvar "t" "d") (tvar "s" "d"))) -- test3aeq2 = eqnl [("xpto",["a"] , (Send (namify "a") (tvar "xpto" "a")) ) , -- ("s" ,["b"] ,(Recv (namify "b") (tvar "s" "b")) ) ] (new "d" (Par (tvar "xpto" "d") (tvar "s" "d"))) -- test3aeq3 = eqnl [("t",["b"] , (Send (namify "b") (tvar "t" "b")) ) , -- ("s" ,["b"] ,(Recv (namify "b") (tvar "s" "b")) ) ] (new "d" (Par (tvar "t" "d") (tvar "s" "d"))) -- -- Won't be -- test3aeq4 = eqnl [("s" ,["b"] ,(Recv (namify "b") (tvar "s" "b")) ) , -- ("t",["a"] , (Send (namify "a") (tvar "t" "a")) ) ] (new "c" (Par (tvar "t" "c") (tvar "s" "c"))) -- Unfolding Test -- --(Bind (Rec [(Name GoType, Embed (Bind [Name String] GoType))]) GoType)
2,438
twored' = do t <- twored return $ pprintEqn t -- -- Testing stuff -- --eqnl :: [(String,[String],GoType)] -> GoType -> Eqn --eqnl l t = EqnSys (bind (rec (map (\(s,c,t1) -> (string2Name s ,Embed(bind (map string2Name c) t1) )) l)) t) --testSubst = tvar "s" "c" -- test1 = eqn "t" "c" (Send (namify "c") (tvar "t" "c")) (new "c" (tvar "t" "c")) -- -- Testing re-use of a in eq s. Should be free [OK] -- test2 = eqnl [("t",["a"] , (Send (namify "a") (tvar "t" "a")) ) , -- ("s" ,["b"] ,(Recv (namify "a") (tvar "s" "b")) ) ] (new "c" (Par (tvar "t" "c") (tvar "s" "c"))) -- -- Baseline for recursive stuff [OK] -- test3 = eqnl [("t",["a"] , (Send (namify "a") (tvar "t" "a")) ) , -- ("s" ,["b"] ,(Recv (namify "b") (tvar "s" "b")) ) ] (new "c" (Par (tvar "t" "c") (tvar "s" "c"))) -- -- Testing mutually recursive binders [OK] -- test4 = eqnl [("t",["a"] , (Send (namify "a") (tvar "s" "a")) ) , -- ("s" ,["b"] ,(Recv (namify "b") (tvar "t" "b")) ) ] (new "c" (Par (tvar "t" "c") (tvar "s" "c"))) -- -- Testing for free "a" in main [OK] -- test5 = eqnl [("t",["a"] , (Send (namify "a") (tvar "t" "a")) ) , -- ("s" ,["b"] ,(Recv (namify "b") (tvar "s" "b")) ) ] (new "c" (Par (tvar "t" "a") (tvar "s" "c"))) -- -- Testing for free rec var in main [OK] -- test6 = eqnl [("t",["a"] , (Send (namify "a") (tvar "t" "a")) ) , -- ("s" ,["b"] ,(Recv (namify "b") (tvar "s" "b")) ) ] (new "c" (Par (tvar "d" "a") (tvar "s" "c"))) -- -- All should be aeq to test3 [OK All] -- test3aeq1 = eqnl [("t",["a"] , (Send (namify "a") (tvar "t" "a")) ) , -- ("s" ,["b"] ,(Recv (namify "b") (tvar "s" "b")) ) ] (new "d" (Par (tvar "t" "d") (tvar "s" "d"))) -- test3aeq2 = eqnl [("xpto",["a"] , (Send (namify "a") (tvar "xpto" "a")) ) , -- ("s" ,["b"] ,(Recv (namify "b") (tvar "s" "b")) ) ] (new "d" (Par (tvar "xpto" "d") (tvar "s" "d"))) -- test3aeq3 = eqnl [("t",["b"] , (Send (namify "b") (tvar "t" "b")) ) , -- ("s" ,["b"] ,(Recv (namify "b") (tvar "s" "b")) ) ] (new "d" (Par (tvar "t" "d") (tvar "s" "d"))) -- -- Won't be -- test3aeq4 = eqnl [("s" ,["b"] ,(Recv (namify "b") (tvar "s" "b")) ) , -- ("t",["a"] , (Send (namify "a") (tvar "t" "a")) ) ] (new "c" (Par (tvar "t" "c") (tvar "s" "c"))) -- Unfolding Test -- --(Bind (Rec [(Name GoType, Embed (Bind [Name String] GoType))]) GoType)
2,438
false
false
0
8
607
55
42
13
null
null
Athas/banko
bankotrav/src/Bankotrav/Base.hs
bsd-2-clause
-- Can an incomplete board be completed into a valid board? boardCanEnd :: BoardIncomplete -> BoardKind -> Bool boardCanEnd board kind = boardCanEndInKind board kind && -- Do a quick check. any (boardCanEndInPerm board) (boardKindPermutations kind)
252
boardCanEnd :: BoardIncomplete -> BoardKind -> Bool boardCanEnd board kind = boardCanEndInKind board kind && -- Do a quick check. any (boardCanEndInPerm board) (boardKindPermutations kind)
192
boardCanEnd board kind = boardCanEndInKind board kind && -- Do a quick check. any (boardCanEndInPerm board) (boardKindPermutations kind)
140
true
true
0
8
39
52
26
26
null
null
martin-kolinek/stack
src/Stack/Ghci.hs
bsd-3-clause
borderedWarning :: MonadLogger m => m a -> m a borderedWarning f = do $logWarn "" $logWarn "* * * * * * * *" x <- f $logWarn "* * * * * * * *" $logWarn "" return x
187
borderedWarning :: MonadLogger m => m a -> m a borderedWarning f = do $logWarn "" $logWarn "* * * * * * * *" x <- f $logWarn "* * * * * * * *" $logWarn "" return x
187
borderedWarning f = do $logWarn "" $logWarn "* * * * * * * *" x <- f $logWarn "* * * * * * * *" $logWarn "" return x
140
false
true
0
8
64
72
27
45
null
null
abhinav/farmhash
src/FarmHash.hs
bsd-3-clause
-- | Hash function for a byte array. Most useful in 32-bit binaries. -- -- May change from time to time, and may differ on platforms. hash32 :: ByteString -> Word32 hash32 = withByteString cHash32
196
hash32 :: ByteString -> Word32 hash32 = withByteString cHash32
62
hash32 = withByteString cHash32
31
true
true
0
7
34
28
13
15
null
null
derekmcloughlin/BridgeBuddyServer
library/BridgeBuddy/Cards.hs
apache-2.0
-- Calculate the number of playing tricks in the hand. -- Note: most systems have the concept of half a playing trick. -- Here we just round the final result down to the nearest Int. -- See http://www.rpbridge.net/8j17.htm for the system used here. -- K, Q-x, K-x, J-10-x, Q-x-x 0.5 A-K, K-Q-J, A-Q-10, A-K-x 2 -- A, K-J, K-Q, A-x, Q-J-x, K-x-x, A-x-x 1 A-Q-J, A-K-J 2.5 -- A-J, A-Q, K-J-10, K-Q-x, A-J-x, A-Q-x 1.5 A-K-Q 3 playingTricks :: Hand -> Int playingTricks hand = floor $ sum [playingTricksInSuit $ suitHolding suit hand | suit <- [Clubs .. Spades]]
644
playingTricks :: Hand -> Int playingTricks hand = floor $ sum [playingTricksInSuit $ suitHolding suit hand | suit <- [Clubs .. Spades]]
135
playingTricks hand = floor $ sum [playingTricksInSuit $ suitHolding suit hand | suit <- [Clubs .. Spades]]
106
true
true
0
10
183
63
34
29
null
null
astro/haskell-torrent
src/WireProtocol.hs
bsd-2-clause
-- Seriously consider HCodecs as a dependency encodeMsg :: Message -> Builder encodeMsg KeepAlive = empty
111
encodeMsg :: Message -> Builder encodeMsg KeepAlive = empty
65
encodeMsg KeepAlive = empty
33
true
true
0
7
21
25
11
14
null
null