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
olsner/ghc
compiler/deSugar/Coverage.hs
bsd-3-clause
{- addTickHsCmd (OpApp e1 c2 fix c3) = liftM4 OpApp (addTickLHsExpr e1) (addTickLHsCmd c2) (return fix) (addTickLHsCmd c3) -} addTickHsCmd (HsCmdPar e) = liftM HsCmdPar (addTickLHsCmd e)
258
addTickHsCmd (HsCmdPar e) = liftM HsCmdPar (addTickLHsCmd e)
60
addTickHsCmd (HsCmdPar e) = liftM HsCmdPar (addTickLHsCmd e)
60
true
false
0
7
98
27
13
14
null
null
beni55/haste-compiler
libraries/ghc-7.10/base/Data/OldList.hs
bsd-3-clause
-- Somehow GHC doesn't detect the selector thunks in the below code, -- so s' keeps a reference to the first line via the pair and we have -- a space leak (cf. #4334). -- So we need to make GHC see the selector thunks with a trick. lines s = cons (case break (== '\n') s of (l, s') -> (l, case s' of [] -> [] _:s'' -> lines s'')) where cons ~(h, t) = h : t -- | 'unlines' is an inverse operation to 'lines'. -- It joins lines, after appending a terminating newline to each.
652
lines s = cons (case break (== '\n') s of (l, s') -> (l, case s' of [] -> [] _:s'' -> lines s'')) where cons ~(h, t) = h : t -- | 'unlines' is an inverse operation to 'lines'. -- It joins lines, after appending a terminating newline to each.
420
lines s = cons (case break (== '\n') s of (l, s') -> (l, case s' of [] -> [] _:s'' -> lines s'')) where cons ~(h, t) = h : t -- | 'unlines' is an inverse operation to 'lines'. -- It joins lines, after appending a terminating newline to each.
420
true
false
0
14
278
100
55
45
null
null
netogallo/polyvariant
src/Analysis/Algorithms/Common.hs
bsd-3-clause
-- | Function that renders a log entry as a list of elements -- endoded in latex renderLog l = let asRows :: LogResult -> [(LaTeX,LaTeX)] asRows b' = let ((b1,b1'),b2,b3,b4,b5) = renderBase b' in [(tau,b1),(nnf tau,b1'),(mathit (stexy "C"),b2),(mathit (stexy "l"),b3),(beta,b4),(delta,b5)] iRender (t,t') = [ (mathbf (stexy "I") <> autoParens (tau !: stexy "1"), texy t), (nnf $ mathbf (stexy "I") <> autoParens (tau !: stexy "1"), texy t') ] rows = case l of BasicLog r -> asRows r AbstLog r (t1,t1') chis x psi2 phi0 -> asRows r ++ [ (tau !: stexy "1", texy t1), (nnf $ tau !: stexy "1", texy t1'), (bar $ texy (chi !: stexy "i" <> stexy "::" <> stexy "s" !: stexy "i" :: LaTeX), texy $ (map renderVar chis :: [LaTeX])), (texy "X", texy $ (map renderVar x :: [LaTeX])), (psi !: stexy "2", texy psi2), (phi !: stexy "0", texy phi0) ] AppLog r i rep1 -> asRows r ++ iRender i ++ [ (theta, texy rep1) ] FixLog r i rep1 rep2 bFix dFix -> asRows r ++ iRender i ++ [ (theta !: stexy "1",texy rep1), (theta !: stexy "2",texy rep2), (delta !: stexy "fix",texy dFix), (beta !: stexy "fix",texy bFix) ] in rows
1,407
renderLog l = let asRows :: LogResult -> [(LaTeX,LaTeX)] asRows b' = let ((b1,b1'),b2,b3,b4,b5) = renderBase b' in [(tau,b1),(nnf tau,b1'),(mathit (stexy "C"),b2),(mathit (stexy "l"),b3),(beta,b4),(delta,b5)] iRender (t,t') = [ (mathbf (stexy "I") <> autoParens (tau !: stexy "1"), texy t), (nnf $ mathbf (stexy "I") <> autoParens (tau !: stexy "1"), texy t') ] rows = case l of BasicLog r -> asRows r AbstLog r (t1,t1') chis x psi2 phi0 -> asRows r ++ [ (tau !: stexy "1", texy t1), (nnf $ tau !: stexy "1", texy t1'), (bar $ texy (chi !: stexy "i" <> stexy "::" <> stexy "s" !: stexy "i" :: LaTeX), texy $ (map renderVar chis :: [LaTeX])), (texy "X", texy $ (map renderVar x :: [LaTeX])), (psi !: stexy "2", texy psi2), (phi !: stexy "0", texy phi0) ] AppLog r i rep1 -> asRows r ++ iRender i ++ [ (theta, texy rep1) ] FixLog r i rep1 rep2 bFix dFix -> asRows r ++ iRender i ++ [ (theta !: stexy "1",texy rep1), (theta !: stexy "2",texy rep2), (delta !: stexy "fix",texy dFix), (beta !: stexy "fix",texy bFix) ] in rows
1,326
renderLog l = let asRows :: LogResult -> [(LaTeX,LaTeX)] asRows b' = let ((b1,b1'),b2,b3,b4,b5) = renderBase b' in [(tau,b1),(nnf tau,b1'),(mathit (stexy "C"),b2),(mathit (stexy "l"),b3),(beta,b4),(delta,b5)] iRender (t,t') = [ (mathbf (stexy "I") <> autoParens (tau !: stexy "1"), texy t), (nnf $ mathbf (stexy "I") <> autoParens (tau !: stexy "1"), texy t') ] rows = case l of BasicLog r -> asRows r AbstLog r (t1,t1') chis x psi2 phi0 -> asRows r ++ [ (tau !: stexy "1", texy t1), (nnf $ tau !: stexy "1", texy t1'), (bar $ texy (chi !: stexy "i" <> stexy "::" <> stexy "s" !: stexy "i" :: LaTeX), texy $ (map renderVar chis :: [LaTeX])), (texy "X", texy $ (map renderVar x :: [LaTeX])), (psi !: stexy "2", texy psi2), (phi !: stexy "0", texy phi0) ] AppLog r i rep1 -> asRows r ++ iRender i ++ [ (theta, texy rep1) ] FixLog r i rep1 rep2 bFix dFix -> asRows r ++ iRender i ++ [ (theta !: stexy "1",texy rep1), (theta !: stexy "2",texy rep2), (delta !: stexy "fix",texy dFix), (beta !: stexy "fix",texy bFix) ] in rows
1,326
true
false
0
22
511
627
330
297
null
null
alexander-at-github/eta
compiler/ETA/Prelude/TysPrim.hs
bsd-3-clause
stableNamePrimTyConName = mkPrimTc (fsLit "StableName#") stableNamePrimTyConKey stableNamePrimTyCon
105
stableNamePrimTyConName = mkPrimTc (fsLit "StableName#") stableNamePrimTyConKey stableNamePrimTyCon
105
stableNamePrimTyConName = mkPrimTc (fsLit "StableName#") stableNamePrimTyConKey stableNamePrimTyCon
105
false
false
0
7
12
19
9
10
null
null
magicant/flesh
src/Flesh/Language/Parser/Buffer.hs
gpl-2.0
-- | Like 'runCursorT', but returns the final result only. evalCursorT :: Functor m => CursorT c m a -> c -> m a evalCursorT = fmap (fmap fst) . runCursorT
155
evalCursorT :: Functor m => CursorT c m a -> c -> m a evalCursorT = fmap (fmap fst) . runCursorT
96
evalCursorT = fmap (fmap fst) . runCursorT
42
true
true
0
9
30
56
25
31
null
null
alexander-at-github/eta
compiler/ETA/TypeCheck/TcSimplify.hs
bsd-3-clause
solveSimples :: WantedConstraints -> TcS WantedConstraints -- Solve the wc_simple and wc_insol components of the WantedConstraints -- Do not affect the inerts solveSimples (WC { wc_simple = simples, wc_insol = insols, wc_impl = implics }) = nestTcS $ do { let all_simples = simples `unionBags` filterBag (not . isDerivedCt) insols -- See Note [Dropping derived constraints] in TcRnTypes for -- why the insolubles may have derived constraints ; wc <- solveSimpleWanteds all_simples ; return ( wc { wc_impl = implics `unionBags` wc_impl wc } ) }
605
solveSimples :: WantedConstraints -> TcS WantedConstraints solveSimples (WC { wc_simple = simples, wc_insol = insols, wc_impl = implics }) = nestTcS $ do { let all_simples = simples `unionBags` filterBag (not . isDerivedCt) insols -- See Note [Dropping derived constraints] in TcRnTypes for -- why the insolubles may have derived constraints ; wc <- solveSimpleWanteds all_simples ; return ( wc { wc_impl = implics `unionBags` wc_impl wc } ) }
505
solveSimples (WC { wc_simple = simples, wc_insol = insols, wc_impl = implics }) = nestTcS $ do { let all_simples = simples `unionBags` filterBag (not . isDerivedCt) insols -- See Note [Dropping derived constraints] in TcRnTypes for -- why the insolubles may have derived constraints ; wc <- solveSimpleWanteds all_simples ; return ( wc { wc_impl = implics `unionBags` wc_impl wc } ) }
446
true
true
2
14
147
126
68
58
null
null
pqnelson/surak
src/Main.hs
mit
pelletierTest :: [Formula] pelletierTest = pelletierTest' ++ [foldr Iff T pelletierTest']
89
pelletierTest :: [Formula] pelletierTest = pelletierTest' ++ [foldr Iff T pelletierTest']
89
pelletierTest = pelletierTest' ++ [foldr Iff T pelletierTest']
62
false
true
0
7
10
28
15
13
null
null
owestphal/LootLanguage
src/Category.hs
bsd-3-clause
implementPrimCat (BaseType ts) = parameter "BaseType" $ unwords $ map show ts
77
implementPrimCat (BaseType ts) = parameter "BaseType" $ unwords $ map show ts
77
implementPrimCat (BaseType ts) = parameter "BaseType" $ unwords $ map show ts
77
false
false
0
7
11
31
14
17
null
null
brownplt/strobe-old
src/BrownPLT/TypedJS/LocalFlows.hs
bsd-2-clause
unRef r _ = r
13
unRef r _ = r
13
unRef r _ = r
13
false
false
0
5
4
11
5
6
null
null
emwap/feldspar-language
tests/Feldspar/Range/Test.hs
bsd-3-clause
typedTestsSigned name typ = typedTests name typ ++ [ testProperty (unwords ["prop_isNegative" , name]) (prop_isNegative typ) , testProperty (unwords ["prop_rangeMod3" , name]) (prop_rangeMod3 typ) , testProperty (unwords ["prop_rangeRem1" , name]) (prop_rangeRem1 typ) , testProperty (unwords ["prop_rangeQuot1" , name]) (prop_rangeQuot1 typ) ]
382
typedTestsSigned name typ = typedTests name typ ++ [ testProperty (unwords ["prop_isNegative" , name]) (prop_isNegative typ) , testProperty (unwords ["prop_rangeMod3" , name]) (prop_rangeMod3 typ) , testProperty (unwords ["prop_rangeRem1" , name]) (prop_rangeRem1 typ) , testProperty (unwords ["prop_rangeQuot1" , name]) (prop_rangeQuot1 typ) ]
382
typedTestsSigned name typ = typedTests name typ ++ [ testProperty (unwords ["prop_isNegative" , name]) (prop_isNegative typ) , testProperty (unwords ["prop_rangeMod3" , name]) (prop_rangeMod3 typ) , testProperty (unwords ["prop_rangeRem1" , name]) (prop_rangeRem1 typ) , testProperty (unwords ["prop_rangeQuot1" , name]) (prop_rangeQuot1 typ) ]
382
false
false
0
10
78
124
65
59
null
null
MateVM/hs-java
JVM/Builder/Instructions.hs
lgpl-3.0
fconst_1 :: Generator e g => g e () fconst_1 = i0 FCONST_1
58
fconst_1 :: Generator e g => g e () fconst_1 = i0 FCONST_1
58
fconst_1 = i0 FCONST_1
22
false
true
0
7
12
30
14
16
null
null
graninas/Haskell-Algorithms
Tests/ArrowsAndFrees/ArrEff.hs
gpl-3.0
aConst c = arr (const c)
24
aConst c = arr (const c)
24
aConst c = arr (const c)
24
false
false
1
7
5
22
8
14
null
null
diminishedprime/.org
reading-list/haskell_programming_from_first_principles/24_04.hs
mit
shouldAlsoWork = "2/1"
22
shouldAlsoWork = "2/1"
22
shouldAlsoWork = "2/1"
22
false
false
0
4
2
6
3
3
null
null
brendanhay/gogol
gogol-datafusion/gen/Network/Google/Resource/DataFusion/Projects/Locations/Instances/Patch.hs
mpl-2.0
-- | Legacy upload protocol for media (e.g. \"media\", \"multipart\"). plipUploadType :: Lens' ProjectsLocationsInstancesPatch (Maybe Text) plipUploadType = lens _plipUploadType (\ s a -> s{_plipUploadType = a})
219
plipUploadType :: Lens' ProjectsLocationsInstancesPatch (Maybe Text) plipUploadType = lens _plipUploadType (\ s a -> s{_plipUploadType = a})
148
plipUploadType = lens _plipUploadType (\ s a -> s{_plipUploadType = a})
79
true
true
0
9
34
48
25
23
null
null
brendanhay/gogol
gogol-cloudsearch/gen/Network/Google/CloudSearch/Types/Product.hs
mpl-2.0
-- | Common debug options. suirDebugOptions :: Lens' StartUploadItemRequest (Maybe DebugOptions) suirDebugOptions = lens _suirDebugOptions (\ s a -> s{_suirDebugOptions = a})
182
suirDebugOptions :: Lens' StartUploadItemRequest (Maybe DebugOptions) suirDebugOptions = lens _suirDebugOptions (\ s a -> s{_suirDebugOptions = a})
155
suirDebugOptions = lens _suirDebugOptions (\ s a -> s{_suirDebugOptions = a})
85
true
true
1
9
29
52
25
27
null
null
urbanslug/ghc
testsuite/tests/indexed-types/should_fail/Overlap10.hs
bsd-3-clause
g :: a -> F a Bool g x = False
30
g :: a -> F a Bool g x = False
30
g x = False
11
false
true
0
6
10
27
12
15
null
null
HIPERFIT/futhark
src/Futhark/Analysis/HORep/SOAC.hs
isc
-- | Either convert an expression to the normalised SOAC -- representation, or a reason why the expression does not have the -- valid form. fromExp :: (Op rep ~ Futhark.SOAC rep, HasScope rep m) => Exp rep -> m (Either NotSOAC (SOAC rep)) fromExp (Op (Futhark.Stream w as form nes lam)) = Right . Stream w form lam nes <$> traverse varInput as
351
fromExp :: (Op rep ~ Futhark.SOAC rep, HasScope rep m) => Exp rep -> m (Either NotSOAC (SOAC rep)) fromExp (Op (Futhark.Stream w as form nes lam)) = Right . Stream w form lam nes <$> traverse varInput as
211
fromExp (Op (Futhark.Stream w as form nes lam)) = Right . Stream w form lam nes <$> traverse varInput as
106
true
true
1
13
71
119
56
63
null
null
rahulmutt/ghcvm
compiler/Eta/TypeCheck/TcRnTypes.hs
bsd-3-clause
isGivenCt :: Ct -> Bool isGivenCt = isGiven . cc_ev
51
isGivenCt :: Ct -> Bool isGivenCt = isGiven . cc_ev
51
isGivenCt = isGiven . cc_ev
27
false
true
0
5
9
19
10
9
null
null
tolysz/prepare-ghcjs
spec-lts8/base/System/IO/Error.hs
bsd-3-clause
isIllegalOperationErrorType _ = False
37
isIllegalOperationErrorType _ = False
37
isIllegalOperationErrorType _ = False
37
false
false
0
5
3
9
4
5
null
null
spechub/Hets
OWL2/ParseMS.hs
gpl-2.0
estriction :: GA.PrefixMap -> CharParser st ClassExpression restriction pm = objectPropertyExpr pm >>= restrictionAny pm
121
restriction :: GA.PrefixMap -> CharParser st ClassExpression restriction pm = objectPropertyExpr pm >>= restrictionAny pm
121
restriction pm = objectPropertyExpr pm >>= restrictionAny pm
60
false
true
0
6
15
35
16
19
null
null
technogeeky/d-A
include/containers-0.5.0.0/Data/Set/Base.hs
gpl-3.0
{-------------------------------------------------------------------- Lists --------------------------------------------------------------------} -- | /O(n)/. Convert the set to a list of elements. Subject to list fusion. toList :: Set a -> [a] toList = toAscList
265
toList :: Set a -> [a] toList = toAscList
41
toList = toAscList
18
true
true
0
6
28
23
13
10
null
null
jacekszymanski/wxHaskell
wxcore/src/haskell/Graphics/UI/WXCore/WxcDefs.hs
lgpl-2.1
wxSTC_CMD_WORDPARTLEFTEXTEND :: Int wxSTC_CMD_WORDPARTLEFTEXTEND = 2391
71
wxSTC_CMD_WORDPARTLEFTEXTEND :: Int wxSTC_CMD_WORDPARTLEFTEXTEND = 2391
71
wxSTC_CMD_WORDPARTLEFTEXTEND = 2391
35
false
true
0
4
5
11
6
5
null
null
ekmett/ghc
compiler/main/DynFlags.hs
bsd-3-clause
splitPathList :: String -> [String] splitPathList s = filter notNull (splitUp s) -- empty paths are ignored: there might be a trailing -- ':' in the initial list, for example. Empty paths can -- cause confusion when they are translated into -I options -- for passing to gcc. where #ifndef mingw32_TARGET_OS splitUp xs = split split_marker xs #else -- Windows: 'hybrid' support for DOS-style paths in directory lists. -- -- That is, if "foo:bar:baz" is used, this interpreted as -- consisting of three entries, 'foo', 'bar', 'baz'. -- However, with "c:/foo:c:\\foo;x:/bar", this is interpreted -- as 3 elts, "c:/foo", "c:\\foo", "x:/bar" -- -- Notice that no attempt is made to fully replace the 'standard' -- split marker ':' with the Windows / DOS one, ';'. The reason being -- that this will cause too much breakage for users & ':' will -- work fine even with DOS paths, if you're not insisting on being silly. -- So, use either. splitUp [] = [] splitUp (x:':':div:xs) | div `elem` dir_markers = ((x:':':div:p): splitUp rs) where (p,rs) = findNextPath xs -- we used to check for existence of the path here, but that -- required the IO monad to be threaded through the command-line -- parser which is quite inconvenient. The splitUp xs = cons p (splitUp rs) where (p,rs) = findNextPath xs cons "" xs = xs cons x xs = x:xs -- will be called either when we've consumed nought or the -- "<Drive>:/" part of a DOS path, so splitting is just a Q of -- finding the next split marker. findNextPath xs = case break (`elem` split_markers) xs of (p, _:ds) -> (p, ds) (p, xs) -> (p, xs) split_markers :: [Char] split_markers = [':', ';'] dir_markers :: [Char] dir_markers = ['/', '\\'] #endif -- ----------------------------------------------------------------------------- -- tmpDir, where we store temporary files.
2,212
splitPathList :: String -> [String] splitPathList s = filter notNull (splitUp s) -- empty paths are ignored: there might be a trailing -- ':' in the initial list, for example. Empty paths can -- cause confusion when they are translated into -I options -- for passing to gcc. where #ifndef mingw32_TARGET_OS splitUp xs = split split_marker xs #else -- Windows: 'hybrid' support for DOS-style paths in directory lists. -- -- That is, if "foo:bar:baz" is used, this interpreted as -- consisting of three entries, 'foo', 'bar', 'baz'. -- However, with "c:/foo:c:\\foo;x:/bar", this is interpreted -- as 3 elts, "c:/foo", "c:\\foo", "x:/bar" -- -- Notice that no attempt is made to fully replace the 'standard' -- split marker ':' with the Windows / DOS one, ';'. The reason being -- that this will cause too much breakage for users & ':' will -- work fine even with DOS paths, if you're not insisting on being silly. -- So, use either. splitUp [] = [] splitUp (x:':':div:xs) | div `elem` dir_markers = ((x:':':div:p): splitUp rs) where (p,rs) = findNextPath xs -- we used to check for existence of the path here, but that -- required the IO monad to be threaded through the command-line -- parser which is quite inconvenient. The splitUp xs = cons p (splitUp rs) where (p,rs) = findNextPath xs cons "" xs = xs cons x xs = x:xs -- will be called either when we've consumed nought or the -- "<Drive>:/" part of a DOS path, so splitting is just a Q of -- finding the next split marker. findNextPath xs = case break (`elem` split_markers) xs of (p, _:ds) -> (p, ds) (p, xs) -> (p, xs) split_markers :: [Char] split_markers = [':', ';'] dir_markers :: [Char] dir_markers = ['/', '\\'] #endif -- ----------------------------------------------------------------------------- -- tmpDir, where we store temporary files.
2,212
splitPathList s = filter notNull (splitUp s) -- empty paths are ignored: there might be a trailing -- ':' in the initial list, for example. Empty paths can -- cause confusion when they are translated into -I options -- for passing to gcc. where #ifndef mingw32_TARGET_OS splitUp xs = split split_marker xs #else -- Windows: 'hybrid' support for DOS-style paths in directory lists. -- -- That is, if "foo:bar:baz" is used, this interpreted as -- consisting of three entries, 'foo', 'bar', 'baz'. -- However, with "c:/foo:c:\\foo;x:/bar", this is interpreted -- as 3 elts, "c:/foo", "c:\\foo", "x:/bar" -- -- Notice that no attempt is made to fully replace the 'standard' -- split marker ':' with the Windows / DOS one, ';'. The reason being -- that this will cause too much breakage for users & ':' will -- work fine even with DOS paths, if you're not insisting on being silly. -- So, use either. splitUp [] = [] splitUp (x:':':div:xs) | div `elem` dir_markers = ((x:':':div:p): splitUp rs) where (p,rs) = findNextPath xs -- we used to check for existence of the path here, but that -- required the IO monad to be threaded through the command-line -- parser which is quite inconvenient. The splitUp xs = cons p (splitUp rs) where (p,rs) = findNextPath xs cons "" xs = xs cons x xs = x:xs -- will be called either when we've consumed nought or the -- "<Drive>:/" part of a DOS path, so splitting is just a Q of -- finding the next split marker. findNextPath xs = case break (`elem` split_markers) xs of (p, _:ds) -> (p, ds) (p, xs) -> (p, xs) split_markers :: [Char] split_markers = [':', ';'] dir_markers :: [Char] dir_markers = ['/', '\\'] #endif -- ----------------------------------------------------------------------------- -- tmpDir, where we store temporary files.
2,176
false
true
1
8
710
68
33
35
null
null
rahulmutt/ghcvm
compiler/Eta/HsSyn/HsTypes.hs
bsd-3-clause
hsLTyVarNames :: LHsTyVarBndrs name -> [name] -- Type variables only hsLTyVarNames qtvs = map hsLTyVarName (hsQTvBndrs qtvs)
124
hsLTyVarNames :: LHsTyVarBndrs name -> [name] hsLTyVarNames qtvs = map hsLTyVarName (hsQTvBndrs qtvs)
101
hsLTyVarNames qtvs = map hsLTyVarName (hsQTvBndrs qtvs)
55
true
true
0
7
16
36
18
18
null
null
ssaavedra/liquidhaskell
src/Language/Haskell/Liquid/Types.hs
bsd-3-clause
mapBind _ (RVar α r) = RVar α r
37
mapBind _ (RVar α r) = RVar α r
37
mapBind _ (RVar α r) = RVar α r
37
false
false
0
7
14
24
11
13
null
null
ulricha/dsh-example-queries
Queries/SIGMOD/Simple.hs
bsd-3-clause
-- Combining quantifiers forallexists :: Q [Text] forallexists = [ c_nameQ c | c <- customers , c_acctbalQ c > 9950.0 , and [ o_orderstatusQ o == "F" | o <- orders, o_custkeyQ o == c_custkeyQ c ] , any (\n -> n_nationkeyQ n == c_nationkeyQ c) [ n | n <- nations, n_nameQ n == "CANADA" ] ]
342
forallexists :: Q [Text] forallexists = [ c_nameQ c | c <- customers , c_acctbalQ c > 9950.0 , and [ o_orderstatusQ o == "F" | o <- orders, o_custkeyQ o == c_custkeyQ c ] , any (\n -> n_nationkeyQ n == c_nationkeyQ c) [ n | n <- nations, n_nameQ n == "CANADA" ] ]
317
forallexists = [ c_nameQ c | c <- customers , c_acctbalQ c > 9950.0 , and [ o_orderstatusQ o == "F" | o <- orders, o_custkeyQ o == c_custkeyQ c ] , any (\n -> n_nationkeyQ n == c_nationkeyQ c) [ n | n <- nations, n_nameQ n == "CANADA" ] ]
292
true
true
0
11
112
131
64
67
null
null
deciduously/Haskell-First-Principles-Exercises
2-Defining and combining/10-Folding Lists/code/vowels.hs
mit
stops = "pbtdkg"
16
stops = "pbtdkg"
16
stops = "pbtdkg"
16
false
false
0
4
2
6
3
3
null
null
frantisekfarka/ghc-dsi
compiler/llvmGen/LlvmCodeGen/Base.hs
bsd-3-clause
maxSupportLlvmVersion :: LlvmVersion maxSupportLlvmVersion = 34
63
maxSupportLlvmVersion :: LlvmVersion maxSupportLlvmVersion = 34
63
maxSupportLlvmVersion = 34
26
false
true
0
4
5
11
6
5
null
null
gabluc/CIS194-Solutions
src/Homework7/Scrabble.hs
bsd-3-clause
getScore :: Score -> Int getScore (Score i) = i
47
getScore :: Score -> Int getScore (Score i) = i
47
getScore (Score i) = i
22
false
true
0
7
9
24
12
12
null
null
ml9951/ghc
compiler/rename/RnBinds.hs
bsd-3-clause
dupFixityDecl :: SrcSpan -> RdrName -> SDoc dupFixityDecl loc rdr_name = vcat [ptext (sLit "Multiple fixity declarations for") <+> quotes (ppr rdr_name), ptext (sLit "also at ") <+> ppr loc]
202
dupFixityDecl :: SrcSpan -> RdrName -> SDoc dupFixityDecl loc rdr_name = vcat [ptext (sLit "Multiple fixity declarations for") <+> quotes (ppr rdr_name), ptext (sLit "also at ") <+> ppr loc]
202
dupFixityDecl loc rdr_name = vcat [ptext (sLit "Multiple fixity declarations for") <+> quotes (ppr rdr_name), ptext (sLit "also at ") <+> ppr loc]
158
false
true
0
10
41
71
34
37
null
null
DanielG/cabal-helper
src/CabalHelper/Compiletime/Process.hs
apache-2.0
logProcessCall :: Verbose => Maybe FilePath -> [(String, EnvOverride)] -> FilePath -> [String] -> IO () logProcessCall mcwd env exe args = do vLog $ intercalate " " $ cd ++ env_args ++ map formatProcessArg (exe:args) where env_args = map (\(k,v) -> k ++ "=" ++ show v) env cd = case mcwd of Nothing -> []; Just cwd -> [ "cd", formatProcessArg cwd++";" ]
386
logProcessCall :: Verbose => Maybe FilePath -> [(String, EnvOverride)] -> FilePath -> [String] -> IO () logProcessCall mcwd env exe args = do vLog $ intercalate " " $ cd ++ env_args ++ map formatProcessArg (exe:args) where env_args = map (\(k,v) -> k ++ "=" ++ show v) env cd = case mcwd of Nothing -> []; Just cwd -> [ "cd", formatProcessArg cwd++";" ]
386
logProcessCall mcwd env exe args = do vLog $ intercalate " " $ cd ++ env_args ++ map formatProcessArg (exe:args) where env_args = map (\(k,v) -> k ++ "=" ++ show v) env cd = case mcwd of Nothing -> []; Just cwd -> [ "cd", formatProcessArg cwd++";" ]
267
false
true
1
12
97
175
88
87
null
null
teleshoes/taffybar
src/System/Taffybar/Widget/Workspaces.hs
bsd-3-clause
buildIconController :: ControllerConstructor buildIconController ws = do tempController <- lift $ do hbox <- Gtk.boxNew Gtk.OrientationHorizontal 0 return IconController {iconsContainer = hbox, iconImages = [], iconWorkspace = ws} initializeWWC tempController ws
298
buildIconController :: ControllerConstructor buildIconController ws = do tempController <- lift $ do hbox <- Gtk.boxNew Gtk.OrientationHorizontal 0 return IconController {iconsContainer = hbox, iconImages = [], iconWorkspace = ws} initializeWWC tempController ws
298
buildIconController ws = do tempController <- lift $ do hbox <- Gtk.boxNew Gtk.OrientationHorizontal 0 return IconController {iconsContainer = hbox, iconImages = [], iconWorkspace = ws} initializeWWC tempController ws
253
false
true
0
14
66
77
38
39
null
null
ml9951/ghc
compiler/prelude/PrelNames.hs
bsd-3-clause
alt_RDR = varQual_RDR rEAD_PREC (fsLit "+++")
62
alt_RDR = varQual_RDR rEAD_PREC (fsLit "+++")
62
alt_RDR = varQual_RDR rEAD_PREC (fsLit "+++")
62
false
false
0
7
22
17
8
9
null
null
Tarrasch/Hong
Fal/Region.hs
bsd-3-clause
(Polygon pts) `containsS` p = let leftOfList = map (isLeftOf p) (zip pts (tail pts ++ [head pts])) in and leftOfList
150
(Polygon pts) `containsS` p = let leftOfList = map (isLeftOf p) (zip pts (tail pts ++ [head pts])) in and leftOfList
150
(Polygon pts) `containsS` p = let leftOfList = map (isLeftOf p) (zip pts (tail pts ++ [head pts])) in and leftOfList
150
false
false
0
15
54
69
33
36
null
null
fehu/itesm-ga
src/Parcial2/Examples/ChromosomeExample.hs
mit
optExtChildren :: Optional1 ChildSide optExtChildren = optional "e" ["xx-children"] [ "Generate crossover extension children, for the parent given" ] [ "crossover parent, values: `Fst`, `Snd`" ]
224
optExtChildren :: Optional1 ChildSide optExtChildren = optional "e" ["xx-children"] [ "Generate crossover extension children, for the parent given" ] [ "crossover parent, values: `Fst`, `Snd`" ]
224
optExtChildren = optional "e" ["xx-children"] [ "Generate crossover extension children, for the parent given" ] [ "crossover parent, values: `Fst`, `Snd`" ]
186
false
true
0
6
55
32
17
15
null
null
diku-dk/futhark
src/Futhark/CLI/Literate.hs
isc
literateBuiltin :: EvalBuiltin ScriptM literateBuiltin "loadimg" vs = case vs of [ValueAtom v] | Just path <- getValue v -> do let path' = map (chr . fromIntegral) (path :: [Word8]) loadImage path' _ -> throwError $ "$loadimg does not accept arguments of types: " <> T.intercalate ", " (map (prettyText . fmap valueType) vs)
380
literateBuiltin :: EvalBuiltin ScriptM literateBuiltin "loadimg" vs = case vs of [ValueAtom v] | Just path <- getValue v -> do let path' = map (chr . fromIntegral) (path :: [Word8]) loadImage path' _ -> throwError $ "$loadimg does not accept arguments of types: " <> T.intercalate ", " (map (prettyText . fmap valueType) vs)
380
literateBuiltin "loadimg" vs = case vs of [ValueAtom v] | Just path <- getValue v -> do let path' = map (chr . fromIntegral) (path :: [Word8]) loadImage path' _ -> throwError $ "$loadimg does not accept arguments of types: " <> T.intercalate ", " (map (prettyText . fmap valueType) vs)
341
false
true
7
12
110
117
59
58
null
null
rueshyna/gogol
gogol-adexchange-buyer/gen/Network/Google/AdExchangeBuyer/Types/Product.hs
mpl-2.0
-- | Only set when contextType=AUCTION_TYPE. Represents the auction types -- this restriction applies to. csriciAuctionType :: Lens' CreativeServingRestrictionsItemContextsItem [Text] csriciAuctionType = lens _csriciAuctionType (\ s a -> s{_csriciAuctionType = a}) . _Default . _Coerce
305
csriciAuctionType :: Lens' CreativeServingRestrictionsItemContextsItem [Text] csriciAuctionType = lens _csriciAuctionType (\ s a -> s{_csriciAuctionType = a}) . _Default . _Coerce
199
csriciAuctionType = lens _csriciAuctionType (\ s a -> s{_csriciAuctionType = a}) . _Default . _Coerce
121
true
true
2
8
54
58
29
29
null
null
joelburget/interplanetary-computation
src/Planetary/Support/Parser/Test.hs
bsd-3-clause
unitTests :: Test () unitTests = scope "parsing" $ tests [ let defn = T.unlines [ "outer:" , " node1:" , " node2:" , " node3:" ] expected = NamedList "outer" [ NamedList "node1" [ NamedList "node2" [] ] , NamedList "node3" [] ] parseNested = NamedList <$> identifier <* colon <*> localIndentation Gt (many (absoluteIndentation parseNested)) in parserTest defn parseNested expected , parserTest "X" identifier "X" , parserTest "X" parseValTy (VTy"X") , parserTest "<_ X> | <_ X Y>" (parseConstructor [] `sepBy` bar) [ ConstructorDecl "_" [VTy"X"] [] , ConstructorDecl "_" [VTy"X", VTy"Y"] [] ] , parserTest "X" parseTyArg $ TyArgVal (VTy"X") , parserTest "X X X" (many parseTyArg) $ let x = TyArgVal (VTy"X") in [x, x, x] , parserTest "1" parseUid "1" , parserTest "123" parseUid "123" , parserTest "<1 X>" parseDataTy $ DataTy (VariableTy "1") [TyArgVal (VTy"X")] -- also test with args -- Bool , parserTest "data Bool =\n | <true>\n | <false> " parseDataDecl (DataDecl "Bool" $ DataTypeInterface [] [ ConstructorDecl "true" [] [] , ConstructorDecl "false" [] [] ]) -- TODO: also test with effect parameter , let ctrResult = [TyArgVal (VariableTy "X"), TyArgVal (VariableTy "Y")] in parserTest "data Either X Y =\n | <left X>\n | <right Y>" parseDataDecl (DataDecl "Either" $ DataTypeInterface [("X", ValTyK), ("Y", ValTyK)] [ ConstructorDecl "left" [VTy"X"] ctrResult , ConstructorDecl "right" [VTy"Y"] ctrResult ]) -- also test effect ty, multiple instances , parserTest "<1 X>" parseInterfaceInstance ("1", [TyArgVal (VTy"X")]) , parserTest "<1 [0]>" parseInterfaceInstance ("1", [ TyArgAbility (Ability ClosedAbility mempty) ]) , parserTest "<1 []>" parseInterfaceInstance ("1", [ TyArgAbility (Ability OpenAbility mempty) ]) , parserTest "<1>" parseInterfaceInstance ("1", []) , parserTest "0" parseAbilityBody closedAbility , parserTest "0,<1>" parseAbilityBody $ Ability ClosedAbility [("1", [])] , parserTest "e" parseAbilityBody emptyAbility , parserTest "e,<1>" parseAbilityBody $ Ability OpenAbility [("1", [])] -- TODO: parseAbility , parserTest "[0,<1>]" parseAbility $ Ability ClosedAbility [("1", [])] , parserTest "[]" parseAbility emptyAbility , parserTest "[0]" parseAbility closedAbility , parserTest "[] X" parsePeg $ Peg emptyAbility (VTy"X") , parserTest "[]X" parsePeg $ Peg emptyAbility (VTy"X") , parserTest "[] <1 X>" parsePeg $ Peg emptyAbility (DataTy (VariableTy "1") [TyArgVal (VTy"X")]) , parserTest "X" parseCompTy $ CompTy [] (Peg emptyAbility (VTy"X")) , parserTest "X -> X" parseCompTy $ CompTy [VTy"X"] (Peg emptyAbility (VTy"X")) , parserTest "X -> []X" parseCompTy $ CompTy [VTy"X"] (Peg emptyAbility (VTy"X")) , parserTest "X -> X -> X" parseCompTy $ CompTy [VTy"X", VTy"X"] (Peg emptyAbility (VTy"X")) , parserTest "{X -> X}" parseValTy $ SuspendedTy $ CompTy [VTy"X"] (Peg emptyAbility (VTy"X")) , parserTest "X" parseValTy (VTy"X") , parserTest "(X)" parseValTy (VTy"X") -- , parserTest "(X Y)" parseValTy (DataTy "X" (VTy"X")) , parserTest "| foo : X -> X" parseCommandDecl $ CommandDeclaration "foo" [VTy"X"] (VTy"X") , let decl = T.unlines [ "interface Iface X Y =" , " | foo : X -> Y" , " | bar : Y -> X" ] expected = InterfaceDecl "Iface" (EffectInterface [("X", ValTyK), ("Y", ValTyK)] [ CommandDeclaration "foo" [VTy"X"] (VTy"Y") , CommandDeclaration "bar" [VTy"Y"] (VTy"X") ]) in parserTest decl parseInterfaceDecl expected , parserTest "Z!" parseTm $ AppT (V"Z") [] , parserTest "Z Z Z" parseTm $ AppT (V"Z") [V"Z", V"Z"] , parserTest "let Z: forall. X = W in Z" parseLet $ Let (V"W") (Polytype [] (VTy"X")) "Z" (V"Z") -- let_ "Z" (Polytype [] (VTy"X")) (V"W") (V"Z") , let defn = T.unlines [ "let on : forall X Y. {X -> {X -> []Y} -> []Y} =" , " \\x f -> f x in on n (\\x -> body)" ] compDomain = [VTy"X", SuspendedTy (CompTy [VTy"X"] (Peg emptyAbility (VTy"Y")))] compCodomain = Peg emptyAbility (VTy"Y") polyVal = SuspendedTy (CompTy compDomain compCodomain) polyBinders = [("X", ValTyK), ("Y", ValTyK)] pty = Polytype polyBinders polyVal expected = Let (Lambda ["x", "f"] (AppT (V"f") [V"x"])) pty "on" (AppT (V"on") [V"n", Lambda ["x"] (V"body")]) in parserTest defn parseLet expected , let defn = "on n (\\x -> body)" expected = AppT (V"on") [V"n", Lambda ["x"] (V"body")] in parserTest defn parseTm expected , let defn = "\\x f -> f x" expected = Lambda ["x", "f"] (AppT (V"f") [V"x"]) in parserTest defn parseTm expected , let defn = T.unlines [ "case x of" , " | <_> -> y" , " | <_ a b c> -> z" ] expected = Case (V "x") [ ([], V "y") , (["a", "b", "c"], V "z") ] in scope "case" $ tests [ parserTest defn parseTm expected , parserTest defn parseCase expected ] -- "data Maybe x = Just x | Nothing" , let defn = "data Maybe x =\n | <just x>\n | <nothing>" ctrResult = [TyArgVal (VariableTy "x")] expected = DataDecl "Maybe" (DataTypeInterface [("x", ValTyK)] [ ConstructorDecl "just" [VariableTy "x"] ctrResult , ConstructorDecl "nothing" [] ctrResult ]) in parserTest defn parseDataDecl expected , let defn = "interface IFace =\n | _ : foo -> bar\n | _ : baz" expected = InterfaceDecl "IFace" (EffectInterface [] [ CommandDeclaration "_" [VariableTy "foo"] (VariableTy "bar") , CommandDeclaration "_" [] (VariableTy "baz") ]) in parserTest defn parseInterfaceDecl expected , let defn = T.unlines [ "handle y! : [e , <Abort>] Y with" , " Receive X:" , " | <receive -> r> -> abort!" , " | y -> y" ] scrutinee = AppT (V"y") [] adj = Adjustment [ ("Receive", [TyArgVal (VariableTy"X")]) ] peg = Peg (Ability OpenAbility [("Abort", [])]) (VariableTy "Y") handlers = [ ("Receive", [([], "r", AppT (V"abort") [])]) ] fallthrough = ("y", V"y") expected = Handle scrutinee adj peg (fromList handlers) fallthrough in parserTest defn parseHandle expected , parserTest "X" parseTyVar ("X", ValTyK) , parserTest "[e]" parseTyVar ("e", EffTyK) , parserTest "\\xs -> xs" parseLambda (Lambda ["xs"] (V"xs")) , parserTest "\\ -> xs" parseLambda (Lambda [] (V"xs")) , parserTest "\\-> xs" parseLambda (Lambda [] (V"xs")) , parserTest "<A.0 x! y!>" parseTm (DataConstructor "A" 0 [AppT (V"x") [], AppT (V"y") []]) , parserTest "<A.1 x <A.0>>" parseTm (DataConstructor "A" 1 [V"x", DataConstructor "A" 0 []]) , let input = "f \"x\"" (cid, ipldVal) = mkForeign @Text "x" expected = AppT (V"f") [ForeignValue "Text" [] (T.pack (show cid))] in scope "text" $ case runTokenParse parseTm testLocation input of Right (actual, store) -> do expectEq expected actual expectEq (storeOf [ipldVal]) store Left errMsg -> fail errMsg -- , let defn = T.unlines -- [ -- ] -- in parserTest defn parseLetrec expected -- TODO: -- * parseValue -- , let defn = T.unlines -- [ "catch : <Abort>X -> {X} -> X" -- , " = \\x -> " -- -- , "x _ = x" -- -- , "<aborting -> _> h = h!" -- ] -- in parserTest defn ]
8,030
unitTests :: Test () unitTests = scope "parsing" $ tests [ let defn = T.unlines [ "outer:" , " node1:" , " node2:" , " node3:" ] expected = NamedList "outer" [ NamedList "node1" [ NamedList "node2" [] ] , NamedList "node3" [] ] parseNested = NamedList <$> identifier <* colon <*> localIndentation Gt (many (absoluteIndentation parseNested)) in parserTest defn parseNested expected , parserTest "X" identifier "X" , parserTest "X" parseValTy (VTy"X") , parserTest "<_ X> | <_ X Y>" (parseConstructor [] `sepBy` bar) [ ConstructorDecl "_" [VTy"X"] [] , ConstructorDecl "_" [VTy"X", VTy"Y"] [] ] , parserTest "X" parseTyArg $ TyArgVal (VTy"X") , parserTest "X X X" (many parseTyArg) $ let x = TyArgVal (VTy"X") in [x, x, x] , parserTest "1" parseUid "1" , parserTest "123" parseUid "123" , parserTest "<1 X>" parseDataTy $ DataTy (VariableTy "1") [TyArgVal (VTy"X")] -- also test with args -- Bool , parserTest "data Bool =\n | <true>\n | <false> " parseDataDecl (DataDecl "Bool" $ DataTypeInterface [] [ ConstructorDecl "true" [] [] , ConstructorDecl "false" [] [] ]) -- TODO: also test with effect parameter , let ctrResult = [TyArgVal (VariableTy "X"), TyArgVal (VariableTy "Y")] in parserTest "data Either X Y =\n | <left X>\n | <right Y>" parseDataDecl (DataDecl "Either" $ DataTypeInterface [("X", ValTyK), ("Y", ValTyK)] [ ConstructorDecl "left" [VTy"X"] ctrResult , ConstructorDecl "right" [VTy"Y"] ctrResult ]) -- also test effect ty, multiple instances , parserTest "<1 X>" parseInterfaceInstance ("1", [TyArgVal (VTy"X")]) , parserTest "<1 [0]>" parseInterfaceInstance ("1", [ TyArgAbility (Ability ClosedAbility mempty) ]) , parserTest "<1 []>" parseInterfaceInstance ("1", [ TyArgAbility (Ability OpenAbility mempty) ]) , parserTest "<1>" parseInterfaceInstance ("1", []) , parserTest "0" parseAbilityBody closedAbility , parserTest "0,<1>" parseAbilityBody $ Ability ClosedAbility [("1", [])] , parserTest "e" parseAbilityBody emptyAbility , parserTest "e,<1>" parseAbilityBody $ Ability OpenAbility [("1", [])] -- TODO: parseAbility , parserTest "[0,<1>]" parseAbility $ Ability ClosedAbility [("1", [])] , parserTest "[]" parseAbility emptyAbility , parserTest "[0]" parseAbility closedAbility , parserTest "[] X" parsePeg $ Peg emptyAbility (VTy"X") , parserTest "[]X" parsePeg $ Peg emptyAbility (VTy"X") , parserTest "[] <1 X>" parsePeg $ Peg emptyAbility (DataTy (VariableTy "1") [TyArgVal (VTy"X")]) , parserTest "X" parseCompTy $ CompTy [] (Peg emptyAbility (VTy"X")) , parserTest "X -> X" parseCompTy $ CompTy [VTy"X"] (Peg emptyAbility (VTy"X")) , parserTest "X -> []X" parseCompTy $ CompTy [VTy"X"] (Peg emptyAbility (VTy"X")) , parserTest "X -> X -> X" parseCompTy $ CompTy [VTy"X", VTy"X"] (Peg emptyAbility (VTy"X")) , parserTest "{X -> X}" parseValTy $ SuspendedTy $ CompTy [VTy"X"] (Peg emptyAbility (VTy"X")) , parserTest "X" parseValTy (VTy"X") , parserTest "(X)" parseValTy (VTy"X") -- , parserTest "(X Y)" parseValTy (DataTy "X" (VTy"X")) , parserTest "| foo : X -> X" parseCommandDecl $ CommandDeclaration "foo" [VTy"X"] (VTy"X") , let decl = T.unlines [ "interface Iface X Y =" , " | foo : X -> Y" , " | bar : Y -> X" ] expected = InterfaceDecl "Iface" (EffectInterface [("X", ValTyK), ("Y", ValTyK)] [ CommandDeclaration "foo" [VTy"X"] (VTy"Y") , CommandDeclaration "bar" [VTy"Y"] (VTy"X") ]) in parserTest decl parseInterfaceDecl expected , parserTest "Z!" parseTm $ AppT (V"Z") [] , parserTest "Z Z Z" parseTm $ AppT (V"Z") [V"Z", V"Z"] , parserTest "let Z: forall. X = W in Z" parseLet $ Let (V"W") (Polytype [] (VTy"X")) "Z" (V"Z") -- let_ "Z" (Polytype [] (VTy"X")) (V"W") (V"Z") , let defn = T.unlines [ "let on : forall X Y. {X -> {X -> []Y} -> []Y} =" , " \\x f -> f x in on n (\\x -> body)" ] compDomain = [VTy"X", SuspendedTy (CompTy [VTy"X"] (Peg emptyAbility (VTy"Y")))] compCodomain = Peg emptyAbility (VTy"Y") polyVal = SuspendedTy (CompTy compDomain compCodomain) polyBinders = [("X", ValTyK), ("Y", ValTyK)] pty = Polytype polyBinders polyVal expected = Let (Lambda ["x", "f"] (AppT (V"f") [V"x"])) pty "on" (AppT (V"on") [V"n", Lambda ["x"] (V"body")]) in parserTest defn parseLet expected , let defn = "on n (\\x -> body)" expected = AppT (V"on") [V"n", Lambda ["x"] (V"body")] in parserTest defn parseTm expected , let defn = "\\x f -> f x" expected = Lambda ["x", "f"] (AppT (V"f") [V"x"]) in parserTest defn parseTm expected , let defn = T.unlines [ "case x of" , " | <_> -> y" , " | <_ a b c> -> z" ] expected = Case (V "x") [ ([], V "y") , (["a", "b", "c"], V "z") ] in scope "case" $ tests [ parserTest defn parseTm expected , parserTest defn parseCase expected ] -- "data Maybe x = Just x | Nothing" , let defn = "data Maybe x =\n | <just x>\n | <nothing>" ctrResult = [TyArgVal (VariableTy "x")] expected = DataDecl "Maybe" (DataTypeInterface [("x", ValTyK)] [ ConstructorDecl "just" [VariableTy "x"] ctrResult , ConstructorDecl "nothing" [] ctrResult ]) in parserTest defn parseDataDecl expected , let defn = "interface IFace =\n | _ : foo -> bar\n | _ : baz" expected = InterfaceDecl "IFace" (EffectInterface [] [ CommandDeclaration "_" [VariableTy "foo"] (VariableTy "bar") , CommandDeclaration "_" [] (VariableTy "baz") ]) in parserTest defn parseInterfaceDecl expected , let defn = T.unlines [ "handle y! : [e , <Abort>] Y with" , " Receive X:" , " | <receive -> r> -> abort!" , " | y -> y" ] scrutinee = AppT (V"y") [] adj = Adjustment [ ("Receive", [TyArgVal (VariableTy"X")]) ] peg = Peg (Ability OpenAbility [("Abort", [])]) (VariableTy "Y") handlers = [ ("Receive", [([], "r", AppT (V"abort") [])]) ] fallthrough = ("y", V"y") expected = Handle scrutinee adj peg (fromList handlers) fallthrough in parserTest defn parseHandle expected , parserTest "X" parseTyVar ("X", ValTyK) , parserTest "[e]" parseTyVar ("e", EffTyK) , parserTest "\\xs -> xs" parseLambda (Lambda ["xs"] (V"xs")) , parserTest "\\ -> xs" parseLambda (Lambda [] (V"xs")) , parserTest "\\-> xs" parseLambda (Lambda [] (V"xs")) , parserTest "<A.0 x! y!>" parseTm (DataConstructor "A" 0 [AppT (V"x") [], AppT (V"y") []]) , parserTest "<A.1 x <A.0>>" parseTm (DataConstructor "A" 1 [V"x", DataConstructor "A" 0 []]) , let input = "f \"x\"" (cid, ipldVal) = mkForeign @Text "x" expected = AppT (V"f") [ForeignValue "Text" [] (T.pack (show cid))] in scope "text" $ case runTokenParse parseTm testLocation input of Right (actual, store) -> do expectEq expected actual expectEq (storeOf [ipldVal]) store Left errMsg -> fail errMsg -- , let defn = T.unlines -- [ -- ] -- in parserTest defn parseLetrec expected -- TODO: -- * parseValue -- , let defn = T.unlines -- [ "catch : <Abort>X -> {X} -> X" -- , " = \\x -> " -- -- , "x _ = x" -- -- , "<aborting -> _> h = h!" -- ] -- in parserTest defn ]
8,030
unitTests = scope "parsing" $ tests [ let defn = T.unlines [ "outer:" , " node1:" , " node2:" , " node3:" ] expected = NamedList "outer" [ NamedList "node1" [ NamedList "node2" [] ] , NamedList "node3" [] ] parseNested = NamedList <$> identifier <* colon <*> localIndentation Gt (many (absoluteIndentation parseNested)) in parserTest defn parseNested expected , parserTest "X" identifier "X" , parserTest "X" parseValTy (VTy"X") , parserTest "<_ X> | <_ X Y>" (parseConstructor [] `sepBy` bar) [ ConstructorDecl "_" [VTy"X"] [] , ConstructorDecl "_" [VTy"X", VTy"Y"] [] ] , parserTest "X" parseTyArg $ TyArgVal (VTy"X") , parserTest "X X X" (many parseTyArg) $ let x = TyArgVal (VTy"X") in [x, x, x] , parserTest "1" parseUid "1" , parserTest "123" parseUid "123" , parserTest "<1 X>" parseDataTy $ DataTy (VariableTy "1") [TyArgVal (VTy"X")] -- also test with args -- Bool , parserTest "data Bool =\n | <true>\n | <false> " parseDataDecl (DataDecl "Bool" $ DataTypeInterface [] [ ConstructorDecl "true" [] [] , ConstructorDecl "false" [] [] ]) -- TODO: also test with effect parameter , let ctrResult = [TyArgVal (VariableTy "X"), TyArgVal (VariableTy "Y")] in parserTest "data Either X Y =\n | <left X>\n | <right Y>" parseDataDecl (DataDecl "Either" $ DataTypeInterface [("X", ValTyK), ("Y", ValTyK)] [ ConstructorDecl "left" [VTy"X"] ctrResult , ConstructorDecl "right" [VTy"Y"] ctrResult ]) -- also test effect ty, multiple instances , parserTest "<1 X>" parseInterfaceInstance ("1", [TyArgVal (VTy"X")]) , parserTest "<1 [0]>" parseInterfaceInstance ("1", [ TyArgAbility (Ability ClosedAbility mempty) ]) , parserTest "<1 []>" parseInterfaceInstance ("1", [ TyArgAbility (Ability OpenAbility mempty) ]) , parserTest "<1>" parseInterfaceInstance ("1", []) , parserTest "0" parseAbilityBody closedAbility , parserTest "0,<1>" parseAbilityBody $ Ability ClosedAbility [("1", [])] , parserTest "e" parseAbilityBody emptyAbility , parserTest "e,<1>" parseAbilityBody $ Ability OpenAbility [("1", [])] -- TODO: parseAbility , parserTest "[0,<1>]" parseAbility $ Ability ClosedAbility [("1", [])] , parserTest "[]" parseAbility emptyAbility , parserTest "[0]" parseAbility closedAbility , parserTest "[] X" parsePeg $ Peg emptyAbility (VTy"X") , parserTest "[]X" parsePeg $ Peg emptyAbility (VTy"X") , parserTest "[] <1 X>" parsePeg $ Peg emptyAbility (DataTy (VariableTy "1") [TyArgVal (VTy"X")]) , parserTest "X" parseCompTy $ CompTy [] (Peg emptyAbility (VTy"X")) , parserTest "X -> X" parseCompTy $ CompTy [VTy"X"] (Peg emptyAbility (VTy"X")) , parserTest "X -> []X" parseCompTy $ CompTy [VTy"X"] (Peg emptyAbility (VTy"X")) , parserTest "X -> X -> X" parseCompTy $ CompTy [VTy"X", VTy"X"] (Peg emptyAbility (VTy"X")) , parserTest "{X -> X}" parseValTy $ SuspendedTy $ CompTy [VTy"X"] (Peg emptyAbility (VTy"X")) , parserTest "X" parseValTy (VTy"X") , parserTest "(X)" parseValTy (VTy"X") -- , parserTest "(X Y)" parseValTy (DataTy "X" (VTy"X")) , parserTest "| foo : X -> X" parseCommandDecl $ CommandDeclaration "foo" [VTy"X"] (VTy"X") , let decl = T.unlines [ "interface Iface X Y =" , " | foo : X -> Y" , " | bar : Y -> X" ] expected = InterfaceDecl "Iface" (EffectInterface [("X", ValTyK), ("Y", ValTyK)] [ CommandDeclaration "foo" [VTy"X"] (VTy"Y") , CommandDeclaration "bar" [VTy"Y"] (VTy"X") ]) in parserTest decl parseInterfaceDecl expected , parserTest "Z!" parseTm $ AppT (V"Z") [] , parserTest "Z Z Z" parseTm $ AppT (V"Z") [V"Z", V"Z"] , parserTest "let Z: forall. X = W in Z" parseLet $ Let (V"W") (Polytype [] (VTy"X")) "Z" (V"Z") -- let_ "Z" (Polytype [] (VTy"X")) (V"W") (V"Z") , let defn = T.unlines [ "let on : forall X Y. {X -> {X -> []Y} -> []Y} =" , " \\x f -> f x in on n (\\x -> body)" ] compDomain = [VTy"X", SuspendedTy (CompTy [VTy"X"] (Peg emptyAbility (VTy"Y")))] compCodomain = Peg emptyAbility (VTy"Y") polyVal = SuspendedTy (CompTy compDomain compCodomain) polyBinders = [("X", ValTyK), ("Y", ValTyK)] pty = Polytype polyBinders polyVal expected = Let (Lambda ["x", "f"] (AppT (V"f") [V"x"])) pty "on" (AppT (V"on") [V"n", Lambda ["x"] (V"body")]) in parserTest defn parseLet expected , let defn = "on n (\\x -> body)" expected = AppT (V"on") [V"n", Lambda ["x"] (V"body")] in parserTest defn parseTm expected , let defn = "\\x f -> f x" expected = Lambda ["x", "f"] (AppT (V"f") [V"x"]) in parserTest defn parseTm expected , let defn = T.unlines [ "case x of" , " | <_> -> y" , " | <_ a b c> -> z" ] expected = Case (V "x") [ ([], V "y") , (["a", "b", "c"], V "z") ] in scope "case" $ tests [ parserTest defn parseTm expected , parserTest defn parseCase expected ] -- "data Maybe x = Just x | Nothing" , let defn = "data Maybe x =\n | <just x>\n | <nothing>" ctrResult = [TyArgVal (VariableTy "x")] expected = DataDecl "Maybe" (DataTypeInterface [("x", ValTyK)] [ ConstructorDecl "just" [VariableTy "x"] ctrResult , ConstructorDecl "nothing" [] ctrResult ]) in parserTest defn parseDataDecl expected , let defn = "interface IFace =\n | _ : foo -> bar\n | _ : baz" expected = InterfaceDecl "IFace" (EffectInterface [] [ CommandDeclaration "_" [VariableTy "foo"] (VariableTy "bar") , CommandDeclaration "_" [] (VariableTy "baz") ]) in parserTest defn parseInterfaceDecl expected , let defn = T.unlines [ "handle y! : [e , <Abort>] Y with" , " Receive X:" , " | <receive -> r> -> abort!" , " | y -> y" ] scrutinee = AppT (V"y") [] adj = Adjustment [ ("Receive", [TyArgVal (VariableTy"X")]) ] peg = Peg (Ability OpenAbility [("Abort", [])]) (VariableTy "Y") handlers = [ ("Receive", [([], "r", AppT (V"abort") [])]) ] fallthrough = ("y", V"y") expected = Handle scrutinee adj peg (fromList handlers) fallthrough in parserTest defn parseHandle expected , parserTest "X" parseTyVar ("X", ValTyK) , parserTest "[e]" parseTyVar ("e", EffTyK) , parserTest "\\xs -> xs" parseLambda (Lambda ["xs"] (V"xs")) , parserTest "\\ -> xs" parseLambda (Lambda [] (V"xs")) , parserTest "\\-> xs" parseLambda (Lambda [] (V"xs")) , parserTest "<A.0 x! y!>" parseTm (DataConstructor "A" 0 [AppT (V"x") [], AppT (V"y") []]) , parserTest "<A.1 x <A.0>>" parseTm (DataConstructor "A" 1 [V"x", DataConstructor "A" 0 []]) , let input = "f \"x\"" (cid, ipldVal) = mkForeign @Text "x" expected = AppT (V"f") [ForeignValue "Text" [] (T.pack (show cid))] in scope "text" $ case runTokenParse parseTm testLocation input of Right (actual, store) -> do expectEq expected actual expectEq (storeOf [ipldVal]) store Left errMsg -> fail errMsg -- , let defn = T.unlines -- [ -- ] -- in parserTest defn parseLetrec expected -- TODO: -- * parseValue -- , let defn = T.unlines -- [ "catch : <Abort>X -> {X} -> X" -- , " = \\x -> " -- -- , "x _ = x" -- -- , "<aborting -> _> h = h!" -- ] -- in parserTest defn ]
8,009
false
true
0
17
2,397
2,504
1,288
1,216
null
null
uebayasi/haskell-graphql-schema
src/Data/GraphQL/XXX/Schema/Parser.hs
bsd-3-clause
enumDefinition :: Parser Statement enumDefinition = EnumDefinition <$> typeDecl "enum" <*> symbols where symbols = braces enumSymbols enumSymbols :: Parser EnumNames enumSymbols = sepEndBy1 enumName spaces -- Input
244
enumDefinition :: Parser Statement enumDefinition = EnumDefinition <$> typeDecl "enum" <*> symbols where symbols = braces enumSymbols enumSymbols :: Parser EnumNames enumSymbols = sepEndBy1 enumName spaces -- Input
244
enumDefinition = EnumDefinition <$> typeDecl "enum" <*> symbols where symbols = braces enumSymbols enumSymbols :: Parser EnumNames enumSymbols = sepEndBy1 enumName spaces -- Input
209
false
true
2
7
57
55
27
28
null
null
RAFIRAF/HASKELL
mergeSort3.hs
mit
mergeTwo (x:xs) (y:ys) = if x <= y then x:mergeTwo xs (y:ys) else y:mergeTwo (x:xs) ys
86
mergeTwo (x:xs) (y:ys) = if x <= y then x:mergeTwo xs (y:ys) else y:mergeTwo (x:xs) ys
86
mergeTwo (x:xs) (y:ys) = if x <= y then x:mergeTwo xs (y:ys) else y:mergeTwo (x:xs) ys
86
false
false
0
9
15
69
36
33
null
null
konn/pandoc-japanese-filters
math-to-svg-filter.hs
gpl-2.0
main :: IO () main = toJSONFilter processMath
45
main :: IO () main = toJSONFilter processMath
45
main = toJSONFilter processMath
31
false
true
0
6
7
19
9
10
null
null
coolhacks/scripts-hacks
examples/shellcheck-master/ShellCheck/Analytics.hs
mit
checkMkdirDashPM _ t@(T_SimpleCommand _ _ args) = potentially $ do name <- getCommandName t guard $ name == "mkdir" dashP <- find ((\f -> f == "p" || f == "parents") . snd) flags dashM <- find ((\f -> f == "m" || f == "mode") . snd) flags guard $ any couldHaveSubdirs (drop 1 args) -- mkdir -pm 0700 dir is fine, but dir/subdir is not. return $ warn (getId $ fst dashM) 2174 "When used with -p, -m only applies to the deepest directory." where flags = getAllFlags t couldHaveSubdirs t = fromMaybe True $ do name <- getLiteralString t return $ '/' `elem` name
609
checkMkdirDashPM _ t@(T_SimpleCommand _ _ args) = potentially $ do name <- getCommandName t guard $ name == "mkdir" dashP <- find ((\f -> f == "p" || f == "parents") . snd) flags dashM <- find ((\f -> f == "m" || f == "mode") . snd) flags guard $ any couldHaveSubdirs (drop 1 args) -- mkdir -pm 0700 dir is fine, but dir/subdir is not. return $ warn (getId $ fst dashM) 2174 "When used with -p, -m only applies to the deepest directory." where flags = getAllFlags t couldHaveSubdirs t = fromMaybe True $ do name <- getLiteralString t return $ '/' `elem` name
609
checkMkdirDashPM _ t@(T_SimpleCommand _ _ args) = potentially $ do name <- getCommandName t guard $ name == "mkdir" dashP <- find ((\f -> f == "p" || f == "parents") . snd) flags dashM <- find ((\f -> f == "m" || f == "mode") . snd) flags guard $ any couldHaveSubdirs (drop 1 args) -- mkdir -pm 0700 dir is fine, but dir/subdir is not. return $ warn (getId $ fst dashM) 2174 "When used with -p, -m only applies to the deepest directory." where flags = getAllFlags t couldHaveSubdirs t = fromMaybe True $ do name <- getLiteralString t return $ '/' `elem` name
609
false
false
2
16
157
227
107
120
null
null
vikraman/ghc
compiler/typecheck/TcRnTypes.hs
bsd-3-clause
runTcPluginM :: TcPluginM a -> Maybe EvBindsVar -> TcM a runTcPluginM (TcPluginM m) = m
87
runTcPluginM :: TcPluginM a -> Maybe EvBindsVar -> TcM a runTcPluginM (TcPluginM m) = m
87
runTcPluginM (TcPluginM m) = m
30
false
true
0
10
14
42
18
24
null
null
spechub/Hets
Proofs/InferBasic.hs
gpl-2.0
proveKnownPMap :: LogicGraph -> IORef IntState -> [GFreeDefMorphism] -> ProofState -> IO (Result ProofState) proveKnownPMap lg intSt freedefs st = maybe (proveFineGrainedSelect lg intSt freedefs st) (callProver st intSt False freedefs) $ lookupKnownProver st ProveGUI
303
proveKnownPMap :: LogicGraph -> IORef IntState -> [GFreeDefMorphism] -> ProofState -> IO (Result ProofState) proveKnownPMap lg intSt freedefs st = maybe (proveFineGrainedSelect lg intSt freedefs st) (callProver st intSt False freedefs) $ lookupKnownProver st ProveGUI
303
proveKnownPMap lg intSt freedefs st = maybe (proveFineGrainedSelect lg intSt freedefs st) (callProver st intSt False freedefs) $ lookupKnownProver st ProveGUI
182
false
true
0
12
70
90
43
47
null
null
event/spim
MIMEDir.hs
agpl-3.0
splitList x xs = let t = span (/=x) xs in fst t : case snd t of -- the first elem of `snd t' is x by definition of span _ : [] -> [ [ ] ] _ : rest -> splitList x rest [] -> []
299
splitList x xs = let t = span (/=x) xs in fst t : case snd t of -- the first elem of `snd t' is x by definition of span _ : [] -> [ [ ] ] _ : rest -> splitList x rest [] -> []
299
splitList x xs = let t = span (/=x) xs in fst t : case snd t of -- the first elem of `snd t' is x by definition of span _ : [] -> [ [ ] ] _ : rest -> splitList x rest [] -> []
299
false
false
3
10
172
94
43
51
null
null
alexander-at-github/eta
libraries/base/GHC/Profiling.hs
bsd-3-clause
startProfTimer :: IO () startProfTimer = undefined
50
startProfTimer :: IO () startProfTimer = undefined
50
startProfTimer = undefined
26
false
true
1
6
6
20
8
12
null
null
noughtmare/yi
yi-core/src/Yi/Buffer/Implementation.hs
gpl-2.0
mkOverlay :: R.YiString -> Region -> StyleName -> R.YiString -> Overlay mkOverlay owner r = Overlay owner (MarkValue (regionStart r) Backward) (MarkValue (regionEnd r) Forward)
196
mkOverlay :: R.YiString -> Region -> StyleName -> R.YiString -> Overlay mkOverlay owner r = Overlay owner (MarkValue (regionStart r) Backward) (MarkValue (regionEnd r) Forward)
196
mkOverlay owner r = Overlay owner (MarkValue (regionStart r) Backward) (MarkValue (regionEnd r) Forward)
124
false
true
0
9
44
71
35
36
null
null
matonix/ExpCalcForGomaotsu
gomaotsu.hs
mit
expKToK1 r k = exp1ToN r (k+1) - exp1ToN r k
44
expKToK1 r k = exp1ToN r (k+1) - exp1ToN r k
44
expKToK1 r k = exp1ToN r (k+1) - exp1ToN r k
44
false
false
1
8
10
36
15
21
null
null
x-y-z/cabal
cabal-install/tests/UnitTests/Distribution/Client/Dependency/Modular/DSL.hs
bsd-3-clause
exInstPkgId :: ExampleInstalled -> C.PackageIdentifier exInstPkgId ex = C.PackageIdentifier { pkgName = C.PackageName (exInstName ex) , pkgVersion = Version [exInstVersion ex, 0, 0] [] }
203
exInstPkgId :: ExampleInstalled -> C.PackageIdentifier exInstPkgId ex = C.PackageIdentifier { pkgName = C.PackageName (exInstName ex) , pkgVersion = Version [exInstVersion ex, 0, 0] [] }
203
exInstPkgId ex = C.PackageIdentifier { pkgName = C.PackageName (exInstName ex) , pkgVersion = Version [exInstVersion ex, 0, 0] [] }
148
false
true
0
10
41
72
36
36
null
null
giorgidze/igraph
Data/IGraph.hs
bsd-3-clause
-- | 6\.2\. `igraph_betweenness_estimate` — Estimated betweenness centrality of -- some vertices. -- -- The betweenness centrality of a vertex is the number of geodesics going -- through it. If there are more than one geodesic between two vertices, the -- value of these geodesics are weighted by one over the number of geodesics. -- When estimating betweenness centrality, igraph takes into consideration only -- those paths that are shorter than or equal to a prescribed length. Note that -- the estimated centrality will always be less than the real one. betweennessEstimate :: Ord a => Graph d a -> VertexSelector a -> Int -- ^ cutoff -> Map a Double betweennessEstimate g@(G _) vs cutoff = unsafePerformIO $ do v <- newVector 0 _e <- withGraph g $ \gp -> withVector v $ \vp -> withVs vs g $ \vsp -> withOptionalWeights g $ \wp -> c_igraph_betweenness_estimate gp vp vsp (isDirected g) (fromIntegral cutoff) wp True -- should be OK for most graphs scores <- vectorToList v return $ M.fromList $ zip (selectedVertices g vs) scores
1,240
betweennessEstimate :: Ord a => Graph d a -> VertexSelector a -> Int -- ^ cutoff -> Map a Double betweennessEstimate g@(G _) vs cutoff = unsafePerformIO $ do v <- newVector 0 _e <- withGraph g $ \gp -> withVector v $ \vp -> withVs vs g $ \vsp -> withOptionalWeights g $ \wp -> c_igraph_betweenness_estimate gp vp vsp (isDirected g) (fromIntegral cutoff) wp True -- should be OK for most graphs scores <- vectorToList v return $ M.fromList $ zip (selectedVertices g vs) scores
682
betweennessEstimate g@(G _) vs cutoff = unsafePerformIO $ do v <- newVector 0 _e <- withGraph g $ \gp -> withVector v $ \vp -> withVs vs g $ \vsp -> withOptionalWeights g $ \wp -> c_igraph_betweenness_estimate gp vp vsp (isDirected g) (fromIntegral cutoff) wp True -- should be OK for most graphs scores <- vectorToList v return $ M.fromList $ zip (selectedVertices g vs) scores
505
true
true
0
19
383
204
102
102
null
null
christiaanb/clash-tryout
src/CLaSH/Util/Pretty/Core.hs
bsd-3-clause
hang' d1 n d2 = vcat [d1, nest n d2]
36
hang' d1 n d2 = vcat [d1, nest n d2]
36
hang' d1 n d2 = vcat [d1, nest n d2]
36
false
false
0
7
9
27
13
14
null
null
robrix/ui-effects
src/UI/Font.hs
bsd-3-clause
word32Bytes :: Word32 -> [Word8] word32Bytes x = [ fromIntegral $ x .&. 0xFF, fromIntegral $ (x .&. 0xFF00) `shiftR` 8, fromIntegral $ (x .&. 0xFF0000) `shiftR` 16, fromIntegral $ (x .&. 0xFF000000) `shiftR` 24 ]
212
word32Bytes :: Word32 -> [Word8] word32Bytes x = [ fromIntegral $ x .&. 0xFF, fromIntegral $ (x .&. 0xFF00) `shiftR` 8, fromIntegral $ (x .&. 0xFF0000) `shiftR` 16, fromIntegral $ (x .&. 0xFF000000) `shiftR` 24 ]
212
word32Bytes x = [ fromIntegral $ x .&. 0xFF, fromIntegral $ (x .&. 0xFF00) `shiftR` 8, fromIntegral $ (x .&. 0xFF0000) `shiftR` 16, fromIntegral $ (x .&. 0xFF000000) `shiftR` 24 ]
179
false
true
0
10
35
98
54
44
null
null
sdiehl/ghc
libraries/base/GHC/IO/Handle/Internals.hs
bsd-3-clause
writeCharBuffer :: Handle__ -> CharBuffer -> IO () writeCharBuffer h_@Handle__{..} !cbuf = do -- bbuf <- readIORef haByteBuffer debugIO ("writeCharBuffer: cbuf=" ++ summaryBuffer cbuf ++ " bbuf=" ++ summaryBuffer bbuf) (cbuf',bbuf') <- case haEncoder of Nothing -> latin1_encode cbuf bbuf Just encoder -> (streamEncode encoder) cbuf bbuf debugIO ("writeCharBuffer after encoding: cbuf=" ++ summaryBuffer cbuf' ++ " bbuf=" ++ summaryBuffer bbuf') -- flush the byte buffer if it is full if isFullBuffer bbuf' -- or we made no progress || not (isEmptyBuffer cbuf') && bufL cbuf' == bufL cbuf -- or the byte buffer has more elements than the user wanted buffered || (case haBufferMode of BlockBuffering (Just s) -> bufferElems bbuf' >= s NoBuffering -> True _other -> False) then do bbuf'' <- Buffered.flushWriteBuffer haDevice bbuf' writeIORef haByteBuffer bbuf'' else writeIORef haByteBuffer bbuf' if not (isEmptyBuffer cbuf') then writeCharBuffer h_ cbuf' else return () -- ----------------------------------------------------------------------------- -- Flushing read buffers -- It is always possible to flush the Char buffer back to the byte buffer.
1,307
writeCharBuffer :: Handle__ -> CharBuffer -> IO () writeCharBuffer h_@Handle__{..} !cbuf = do -- bbuf <- readIORef haByteBuffer debugIO ("writeCharBuffer: cbuf=" ++ summaryBuffer cbuf ++ " bbuf=" ++ summaryBuffer bbuf) (cbuf',bbuf') <- case haEncoder of Nothing -> latin1_encode cbuf bbuf Just encoder -> (streamEncode encoder) cbuf bbuf debugIO ("writeCharBuffer after encoding: cbuf=" ++ summaryBuffer cbuf' ++ " bbuf=" ++ summaryBuffer bbuf') -- flush the byte buffer if it is full if isFullBuffer bbuf' -- or we made no progress || not (isEmptyBuffer cbuf') && bufL cbuf' == bufL cbuf -- or the byte buffer has more elements than the user wanted buffered || (case haBufferMode of BlockBuffering (Just s) -> bufferElems bbuf' >= s NoBuffering -> True _other -> False) then do bbuf'' <- Buffered.flushWriteBuffer haDevice bbuf' writeIORef haByteBuffer bbuf'' else writeIORef haByteBuffer bbuf' if not (isEmptyBuffer cbuf') then writeCharBuffer h_ cbuf' else return () -- ----------------------------------------------------------------------------- -- Flushing read buffers -- It is always possible to flush the Char buffer back to the byte buffer.
1,307
writeCharBuffer h_@Handle__{..} !cbuf = do -- bbuf <- readIORef haByteBuffer debugIO ("writeCharBuffer: cbuf=" ++ summaryBuffer cbuf ++ " bbuf=" ++ summaryBuffer bbuf) (cbuf',bbuf') <- case haEncoder of Nothing -> latin1_encode cbuf bbuf Just encoder -> (streamEncode encoder) cbuf bbuf debugIO ("writeCharBuffer after encoding: cbuf=" ++ summaryBuffer cbuf' ++ " bbuf=" ++ summaryBuffer bbuf') -- flush the byte buffer if it is full if isFullBuffer bbuf' -- or we made no progress || not (isEmptyBuffer cbuf') && bufL cbuf' == bufL cbuf -- or the byte buffer has more elements than the user wanted buffered || (case haBufferMode of BlockBuffering (Just s) -> bufferElems bbuf' >= s NoBuffering -> True _other -> False) then do bbuf'' <- Buffered.flushWriteBuffer haDevice bbuf' writeIORef haByteBuffer bbuf'' else writeIORef haByteBuffer bbuf' if not (isEmptyBuffer cbuf') then writeCharBuffer h_ cbuf' else return () -- ----------------------------------------------------------------------------- -- Flushing read buffers -- It is always possible to flush the Char buffer back to the byte buffer.
1,256
false
true
0
15
322
301
143
158
null
null
text-utf8/text
tests/Tests/Properties.hs
bsd-2-clause
t_ascii t = E.decodeASCII (E.encodeUtf8 a) === a where a = T.map (\c -> chr (ord c `mod` 128)) t
104
t_ascii t = E.decodeASCII (E.encodeUtf8 a) === a where a = T.map (\c -> chr (ord c `mod` 128)) t
104
t_ascii t = E.decodeASCII (E.encodeUtf8 a) === a where a = T.map (\c -> chr (ord c `mod` 128)) t
104
false
false
0
13
27
63
32
31
null
null
Courseography/courseography
app/Svg/Builder.hs
gpl-3.0
-- | Determines if a text intersects with any shape in a list. intersectsWithShape :: [Shape] -> Text -> Bool intersectsWithShape shapes text = any (intersectsWithPoint (textPos text)) shapes
195
intersectsWithShape :: [Shape] -> Text -> Bool intersectsWithShape shapes text = any (intersectsWithPoint (textPos text)) shapes
132
intersectsWithShape shapes text = any (intersectsWithPoint (textPos text)) shapes
85
true
true
0
9
32
50
24
26
null
null
BartAdv/Idris-dev
src/Idris/Inliner.hs
bsd-3-clause
-- Inlining is either top level (i.e. not in a function arg) or argument level -- For each application in a term: -- * Check if the function is inlinable -- (Dictionaries are inlinable in an argument, not otherwise) -- - If so, try inlining without reducing its arguments -- + If successful, then continue on the result (top level) -- + If not, reduce the arguments (argument level) and try again -- - If not, inline all the arguments (top level) inlineTerm :: IState -> Term -> Term inlineTerm ist tm = inl tm where inl orig@(P _ n _) = inlApp n [] orig inl orig@(App _ f a) | (P _ fn _, args) <- unApply orig = inlApp fn args orig inl (Bind n (Let t v) sc) = Bind n (Let t (inl v)) (inl sc) inl (Bind n b sc) = Bind n b (inl sc) inl tm = tm inlApp fn args orig = orig
824
inlineTerm :: IState -> Term -> Term inlineTerm ist tm = inl tm where inl orig@(P _ n _) = inlApp n [] orig inl orig@(App _ f a) | (P _ fn _, args) <- unApply orig = inlApp fn args orig inl (Bind n (Let t v) sc) = Bind n (Let t (inl v)) (inl sc) inl (Bind n b sc) = Bind n b (inl sc) inl tm = tm inlApp fn args orig = orig
341
inlineTerm ist tm = inl tm where inl orig@(P _ n _) = inlApp n [] orig inl orig@(App _ f a) | (P _ fn _, args) <- unApply orig = inlApp fn args orig inl (Bind n (Let t v) sc) = Bind n (Let t (inl v)) (inl sc) inl (Bind n b sc) = Bind n b (inl sc) inl tm = tm inlApp fn args orig = orig
304
true
true
0
12
216
230
115
115
null
null
agrafix/Spock-worker
src/Web/Spock/Worker/Internal/Queue.hs
mit
dequeuePQ' :: Ord p => p -> PureQueue p v -> (Maybe (p, v), PureQueue p v) dequeuePQ' prioBound pq@(PureQueue m _) | M.null m = (Nothing, pq) | minK > prioBound = (Nothing, pq) | otherwise = case V.toList vec of [workEl] -> (Just (minK, workEl), updatePQ (M.delete minK)) (workEl:xs) -> (Just (minK, workEl), updatePQ (M.adjust (const (V.fromList xs)) minK)) [] -> error "Library-Error: This should never happen." where (minK, vec) = M.findMin m updatePQ fun = pq { pq_container = fun (pq_container pq) }
632
dequeuePQ' :: Ord p => p -> PureQueue p v -> (Maybe (p, v), PureQueue p v) dequeuePQ' prioBound pq@(PureQueue m _) | M.null m = (Nothing, pq) | minK > prioBound = (Nothing, pq) | otherwise = case V.toList vec of [workEl] -> (Just (minK, workEl), updatePQ (M.delete minK)) (workEl:xs) -> (Just (minK, workEl), updatePQ (M.adjust (const (V.fromList xs)) minK)) [] -> error "Library-Error: This should never happen." where (minK, vec) = M.findMin m updatePQ fun = pq { pq_container = fun (pq_container pq) }
632
dequeuePQ' prioBound pq@(PureQueue m _) | M.null m = (Nothing, pq) | minK > prioBound = (Nothing, pq) | otherwise = case V.toList vec of [workEl] -> (Just (minK, workEl), updatePQ (M.delete minK)) (workEl:xs) -> (Just (minK, workEl), updatePQ (M.adjust (const (V.fromList xs)) minK)) [] -> error "Library-Error: This should never happen." where (minK, vec) = M.findMin m updatePQ fun = pq { pq_container = fun (pq_container pq) }
557
false
true
0
17
213
266
136
130
null
null
zachsully/hakaru
haskell/Language/Hakaru/Parser/Maple.hs
bsd-3-clause
stringLiteral :: Parser Text stringLiteral = Text.pack <$> Token.stringLiteral lexer
84
stringLiteral :: Parser Text stringLiteral = Text.pack <$> Token.stringLiteral lexer
84
stringLiteral = Text.pack <$> Token.stringLiteral lexer
55
false
true
0
7
9
25
12
13
null
null
d0kt0r0/estuary
client/src/Estuary/Types/Terminal.hs
gpl-3.0
presetView' :: H (Text -> Command) presetView' = PresetView <$ reserved "presetview"
84
presetView' :: H (Text -> Command) presetView' = PresetView <$ reserved "presetview"
84
presetView' = PresetView <$ reserved "presetview"
49
false
true
2
8
11
35
15
20
null
null
bitemyapp/ghc
libraries/template-haskell/Language/Haskell/TH/Ppr.hs
bsd-3-clause
pprTyLit (StrTyLit s) = text (show s)
37
pprTyLit (StrTyLit s) = text (show s)
37
pprTyLit (StrTyLit s) = text (show s)
37
false
false
0
6
6
25
11
14
null
null
mgsloan/hask-monkey
src/ActiveHs/Simple.hs
bsd-3-clause
fatal (NotAllowed _) = False
29
fatal (NotAllowed _) = False
29
fatal (NotAllowed _) = False
29
false
false
0
6
5
16
7
9
null
null
GaloisInc/halvm-ghc
compiler/main/DynFlags.hs
bsd-3-clause
wayUnsetGeneralFlags _ WayEventLog = []
39
wayUnsetGeneralFlags _ WayEventLog = []
39
wayUnsetGeneralFlags _ WayEventLog = []
39
false
false
0
5
4
13
6
7
null
null
sdiehl/ghc
compiler/ghci/ByteCodeInstr.hs
bsd-3-clause
bciStackUse PUSH_BCO{} = 1
37
bciStackUse PUSH_BCO{} = 1
37
bciStackUse PUSH_BCO{} = 1
37
false
false
0
6
14
13
6
7
null
null
rahulmutt/ghcvm
compiler/Eta/HsSyn/HsBinds.hs
bsd-3-clause
hsSigDoc (SpecInstSig {}) = ptext (sLit "SPECIALISE instance pragma")
75
hsSigDoc (SpecInstSig {}) = ptext (sLit "SPECIALISE instance pragma")
75
hsSigDoc (SpecInstSig {}) = ptext (sLit "SPECIALISE instance pragma")
75
false
false
0
7
14
25
12
13
null
null
Daniel-Diaz/processing
Graphics/Web/Processing/Core/Primal.hs
bsd-3-clause
docLE :: Doc docLE = fromText "<="
34
docLE :: Doc docLE = fromText "<="
34
docLE = fromText "<="
21
false
true
0
5
6
14
7
7
null
null
fpco/cabal
cabal-install/Distribution/Client/InstallPlan.hs
bsd-3-clause
completed :: PackageIdentifier -> BuildSuccess -> InstallPlan -> InstallPlan completed pkgid buildResult plan = assert (invariant plan') plan' where plan' = plan { planIndex = PackageIndex.insert installed (planIndex plan) } installed = Installed (lookupProcessingPackage plan pkgid) buildResult -- | Marks a package in the graph as having failed. It also marks all the -- packages that depended on it as having failed. -- -- * The package must exist in the graph and be in the processing -- state. --
570
completed :: PackageIdentifier -> BuildSuccess -> InstallPlan -> InstallPlan completed pkgid buildResult plan = assert (invariant plan') plan' where plan' = plan { planIndex = PackageIndex.insert installed (planIndex plan) } installed = Installed (lookupProcessingPackage plan pkgid) buildResult -- | Marks a package in the graph as having failed. It also marks all the -- packages that depended on it as having failed. -- -- * The package must exist in the graph and be in the processing -- state. --
570
completed pkgid buildResult plan = assert (invariant plan') plan' where plan' = plan { planIndex = PackageIndex.insert installed (planIndex plan) } installed = Installed (lookupProcessingPackage plan pkgid) buildResult -- | Marks a package in the graph as having failed. It also marks all the -- packages that depended on it as having failed. -- -- * The package must exist in the graph and be in the processing -- state. --
473
false
true
1
10
148
95
50
45
null
null
nrolland/react-flux
example/purecss-side-menu/Main.hs
bsd-3-clause
main :: IO () main = do initHistory reactRender "side-menu-app" myApp ()
80
main :: IO () main = do initHistory reactRender "side-menu-app" myApp ()
80
main = do initHistory reactRender "side-menu-app" myApp ()
66
false
true
0
9
19
37
15
22
null
null
spaceships/circuit-synthesis
src/Circuit/Format/Bench.hs
mit
parseGate :: Gate g => ParseBench g () parseGate = do zwire <- name spaces char '=' spaces let parseNot = do string "NOT" xwire <- between (char '(') (char ')') name xref <- view (b_gates . at xwire . non (error "[parseGate] unknown argument")) <$> getSt lift $ B.circNot xref let parseAnd = do string "AND" char '(' xwire <- name char ',' spaces ywire <- name char ')' xref <- view (b_gates . at xwire . non (error "[parseGate] unknown argument")) <$> getSt yref <- view (b_gates . at ywire . non (error "[parseGate] unknown argument")) <$> getSt lift $ B.circAnd xref yref zref <- parseNot <|> parseAnd <?> "[parseGate] unknown gate!" endLine modifySt (b_gates . at zwire ?~ zref)
985
parseGate :: Gate g => ParseBench g () parseGate = do zwire <- name spaces char '=' spaces let parseNot = do string "NOT" xwire <- between (char '(') (char ')') name xref <- view (b_gates . at xwire . non (error "[parseGate] unknown argument")) <$> getSt lift $ B.circNot xref let parseAnd = do string "AND" char '(' xwire <- name char ',' spaces ywire <- name char ')' xref <- view (b_gates . at xwire . non (error "[parseGate] unknown argument")) <$> getSt yref <- view (b_gates . at ywire . non (error "[parseGate] unknown argument")) <$> getSt lift $ B.circAnd xref yref zref <- parseNot <|> parseAnd <?> "[parseGate] unknown gate!" endLine modifySt (b_gates . at zwire ?~ zref)
985
parseGate = do zwire <- name spaces char '=' spaces let parseNot = do string "NOT" xwire <- between (char '(') (char ')') name xref <- view (b_gates . at xwire . non (error "[parseGate] unknown argument")) <$> getSt lift $ B.circNot xref let parseAnd = do string "AND" char '(' xwire <- name char ',' spaces ywire <- name char ')' xref <- view (b_gates . at xwire . non (error "[parseGate] unknown argument")) <$> getSt yref <- view (b_gates . at ywire . non (error "[parseGate] unknown argument")) <$> getSt lift $ B.circAnd xref yref zref <- parseNot <|> parseAnd <?> "[parseGate] unknown gate!" endLine modifySt (b_gates . at zwire ?~ zref)
946
false
true
6
19
424
310
137
173
null
null
ulricha/dsh
src/Database/DSH/SL/Builtins.hs
bsd-3-clause
appLayout :: v -> (v -> DVec -> Build TSL (DVec, v)) -> Layout DVec -> Build TSL (Layout DVec) appLayout _ _ LCol = return LCol
157
appLayout :: v -> (v -> DVec -> Build TSL (DVec, v)) -> Layout DVec -> Build TSL (Layout DVec) appLayout _ _ LCol = return LCol
157
appLayout _ _ LCol = return LCol
32
false
true
0
11
56
69
34
35
null
null
cspollard/bcalib
src/BCalib/IP2D.hs
bsd-3-clause
ip2dPb :: Lens' IP2DInfo Double ip2dPb f_ajeW (IP2DInfo x1_ajeX x2_ajeY x3_ajeZ x4_ajf0 x5_ajf1) = fmap (\ y1_ajf2 -> IP2DInfo x1_ajeX x2_ajeY x3_ajeZ x4_ajf0 y1_ajf2) (f_ajeW x5_ajf1)
198
ip2dPb :: Lens' IP2DInfo Double ip2dPb f_ajeW (IP2DInfo x1_ajeX x2_ajeY x3_ajeZ x4_ajf0 x5_ajf1) = fmap (\ y1_ajf2 -> IP2DInfo x1_ajeX x2_ajeY x3_ajeZ x4_ajf0 y1_ajf2) (f_ajeW x5_ajf1)
198
ip2dPb f_ajeW (IP2DInfo x1_ajeX x2_ajeY x3_ajeZ x4_ajf0 x5_ajf1) = fmap (\ y1_ajf2 -> IP2DInfo x1_ajeX x2_ajeY x3_ajeZ x4_ajf0 y1_ajf2) (f_ajeW x5_ajf1)
166
false
true
1
7
39
73
32
41
null
null
AubreyEAnderson/shellcheck
ShellCheck/Analytics.hs
gpl-3.0
prop_checkSingleQuotedVariables3c= verify checkSingleQuotedVariables "sed 's/$((1+foo))/bar/'"
94
prop_checkSingleQuotedVariables3c= verify checkSingleQuotedVariables "sed 's/$((1+foo))/bar/'"
94
prop_checkSingleQuotedVariables3c= verify checkSingleQuotedVariables "sed 's/$((1+foo))/bar/'"
94
false
false
0
5
4
11
5
6
null
null
rimmington/unordered-containers
Data/HashMap/Base.hs
bsd-3-clause
-- | /O(n)/ Reduce this map by applying a binary operator to all -- elements, using the given starting value (typically the -- left-identity of the operator). Each application of the operator -- is evaluated before before using the result in the next -- application. This function is strict in the starting value. foldlWithKey' :: (a -> k -> v -> a) -> a -> HashMap k v -> a foldlWithKey' f = go where go !z Empty = z go z (Leaf _ (L k v)) = f z k v go z (BitmapIndexed _ ary) = A.foldl' go z ary go z (Full ary) = A.foldl' go z ary go z (Collision _ ary) = A.foldl' (\ z' (L k v) -> f z' k v) z ary
659
foldlWithKey' :: (a -> k -> v -> a) -> a -> HashMap k v -> a foldlWithKey' f = go where go !z Empty = z go z (Leaf _ (L k v)) = f z k v go z (BitmapIndexed _ ary) = A.foldl' go z ary go z (Full ary) = A.foldl' go z ary go z (Collision _ ary) = A.foldl' (\ z' (L k v) -> f z' k v) z ary
343
foldlWithKey' f = go where go !z Empty = z go z (Leaf _ (L k v)) = f z k v go z (BitmapIndexed _ ary) = A.foldl' go z ary go z (Full ary) = A.foldl' go z ary go z (Collision _ ary) = A.foldl' (\ z' (L k v) -> f z' k v) z ary
282
true
true
4
9
189
198
101
97
null
null
pascal-knodel/haskell-craft
_/links/E'7'27.hs
mit
dropLine :: Int -> [Word] -> Line dropLine _ [] = []
52
dropLine :: Int -> [Word] -> Line dropLine _ [] = []
52
dropLine _ [] = []
18
false
true
0
7
11
31
16
15
null
null
bitemyapp/persistent
persistent-mongoDB/Database/Persist/MongoDB.hs
mit
-- | Point to an array field with an embedded object and give a deeper query into the embedded object. -- Use with 'nestEq'. (->.) :: forall record emb typ. PersistEntity emb => EntityField record [emb] -> EntityField emb typ -> NestedField record typ (->.) = LastEmbFld
271
(->.) :: forall record emb typ. PersistEntity emb => EntityField record [emb] -> EntityField emb typ -> NestedField record typ (->.) = LastEmbFld
146
(->.) = LastEmbFld
19
true
true
0
10
47
63
33
30
null
null
emwap/feldspar-compiler
lib/Feldspar/Compiler/Frontend/Interactive/Interface.hs
bsd-3-clause
icompile' :: (SyntacticFeld t) => Options -> String -> t -> IO () icompile' opts functionName prg = do let res = compileToCCore functionName opts prg when (printHeader opts) $ do putStrLn "=============== Header ================" putStrLn $ sourceCode $ interface res putStrLn "=============== Source ================" putStrLn $ sourceCode $ implementation res -- | Get the generated core for a program.
435
icompile' :: (SyntacticFeld t) => Options -> String -> t -> IO () icompile' opts functionName prg = do let res = compileToCCore functionName opts prg when (printHeader opts) $ do putStrLn "=============== Header ================" putStrLn $ sourceCode $ interface res putStrLn "=============== Source ================" putStrLn $ sourceCode $ implementation res -- | Get the generated core for a program.
435
icompile' opts functionName prg = do let res = compileToCCore functionName opts prg when (printHeader opts) $ do putStrLn "=============== Header ================" putStrLn $ sourceCode $ interface res putStrLn "=============== Source ================" putStrLn $ sourceCode $ implementation res -- | Get the generated core for a program.
369
false
true
0
12
90
122
54
68
null
null
zhengqm/scheme
src/Evaluator.hs
bsd-3-clause
cdr [badArg] = throwError $ TypeMismatch "pair" badArg
69
cdr [badArg] = throwError $ TypeMismatch "pair" badArg
69
cdr [badArg] = throwError $ TypeMismatch "pair" badArg
69
false
false
0
6
22
21
10
11
null
null
bens/libmpd-haskell
tests/CommandSpec.hs
lgpl-2.1
testPrevious = cmd_ [("previous", Right "OK")] previous
55
testPrevious = cmd_ [("previous", Right "OK")] previous
55
testPrevious = cmd_ [("previous", Right "OK")] previous
55
false
false
0
8
6
23
12
11
null
null
Tener/HaNS
src/Hans/Address/IP4.hs
bsd-3-clause
convertFromWord32 :: Word32 -> IP4 convertFromWord32 n = IP4 a b c d where a = fromIntegral (n `shiftR` 24) b = fromIntegral (n `shiftR` 16) c = fromIntegral (n `shiftR` 8) d = fromIntegral n
201
convertFromWord32 :: Word32 -> IP4 convertFromWord32 n = IP4 a b c d where a = fromIntegral (n `shiftR` 24) b = fromIntegral (n `shiftR` 16) c = fromIntegral (n `shiftR` 8) d = fromIntegral n
201
convertFromWord32 n = IP4 a b c d where a = fromIntegral (n `shiftR` 24) b = fromIntegral (n `shiftR` 16) c = fromIntegral (n `shiftR` 8) d = fromIntegral n
166
false
true
0
7
45
89
48
41
null
null
R-Morgan/NGramCrackers
src/NGramCrackers/Parsers/Metadata.hs
agpl-3.0
dateParser :: PT.Parser Date dateParser = liftA3 toDate month day year where month = dP toMonth <$> many1 digit <* seppr day = dP toDay <$> many1 digit <* seppr year = dP toYear <$> many1 digit seppr = char '/' dP f = f . read
332
dateParser :: PT.Parser Date dateParser = liftA3 toDate month day year where month = dP toMonth <$> many1 digit <* seppr day = dP toDay <$> many1 digit <* seppr year = dP toYear <$> many1 digit seppr = char '/' dP f = f . read
332
dateParser = liftA3 toDate month day year where month = dP toMonth <$> many1 digit <* seppr day = dP toDay <$> many1 digit <* seppr year = dP toYear <$> many1 digit seppr = char '/' dP f = f . read
303
false
true
0
9
152
100
48
52
null
null
tolysz/prepare-ghcjs
spec-lts8/base/Data/Typeable/Internal.hs
bsd-3-clause
mkPolyTyConApp tc kinds types = TypeRep (fingerprintFingerprints sub_fps) tc kinds types where !kt_fps = typeRepFingerprints kinds types sub_fps = tyConFingerprint tc : kt_fps
187
mkPolyTyConApp tc kinds types = TypeRep (fingerprintFingerprints sub_fps) tc kinds types where !kt_fps = typeRepFingerprints kinds types sub_fps = tyConFingerprint tc : kt_fps
187
mkPolyTyConApp tc kinds types = TypeRep (fingerprintFingerprints sub_fps) tc kinds types where !kt_fps = typeRepFingerprints kinds types sub_fps = tyConFingerprint tc : kt_fps
187
false
false
0
7
34
55
25
30
null
null
theor/zorkell
src/Header.hs
bsd-3-clause
exec x = do (story,offset) <- get -- traceShowM ("cur offset", offset) let staticStart = toInt . baseStaticAddr . header $ story let isDynMem = offset < staticStart let r = do bread <- BS.bytesRead rema <- BS.remaining -- traceShowM ("will skip", offset, "read", bread, "remaining", rema) BS.skip $ if isDynMem then offset else offset - staticStart -- traceShowM ("Skipped", offset) xx <- x bread <- (+ if isDynMem then 0 else staticStart) <$> BS.bytesRead return (bread,xx) let yy = fst . BS.runGet r . (if isDynMem then dynMem else staticMem) $ story setAt $ either (const $ trace "ERROR SET" offset) fst yy lift (fmap snd yy) --
751
exec x = do (story,offset) <- get -- traceShowM ("cur offset", offset) let staticStart = toInt . baseStaticAddr . header $ story let isDynMem = offset < staticStart let r = do bread <- BS.bytesRead rema <- BS.remaining -- traceShowM ("will skip", offset, "read", bread, "remaining", rema) BS.skip $ if isDynMem then offset else offset - staticStart -- traceShowM ("Skipped", offset) xx <- x bread <- (+ if isDynMem then 0 else staticStart) <$> BS.bytesRead return (bread,xx) let yy = fst . BS.runGet r . (if isDynMem then dynMem else staticMem) $ story setAt $ either (const $ trace "ERROR SET" offset) fst yy lift (fmap snd yy) --
751
exec x = do (story,offset) <- get -- traceShowM ("cur offset", offset) let staticStart = toInt . baseStaticAddr . header $ story let isDynMem = offset < staticStart let r = do bread <- BS.bytesRead rema <- BS.remaining -- traceShowM ("will skip", offset, "read", bread, "remaining", rema) BS.skip $ if isDynMem then offset else offset - staticStart -- traceShowM ("Skipped", offset) xx <- x bread <- (+ if isDynMem then 0 else staticStart) <$> BS.bytesRead return (bread,xx) let yy = fst . BS.runGet r . (if isDynMem then dynMem else staticMem) $ story setAt $ either (const $ trace "ERROR SET" offset) fst yy lift (fmap snd yy) --
751
false
false
3
10
228
219
114
105
null
null
MichielDerhaeg/stack
src/Stack/Build/ConstructPlan.hs
bsd-3-clause
stripNonDeps :: Set PackageName -> Plan -> Plan stripNonDeps deps plan = plan { planTasks = Map.filter checkTask $ planTasks plan , planFinals = Map.empty , planInstallExes = Map.empty -- TODO maybe don't disable this? } where checkTask task = packageIdentifierName (taskProvides task) `Set.member` deps
325
stripNonDeps :: Set PackageName -> Plan -> Plan stripNonDeps deps plan = plan { planTasks = Map.filter checkTask $ planTasks plan , planFinals = Map.empty , planInstallExes = Map.empty -- TODO maybe don't disable this? } where checkTask task = packageIdentifierName (taskProvides task) `Set.member` deps
325
stripNonDeps deps plan = plan { planTasks = Map.filter checkTask $ planTasks plan , planFinals = Map.empty , planInstallExes = Map.empty -- TODO maybe don't disable this? } where checkTask task = packageIdentifierName (taskProvides task) `Set.member` deps
277
false
true
0
9
66
96
49
47
null
null
fmapfmapfmap/amazonka
amazonka-cognito-sync/gen/Network/AWS/CognitoSync/DeleteDataset.hs
mpl-2.0
-- | The response status code. drsResponseStatus :: Lens' DeleteDatasetResponse Int drsResponseStatus = lens _drsResponseStatus (\ s a -> s{_drsResponseStatus = a})
164
drsResponseStatus :: Lens' DeleteDatasetResponse Int drsResponseStatus = lens _drsResponseStatus (\ s a -> s{_drsResponseStatus = a})
133
drsResponseStatus = lens _drsResponseStatus (\ s a -> s{_drsResponseStatus = a})
80
true
true
1
9
21
43
22
21
null
null
apyrgio/ganeti
src/Ganeti/Constants.hs
bsd-2-clause
sshsSshRootKey :: String sshsSshRootKey = "ssh_root_key"
56
sshsSshRootKey :: String sshsSshRootKey = "ssh_root_key"
56
sshsSshRootKey = "ssh_root_key"
31
false
true
0
4
5
11
6
5
null
null
DavidAlphaFox/darcs
src/Darcs/Repository/Repair.hs
gpl-2.0
checkIndex :: (RepoPatch p, ApplyState p ~ Tree) => Repository p wR wU wT -> Bool -> IO Bool checkIndex repo quiet = do index <- updateIndex =<< readIndex repo pristine <- expand =<< readRecordedAndPending repo working <- expand =<< restrict pristine <$> readPlainTree "." working_hashed <- darcsUpdateHashes working let index_paths = [ p | (p, _) <- list index ] working_paths = [ p | (p, _) <- list working ] index_extra = index_paths \\ working_paths working_extra = working_paths \\ index_paths gethashes p (Just i1) (Just i2) = (p, itemHash i1, itemHash i2) gethashes p (Just i1) Nothing = (p, itemHash i1, NoHash) gethashes p Nothing (Just i2) = (p, NoHash, itemHash i2) gethashes p Nothing Nothing = error $ "Bad case at " ++ show p mismatches = [ miss | miss@(_, h1, h2) <- zipTrees gethashes index working_hashed, h1 /= h2 ] format paths = unlines $ map ((" " ++) . anchorPath "") paths mismatches_disp = unlines [ anchorPath "" p ++ "\n index: " ++ BS.unpack (encodeBase16 h1) ++ "\n working: " ++ BS.unpack (encodeBase16 h2) | (p, h1, h2) <- mismatches ] unless (quiet || null index_extra) $ putStrLn $ "Extra items in index!\n" ++ format index_extra unless (quiet || null working_extra) $ putStrLn $ "Missing items in index!\n" ++ format working_extra unless (quiet || null mismatches) $ putStrLn $ "Hash mismatch(es)!\n" ++ mismatches_disp return $ null index_extra && null working_extra && null mismatches
1,649
checkIndex :: (RepoPatch p, ApplyState p ~ Tree) => Repository p wR wU wT -> Bool -> IO Bool checkIndex repo quiet = do index <- updateIndex =<< readIndex repo pristine <- expand =<< readRecordedAndPending repo working <- expand =<< restrict pristine <$> readPlainTree "." working_hashed <- darcsUpdateHashes working let index_paths = [ p | (p, _) <- list index ] working_paths = [ p | (p, _) <- list working ] index_extra = index_paths \\ working_paths working_extra = working_paths \\ index_paths gethashes p (Just i1) (Just i2) = (p, itemHash i1, itemHash i2) gethashes p (Just i1) Nothing = (p, itemHash i1, NoHash) gethashes p Nothing (Just i2) = (p, NoHash, itemHash i2) gethashes p Nothing Nothing = error $ "Bad case at " ++ show p mismatches = [ miss | miss@(_, h1, h2) <- zipTrees gethashes index working_hashed, h1 /= h2 ] format paths = unlines $ map ((" " ++) . anchorPath "") paths mismatches_disp = unlines [ anchorPath "" p ++ "\n index: " ++ BS.unpack (encodeBase16 h1) ++ "\n working: " ++ BS.unpack (encodeBase16 h2) | (p, h1, h2) <- mismatches ] unless (quiet || null index_extra) $ putStrLn $ "Extra items in index!\n" ++ format index_extra unless (quiet || null working_extra) $ putStrLn $ "Missing items in index!\n" ++ format working_extra unless (quiet || null mismatches) $ putStrLn $ "Hash mismatch(es)!\n" ++ mismatches_disp return $ null index_extra && null working_extra && null mismatches
1,649
checkIndex repo quiet = do index <- updateIndex =<< readIndex repo pristine <- expand =<< readRecordedAndPending repo working <- expand =<< restrict pristine <$> readPlainTree "." working_hashed <- darcsUpdateHashes working let index_paths = [ p | (p, _) <- list index ] working_paths = [ p | (p, _) <- list working ] index_extra = index_paths \\ working_paths working_extra = working_paths \\ index_paths gethashes p (Just i1) (Just i2) = (p, itemHash i1, itemHash i2) gethashes p (Just i1) Nothing = (p, itemHash i1, NoHash) gethashes p Nothing (Just i2) = (p, NoHash, itemHash i2) gethashes p Nothing Nothing = error $ "Bad case at " ++ show p mismatches = [ miss | miss@(_, h1, h2) <- zipTrees gethashes index working_hashed, h1 /= h2 ] format paths = unlines $ map ((" " ++) . anchorPath "") paths mismatches_disp = unlines [ anchorPath "" p ++ "\n index: " ++ BS.unpack (encodeBase16 h1) ++ "\n working: " ++ BS.unpack (encodeBase16 h2) | (p, h1, h2) <- mismatches ] unless (quiet || null index_extra) $ putStrLn $ "Extra items in index!\n" ++ format index_extra unless (quiet || null working_extra) $ putStrLn $ "Missing items in index!\n" ++ format working_extra unless (quiet || null mismatches) $ putStrLn $ "Hash mismatch(es)!\n" ++ mismatches_disp return $ null index_extra && null working_extra && null mismatches
1,556
false
true
0
17
469
568
281
287
null
null
plaprade/haskoin
haskoin-wallet/test/Network/Haskoin/Wallet/Units.hs
unlicense
assertBalance :: AccountId -> Word32 -> Word64 -> App () assertBalance ai conf b = do bal <- accountBalance ai conf False liftIO $ assertEqual ("Balance is not " ++ show b) b bal
186
assertBalance :: AccountId -> Word32 -> Word64 -> App () assertBalance ai conf b = do bal <- accountBalance ai conf False liftIO $ assertEqual ("Balance is not " ++ show b) b bal
186
assertBalance ai conf b = do bal <- accountBalance ai conf False liftIO $ assertEqual ("Balance is not " ++ show b) b bal
129
false
true
0
11
41
73
34
39
null
null
MasseR/xmonadcontrib
XMonad/Layout/LayoutBuilder.hs
bsd-3-clause
splitStack (Just s) num subf nextf = ( differentiate' subf' subl , differentiate' nextf' nextl , subf' , nextf' ) where ws = W.integrate s n = calcNum (length ws) num subl = take n ws nextl = drop n ws subf' = foc subl subf nextf' = foc nextl nextf foc [] _ = Nothing foc l f = if W.focus s `elem` l then Just $ W.focus s else if maybe False (`elem` l) f then f else Just $ head l
678
splitStack (Just s) num subf nextf = ( differentiate' subf' subl , differentiate' nextf' nextl , subf' , nextf' ) where ws = W.integrate s n = calcNum (length ws) num subl = take n ws nextl = drop n ws subf' = foc subl subf nextf' = foc nextl nextf foc [] _ = Nothing foc l f = if W.focus s `elem` l then Just $ W.focus s else if maybe False (`elem` l) f then f else Just $ head l
678
splitStack (Just s) num subf nextf = ( differentiate' subf' subl , differentiate' nextf' nextl , subf' , nextf' ) where ws = W.integrate s n = calcNum (length ws) num subl = take n ws nextl = drop n ws subf' = foc subl subf nextf' = foc nextl nextf foc [] _ = Nothing foc l f = if W.focus s `elem` l then Just $ W.focus s else if maybe False (`elem` l) f then f else Just $ head l
678
false
false
10
8
381
226
98
128
null
null
isomorphism/webgl
src/Graphics/Rendering/WebGL/EnumConvert.hs
mit
getTypeEnum Lum8 = gl_UNSIGNED_BYTE
39
getTypeEnum Lum8 = gl_UNSIGNED_BYTE
39
getTypeEnum Lum8 = gl_UNSIGNED_BYTE
39
false
false
0
5
7
9
4
5
null
null
limaner2002/EPC-tools
USACScripts/src/Scripts/ComadReview.hs
bsd-3-clause
handleNoViolation (Right v) = sendUpdates "Add Violation Button" (MonadicFold $ to $ buttonUpdate "Add Violation") v >>= sendUpdates "Add Violation" (MonadicFold $ dropping 1 getGridFieldCell . traverse . gfColumns . at "" . traverse . _TextCellDynLink . _2 . traverse . to toUpdate . to Right) >>= sendUpdates "Select Party at Fault & Save" (MonadicFold (to $ dropdownUpdate "Party at Fault" 2) <|> MonadicFold (to $ buttonUpdate "Save & Continue") ) >>= sendUpdates "Add Rationale Button" (MonadicFold (to $ buttonUpdate "Add Rationale")) >>= sendUpdates "Select Rationale Type" (MonadicFold (to $ dropdownUpdate "Rationale Type" 3)) >>= sendUpdates "Select Rationale Text" (MonadicFold $ dropping 2 getGridFieldCell . traverse . gfColumns . at "" . traverse . _TextCellDynLink . _2 . traverse . to toUpdate . to Right) >>= sendUpdates "Save Rationale" (MonadicFold $ to $ buttonUpdate "Save Rationale") >>= sendUpdates "Back to Violations" (MonadicFold $ to $ buttonUpdate "Back") >>= sendUpdates "Back to Review COMAD Request" (MonadicFold $ to $ buttonUpdate "Back")
1,208
handleNoViolation (Right v) = sendUpdates "Add Violation Button" (MonadicFold $ to $ buttonUpdate "Add Violation") v >>= sendUpdates "Add Violation" (MonadicFold $ dropping 1 getGridFieldCell . traverse . gfColumns . at "" . traverse . _TextCellDynLink . _2 . traverse . to toUpdate . to Right) >>= sendUpdates "Select Party at Fault & Save" (MonadicFold (to $ dropdownUpdate "Party at Fault" 2) <|> MonadicFold (to $ buttonUpdate "Save & Continue") ) >>= sendUpdates "Add Rationale Button" (MonadicFold (to $ buttonUpdate "Add Rationale")) >>= sendUpdates "Select Rationale Type" (MonadicFold (to $ dropdownUpdate "Rationale Type" 3)) >>= sendUpdates "Select Rationale Text" (MonadicFold $ dropping 2 getGridFieldCell . traverse . gfColumns . at "" . traverse . _TextCellDynLink . _2 . traverse . to toUpdate . to Right) >>= sendUpdates "Save Rationale" (MonadicFold $ to $ buttonUpdate "Save Rationale") >>= sendUpdates "Back to Violations" (MonadicFold $ to $ buttonUpdate "Back") >>= sendUpdates "Back to Review COMAD Request" (MonadicFold $ to $ buttonUpdate "Back")
1,208
handleNoViolation (Right v) = sendUpdates "Add Violation Button" (MonadicFold $ to $ buttonUpdate "Add Violation") v >>= sendUpdates "Add Violation" (MonadicFold $ dropping 1 getGridFieldCell . traverse . gfColumns . at "" . traverse . _TextCellDynLink . _2 . traverse . to toUpdate . to Right) >>= sendUpdates "Select Party at Fault & Save" (MonadicFold (to $ dropdownUpdate "Party at Fault" 2) <|> MonadicFold (to $ buttonUpdate "Save & Continue") ) >>= sendUpdates "Add Rationale Button" (MonadicFold (to $ buttonUpdate "Add Rationale")) >>= sendUpdates "Select Rationale Type" (MonadicFold (to $ dropdownUpdate "Rationale Type" 3)) >>= sendUpdates "Select Rationale Text" (MonadicFold $ dropping 2 getGridFieldCell . traverse . gfColumns . at "" . traverse . _TextCellDynLink . _2 . traverse . to toUpdate . to Right) >>= sendUpdates "Save Rationale" (MonadicFold $ to $ buttonUpdate "Save Rationale") >>= sendUpdates "Back to Violations" (MonadicFold $ to $ buttonUpdate "Back") >>= sendUpdates "Back to Review COMAD Request" (MonadicFold $ to $ buttonUpdate "Back")
1,208
false
false
16
17
296
349
166
183
null
null
termite2/debug
Debug/AbstractorIFace.hs
bsd-3-clause
avarType (AVarInt tr) = case termType tr of I.SInt _ w -> D.SInt w I.UInt _ w -> D.UInt w ---- Construct transition relation that represent the result of three-valued ---- abstraction. ---- ---- If srWin == True then ---- T := quantify_dis (Tc /\ c-c) \/ (Tu /\ c+u) ---- else ---- T := (Tc /\ c+c) \/ quantify_dis (Tc /\ c-u) ---- ---- where Tc and Tu are controllable and uncontrollable transition relations, ---- and the quantify_dis function quantifies away disabled variables. For a ---- single variable X: ---- ---- quantify_dis_X(rel) = (X.en /\ rel) \/ (!X.en /\ exists X. rel) ---- --mkTRel :: (D.Rel c v a s) => SynthesisRes c a -> a --mkTRel sr@SynthesisRes{..} = -- let ?m = srCtx in -- let tcont = srTran .& srCont -- tucont = srTran .& (nt srCont) -- in trace "mkTRel" -- $ case srWin of -- Just True -> (quant_dis sr (tcont .& srCMinusC)) .| (tucont .& srCPlusU) -- Just False -> (tcont .& srCPlusC) .| (quant_dis sr (tucont .& srCMinusU)) -- Nothing -> srTran -- --quant_dis :: (D.Rel c v a s, ?m :: c) => SynthesisRes c a -> a -> a --quant_dis SynthesisRes{..} rel = -- foldl' quant_dis1 rel -- $ map (\(v,ev) -> trace ("quant_dis " ++ D.mvarName v ++ "(" ++ show (D.mvarIdx v) ++ ") " ++ D.mvarName ev ++ "(" ++ show (D.mvarIdx ev) ++ ")") $ (D.mvarToVS v, D.mvarToVS ev)) -- $ mapMaybe (\v -> fmap (v,) (find ((== (D.mkEnVarName $ D.mvarName v)) . D.mvarName) srLabelVars)) -- $ srLabelVars -- --quant_dis1 :: (D.Rel c v a s, ?m :: c) => a -> (v,v) -> a --quant_dis1 rel (var, envar) = -- let rel1 = ((eqConst envar (1::Int)) .& rel) -- rel2 = ((eqConst envar (0::Int)) .& exists var rel) -- --rel3 = rel1 .| rel2 -- in rel1 .| rel2
1,835
avarType (AVarInt tr) = case termType tr of I.SInt _ w -> D.SInt w I.UInt _ w -> D.UInt w ---- Construct transition relation that represent the result of three-valued ---- abstraction. ---- ---- If srWin == True then ---- T := quantify_dis (Tc /\ c-c) \/ (Tu /\ c+u) ---- else ---- T := (Tc /\ c+c) \/ quantify_dis (Tc /\ c-u) ---- ---- where Tc and Tu are controllable and uncontrollable transition relations, ---- and the quantify_dis function quantifies away disabled variables. For a ---- single variable X: ---- ---- quantify_dis_X(rel) = (X.en /\ rel) \/ (!X.en /\ exists X. rel) ---- --mkTRel :: (D.Rel c v a s) => SynthesisRes c a -> a --mkTRel sr@SynthesisRes{..} = -- let ?m = srCtx in -- let tcont = srTran .& srCont -- tucont = srTran .& (nt srCont) -- in trace "mkTRel" -- $ case srWin of -- Just True -> (quant_dis sr (tcont .& srCMinusC)) .| (tucont .& srCPlusU) -- Just False -> (tcont .& srCPlusC) .| (quant_dis sr (tucont .& srCMinusU)) -- Nothing -> srTran -- --quant_dis :: (D.Rel c v a s, ?m :: c) => SynthesisRes c a -> a -> a --quant_dis SynthesisRes{..} rel = -- foldl' quant_dis1 rel -- $ map (\(v,ev) -> trace ("quant_dis " ++ D.mvarName v ++ "(" ++ show (D.mvarIdx v) ++ ") " ++ D.mvarName ev ++ "(" ++ show (D.mvarIdx ev) ++ ")") $ (D.mvarToVS v, D.mvarToVS ev)) -- $ mapMaybe (\v -> fmap (v,) (find ((== (D.mkEnVarName $ D.mvarName v)) . D.mvarName) srLabelVars)) -- $ srLabelVars -- --quant_dis1 :: (D.Rel c v a s, ?m :: c) => a -> (v,v) -> a --quant_dis1 rel (var, envar) = -- let rel1 = ((eqConst envar (1::Int)) .& rel) -- rel2 = ((eqConst envar (0::Int)) .& exists var rel) -- --rel3 = rel1 .| rel2 -- in rel1 .| rel2
1,835
avarType (AVarInt tr) = case termType tr of I.SInt _ w -> D.SInt w I.UInt _ w -> D.UInt w ---- Construct transition relation that represent the result of three-valued ---- abstraction. ---- ---- If srWin == True then ---- T := quantify_dis (Tc /\ c-c) \/ (Tu /\ c+u) ---- else ---- T := (Tc /\ c+c) \/ quantify_dis (Tc /\ c-u) ---- ---- where Tc and Tu are controllable and uncontrollable transition relations, ---- and the quantify_dis function quantifies away disabled variables. For a ---- single variable X: ---- ---- quantify_dis_X(rel) = (X.en /\ rel) \/ (!X.en /\ exists X. rel) ---- --mkTRel :: (D.Rel c v a s) => SynthesisRes c a -> a --mkTRel sr@SynthesisRes{..} = -- let ?m = srCtx in -- let tcont = srTran .& srCont -- tucont = srTran .& (nt srCont) -- in trace "mkTRel" -- $ case srWin of -- Just True -> (quant_dis sr (tcont .& srCMinusC)) .| (tucont .& srCPlusU) -- Just False -> (tcont .& srCPlusC) .| (quant_dis sr (tucont .& srCMinusU)) -- Nothing -> srTran -- --quant_dis :: (D.Rel c v a s, ?m :: c) => SynthesisRes c a -> a -> a --quant_dis SynthesisRes{..} rel = -- foldl' quant_dis1 rel -- $ map (\(v,ev) -> trace ("quant_dis " ++ D.mvarName v ++ "(" ++ show (D.mvarIdx v) ++ ") " ++ D.mvarName ev ++ "(" ++ show (D.mvarIdx ev) ++ ")") $ (D.mvarToVS v, D.mvarToVS ev)) -- $ mapMaybe (\v -> fmap (v,) (find ((== (D.mkEnVarName $ D.mvarName v)) . D.mvarName) srLabelVars)) -- $ srLabelVars -- --quant_dis1 :: (D.Rel c v a s, ?m :: c) => a -> (v,v) -> a --quant_dis1 rel (var, envar) = -- let rel1 = ((eqConst envar (1::Int)) .& rel) -- rel2 = ((eqConst envar (0::Int)) .& exists var rel) -- --rel3 = rel1 .| rel2 -- in rel1 .| rel2
1,835
false
false
0
9
496
97
64
33
null
null
ml9951/ghc
compiler/types/CoAxiom.hs
bsd-3-clause
fsFromRole Phantom = fsLit "phantom"
45
fsFromRole Phantom = fsLit "phantom"
45
fsFromRole Phantom = fsLit "phantom"
45
false
false
0
5
13
12
5
7
null
null
agocorona/ghcjs-hplay
src/GHCJS/HPlay/Cell.hs
mit
typeIO :: (ElemID -> IO (Maybe a)) -> a typeIO = undefined
59
typeIO :: (ElemID -> IO (Maybe a)) -> a typeIO = undefined
58
typeIO = undefined
18
false
true
0
11
12
38
17
21
null
null
bgwines/project-euler
src/solved/problem86.hs
bsd-3-clause
main = do (putStrLn . show) sought
35
main = do (putStrLn . show) sought
35
main = do (putStrLn . show) sought
35
false
false
1
10
7
23
9
14
null
null
Peaker/lamdu
src/Lamdu/Sugar/Convert/Fragment.hs
gpl-3.0
convertAppliedHole :: (Monad m, Typeable m, Monoid a) => V.App V.Term # Ann (Input.Payload m a) -> Input.Payload m a # V.Term -> ExpressionU EvalPrep m a -> MaybeT (ConvertM m) (ExpressionU EvalPrep m a) convertAppliedHole app@(V.App funcI argI) exprPl argS = do Lens.view (ConvertM.scConfig . Config.sugarsEnabled . Config.fragment) >>= guard guard (Lens.has ExprLens.valHole funcI) do isTypeMatch <- checkTypeMatch (argI ^. hAnn . Input.inferredTypeUVar) (exprPl ^. Input.inferredTypeUVar) postProcess <- ConvertM.postProcessAssert healMis <- healMismatch typeMismatch <- if isTypeMatch then pure Nothing else Actions.makeTypeAnnotation (EntityId.ofFragmentArg (argPl ^. Input.entityId)) (argPl ^. Input.inferredType) <&> Just opts <- do forType <- transformArg exprPl argI & transaction ResultGroups { gDefs = makeGlobals (makeGetDef topRef argI) <&> traverse . rTexts . Lens.mapped . traverse %~ toOpName , gLocals = makeLocals (makeLocal topRef argI) (exprPl ^. Input.inferScope) <&> traverse %~ sequenceA <&> (^.. traverse . Lens._Just) , gInjects = makeTagRes "'" (Pure . V.BLeaf . V.LInject) <&> funcOpt , gToNoms = makeNoms [] "" (makeToNom argI <&> Lens.mapped . Lens.mapped %~ (:[]) . (Result mempty ?? mempty)) , gFromNoms = makeNoms (forType ^.. Lens.folded . _1 . Lens._Just) "." (makeFromNom exprPl argI <&> Lens.mapped . Lens.mapped %~ (:[])) , gForType = forType ^.. Lens.folded . _2 & pure , gGetFields = makeTagRes "." (Pure . V.BLeaf . V.LGetField) <&> funcOpt , gSyntax = makeResultsSyntax topRef argI & transaction , gWrapInRecs = makeTagRes "{" (\t -> [ (TypeMatches , V.RowExtend t (argI & hflipped %~ hmap (const (ExistingRef . (^. Input.stored . ExprIRef.iref)))) (Ann WriteNew (V.BLeaf V.LRecEmpty)) & V.BRecExtend & Ann WriteNew ) ] ) } <&> (>>= traverse (makeOption exprPl)) <&> Lens.mapped . traverse . rExpr . _2 . optionExpr %~ toFragOpt & traverse ConvertM.convertOnce <&> filterResults (\outerMatch innerMatch -> (innerMatch, outerMatch)) & ConvertM.convertOnce apply <- argI ^. hAnn . Input.stored & ExprIRef.setIref .~ exprPl ^. Input.stored . ExprIRef.setIref & Actions.makeApply BodyFragment Fragment { _fExpr = argS & annotation . pActions . detach .~ FragmentedAlready storedEntityId & annotation . pActions . delete .~ SetToHole (DataOps.setToHole stored <* postProcess <&> EntityId.ofValI) & annotation . pActions . mApply ?~ apply , _fHeal = ( if isTypeMatch then DataOps.replace stored argIRef <* postProcess else argIRef <$ healMis (stored ^. iref) ) <&> EntityId.ofValI , _fTypeMismatch = typeMismatch , _fOptions = opts } & pure >>= Actions.addActions app exprPl & lift <&> annotation . pActions . detach .~ FragmentedAlready storedEntityId where topRef = exprPl ^. Input.stored . ExprIRef.iref funcOpt = traverse . rExpr %~ makeFuncOpts argPl = argS ^. annotation . pInput argIRef = argI ^. hAnn . Input.stored . iref stored = exprPl ^. Input.stored storedEntityId = stored ^. iref & EntityId.ofValI makeFuncOpts opt = emplaceArg argI <&> _2 %~ Ann (ExistingRef topRef) . V.BApp . App (writeNew opt)
4,667
convertAppliedHole :: (Monad m, Typeable m, Monoid a) => V.App V.Term # Ann (Input.Payload m a) -> Input.Payload m a # V.Term -> ExpressionU EvalPrep m a -> MaybeT (ConvertM m) (ExpressionU EvalPrep m a) convertAppliedHole app@(V.App funcI argI) exprPl argS = do Lens.view (ConvertM.scConfig . Config.sugarsEnabled . Config.fragment) >>= guard guard (Lens.has ExprLens.valHole funcI) do isTypeMatch <- checkTypeMatch (argI ^. hAnn . Input.inferredTypeUVar) (exprPl ^. Input.inferredTypeUVar) postProcess <- ConvertM.postProcessAssert healMis <- healMismatch typeMismatch <- if isTypeMatch then pure Nothing else Actions.makeTypeAnnotation (EntityId.ofFragmentArg (argPl ^. Input.entityId)) (argPl ^. Input.inferredType) <&> Just opts <- do forType <- transformArg exprPl argI & transaction ResultGroups { gDefs = makeGlobals (makeGetDef topRef argI) <&> traverse . rTexts . Lens.mapped . traverse %~ toOpName , gLocals = makeLocals (makeLocal topRef argI) (exprPl ^. Input.inferScope) <&> traverse %~ sequenceA <&> (^.. traverse . Lens._Just) , gInjects = makeTagRes "'" (Pure . V.BLeaf . V.LInject) <&> funcOpt , gToNoms = makeNoms [] "" (makeToNom argI <&> Lens.mapped . Lens.mapped %~ (:[]) . (Result mempty ?? mempty)) , gFromNoms = makeNoms (forType ^.. Lens.folded . _1 . Lens._Just) "." (makeFromNom exprPl argI <&> Lens.mapped . Lens.mapped %~ (:[])) , gForType = forType ^.. Lens.folded . _2 & pure , gGetFields = makeTagRes "." (Pure . V.BLeaf . V.LGetField) <&> funcOpt , gSyntax = makeResultsSyntax topRef argI & transaction , gWrapInRecs = makeTagRes "{" (\t -> [ (TypeMatches , V.RowExtend t (argI & hflipped %~ hmap (const (ExistingRef . (^. Input.stored . ExprIRef.iref)))) (Ann WriteNew (V.BLeaf V.LRecEmpty)) & V.BRecExtend & Ann WriteNew ) ] ) } <&> (>>= traverse (makeOption exprPl)) <&> Lens.mapped . traverse . rExpr . _2 . optionExpr %~ toFragOpt & traverse ConvertM.convertOnce <&> filterResults (\outerMatch innerMatch -> (innerMatch, outerMatch)) & ConvertM.convertOnce apply <- argI ^. hAnn . Input.stored & ExprIRef.setIref .~ exprPl ^. Input.stored . ExprIRef.setIref & Actions.makeApply BodyFragment Fragment { _fExpr = argS & annotation . pActions . detach .~ FragmentedAlready storedEntityId & annotation . pActions . delete .~ SetToHole (DataOps.setToHole stored <* postProcess <&> EntityId.ofValI) & annotation . pActions . mApply ?~ apply , _fHeal = ( if isTypeMatch then DataOps.replace stored argIRef <* postProcess else argIRef <$ healMis (stored ^. iref) ) <&> EntityId.ofValI , _fTypeMismatch = typeMismatch , _fOptions = opts } & pure >>= Actions.addActions app exprPl & lift <&> annotation . pActions . detach .~ FragmentedAlready storedEntityId where topRef = exprPl ^. Input.stored . ExprIRef.iref funcOpt = traverse . rExpr %~ makeFuncOpts argPl = argS ^. annotation . pInput argIRef = argI ^. hAnn . Input.stored . iref stored = exprPl ^. Input.stored storedEntityId = stored ^. iref & EntityId.ofValI makeFuncOpts opt = emplaceArg argI <&> _2 %~ Ann (ExistingRef topRef) . V.BApp . App (writeNew opt)
4,667
convertAppliedHole app@(V.App funcI argI) exprPl argS = do Lens.view (ConvertM.scConfig . Config.sugarsEnabled . Config.fragment) >>= guard guard (Lens.has ExprLens.valHole funcI) do isTypeMatch <- checkTypeMatch (argI ^. hAnn . Input.inferredTypeUVar) (exprPl ^. Input.inferredTypeUVar) postProcess <- ConvertM.postProcessAssert healMis <- healMismatch typeMismatch <- if isTypeMatch then pure Nothing else Actions.makeTypeAnnotation (EntityId.ofFragmentArg (argPl ^. Input.entityId)) (argPl ^. Input.inferredType) <&> Just opts <- do forType <- transformArg exprPl argI & transaction ResultGroups { gDefs = makeGlobals (makeGetDef topRef argI) <&> traverse . rTexts . Lens.mapped . traverse %~ toOpName , gLocals = makeLocals (makeLocal topRef argI) (exprPl ^. Input.inferScope) <&> traverse %~ sequenceA <&> (^.. traverse . Lens._Just) , gInjects = makeTagRes "'" (Pure . V.BLeaf . V.LInject) <&> funcOpt , gToNoms = makeNoms [] "" (makeToNom argI <&> Lens.mapped . Lens.mapped %~ (:[]) . (Result mempty ?? mempty)) , gFromNoms = makeNoms (forType ^.. Lens.folded . _1 . Lens._Just) "." (makeFromNom exprPl argI <&> Lens.mapped . Lens.mapped %~ (:[])) , gForType = forType ^.. Lens.folded . _2 & pure , gGetFields = makeTagRes "." (Pure . V.BLeaf . V.LGetField) <&> funcOpt , gSyntax = makeResultsSyntax topRef argI & transaction , gWrapInRecs = makeTagRes "{" (\t -> [ (TypeMatches , V.RowExtend t (argI & hflipped %~ hmap (const (ExistingRef . (^. Input.stored . ExprIRef.iref)))) (Ann WriteNew (V.BLeaf V.LRecEmpty)) & V.BRecExtend & Ann WriteNew ) ] ) } <&> (>>= traverse (makeOption exprPl)) <&> Lens.mapped . traverse . rExpr . _2 . optionExpr %~ toFragOpt & traverse ConvertM.convertOnce <&> filterResults (\outerMatch innerMatch -> (innerMatch, outerMatch)) & ConvertM.convertOnce apply <- argI ^. hAnn . Input.stored & ExprIRef.setIref .~ exprPl ^. Input.stored . ExprIRef.setIref & Actions.makeApply BodyFragment Fragment { _fExpr = argS & annotation . pActions . detach .~ FragmentedAlready storedEntityId & annotation . pActions . delete .~ SetToHole (DataOps.setToHole stored <* postProcess <&> EntityId.ofValI) & annotation . pActions . mApply ?~ apply , _fHeal = ( if isTypeMatch then DataOps.replace stored argIRef <* postProcess else argIRef <$ healMis (stored ^. iref) ) <&> EntityId.ofValI , _fTypeMismatch = typeMismatch , _fOptions = opts } & pure >>= Actions.addActions app exprPl & lift <&> annotation . pActions . detach .~ FragmentedAlready storedEntityId where topRef = exprPl ^. Input.stored . ExprIRef.iref funcOpt = traverse . rExpr %~ makeFuncOpts argPl = argS ^. annotation . pInput argIRef = argI ^. hAnn . Input.stored . iref stored = exprPl ^. Input.stored storedEntityId = stored ^. iref & EntityId.ofValI makeFuncOpts opt = emplaceArg argI <&> _2 %~ Ann (ExistingRef topRef) . V.BApp . App (writeNew opt)
4,443
false
true
116
27
2,067
900
508
392
null
null
jfischoff/simple-c-value
src/Language/C/Simple/CValue.hs
bsd-3-clause
fromPIntMax :: PrimitiveValue -> CIntMax fromPIntMax (PIntMax x1) = x1
70
fromPIntMax :: PrimitiveValue -> CIntMax fromPIntMax (PIntMax x1) = x1
70
fromPIntMax (PIntMax x1) = x1
29
false
true
0
7
9
24
12
12
null
null
spechub/Hets
CSL/Parse_AS_Basic.hs
gpl-2.0
expexp :: OperatorState st => CharParser st EXPRESSION expexp = do exp1 <- expatom exps <- many $ pair (oneOfKeys ["**", "^"]) expatom return $ if null exps then exp1 else foldl (\ a b -> mkPredefOp OP_pow [a, snd b]) exp1 exps -- | parse a basic expression
268
expexp :: OperatorState st => CharParser st EXPRESSION expexp = do exp1 <- expatom exps <- many $ pair (oneOfKeys ["**", "^"]) expatom return $ if null exps then exp1 else foldl (\ a b -> mkPredefOp OP_pow [a, snd b]) exp1 exps -- | parse a basic expression
268
expexp = do exp1 <- expatom exps <- many $ pair (oneOfKeys ["**", "^"]) expatom return $ if null exps then exp1 else foldl (\ a b -> mkPredefOp OP_pow [a, snd b]) exp1 exps -- | parse a basic expression
213
false
true
0
14
59
108
54
54
null
null
mcapodici/haskelllearn
stockexchangeprototype/src/SEP/Parser.hs
mit
rightToMaybe (Right b) = Just b
31
rightToMaybe (Right b) = Just b
31
rightToMaybe (Right b) = Just b
31
false
false
0
7
5
18
8
10
null
null
corngood/cabal
cabal-install/Main.hs
bsd-3-clause
fetchAction :: FetchFlags -> [String] -> GlobalFlags -> IO () fetchAction fetchFlags extraArgs globalFlags = do let verbosity = fromFlag (fetchVerbosity fetchFlags) targets <- readUserTargets verbosity extraArgs config <- loadConfig verbosity (globalConfigFile globalFlags) mempty let configFlags = savedConfigureFlags config globalFlags' = savedGlobalFlags config `mappend` globalFlags (comp, platform, conf) <- configCompilerAux' configFlags fetch verbosity (configPackageDB' configFlags) (globalRepos globalFlags') comp platform conf globalFlags' fetchFlags targets
619
fetchAction :: FetchFlags -> [String] -> GlobalFlags -> IO () fetchAction fetchFlags extraArgs globalFlags = do let verbosity = fromFlag (fetchVerbosity fetchFlags) targets <- readUserTargets verbosity extraArgs config <- loadConfig verbosity (globalConfigFile globalFlags) mempty let configFlags = savedConfigureFlags config globalFlags' = savedGlobalFlags config `mappend` globalFlags (comp, platform, conf) <- configCompilerAux' configFlags fetch verbosity (configPackageDB' configFlags) (globalRepos globalFlags') comp platform conf globalFlags' fetchFlags targets
619
fetchAction fetchFlags extraArgs globalFlags = do let verbosity = fromFlag (fetchVerbosity fetchFlags) targets <- readUserTargets verbosity extraArgs config <- loadConfig verbosity (globalConfigFile globalFlags) mempty let configFlags = savedConfigureFlags config globalFlags' = savedGlobalFlags config `mappend` globalFlags (comp, platform, conf) <- configCompilerAux' configFlags fetch verbosity (configPackageDB' configFlags) (globalRepos globalFlags') comp platform conf globalFlags' fetchFlags targets
557
false
true
0
12
113
167
80
87
null
null
green-haskell/ghc
compiler/typecheck/TcType.hs
bsd-3-clause
tcSplitFunTy_maybe :: Type -> Maybe (Type, Type) tcSplitFunTy_maybe ty | Just ty' <- tcView ty = tcSplitFunTy_maybe ty'
129
tcSplitFunTy_maybe :: Type -> Maybe (Type, Type) tcSplitFunTy_maybe ty | Just ty' <- tcView ty = tcSplitFunTy_maybe ty'
129
tcSplitFunTy_maybe ty | Just ty' <- tcView ty = tcSplitFunTy_maybe ty'
80
false
true
0
9
27
50
22
28
null
null
dcreager/cabal
Distribution/ParseUtils.hs
bsd-3-clause
-- | Fix different systems silly line ending conventions normaliseLineEndings :: String -> String normaliseLineEndings [] = []
126
normaliseLineEndings :: String -> String normaliseLineEndings [] = []
69
normaliseLineEndings [] = []
28
true
true
0
6
17
23
12
11
null
null