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
mfpi/OpenGLRaw
src/Graphics/Rendering/OpenGL/Raw/ARB/ComputeShader.hs
bsd-3-clause
gl_MAX_COMPUTE_ATOMIC_COUNTER_BUFFERS :: GLenum gl_MAX_COMPUTE_ATOMIC_COUNTER_BUFFERS = 0x8264
94
gl_MAX_COMPUTE_ATOMIC_COUNTER_BUFFERS :: GLenum gl_MAX_COMPUTE_ATOMIC_COUNTER_BUFFERS = 0x8264
94
gl_MAX_COMPUTE_ATOMIC_COUNTER_BUFFERS = 0x8264
46
false
true
0
4
5
11
6
5
null
null
kawamuray/ganeti
src/Ganeti/Constants.hs
gpl-2.0
ssNodePrimaryIps :: String ssNodePrimaryIps = "node_primary_ips"
64
ssNodePrimaryIps :: String ssNodePrimaryIps = "node_primary_ips"
64
ssNodePrimaryIps = "node_primary_ips"
37
false
true
0
4
5
11
6
5
null
null
mitchellwrosen/hpack
src/Hpack/Run.hs
mit
renderCppOptions :: [CppOption] -> Element renderCppOptions = Field "cpp-options" . WordList
92
renderCppOptions :: [CppOption] -> Element renderCppOptions = Field "cpp-options" . WordList
92
renderCppOptions = Field "cpp-options" . WordList
49
false
true
0
6
10
25
13
12
null
null
ekmett/wxHaskell
wxcore/src/haskell/Graphics/UI/WXCore/WxcDefs.hs
lgpl-2.1
wxMACINTOSH :: Int wxMACINTOSH = 7
34
wxMACINTOSH :: Int wxMACINTOSH = 7
34
wxMACINTOSH = 7
15
false
true
0
6
5
18
7
11
null
null
haroldcarr/utah-haskell
future/src/Service/Interact.hs
apache-2.0
mkInvalidMethodOrRoute :: IO Msg mkInvalidMethodOrRoute = mkInvalidResponse "INVALID HTTP METHOD OR ROUTE"
106
mkInvalidMethodOrRoute :: IO Msg mkInvalidMethodOrRoute = mkInvalidResponse "INVALID HTTP METHOD OR ROUTE"
106
mkInvalidMethodOrRoute = mkInvalidResponse "INVALID HTTP METHOD OR ROUTE"
73
false
true
0
5
11
17
8
9
null
null
sdiehl/ghc
libraries/base/GHC/Event/Unique.hs
bsd-3-clause
newSource :: IO UniqueSource newSource = IO $ \s -> case newByteArray# size s of (# s', mba #) -> (# s', US mba #) where !(I# size) = SIZEOF_HSINT
158
newSource :: IO UniqueSource newSource = IO $ \s -> case newByteArray# size s of (# s', mba #) -> (# s', US mba #) where !(I# size) = SIZEOF_HSINT
158
newSource = IO $ \s -> case newByteArray# size s of (# s', mba #) -> (# s', US mba #) where !(I# size) = SIZEOF_HSINT
129
false
true
2
10
41
74
34
40
null
null
olsner/ghc
compiler/typecheck/FamInst.hs
bsd-3-clause
injTyVarsOfType (AppTy fun arg) = injTyVarsOfType fun `unionVarSet` injTyVarsOfType arg
89
injTyVarsOfType (AppTy fun arg) = injTyVarsOfType fun `unionVarSet` injTyVarsOfType arg
89
injTyVarsOfType (AppTy fun arg) = injTyVarsOfType fun `unionVarSet` injTyVarsOfType arg
89
false
false
0
7
11
29
14
15
null
null
uduki/hsQt
Qtc/Enums/Core/QVariant.hs
bsd-2-clause
eStringList :: QVariantType eStringList = ieQVariantType $ 11
63
eStringList :: QVariantType eStringList = ieQVariantType $ 11
63
eStringList = ieQVariantType $ 11
35
false
true
0
6
9
18
8
10
null
null
4ZP6Capstone2015/ampersand
src/Database/Design/Ampersand/Input/ADL1/Lexer.hs
gpl-3.0
isIdStart :: Char -> Bool isIdStart c = isLower c || c == '_'
61
isIdStart :: Char -> Bool isIdStart c = isLower c || c == '_'
61
isIdStart c = isLower c || c == '_'
35
false
true
0
7
13
29
14
15
null
null
GaloisInc/halvm-ghc
compiler/prelude/PrelNames.hs
bsd-3-clause
rep1TyConKey = mkPreludeTyConUnique 156
39
rep1TyConKey = mkPreludeTyConUnique 156
39
rep1TyConKey = mkPreludeTyConUnique 156
39
false
false
1
5
3
12
4
8
null
null
kishoredbn/barrelfish
tools/flounder/Multihop.hs
mit
change_waitset_fn_def :: String -> C.Unit change_waitset_fn_def ifn = C.FunctionDef C.Static (C.TypeName "errval_t") (change_waitset_fn_name ifn) params [ localvar (C.Ptr $ C.Struct $ m_bind_type ifn) multihop_bind_var_name (Just $ C.Cast (C.Ptr C.Void) bindvar), C.SBlank, C.SComment "change waitset on binding", C.Ex $ C.Assignment (bindvar `C.DerefField` "waitset") (C.Variable "ws"), C.SBlank, C.SComment "change waitset on multi-hop channel", C.Return $ C.Call "multihop_chan_change_waitset" [chanaddr, C.Variable "ws"] ] where chanaddr = C.AddressOf $ C.DerefField multihop_bind_var "chan" params = [C.Param (C.Ptr $ C.Struct $ intf_bind_type ifn) intf_bind_var, C.Param (C.Ptr $ C.Struct "waitset") "ws"]
851
change_waitset_fn_def :: String -> C.Unit change_waitset_fn_def ifn = C.FunctionDef C.Static (C.TypeName "errval_t") (change_waitset_fn_name ifn) params [ localvar (C.Ptr $ C.Struct $ m_bind_type ifn) multihop_bind_var_name (Just $ C.Cast (C.Ptr C.Void) bindvar), C.SBlank, C.SComment "change waitset on binding", C.Ex $ C.Assignment (bindvar `C.DerefField` "waitset") (C.Variable "ws"), C.SBlank, C.SComment "change waitset on multi-hop channel", C.Return $ C.Call "multihop_chan_change_waitset" [chanaddr, C.Variable "ws"] ] where chanaddr = C.AddressOf $ C.DerefField multihop_bind_var "chan" params = [C.Param (C.Ptr $ C.Struct $ intf_bind_type ifn) intf_bind_var, C.Param (C.Ptr $ C.Struct "waitset") "ws"]
851
change_waitset_fn_def ifn = C.FunctionDef C.Static (C.TypeName "errval_t") (change_waitset_fn_name ifn) params [ localvar (C.Ptr $ C.Struct $ m_bind_type ifn) multihop_bind_var_name (Just $ C.Cast (C.Ptr C.Void) bindvar), C.SBlank, C.SComment "change waitset on binding", C.Ex $ C.Assignment (bindvar `C.DerefField` "waitset") (C.Variable "ws"), C.SBlank, C.SComment "change waitset on multi-hop channel", C.Return $ C.Call "multihop_chan_change_waitset" [chanaddr, C.Variable "ws"] ] where chanaddr = C.AddressOf $ C.DerefField multihop_bind_var "chan" params = [C.Param (C.Ptr $ C.Struct $ intf_bind_type ifn) intf_bind_var, C.Param (C.Ptr $ C.Struct "waitset") "ws"]
809
false
true
1
13
222
268
136
132
null
null
Kyly/liquidhaskell
src/Language/Haskell/Liquid/CoreToLogic.hs
bsd-3-clause
coreToPred p@(C.App _ _) = toPredApp p
38
coreToPred p@(C.App _ _) = toPredApp p
38
coreToPred p@(C.App _ _) = toPredApp p
38
false
false
1
8
6
30
12
18
null
null
ocramz/petsc-hs
src/Numerical/PETSc/Internal/Storable/Vector.hs
gpl-3.0
toList :: Storable a => VS.Vector a -> [a] toList = VS.toList
61
toList :: Storable a => VS.Vector a -> [a] toList = VS.toList
61
toList = VS.toList
18
false
true
0
8
11
32
16
16
null
null
edom/sound
src/Sound/InfList.hs
bsd-3-clause
-- ** Unfolding {- | @ lunfoldr fs fa s = 'fmap' fa ('literate' fs s) @ @ lunfoldr fs fa s = \< fa s, fa (fs s), fa (fs (fs s)), ... \> @ -} lunfoldr :: (s -> s) -> (s -> a) -> s -> L a lunfoldr !fs !fa = loop where loop !s = let !a = fa s !t = fs s u = loop t in MkL a u
378
lunfoldr :: (s -> s) -> (s -> a) -> s -> L a lunfoldr !fs !fa = loop where loop !s = let !a = fa s !t = fs s u = loop t in MkL a u
235
lunfoldr !fs !fa = loop where loop !s = let !a = fa s !t = fs s u = loop t in MkL a u
190
true
true
0
10
183
108
49
59
null
null
spwhitton/srem
src/Utility/Notify/Windows.hs
gpl-3.0
sendNotification :: Reminder -> IO ProcessHandle sendNotification r = getEnv "USERNAME" >>= \u -> spawnCommand . unwords $ [ "msg" , "/time:5" , u , getReminderText r ]
194
sendNotification :: Reminder -> IO ProcessHandle sendNotification r = getEnv "USERNAME" >>= \u -> spawnCommand . unwords $ [ "msg" , "/time:5" , u , getReminderText r ]
194
sendNotification r = getEnv "USERNAME" >>= \u -> spawnCommand . unwords $ [ "msg" , "/time:5" , u , getReminderText r ]
143
false
true
0
9
53
56
29
27
null
null
GaloisInc/saw-script
src/SAWScript/MGU.hs
bsd-3-clause
withExprPos :: Pos -> TI a -> TI a withExprPos p = local (\e -> e { currentExprPos = p })
89
withExprPos :: Pos -> TI a -> TI a withExprPos p = local (\e -> e { currentExprPos = p })
89
withExprPos p = local (\e -> e { currentExprPos = p })
54
false
true
0
9
20
47
24
23
null
null
kmilner/tamarin-prover
lib/sapic/src/Sapic/Facts.hs
gpl-3.0
actionToFact (ChannelIn t) = protoFact Linear "ChannelIn" [t]
64
actionToFact (ChannelIn t) = protoFact Linear "ChannelIn" [t]
64
actionToFact (ChannelIn t) = protoFact Linear "ChannelIn" [t]
64
false
false
0
7
10
25
12
13
null
null
Whoops/Serenity
src/Organize.hs
gpl-3.0
extractTagFile filename Nothing = error ("Unable to open file: " ++ filename)
77
extractTagFile filename Nothing = error ("Unable to open file: " ++ filename)
77
extractTagFile filename Nothing = error ("Unable to open file: " ++ filename)
77
false
false
0
7
11
23
10
13
null
null
silkapp/xmlhtml
src/Text/XmlHtml/XML/Parse.hs
bsd-3-clause
elem :: Eq a => a -> [a] -> Bool elem = L.elem
46
elem :: Eq a => a -> [a] -> Bool elem = L.elem
46
elem = L.elem
13
false
true
0
8
12
31
16
15
null
null
nirvinm/Solving-Exercises-in-Haskell-Programming-From-First-Principles
Testing/ciphers/src/VigenereCipher.hs
gpl-3.0
crypt :: (Alphabet -> Alphabet -> Alphabet) -> [Alphabet] -> [Alphabet] -> [Alphabet] crypt _ [] _ = []
103
crypt :: (Alphabet -> Alphabet -> Alphabet) -> [Alphabet] -> [Alphabet] -> [Alphabet] crypt _ [] _ = []
103
crypt _ [] _ = []
17
false
true
0
8
18
54
29
25
null
null
MichielDeCuyper/Algebraic-Effect-Handlers
src/Effect/Reader.hs
mit
local :: (Functor f, TermMonad m (Reader e + f)) => Codensity (LocalCarrier m e) a -> (e -> e) -> m a local = unLoC . runCod var
128
local :: (Functor f, TermMonad m (Reader e + f)) => Codensity (LocalCarrier m e) a -> (e -> e) -> m a local = unLoC . runCod var
128
local = unLoC . runCod var
26
false
true
1
10
28
83
39
44
null
null
jeffreyrosenbluth/NYC-meetup
meetup/Mirror.hs
mit
diagram2 :: Diagram B diagram2 = mkTriangle 6 . mkConfetti 50 $ mkStdGen 0
74
diagram2 :: Diagram B diagram2 = mkTriangle 6 . mkConfetti 50 $ mkStdGen 0
74
diagram2 = mkTriangle 6 . mkConfetti 50 $ mkStdGen 0
52
false
true
0
7
13
31
14
17
null
null
kinoru/prospect
src/RawFilePath.hs
agpl-3.0
getAppDirectory :: RawFilePath -> IO RawFilePath getAppDirectory app = fmap (</> ".config" </> app) getHomeDirectory
116
getAppDirectory :: RawFilePath -> IO RawFilePath getAppDirectory app = fmap (</> ".config" </> app) getHomeDirectory
116
getAppDirectory app = fmap (</> ".config" </> app) getHomeDirectory
67
false
true
0
7
14
34
17
17
null
null
keithodulaigh/Hets
THF/Print.hs
gpl-2.0
printProblemTHF :: SignTHF -> [Named THFFormula] -> Named THFFormula -> Doc printProblemTHF sig ax gl = pretty sig $++$ text "%Axioms:" $+$ foldl (\ d e -> d $+$ printNamedSentenceTHF (Just Axiom) e) empty ax $++$ text "%Goal:" $+$ printNamedSentenceTHF (Just Conjecture) gl
282
printProblemTHF :: SignTHF -> [Named THFFormula] -> Named THFFormula -> Doc printProblemTHF sig ax gl = pretty sig $++$ text "%Axioms:" $+$ foldl (\ d e -> d $+$ printNamedSentenceTHF (Just Axiom) e) empty ax $++$ text "%Goal:" $+$ printNamedSentenceTHF (Just Conjecture) gl
282
printProblemTHF sig ax gl = pretty sig $++$ text "%Axioms:" $+$ foldl (\ d e -> d $+$ printNamedSentenceTHF (Just Axiom) e) empty ax $++$ text "%Goal:" $+$ printNamedSentenceTHF (Just Conjecture) gl
206
false
true
0
14
50
107
51
56
null
null
alexander-at-github/eta
compiler/ETA/Core/PprCore.hs
bsd-3-clause
pprTypedLamBinder :: BindingSite -> Bool -> Var -> SDoc -- For lambda and case binders, show the unfolding info (usually none) pprTypedLamBinder bind_site debug_on var = sdocWithDynFlags $ \dflags -> case () of _ | not debug_on -- Even dead binders can be one-shot , isDeadBinder var -> char '_' <+> ppWhen (isId var) (pprIdBndrInfo (idInfo var)) | not debug_on -- No parens, no kind info , CaseBind <- bind_site -> pprUntypedBinder var | suppress_sigs dflags -> pprUntypedBinder var | isTyVar var -> parens (pprKindedTyVarBndr var) | otherwise -> parens (hang (pprIdBndr var) 2 (vcat [ dcolon <+> pprType (idType var) , pp_unf])) where suppress_sigs = gopt Opt_SuppressTypeSignatures unf_info = unfoldingInfo (idInfo var) pp_unf | hasSomeUnfolding unf_info = ptext (sLit "Unf=") <> ppr unf_info | otherwise = empty
1,077
pprTypedLamBinder :: BindingSite -> Bool -> Var -> SDoc pprTypedLamBinder bind_site debug_on var = sdocWithDynFlags $ \dflags -> case () of _ | not debug_on -- Even dead binders can be one-shot , isDeadBinder var -> char '_' <+> ppWhen (isId var) (pprIdBndrInfo (idInfo var)) | not debug_on -- No parens, no kind info , CaseBind <- bind_site -> pprUntypedBinder var | suppress_sigs dflags -> pprUntypedBinder var | isTyVar var -> parens (pprKindedTyVarBndr var) | otherwise -> parens (hang (pprIdBndr var) 2 (vcat [ dcolon <+> pprType (idType var) , pp_unf])) where suppress_sigs = gopt Opt_SuppressTypeSignatures unf_info = unfoldingInfo (idInfo var) pp_unf | hasSomeUnfolding unf_info = ptext (sLit "Unf=") <> ppr unf_info | otherwise = empty
1,006
pprTypedLamBinder bind_site debug_on var = sdocWithDynFlags $ \dflags -> case () of _ | not debug_on -- Even dead binders can be one-shot , isDeadBinder var -> char '_' <+> ppWhen (isId var) (pprIdBndrInfo (idInfo var)) | not debug_on -- No parens, no kind info , CaseBind <- bind_site -> pprUntypedBinder var | suppress_sigs dflags -> pprUntypedBinder var | isTyVar var -> parens (pprKindedTyVarBndr var) | otherwise -> parens (hang (pprIdBndr var) 2 (vcat [ dcolon <+> pprType (idType var) , pp_unf])) where suppress_sigs = gopt Opt_SuppressTypeSignatures unf_info = unfoldingInfo (idInfo var) pp_unf | hasSomeUnfolding unf_info = ptext (sLit "Unf=") <> ppr unf_info | otherwise = empty
950
true
true
4
20
389
274
129
145
null
null
haskell/filepath
System/FilePath/Internal.hs
bsd-3-clause
{- \\sharename\ -} readDriveShare :: String -> Maybe (FilePath, FilePath) readDriveShare (s1:s2:xs) | isPathSeparator s1 && isPathSeparator s2 = Just (s1:s2:a,b) where (a,b) = readDriveShareName xs
209
readDriveShare :: String -> Maybe (FilePath, FilePath) readDriveShare (s1:s2:xs) | isPathSeparator s1 && isPathSeparator s2 = Just (s1:s2:a,b) where (a,b) = readDriveShareName xs
190
readDriveShare (s1:s2:xs) | isPathSeparator s1 && isPathSeparator s2 = Just (s1:s2:a,b) where (a,b) = readDriveShareName xs
135
true
true
0
9
37
94
46
48
null
null
vikraman/ghc
libraries/template-haskell/Language/Haskell/TH/Ppr.hs
bsd-3-clause
ppr_dec :: Bool -- declaration on the toplevel? -> Dec -> Doc ppr_dec _ (FunD f cs) = vcat $ map (\c -> pprPrefixOcc f <+> ppr c) cs
154
ppr_dec :: Bool -- declaration on the toplevel? -> Dec -> Doc ppr_dec _ (FunD f cs) = vcat $ map (\c -> pprPrefixOcc f <+> ppr c) cs
154
ppr_dec _ (FunD f cs) = vcat $ map (\c -> pprPrefixOcc f <+> ppr c) cs
72
false
true
0
10
50
60
30
30
null
null
mmisamore/directed-cubical
Math/Topology/CubeCmplx/DirCubeCmplx.hs
bsd-3-clause
-- | Given a (nongeneric) cubical cell, get all proper cubical subcells. properSubCells :: CubeCell -> [CubeCell] properSubCells = lookupSubCells (map nCubeProperCells [0..])
174
properSubCells :: CubeCell -> [CubeCell] properSubCells = lookupSubCells (map nCubeProperCells [0..])
101
properSubCells = lookupSubCells (map nCubeProperCells [0..])
60
true
true
0
8
22
39
19
20
null
null
brendanhay/gogol
gogol-commentanalyzer/gen/Network/Google/CommentAnalyzer/Types/Product.hs
mpl-2.0
-- | UTF-8 encoded text. teText :: Lens' TextEntry (Maybe Text) teText = lens _teText (\ s a -> s{_teText = a})
111
teText :: Lens' TextEntry (Maybe Text) teText = lens _teText (\ s a -> s{_teText = a})
86
teText = lens _teText (\ s a -> s{_teText = a})
47
true
true
0
9
21
46
25
21
null
null
brendanhay/gogol
gogol-cloudsearch/gen/Network/Google/Resource/CloudSearch/Debug/Datasources/Items/UnmAppedids/List.hs
mpl-2.0
-- | The next_page_token value returned from a previous List request, if any. ddiualPageToken :: Lens' DebugDatasourcesItemsUnmAppedidsList (Maybe Text) ddiualPageToken = lens _ddiualPageToken (\ s a -> s{_ddiualPageToken = a})
235
ddiualPageToken :: Lens' DebugDatasourcesItemsUnmAppedidsList (Maybe Text) ddiualPageToken = lens _ddiualPageToken (\ s a -> s{_ddiualPageToken = a})
157
ddiualPageToken = lens _ddiualPageToken (\ s a -> s{_ddiualPageToken = a})
82
true
true
0
9
37
48
25
23
null
null
forked-upstream-packages-for-ghcjs/ghc
testsuite/tests/typecheck/should_compile/tc049.hs
bsd-3-clause
---------------------------------------- mem1 x [] = False
59
mem1 x [] = False
17
mem1 x [] = False
17
true
false
1
5
6
19
7
12
null
null
kmate/HaRe
old/testing/foldDef/ComplexParamIn3.hs
bsd-3-clause
--In this example, unfold the first 'sq' in 'sumSquares' --This example aims to test unfolding a definition with guards. sumSquares x y = (case (x, y) of (m, n) -> m ^ 2)
193
sumSquares x y = (case (x, y) of (m, n) -> m ^ 2)
71
sumSquares x y = (case (x, y) of (m, n) -> m ^ 2)
71
true
false
0
9
55
42
24
18
null
null
apunktbau/co4
test/CO4/Example/QueensSelfContained.hs
gpl-3.0
natAllocator 0 = knownZ
23
natAllocator 0 = knownZ
23
natAllocator 0 = knownZ
23
false
false
0
5
3
9
4
5
null
null
nikita-volkov/laika
library/Laika/Building/HTMLExp.hs
mit
unescapedText :: Text -> Builder unescapedText = bytesBuilder . F.encodeUtf8Builder
85
unescapedText :: Text -> Builder unescapedText = bytesBuilder . F.encodeUtf8Builder
85
unescapedText = bytesBuilder . F.encodeUtf8Builder
52
false
true
0
6
11
21
11
10
null
null
aspidites/c207
src/Types.hs
bsd-3-clause
mkPunchCard :: Repo -> Punch -> PunchCard mkPunchCard Repo{..} Punch{..} = PunchCard rName rOrg pTime pCommits
110
mkPunchCard :: Repo -> Punch -> PunchCard mkPunchCard Repo{..} Punch{..} = PunchCard rName rOrg pTime pCommits
110
mkPunchCard Repo{..} Punch{..} = PunchCard rName rOrg pTime pCommits
68
false
true
3
5
15
42
23
19
null
null
akegalj/snowdrift
View/User.hs
agpl-3.0
hiddenMarkdown (Just (Markdown str)) = fmap (fmap Markdown) $ aopt hiddenField "" (Just $ Just str)
99
hiddenMarkdown (Just (Markdown str)) = fmap (fmap Markdown) $ aopt hiddenField "" (Just $ Just str)
99
hiddenMarkdown (Just (Markdown str)) = fmap (fmap Markdown) $ aopt hiddenField "" (Just $ Just str)
99
false
false
0
9
15
51
24
27
null
null
paulp/unison
parser-typechecker/src/Unison/Typechecker/Context1.hs
mit
instantiateL v t = getContext >>= \ctx -> case Type.monotype t >>= (solve ctx v) of Just ctx -> setContext ctx -- InstLSolve Nothing -> case t of Type.Existential' v2 | ordered ctx v v2 -> -- InstLReach (both are existential, set v2 = v) maybe (fail "InstLReach failed") setContext $ solve ctx v2 (Type.Monotype (Type.existential v)) Type.Arrow' i o -> do -- InstLArr [i',o'] <- traverse freshenVar [ABT.v' "i", ABT.v' "o"] let s = Solved v (Type.Monotype (Type.arrow() (Type.existential i') (Type.existential o'))) modifyContext' $ replace (Existential v) (context [Existential o', Existential i', s]) instantiateR i i' ctx <- getContext instantiateL o' (apply ctx o) Type.App' x y -> do -- analogue of InstLArr [x', y'] <- traverse freshenVar [ABT.v' "x", ABT.v' "y"] let s = Solved v (Type.Monotype (Type.app() (Type.existential x') (Type.existential y'))) modifyContext' $ replace (Existential v) (context [Existential y', Existential x', s]) ctx0 <- getContext ctx' <- instantiateL x' (apply ctx0 x) >> getContext instantiateL y' (apply ctx' y) Type.Effect' es vt -> do es' <- replicateM (length es) (freshNamed "eeee") vt' <- freshNamed "vt" let s = Solved v (Type.Monotype (Type.effect() (Type.existential <$> es') (Type.existential vt'))) modifyContext' $ replace (Existential v) (context $ (Existential <$> es') ++ [Existential vt', s]) Foldable.for_ (es' `zip` es) $ \(e',e) -> do ctx <- getContext instantiateL e' (apply ctx e) ctx <- getContext instantiateL vt' (apply ctx vt) Type.Forall' body -> do -- InstLIIL v <- extendUniversal =<< ABT.freshen body freshenTypeVar instantiateL v (ABT.bind body (Type.universal v)) modifyContext (retract (Universal v)) _ -> do let msg = "could not instantiate left: '" ++ show v ++ " <: " ++ show t logContext msg fail msg -- | Instantiate the given existential such that it is -- a supertype of the given type, updating the context -- in the process.
2,111
instantiateL v t = getContext >>= \ctx -> case Type.monotype t >>= (solve ctx v) of Just ctx -> setContext ctx -- InstLSolve Nothing -> case t of Type.Existential' v2 | ordered ctx v v2 -> -- InstLReach (both are existential, set v2 = v) maybe (fail "InstLReach failed") setContext $ solve ctx v2 (Type.Monotype (Type.existential v)) Type.Arrow' i o -> do -- InstLArr [i',o'] <- traverse freshenVar [ABT.v' "i", ABT.v' "o"] let s = Solved v (Type.Monotype (Type.arrow() (Type.existential i') (Type.existential o'))) modifyContext' $ replace (Existential v) (context [Existential o', Existential i', s]) instantiateR i i' ctx <- getContext instantiateL o' (apply ctx o) Type.App' x y -> do -- analogue of InstLArr [x', y'] <- traverse freshenVar [ABT.v' "x", ABT.v' "y"] let s = Solved v (Type.Monotype (Type.app() (Type.existential x') (Type.existential y'))) modifyContext' $ replace (Existential v) (context [Existential y', Existential x', s]) ctx0 <- getContext ctx' <- instantiateL x' (apply ctx0 x) >> getContext instantiateL y' (apply ctx' y) Type.Effect' es vt -> do es' <- replicateM (length es) (freshNamed "eeee") vt' <- freshNamed "vt" let s = Solved v (Type.Monotype (Type.effect() (Type.existential <$> es') (Type.existential vt'))) modifyContext' $ replace (Existential v) (context $ (Existential <$> es') ++ [Existential vt', s]) Foldable.for_ (es' `zip` es) $ \(e',e) -> do ctx <- getContext instantiateL e' (apply ctx e) ctx <- getContext instantiateL vt' (apply ctx vt) Type.Forall' body -> do -- InstLIIL v <- extendUniversal =<< ABT.freshen body freshenTypeVar instantiateL v (ABT.bind body (Type.universal v)) modifyContext (retract (Universal v)) _ -> do let msg = "could not instantiate left: '" ++ show v ++ " <: " ++ show t logContext msg fail msg -- | Instantiate the given existential such that it is -- a supertype of the given type, updating the context -- in the process.
2,111
instantiateL v t = getContext >>= \ctx -> case Type.monotype t >>= (solve ctx v) of Just ctx -> setContext ctx -- InstLSolve Nothing -> case t of Type.Existential' v2 | ordered ctx v v2 -> -- InstLReach (both are existential, set v2 = v) maybe (fail "InstLReach failed") setContext $ solve ctx v2 (Type.Monotype (Type.existential v)) Type.Arrow' i o -> do -- InstLArr [i',o'] <- traverse freshenVar [ABT.v' "i", ABT.v' "o"] let s = Solved v (Type.Monotype (Type.arrow() (Type.existential i') (Type.existential o'))) modifyContext' $ replace (Existential v) (context [Existential o', Existential i', s]) instantiateR i i' ctx <- getContext instantiateL o' (apply ctx o) Type.App' x y -> do -- analogue of InstLArr [x', y'] <- traverse freshenVar [ABT.v' "x", ABT.v' "y"] let s = Solved v (Type.Monotype (Type.app() (Type.existential x') (Type.existential y'))) modifyContext' $ replace (Existential v) (context [Existential y', Existential x', s]) ctx0 <- getContext ctx' <- instantiateL x' (apply ctx0 x) >> getContext instantiateL y' (apply ctx' y) Type.Effect' es vt -> do es' <- replicateM (length es) (freshNamed "eeee") vt' <- freshNamed "vt" let s = Solved v (Type.Monotype (Type.effect() (Type.existential <$> es') (Type.existential vt'))) modifyContext' $ replace (Existential v) (context $ (Existential <$> es') ++ [Existential vt', s]) Foldable.for_ (es' `zip` es) $ \(e',e) -> do ctx <- getContext instantiateL e' (apply ctx e) ctx <- getContext instantiateL vt' (apply ctx vt) Type.Forall' body -> do -- InstLIIL v <- extendUniversal =<< ABT.freshen body freshenTypeVar instantiateL v (ABT.bind body (Type.universal v)) modifyContext (retract (Universal v)) _ -> do let msg = "could not instantiate left: '" ++ show v ++ " <: " ++ show t logContext msg fail msg -- | Instantiate the given existential such that it is -- a supertype of the given type, updating the context -- in the process.
2,111
false
false
1
25
508
833
394
439
null
null
technogeeky/d-A
include/containers-0.5.0.0/Data/IntMap/Strict.hs
gpl-3.0
-- | /O(n)/. Build a map from a list of key\/value pairs where -- the keys are in ascending order, with a combining function on equal keys. -- /The precondition (input list is ascending) is not checked./ -- -- > fromAscListWith (++) [(3,"b"), (5,"a"), (5,"b")] == fromList [(3, "b"), (5, "ba")] fromAscListWith :: (a -> a -> a) -> [(Key,a)] -> IntMap a fromAscListWith f xs = fromAscListWithKey (\_ x y -> f x y) xs
418
fromAscListWith :: (a -> a -> a) -> [(Key,a)] -> IntMap a fromAscListWith f xs = fromAscListWithKey (\_ x y -> f x y) xs
122
fromAscListWith f xs = fromAscListWithKey (\_ x y -> f x y) xs
64
true
true
0
8
78
74
41
33
null
null
phaazon/vector
Data/Vector/Primitive.hs
bsd-3-clause
unsafeTake = G.unsafeTake
25
unsafeTake = G.unsafeTake
25
unsafeTake = G.unsafeTake
25
false
false
0
5
2
8
4
4
null
null
ekmett/ghc
compiler/codeGen/StgCmmPrim.hs
bsd-3-clause
doCopyByteArrayOp :: CmmExpr -> CmmExpr -> CmmExpr -> CmmExpr -> CmmExpr -> FCode () doCopyByteArrayOp = emitCopyByteArray copy where -- Copy data (we assume the arrays aren't overlapping since -- they're of different types) copy _src _dst dst_p src_p bytes = do dflags <- getDynFlags emitMemcpyCall dst_p src_p bytes (mkIntExpr dflags 1) -- | Takes a source 'MutableByteArray#', an offset in the source -- array, a destination 'MutableByteArray#', an offset into the -- destination array, and the number of bytes to copy. Copies the -- given number of bytes from the source array to the destination -- array.
662
doCopyByteArrayOp :: CmmExpr -> CmmExpr -> CmmExpr -> CmmExpr -> CmmExpr -> FCode () doCopyByteArrayOp = emitCopyByteArray copy where -- Copy data (we assume the arrays aren't overlapping since -- they're of different types) copy _src _dst dst_p src_p bytes = do dflags <- getDynFlags emitMemcpyCall dst_p src_p bytes (mkIntExpr dflags 1) -- | Takes a source 'MutableByteArray#', an offset in the source -- array, a destination 'MutableByteArray#', an offset into the -- destination array, and the number of bytes to copy. Copies the -- given number of bytes from the source array to the destination -- array.
662
doCopyByteArrayOp = emitCopyByteArray copy where -- Copy data (we assume the arrays aren't overlapping since -- they're of different types) copy _src _dst dst_p src_p bytes = do dflags <- getDynFlags emitMemcpyCall dst_p src_p bytes (mkIntExpr dflags 1) -- | Takes a source 'MutableByteArray#', an offset in the source -- array, a destination 'MutableByteArray#', an offset into the -- destination array, and the number of bytes to copy. Copies the -- given number of bytes from the source array to the destination -- array.
559
false
true
0
11
150
91
47
44
null
null
gcampax/ghc
compiler/main/DynFlags.hs
bsd-3-clause
----------------------------------------------------------------------------- -- Via-C compilation stuff -- There are some options that we need to pass to gcc when compiling -- Haskell code via C, but are only supported by recent versions of -- gcc. The configure script decides which of these options we need, -- and puts them in the "settings" file in $topdir. The advantage of -- having these in a separate file is that the file can be created at -- install-time depending on the available gcc version, and even -- re-generated later if gcc is upgraded. -- -- The options below are not dependent on the version of gcc, only the -- platform. picCCOpts :: DynFlags -> [String] picCCOpts dflags = case platformOS (targetPlatform dflags) of OSDarwin -- Apple prefers to do things the other way round. -- PIC is on by default. -- -mdynamic-no-pic: -- Turn off PIC code generation. -- -fno-common: -- Don't generate "common" symbols - these are unwanted -- in dynamic libraries. | gopt Opt_PIC dflags -> ["-fno-common", "-U__PIC__", "-D__PIC__"] | otherwise -> ["-mdynamic-no-pic"] OSMinGW32 -- no -fPIC for Windows | gopt Opt_PIC dflags -> ["-U__PIC__", "-D__PIC__"] | otherwise -> [] _ -- we need -fPIC for C files when we are compiling with -dynamic, -- otherwise things like stub.c files don't get compiled -- correctly. They need to reference data in the Haskell -- objects, but can't without -fPIC. See -- http://ghc.haskell.org/trac/ghc/wiki/Commentary/PositionIndependentCode | gopt Opt_PIC dflags || not (gopt Opt_Static dflags) -> ["-fPIC", "-U__PIC__", "-D__PIC__"] | otherwise -> []
1,831
picCCOpts :: DynFlags -> [String] picCCOpts dflags = case platformOS (targetPlatform dflags) of OSDarwin -- Apple prefers to do things the other way round. -- PIC is on by default. -- -mdynamic-no-pic: -- Turn off PIC code generation. -- -fno-common: -- Don't generate "common" symbols - these are unwanted -- in dynamic libraries. | gopt Opt_PIC dflags -> ["-fno-common", "-U__PIC__", "-D__PIC__"] | otherwise -> ["-mdynamic-no-pic"] OSMinGW32 -- no -fPIC for Windows | gopt Opt_PIC dflags -> ["-U__PIC__", "-D__PIC__"] | otherwise -> [] _ -- we need -fPIC for C files when we are compiling with -dynamic, -- otherwise things like stub.c files don't get compiled -- correctly. They need to reference data in the Haskell -- objects, but can't without -fPIC. See -- http://ghc.haskell.org/trac/ghc/wiki/Commentary/PositionIndependentCode | gopt Opt_PIC dflags || not (gopt Opt_Static dflags) -> ["-fPIC", "-U__PIC__", "-D__PIC__"] | otherwise -> []
1,184
picCCOpts dflags = case platformOS (targetPlatform dflags) of OSDarwin -- Apple prefers to do things the other way round. -- PIC is on by default. -- -mdynamic-no-pic: -- Turn off PIC code generation. -- -fno-common: -- Don't generate "common" symbols - these are unwanted -- in dynamic libraries. | gopt Opt_PIC dflags -> ["-fno-common", "-U__PIC__", "-D__PIC__"] | otherwise -> ["-mdynamic-no-pic"] OSMinGW32 -- no -fPIC for Windows | gopt Opt_PIC dflags -> ["-U__PIC__", "-D__PIC__"] | otherwise -> [] _ -- we need -fPIC for C files when we are compiling with -dynamic, -- otherwise things like stub.c files don't get compiled -- correctly. They need to reference data in the Haskell -- objects, but can't without -fPIC. See -- http://ghc.haskell.org/trac/ghc/wiki/Commentary/PositionIndependentCode | gopt Opt_PIC dflags || not (gopt Opt_Static dflags) -> ["-fPIC", "-U__PIC__", "-D__PIC__"] | otherwise -> []
1,150
true
true
0
14
486
189
103
86
null
null
mitchellwrosen/language-lua2
src/Language/Lua/Parser/Internal.hs
bsd-3-clause
if' :: Prod r String (L Token) (L Token) if' = locSymbol TkIf <?> "'if'"
72
if' :: Prod r String (L Token) (L Token) if' = locSymbol TkIf <?> "'if'"
72
if' = locSymbol TkIf <?> "'if'"
31
false
true
1
7
14
43
19
24
null
null
TomMD/ghc
compiler/prelude/THNames.hs
bsd-3-clause
newtypeDIdKey = mkPreludeMiscIdUnique 333
56
newtypeDIdKey = mkPreludeMiscIdUnique 333
56
newtypeDIdKey = mkPreludeMiscIdUnique 333
56
false
false
0
5
18
9
4
5
null
null
ezyang/ghc
compiler/types/TyCoRep.hs
bsd-3-clause
tidyFreeTyCoVars :: TidyEnv -> [TyCoVar] -> TidyEnv -- ^ Add the free 'TyVar's to the env in tidy form, -- so that we can tidy the type they are free in tidyFreeTyCoVars (full_occ_env, var_env) tyvars = fst (tidyOpenTyCoVars (full_occ_env, var_env) tyvars)
258
tidyFreeTyCoVars :: TidyEnv -> [TyCoVar] -> TidyEnv tidyFreeTyCoVars (full_occ_env, var_env) tyvars = fst (tidyOpenTyCoVars (full_occ_env, var_env) tyvars)
157
tidyFreeTyCoVars (full_occ_env, var_env) tyvars = fst (tidyOpenTyCoVars (full_occ_env, var_env) tyvars)
105
true
true
0
9
42
58
30
28
null
null
danstiner/transpiler
src/Batch/Lexer.hs
mit
amperstand = keyword Amperstand
31
amperstand = keyword Amperstand
31
amperstand = keyword Amperstand
31
false
false
1
5
3
12
4
8
null
null
plaprade/haskoin
haskoin-wallet/test/Network/Haskoin/Wallet/Units.hs
unlicense
testNotification :: App () testNotification = do _ <- newAccount NewAccount { newAccountName = "acc1" , newAccountType = AccountRegular , newAccountDeriv = Just 0 , newAccountMaster = Nothing , newAccountMnemonic = Just (cs ms) , newAccountPassword = Nothing , newAccountKeys = [] , newAccountReadOnly = False , newAccountEntropy = Nothing } let tx1 = fakeTx [ (tid1, 4) ] [ ("1BThGRupK6Ah44sfCtsg2QkoEDJA58d8in", 10000000) ] tx2 = fakeTx [ (txHash tx1, 0) ] [ ("1MchgrtQEUgV1f7Nqe1vEzvdmBzJHz8zrY", 6000000) -- external , ("1JGvK2MYQ3wwxMdYeyf7Eg1HeVJuEq3AT1", 4000000) -- change ] tx3 = fakeTx [ (txHash tx2, 1) ] [ ("1MchgrtQEUgV1f7Nqe1vEzvdmBzJHz8zrY", 4000000) ] -- external notifChan <- liftIO $ atomically $ newTBMChan 1000 _ <- importNetTx tx1 (Just notifChan) tx1NM <- liftIO $ atomically $ readTBMChan notifChan liftIO $ case tx1NM of Just (NotifTx JsonTx{..}) -> assertEqual "Notif hash does not match" (txHash tx1) jsonTxHash _ -> assertFailure "Transaction notification is not the right type" _ <- importNetTx tx2 (Just notifChan) tx2NM <- liftIO $ atomically $ readTBMChan notifChan liftIO $ case tx2NM of Just (NotifTx JsonTx{..}) -> assertEqual "Notif hash does not match" (txHash tx2) jsonTxHash _ -> assertFailure "Transaction notification is not the right type" _ <- importNetTx tx3 Nothing let block1 = fakeNode nGenesisBlock [txHash tx1] 0 1 block2 = fakeNode block1 [txHash tx2] 0 2 best = BestChain [block1, block2] txs1 = [[txHash tx1], [txHash tx2]] importMerkles best txs1 (Just notifChan) b1NM <- liftIO $ atomically $ readTBMChan notifChan liftIO $ case b1NM of Just (NotifBlock JsonBlock{..}) -> assertEqual "Block hash does not match" (nodeHash block1) jsonBlockHash _ -> assertFailure "Block notification not the right type" tx1NM' <- liftIO $ atomically $ readTBMChan notifChan liftIO $ case tx1NM' of Just (NotifTx JsonTx{..}) -> assertEqual "Transaction list does not match" (txHash tx1) jsonTxHash _ -> assertFailure "Transaction notification not the right type" b2NM <- liftIO $ atomically $ readTBMChan notifChan liftIO $ case b2NM of Just (NotifBlock JsonBlock{..}) -> assertEqual "Block hash does not match" (nodeHash block2) jsonBlockHash _ -> assertFailure "Block notification not the right type" tx2NM' <- liftIO $ atomically $ readTBMChan notifChan liftIO $ case tx2NM' of Just (NotifTx JsonTx{..}) -> assertEqual "Transaction list does not match" (txHash tx2) jsonTxHash _ -> assertFailure "Transaction notification not the right type" let block2' = fakeNode block1 [txHash tx2, txHash tx3] 1 22 txs2 = [[txHash tx2, txHash tx3]] reorg = ChainReorg block1 [block2] [block2'] importMerkles reorg txs2 (Just notifChan) b3NM <- liftIO $ atomically $ readTBMChan notifChan liftIO $ case b3NM of Just (NotifBlock JsonBlock{..}) -> assertEqual "Block hash does not match" (nodeHash block2') jsonBlockHash _ -> assertFailure "Block notification not the right type" tx3NM2 <- liftIO $ atomically $ readTBMChan notifChan liftIO $ case tx3NM2 of Just (NotifTx JsonTx{..}) -> assertEqual "Transaction does not match" (txHash tx2) jsonTxHash _ -> assertFailure "Transaction notification not the right type" tx3NM3 <- liftIO $ atomically $ readTBMChan notifChan liftIO $ case tx3NM3 of Just (NotifTx JsonTx{..}) -> assertEqual "Transaction does not match" (txHash tx3) jsonTxHash _ -> assertFailure "Transaction notification not the right type"
4,123
testNotification :: App () testNotification = do _ <- newAccount NewAccount { newAccountName = "acc1" , newAccountType = AccountRegular , newAccountDeriv = Just 0 , newAccountMaster = Nothing , newAccountMnemonic = Just (cs ms) , newAccountPassword = Nothing , newAccountKeys = [] , newAccountReadOnly = False , newAccountEntropy = Nothing } let tx1 = fakeTx [ (tid1, 4) ] [ ("1BThGRupK6Ah44sfCtsg2QkoEDJA58d8in", 10000000) ] tx2 = fakeTx [ (txHash tx1, 0) ] [ ("1MchgrtQEUgV1f7Nqe1vEzvdmBzJHz8zrY", 6000000) -- external , ("1JGvK2MYQ3wwxMdYeyf7Eg1HeVJuEq3AT1", 4000000) -- change ] tx3 = fakeTx [ (txHash tx2, 1) ] [ ("1MchgrtQEUgV1f7Nqe1vEzvdmBzJHz8zrY", 4000000) ] -- external notifChan <- liftIO $ atomically $ newTBMChan 1000 _ <- importNetTx tx1 (Just notifChan) tx1NM <- liftIO $ atomically $ readTBMChan notifChan liftIO $ case tx1NM of Just (NotifTx JsonTx{..}) -> assertEqual "Notif hash does not match" (txHash tx1) jsonTxHash _ -> assertFailure "Transaction notification is not the right type" _ <- importNetTx tx2 (Just notifChan) tx2NM <- liftIO $ atomically $ readTBMChan notifChan liftIO $ case tx2NM of Just (NotifTx JsonTx{..}) -> assertEqual "Notif hash does not match" (txHash tx2) jsonTxHash _ -> assertFailure "Transaction notification is not the right type" _ <- importNetTx tx3 Nothing let block1 = fakeNode nGenesisBlock [txHash tx1] 0 1 block2 = fakeNode block1 [txHash tx2] 0 2 best = BestChain [block1, block2] txs1 = [[txHash tx1], [txHash tx2]] importMerkles best txs1 (Just notifChan) b1NM <- liftIO $ atomically $ readTBMChan notifChan liftIO $ case b1NM of Just (NotifBlock JsonBlock{..}) -> assertEqual "Block hash does not match" (nodeHash block1) jsonBlockHash _ -> assertFailure "Block notification not the right type" tx1NM' <- liftIO $ atomically $ readTBMChan notifChan liftIO $ case tx1NM' of Just (NotifTx JsonTx{..}) -> assertEqual "Transaction list does not match" (txHash tx1) jsonTxHash _ -> assertFailure "Transaction notification not the right type" b2NM <- liftIO $ atomically $ readTBMChan notifChan liftIO $ case b2NM of Just (NotifBlock JsonBlock{..}) -> assertEqual "Block hash does not match" (nodeHash block2) jsonBlockHash _ -> assertFailure "Block notification not the right type" tx2NM' <- liftIO $ atomically $ readTBMChan notifChan liftIO $ case tx2NM' of Just (NotifTx JsonTx{..}) -> assertEqual "Transaction list does not match" (txHash tx2) jsonTxHash _ -> assertFailure "Transaction notification not the right type" let block2' = fakeNode block1 [txHash tx2, txHash tx3] 1 22 txs2 = [[txHash tx2, txHash tx3]] reorg = ChainReorg block1 [block2] [block2'] importMerkles reorg txs2 (Just notifChan) b3NM <- liftIO $ atomically $ readTBMChan notifChan liftIO $ case b3NM of Just (NotifBlock JsonBlock{..}) -> assertEqual "Block hash does not match" (nodeHash block2') jsonBlockHash _ -> assertFailure "Block notification not the right type" tx3NM2 <- liftIO $ atomically $ readTBMChan notifChan liftIO $ case tx3NM2 of Just (NotifTx JsonTx{..}) -> assertEqual "Transaction does not match" (txHash tx2) jsonTxHash _ -> assertFailure "Transaction notification not the right type" tx3NM3 <- liftIO $ atomically $ readTBMChan notifChan liftIO $ case tx3NM3 of Just (NotifTx JsonTx{..}) -> assertEqual "Transaction does not match" (txHash tx3) jsonTxHash _ -> assertFailure "Transaction notification not the right type"
4,123
testNotification = do _ <- newAccount NewAccount { newAccountName = "acc1" , newAccountType = AccountRegular , newAccountDeriv = Just 0 , newAccountMaster = Nothing , newAccountMnemonic = Just (cs ms) , newAccountPassword = Nothing , newAccountKeys = [] , newAccountReadOnly = False , newAccountEntropy = Nothing } let tx1 = fakeTx [ (tid1, 4) ] [ ("1BThGRupK6Ah44sfCtsg2QkoEDJA58d8in", 10000000) ] tx2 = fakeTx [ (txHash tx1, 0) ] [ ("1MchgrtQEUgV1f7Nqe1vEzvdmBzJHz8zrY", 6000000) -- external , ("1JGvK2MYQ3wwxMdYeyf7Eg1HeVJuEq3AT1", 4000000) -- change ] tx3 = fakeTx [ (txHash tx2, 1) ] [ ("1MchgrtQEUgV1f7Nqe1vEzvdmBzJHz8zrY", 4000000) ] -- external notifChan <- liftIO $ atomically $ newTBMChan 1000 _ <- importNetTx tx1 (Just notifChan) tx1NM <- liftIO $ atomically $ readTBMChan notifChan liftIO $ case tx1NM of Just (NotifTx JsonTx{..}) -> assertEqual "Notif hash does not match" (txHash tx1) jsonTxHash _ -> assertFailure "Transaction notification is not the right type" _ <- importNetTx tx2 (Just notifChan) tx2NM <- liftIO $ atomically $ readTBMChan notifChan liftIO $ case tx2NM of Just (NotifTx JsonTx{..}) -> assertEqual "Notif hash does not match" (txHash tx2) jsonTxHash _ -> assertFailure "Transaction notification is not the right type" _ <- importNetTx tx3 Nothing let block1 = fakeNode nGenesisBlock [txHash tx1] 0 1 block2 = fakeNode block1 [txHash tx2] 0 2 best = BestChain [block1, block2] txs1 = [[txHash tx1], [txHash tx2]] importMerkles best txs1 (Just notifChan) b1NM <- liftIO $ atomically $ readTBMChan notifChan liftIO $ case b1NM of Just (NotifBlock JsonBlock{..}) -> assertEqual "Block hash does not match" (nodeHash block1) jsonBlockHash _ -> assertFailure "Block notification not the right type" tx1NM' <- liftIO $ atomically $ readTBMChan notifChan liftIO $ case tx1NM' of Just (NotifTx JsonTx{..}) -> assertEqual "Transaction list does not match" (txHash tx1) jsonTxHash _ -> assertFailure "Transaction notification not the right type" b2NM <- liftIO $ atomically $ readTBMChan notifChan liftIO $ case b2NM of Just (NotifBlock JsonBlock{..}) -> assertEqual "Block hash does not match" (nodeHash block2) jsonBlockHash _ -> assertFailure "Block notification not the right type" tx2NM' <- liftIO $ atomically $ readTBMChan notifChan liftIO $ case tx2NM' of Just (NotifTx JsonTx{..}) -> assertEqual "Transaction list does not match" (txHash tx2) jsonTxHash _ -> assertFailure "Transaction notification not the right type" let block2' = fakeNode block1 [txHash tx2, txHash tx3] 1 22 txs2 = [[txHash tx2, txHash tx3]] reorg = ChainReorg block1 [block2] [block2'] importMerkles reorg txs2 (Just notifChan) b3NM <- liftIO $ atomically $ readTBMChan notifChan liftIO $ case b3NM of Just (NotifBlock JsonBlock{..}) -> assertEqual "Block hash does not match" (nodeHash block2') jsonBlockHash _ -> assertFailure "Block notification not the right type" tx3NM2 <- liftIO $ atomically $ readTBMChan notifChan liftIO $ case tx3NM2 of Just (NotifTx JsonTx{..}) -> assertEqual "Transaction does not match" (txHash tx2) jsonTxHash _ -> assertFailure "Transaction notification not the right type" tx3NM3 <- liftIO $ atomically $ readTBMChan notifChan liftIO $ case tx3NM3 of Just (NotifTx JsonTx{..}) -> assertEqual "Transaction does not match" (txHash tx3) jsonTxHash _ -> assertFailure "Transaction notification not the right type"
4,096
false
true
0
15
1,244
1,097
535
562
null
null
ku-fpg/kansas-amber
tests/ExprTests/ExprWord16.hs
bsd-3-clause
prop_sub :: ArduinoConnection -> RemoteRef Word16 -> Word16 -> Word16 -> Property prop_sub c r x y = monadicIO $ do let local = x - y remote <- run $ send c $ do writeRemoteRefE r $ (lit x) - (lit y) v <- readRemoteRefE r return v assert (local == litEval16 remote)
301
prop_sub :: ArduinoConnection -> RemoteRef Word16 -> Word16 -> Word16 -> Property prop_sub c r x y = monadicIO $ do let local = x - y remote <- run $ send c $ do writeRemoteRefE r $ (lit x) - (lit y) v <- readRemoteRefE r return v assert (local == litEval16 remote)
301
prop_sub c r x y = monadicIO $ do let local = x - y remote <- run $ send c $ do writeRemoteRefE r $ (lit x) - (lit y) v <- readRemoteRefE r return v assert (local == litEval16 remote)
219
false
true
0
15
89
132
60
72
null
null
sapek/bond
compiler/Main.hs
mit
writeSchema _ = error "writeSchema: impossible happened."
57
writeSchema _ = error "writeSchema: impossible happened."
57
writeSchema _ = error "writeSchema: impossible happened."
57
false
false
0
5
6
13
5
8
null
null
genos/online_problems
exercism/haskell/anagram/test/Tests.hs
mit
cases :: [Case] cases = [ Case { description = "no matches" , subject = "diaper" , candidates = [ "hello", "world", "zombies", "pants"] , expected = [] } , Case { description = "detects simple anagram" , subject = "ant" , candidates = ["tan", "stand", "at"] , expected = ["tan"] } , Case { description = "does not detect false positives" , subject = "galea" , candidates = ["eagle"] , expected = [] } , Case { description = "detects two anagrams" , subject = "master" , candidates = ["stream", "pigeon", "maters"] , expected = ["stream", "maters"] } , Case { description = "does not detect anagram subsets" , subject = "good" , candidates = ["dog", "goody"] , expected = [] } , Case { description = "detects anagram" , subject = "listen" , candidates = ["enlists", "google", "inlets", "banana"] , expected = ["inlets"] } , Case { description = "detects three anagrams" , subject = "allergy" , candidates = ["gallery", "ballerina", "regally", "clergy", "largely", "leading"] , expected = ["gallery", "regally", "largely"] } , Case { description = "does not detect identical words" , subject = "corn" , candidates = ["corn", "dark", "Corn", "rank", "CORN", "cron", "park"] , expected = ["cron"] } , Case { description = "does not detect non-anagrams with identical checksum" , subject = "mass" , candidates = ["last"] , expected = [] } , Case { description = "detects anagrams case-insensitively" , subject = "Orchestra" , candidates = ["cashregister", "Carthorse", "radishes"] , expected = ["Carthorse"] } , Case { description = "detects anagrams using case-insensitive subject" , subject = "Orchestra" , candidates = ["cashregister", "carthorse", "radishes"] , expected = ["carthorse"] } , Case { description = "detects anagrams using case-insensitive possible matches" , subject = "orchestra" , candidates = ["cashregister", "Carthorse", "radishes"] , expected = ["Carthorse"] } , Case { description = "does not detect a word as its own anagram" , subject = "banana" , candidates = ["Banana"] , expected = [] } , Case { description = "does not detect a anagram if the original word is repeated" , subject = "go" , candidates = ["go Go GO"] , expected = [] } , Case { description = "anagrams must use all letters exactly once" , subject = "tapper" , candidates = ["patter"] , expected = [] } , Case { description = "capital word is not own anagram" , subject = "BANANA" , candidates = ["Banana"] , expected = [] } ]
3,631
cases :: [Case] cases = [ Case { description = "no matches" , subject = "diaper" , candidates = [ "hello", "world", "zombies", "pants"] , expected = [] } , Case { description = "detects simple anagram" , subject = "ant" , candidates = ["tan", "stand", "at"] , expected = ["tan"] } , Case { description = "does not detect false positives" , subject = "galea" , candidates = ["eagle"] , expected = [] } , Case { description = "detects two anagrams" , subject = "master" , candidates = ["stream", "pigeon", "maters"] , expected = ["stream", "maters"] } , Case { description = "does not detect anagram subsets" , subject = "good" , candidates = ["dog", "goody"] , expected = [] } , Case { description = "detects anagram" , subject = "listen" , candidates = ["enlists", "google", "inlets", "banana"] , expected = ["inlets"] } , Case { description = "detects three anagrams" , subject = "allergy" , candidates = ["gallery", "ballerina", "regally", "clergy", "largely", "leading"] , expected = ["gallery", "regally", "largely"] } , Case { description = "does not detect identical words" , subject = "corn" , candidates = ["corn", "dark", "Corn", "rank", "CORN", "cron", "park"] , expected = ["cron"] } , Case { description = "does not detect non-anagrams with identical checksum" , subject = "mass" , candidates = ["last"] , expected = [] } , Case { description = "detects anagrams case-insensitively" , subject = "Orchestra" , candidates = ["cashregister", "Carthorse", "radishes"] , expected = ["Carthorse"] } , Case { description = "detects anagrams using case-insensitive subject" , subject = "Orchestra" , candidates = ["cashregister", "carthorse", "radishes"] , expected = ["carthorse"] } , Case { description = "detects anagrams using case-insensitive possible matches" , subject = "orchestra" , candidates = ["cashregister", "Carthorse", "radishes"] , expected = ["Carthorse"] } , Case { description = "does not detect a word as its own anagram" , subject = "banana" , candidates = ["Banana"] , expected = [] } , Case { description = "does not detect a anagram if the original word is repeated" , subject = "go" , candidates = ["go Go GO"] , expected = [] } , Case { description = "anagrams must use all letters exactly once" , subject = "tapper" , candidates = ["patter"] , expected = [] } , Case { description = "capital word is not own anagram" , subject = "BANANA" , candidates = ["Banana"] , expected = [] } ]
3,631
cases = [ Case { description = "no matches" , subject = "diaper" , candidates = [ "hello", "world", "zombies", "pants"] , expected = [] } , Case { description = "detects simple anagram" , subject = "ant" , candidates = ["tan", "stand", "at"] , expected = ["tan"] } , Case { description = "does not detect false positives" , subject = "galea" , candidates = ["eagle"] , expected = [] } , Case { description = "detects two anagrams" , subject = "master" , candidates = ["stream", "pigeon", "maters"] , expected = ["stream", "maters"] } , Case { description = "does not detect anagram subsets" , subject = "good" , candidates = ["dog", "goody"] , expected = [] } , Case { description = "detects anagram" , subject = "listen" , candidates = ["enlists", "google", "inlets", "banana"] , expected = ["inlets"] } , Case { description = "detects three anagrams" , subject = "allergy" , candidates = ["gallery", "ballerina", "regally", "clergy", "largely", "leading"] , expected = ["gallery", "regally", "largely"] } , Case { description = "does not detect identical words" , subject = "corn" , candidates = ["corn", "dark", "Corn", "rank", "CORN", "cron", "park"] , expected = ["cron"] } , Case { description = "does not detect non-anagrams with identical checksum" , subject = "mass" , candidates = ["last"] , expected = [] } , Case { description = "detects anagrams case-insensitively" , subject = "Orchestra" , candidates = ["cashregister", "Carthorse", "radishes"] , expected = ["Carthorse"] } , Case { description = "detects anagrams using case-insensitive subject" , subject = "Orchestra" , candidates = ["cashregister", "carthorse", "radishes"] , expected = ["carthorse"] } , Case { description = "detects anagrams using case-insensitive possible matches" , subject = "orchestra" , candidates = ["cashregister", "Carthorse", "radishes"] , expected = ["Carthorse"] } , Case { description = "does not detect a word as its own anagram" , subject = "banana" , candidates = ["Banana"] , expected = [] } , Case { description = "does not detect a anagram if the original word is repeated" , subject = "go" , candidates = ["go Go GO"] , expected = [] } , Case { description = "anagrams must use all letters exactly once" , subject = "tapper" , candidates = ["patter"] , expected = [] } , Case { description = "capital word is not own anagram" , subject = "BANANA" , candidates = ["Banana"] , expected = [] } ]
3,615
false
true
0
8
1,625
659
430
229
null
null
alexander-at-github/eta
compiler/ETA/Types/Type.hs
bsd-3-clause
{- -- (mkPiType now in CoreUtils) applyTy, applyTys ~~~~~~~~~~~~~~~~~ -} -- | Instantiate a forall type with one or more type arguments. -- Used when we have a polymorphic function applied to type args: -- -- > f t1 t2 -- -- We use @applyTys type-of-f [t1,t2]@ to compute the type of the expression. -- Panics if no application is possible. applyTy :: Type -> KindOrType -> Type applyTy ty arg | Just ty' <- coreView ty = applyTy ty' arg
439
applyTy :: Type -> KindOrType -> Type applyTy ty arg | Just ty' <- coreView ty = applyTy ty' arg
96
applyTy ty arg | Just ty' <- coreView ty = applyTy ty' arg
58
true
true
0
9
82
57
29
28
null
null
oinuar/doppler-html
src/Doppler/Tag/Types.hs
mit
getAttributes (ShortTag _ attr) = attr
41
getAttributes (ShortTag _ attr) = attr
41
getAttributes (ShortTag _ attr) = attr
41
false
false
0
7
8
17
8
9
null
null
forked-upstream-packages-for-ghcjs/ghc
compiler/simplCore/SetLevels.hs
bsd-3-clause
annotateBotStr id (Just (arity, sig)) = id `setIdArity` arity `setIdStrictness` sig
126
annotateBotStr id (Just (arity, sig)) = id `setIdArity` arity `setIdStrictness` sig
126
annotateBotStr id (Just (arity, sig)) = id `setIdArity` arity `setIdStrictness` sig
126
false
false
0
8
53
35
20
15
null
null
rueshyna/gogol
gogol-compute/gen/Network/Google/Resource/Compute/URLMaps/InvalidateCache.hs
mpl-2.0
-- | Name of the UrlMap scoping this request. umicURLMap :: Lens' URLMapsInvalidateCache Text umicURLMap = lens _umicURLMap (\ s a -> s{_umicURLMap = a})
155
umicURLMap :: Lens' URLMapsInvalidateCache Text umicURLMap = lens _umicURLMap (\ s a -> s{_umicURLMap = a})
109
umicURLMap = lens _umicURLMap (\ s a -> s{_umicURLMap = a})
61
true
true
0
9
26
42
22
20
null
null
fatho/ninja
src/Graphics/Ninja/Storable/Generics.hs
mit
genericSizeOf :: (Generic a, GStorable (Rep a)) => a -> Int genericSizeOf x = gSizeOf (from x)
94
genericSizeOf :: (Generic a, GStorable (Rep a)) => a -> Int genericSizeOf x = gSizeOf (from x)
94
genericSizeOf x = gSizeOf (from x)
34
false
true
0
9
16
54
25
29
null
null
SamirTalwar/advent-of-code
2021/AOC_19_2.hs
mit
parser :: Parsec Text () [Scanner] parser = sepBy scanner (string "\n") where scanner = do _ <- string "--- scanner " *> int <* string " ---\n" beacons <- List.sort <$> many beacon return $ Scanner (Point 0 0 0) beacons beacon = do x <- fromIntegral <$> int _ <- char ',' y <- fromIntegral <$> int _ <- char ',' z <- fromIntegral <$> int _ <- char '\n' return $ Beacon (Point x y z)
452
parser :: Parsec Text () [Scanner] parser = sepBy scanner (string "\n") where scanner = do _ <- string "--- scanner " *> int <* string " ---\n" beacons <- List.sort <$> many beacon return $ Scanner (Point 0 0 0) beacons beacon = do x <- fromIntegral <$> int _ <- char ',' y <- fromIntegral <$> int _ <- char ',' z <- fromIntegral <$> int _ <- char '\n' return $ Beacon (Point x y z)
452
parser = sepBy scanner (string "\n") where scanner = do _ <- string "--- scanner " *> int <* string " ---\n" beacons <- List.sort <$> many beacon return $ Scanner (Point 0 0 0) beacons beacon = do x <- fromIntegral <$> int _ <- char ',' y <- fromIntegral <$> int _ <- char ',' z <- fromIntegral <$> int _ <- char '\n' return $ Beacon (Point x y z)
417
false
true
2
11
148
202
87
115
null
null
raichoo/Idris-dev
src/Idris/IBC.hs
bsd-3-clause
pClasses :: [(Name, ClassInfo)] -> Idris () pClasses cs = mapM_ (\ (n, c) -> do i <- getIState -- Don't lose instances from previous IBCs, which -- could have loaded in any order let is = case lookupCtxtExact n (idris_classes i) of Just (CI _ _ _ _ _ ins _) -> ins _ -> [] let c' = c { class_instances = class_instances c ++ is } putIState (i { idris_classes = addDef n c' (idris_classes i) })) cs
737
pClasses :: [(Name, ClassInfo)] -> Idris () pClasses cs = mapM_ (\ (n, c) -> do i <- getIState -- Don't lose instances from previous IBCs, which -- could have loaded in any order let is = case lookupCtxtExact n (idris_classes i) of Just (CI _ _ _ _ _ ins _) -> ins _ -> [] let c' = c { class_instances = class_instances c ++ is } putIState (i { idris_classes = addDef n c' (idris_classes i) })) cs
737
pClasses cs = mapM_ (\ (n, c) -> do i <- getIState -- Don't lose instances from previous IBCs, which -- could have loaded in any order let is = case lookupCtxtExact n (idris_classes i) of Just (CI _ _ _ _ _ ins _) -> ins _ -> [] let c' = c { class_instances = class_instances c ++ is } putIState (i { idris_classes = addDef n c' (idris_classes i) })) cs
693
false
true
0
17
420
179
89
90
null
null
rueshyna/gogol
gogol-dfareporting/gen/Network/Google/DFAReporting/Types/Product.hs
mpl-2.0
-- | Account user profile collection. aupflrAccountUserProFiles :: Lens' AccountUserProFilesListResponse [AccountUserProFile] aupflrAccountUserProFiles = lens _aupflrAccountUserProFiles (\ s a -> s{_aupflrAccountUserProFiles = a}) . _Default . _Coerce
271
aupflrAccountUserProFiles :: Lens' AccountUserProFilesListResponse [AccountUserProFile] aupflrAccountUserProFiles = lens _aupflrAccountUserProFiles (\ s a -> s{_aupflrAccountUserProFiles = a}) . _Default . _Coerce
233
aupflrAccountUserProFiles = lens _aupflrAccountUserProFiles (\ s a -> s{_aupflrAccountUserProFiles = a}) . _Default . _Coerce
145
true
true
2
8
45
57
28
29
null
null
wilbowma/accelerate
Data/Array/Accelerate/CUDA/Execute.hs
bsd-3-clause
mapOp :: Elt e => Int -> AccKernel (Array dim e) -> [AccBinding aenv] -> PreOpenAcc ExecOpenAcc aenv (Array dim e) -> Val aenv -> Array dim e' -> CIO (Array dim e) mapOp c kernel bindings acc aenv (Array sh0 in0) = do res@(Array _ out) <- newArray c (toElt sh0) execute kernel bindings acc aenv (size sh0) ((((),out),in0),size sh0) freeArray in0 return res
406
mapOp :: Elt e => Int -> AccKernel (Array dim e) -> [AccBinding aenv] -> PreOpenAcc ExecOpenAcc aenv (Array dim e) -> Val aenv -> Array dim e' -> CIO (Array dim e) mapOp c kernel bindings acc aenv (Array sh0 in0) = do res@(Array _ out) <- newArray c (toElt sh0) execute kernel bindings acc aenv (size sh0) ((((),out),in0),size sh0) freeArray in0 return res
406
mapOp c kernel bindings acc aenv (Array sh0 in0) = do res@(Array _ out) <- newArray c (toElt sh0) execute kernel bindings acc aenv (size sh0) ((((),out),in0),size sh0) freeArray in0 return res
200
false
true
0
14
114
200
96
104
null
null
dec9ue/jhc_copygc
src/FrontEnd/Infix.hs
gpl-2.0
syn_err_precedence op exp = syn_err_msg ++ "\tERROR: the precedence of " ++ show op ++ " is incompatible with the precendence of it's argument: " ++ show exp
188
syn_err_precedence op exp = syn_err_msg ++ "\tERROR: the precedence of " ++ show op ++ " is incompatible with the precendence of it's argument: " ++ show exp
188
syn_err_precedence op exp = syn_err_msg ++ "\tERROR: the precedence of " ++ show op ++ " is incompatible with the precendence of it's argument: " ++ show exp
188
false
false
3
6
58
38
15
23
null
null
CloudI/CloudI
src/api/haskell/external/bytestring-0.10.10.0/Data/ByteString/Builder.hs
mit
int64LE :: Int64 -> Builder int64LE = P.primFixed P.int64LE
59
int64LE :: Int64 -> Builder int64LE = P.primFixed P.int64LE
59
int64LE = P.primFixed P.int64LE
31
false
true
0
7
8
28
12
16
null
null
mcmaniac/ghc
compiler/cmm/CLabel.hs
bsd-3-clause
mkEMPTY_MVAR_infoLabel = CmmLabel rtsPackageId (fsLit "stg_EMPTY_MVAR") CmmInfo
95
mkEMPTY_MVAR_infoLabel = CmmLabel rtsPackageId (fsLit "stg_EMPTY_MVAR") CmmInfo
95
mkEMPTY_MVAR_infoLabel = CmmLabel rtsPackageId (fsLit "stg_EMPTY_MVAR") CmmInfo
95
false
false
0
7
22
19
9
10
null
null
wrengr/bytestring-trie
dev/Test/Properties.hs
bsd-3-clause
prop_FiltermapVertComposition :: Eq c => F b c -> F a b -> WTrie a -> Bool prop_FiltermapVertComposition f g = ((T.filterMap f . T.filterMap g) .==. T.filterMap (f <=< g)) . unWT
182
prop_FiltermapVertComposition :: Eq c => F b c -> F a b -> WTrie a -> Bool prop_FiltermapVertComposition f g = ((T.filterMap f . T.filterMap g) .==. T.filterMap (f <=< g)) . unWT
182
prop_FiltermapVertComposition f g = ((T.filterMap f . T.filterMap g) .==. T.filterMap (f <=< g)) . unWT
107
false
true
0
11
36
88
42
46
null
null
hvr/text
Data/Text/Internal/Builder.hs
bsd-2-clause
-- | /O(1)./ A @Builder@ taking a single character, satisfying -- -- * @'toLazyText' ('singleton' c) = 'L.singleton' c@ -- singleton :: Char -> Builder singleton c = writeAtMost 2 $ \ marr o -> unsafeWrite marr o c
215
singleton :: Char -> Builder singleton c = writeAtMost 2 $ \ marr o -> unsafeWrite marr o c
91
singleton c = writeAtMost 2 $ \ marr o -> unsafeWrite marr o c
62
true
true
0
7
39
43
23
20
null
null
Gabriel439/Haskell-Pipes-ByteString-Library
src/Pipes/ByteString.hs
bsd-3-clause
{-| Fold an effectful 'Producer' of strict 'ByteString's into a lazy 'BL.ByteString' alongside the return value Note: 'toLazyM'' is not an idiomatic use of @pipes@, but I provide it for simple testing purposes. Idiomatic @pipes@ style consumes the chunks immediately as they are generated instead of loading them all into memory. -} toLazyM' :: Monad m => Producer ByteString m a -> m (BL.ByteString, a) toLazyM' p = do (chunks, a) <- P.toListM' p return (BL.fromChunks chunks, a)
515
toLazyM' :: Monad m => Producer ByteString m a -> m (BL.ByteString, a) toLazyM' p = do (chunks, a) <- P.toListM' p return (BL.fromChunks chunks, a)
164
toLazyM' p = do (chunks, a) <- P.toListM' p return (BL.fromChunks chunks, a)
93
true
true
0
10
112
83
40
43
null
null
vladimir-ipatov/ganeti
src/Ganeti/Constants.hs
gpl-2.0
minVgSize :: Int minVgSize = 20480
34
minVgSize :: Int minVgSize = 20480
34
minVgSize = 20480
17
false
true
0
6
5
18
7
11
null
null
mcschroeder/ghc
compiler/main/DynFlags.hs
bsd-3-clause
interpWays :: [Way] interpWays | dynamicGhc = [WayDyn] | rtsIsProfiled = [WayProf] | otherwise = []
105
interpWays :: [Way] interpWays | dynamicGhc = [WayDyn] | rtsIsProfiled = [WayProf] | otherwise = []
105
interpWays | dynamicGhc = [WayDyn] | rtsIsProfiled = [WayProf] | otherwise = []
85
false
true
2
7
21
46
23
23
null
null
haskellweekly/haskellweekly.github.io
executables/haskell-weekly.hs
mit
getDay :: Text -> Maybe Time.Day getDay meta = case Text.words meta of ["<!--", day, "-->"] -> parseDay "%Y-%m-%d" day _ -> Nothing
135
getDay :: Text -> Maybe Time.Day getDay meta = case Text.words meta of ["<!--", day, "-->"] -> parseDay "%Y-%m-%d" day _ -> Nothing
135
getDay meta = case Text.words meta of ["<!--", day, "-->"] -> parseDay "%Y-%m-%d" day _ -> Nothing
102
false
true
3
7
26
58
29
29
null
null
rueshyna/gogol
gogol-genomics/gen/Network/Google/Resource/Genomics/DataSets/Get.hs
mpl-2.0
-- | Legacy upload protocol for media (e.g. \"media\", \"multipart\"). dsgUploadType :: Lens' DataSetsGet (Maybe Text) dsgUploadType = lens _dsgUploadType (\ s a -> s{_dsgUploadType = a})
195
dsgUploadType :: Lens' DataSetsGet (Maybe Text) dsgUploadType = lens _dsgUploadType (\ s a -> s{_dsgUploadType = a})
124
dsgUploadType = lens _dsgUploadType (\ s a -> s{_dsgUploadType = a})
76
true
true
1
9
34
51
25
26
null
null
MartinThoma/LaTeX-examples
source-code/Minted-Haskell/Sort.hs
mit
-- Aufgabe 3 merge :: (Ord t) => [t] -> [t] -> [t] merge [] x = x
73
merge :: (Ord t) => [t] -> [t] -> [t] merge [] x = x
52
merge [] x = x
14
true
true
0
10
25
47
25
22
null
null
energyflowanalysis/efa-2.1
demo/pretty/Main.hs
bsd-3-clause
p1, p2 :: S.TC S.Signal (Typ A P Tt) (Data ([] :> Nil) Double) p1 = S.fromList l
80
p1, p2 :: S.TC S.Signal (Typ A P Tt) (Data ([] :> Nil) Double) p1 = S.fromList l
80
p1 = S.fromList l
17
false
true
2
11
17
62
29
33
null
null
emanuelcasco/tp-paradigmas-funcional
src/NightClub.hs
mit
marcos = UnCliente { nombre = "Marcos", resistencia = 40, amigos = [rodri], tragos = [(tomarKlusener "Guinda")] }
124
marcos = UnCliente { nombre = "Marcos", resistencia = 40, amigos = [rodri], tragos = [(tomarKlusener "Guinda")] }
124
marcos = UnCliente { nombre = "Marcos", resistencia = 40, amigos = [rodri], tragos = [(tomarKlusener "Guinda")] }
124
false
false
0
9
28
44
27
17
null
null
sgillespie/ghc
compiler/prelude/TysWiredIn.hs
bsd-3-clause
parrDataConName = mkWiredInDataConName UserSyntax gHC_PARR' (fsLit "PArr") parrDataConKey parrDataCon
121
parrDataConName = mkWiredInDataConName UserSyntax gHC_PARR' (fsLit "PArr") parrDataConKey parrDataCon
121
parrDataConName = mkWiredInDataConName UserSyntax gHC_PARR' (fsLit "PArr") parrDataConKey parrDataCon
121
false
false
0
7
28
23
11
12
null
null
RayRacine/aws
Aws/Iam/Internal.hs
bsd-3-clause
-- | Returns the parameters @Marker@ and @MaxItems@ that are present in all -- IAM data pagination requests. markedIter :: Maybe Text -> Maybe Integer -> [Maybe (ByteString, Text)] markedIter marker maxItems = [ ("Marker" ,) <$> marker , ("MaxItems",) . encodeInteger <$> maxItems ] where encodeInteger = Text.pack . show -- | Reads and returns the @IsTruncated@ and @Marker@ attributes present in -- all IAM data pagination responses.
475
markedIter :: Maybe Text -> Maybe Integer -> [Maybe (ByteString, Text)] markedIter marker maxItems = [ ("Marker" ,) <$> marker , ("MaxItems",) . encodeInteger <$> maxItems ] where encodeInteger = Text.pack . show -- | Reads and returns the @IsTruncated@ and @Marker@ attributes present in -- all IAM data pagination responses.
366
markedIter marker maxItems = [ ("Marker" ,) <$> marker , ("MaxItems",) . encodeInteger <$> maxItems ] where encodeInteger = Text.pack . show -- | Reads and returns the @IsTruncated@ and @Marker@ attributes present in -- all IAM data pagination responses.
294
true
true
1
11
108
95
49
46
null
null
haroldcarr/utah-haskell
2015-09-17-REST-client-wreq-aeson-foldr/solution/src/Service/Interact.hs
apache-2.0
mkInvalidResponse :: String -> IO Msg mkInvalidResponse = return . Msg "BAD" 0
88
mkInvalidResponse :: String -> IO Msg mkInvalidResponse = return . Msg "BAD" 0
88
mkInvalidResponse = return . Msg "BAD" 0
45
false
true
0
7
22
32
14
18
null
null
mikeplus64/trifecta
src/Text/Trifecta/Util/IntervalMap.hs
bsd-3-clause
-- | /O(k log (n/\//k))/. All intervals that contain the given point, -- in lexicographical order. search :: Ord v => v -> IntervalMap v a -> [(Interval v, a)] search p = intersections p p
189
search :: Ord v => v -> IntervalMap v a -> [(Interval v, a)] search p = intersections p p
89
search p = intersections p p
28
true
true
0
12
36
60
28
32
null
null
linusyang/barrelfish
hake/RuleDefs.hs
mit
-- -- Add a set of C (or whatever) dependences on a *generated* file. -- Somewhere else this file has to be defined as a target, of -- course... -- extraCDependencyForObj :: Options -> String -> String -> String -> [RuleToken] extraCDependencyForObj opts file s obj = let arch = optArch opts in [ Target arch (dependFilePath obj), Target arch obj, Dep BuildTree arch file ]
409
extraCDependencyForObj :: Options -> String -> String -> String -> [RuleToken] extraCDependencyForObj opts file s obj = let arch = optArch opts in [ Target arch (dependFilePath obj), Target arch obj, Dep BuildTree arch file ]
261
extraCDependencyForObj opts file s obj = let arch = optArch opts in [ Target arch (dependFilePath obj), Target arch obj, Dep BuildTree arch file ]
182
true
true
0
10
101
90
47
43
null
null
oldmanmike/ghc
compiler/main/GhcMake.hs
bsd-3-clause
mkRootMap :: [ModSummary] -> NodeMap [Either ErrMsg ModSummary] mkRootMap summaries = Map.insertListWith (flip (++)) [ (msKey s, [Right s]) | s <- summaries ] Map.empty
250
mkRootMap :: [ModSummary] -> NodeMap [Either ErrMsg ModSummary] mkRootMap summaries = Map.insertListWith (flip (++)) [ (msKey s, [Right s]) | s <- summaries ] Map.empty
250
mkRootMap summaries = Map.insertListWith (flip (++)) [ (msKey s, [Right s]) | s <- summaries ] Map.empty
186
false
true
0
9
106
81
41
40
null
null
jutaro/rdf4h
src/Data/RDF/Types.hs
bsd-3-clause
compareLValue _ (PlainLL _ _) = GT
56
compareLValue _ (PlainLL _ _) = GT
56
compareLValue _ (PlainLL _ _) = GT
56
false
false
0
7
28
19
9
10
null
null
chemist/siberia
src/Siberia/Internal.hs
bsd-3-clause
kill :: MProcess -> IO () kill (Just x) = killThread x
54
kill :: MProcess -> IO () kill (Just x) = killThread x
54
kill (Just x) = killThread x
28
false
true
0
9
11
37
16
21
null
null
DaMSL/K3
src/Language/K3/Utils/Pretty.hs
apache-2.0
tersePrintConfig :: PrintConfig tersePrintConfig = defaultPrintConfig {printNamespace=False, printFunctions=False, printQualifiers=False, printVerboseTypes=False}
279
tersePrintConfig :: PrintConfig tersePrintConfig = defaultPrintConfig {printNamespace=False, printFunctions=False, printQualifiers=False, printVerboseTypes=False}
279
tersePrintConfig = defaultPrintConfig {printNamespace=False, printFunctions=False, printQualifiers=False, printVerboseTypes=False}
247
false
true
0
6
126
37
23
14
null
null
tjakway/ghcjvm
libraries/base/GHC/Conc/Sync.hs
bsd-3-clause
-- | Returns the number of CPUs that the machine has -- -- @since 4.5.0.0 getNumProcessors :: IO Int getNumProcessors = fmap fromIntegral c_getNumberOfProcessors
161
getNumProcessors :: IO Int getNumProcessors = fmap fromIntegral c_getNumberOfProcessors
87
getNumProcessors = fmap fromIntegral c_getNumberOfProcessors
60
true
true
0
5
23
22
12
10
null
null
Fuuzetsu/stack
src/Stack/Build/ConstructPlan.hs
bsd-3-clause
-- | Is the given package/version combo defined in the snapshot? inSnapshot :: PackageName -> Version -> M Bool inSnapshot name version = do p <- asks mbp ls <- asks localNames return $ fromMaybe False $ do guard $ not $ name `Set.member` ls mpi <- Map.lookup name (mbpPackages p) return $ mpiVersion mpi == version
351
inSnapshot :: PackageName -> Version -> M Bool inSnapshot name version = do p <- asks mbp ls <- asks localNames return $ fromMaybe False $ do guard $ not $ name `Set.member` ls mpi <- Map.lookup name (mbpPackages p) return $ mpiVersion mpi == version
286
inSnapshot name version = do p <- asks mbp ls <- asks localNames return $ fromMaybe False $ do guard $ not $ name `Set.member` ls mpi <- Map.lookup name (mbpPackages p) return $ mpiVersion mpi == version
239
true
true
0
13
92
115
53
62
null
null
bogwonch/SecPAL
src/Logic/General/Parser.hs
gpl-3.0
pEValue :: forall s u (m :: * -> *). Stream s m Char => ParsecT s u m Ec pEValue = Value <$> pValue
99
pEValue :: forall s u (m :: * -> *). Stream s m Char => ParsecT s u m Ec pEValue = Value <$> pValue
99
pEValue = Value <$> pValue
26
false
true
2
9
24
59
29
30
null
null
pparkkin/eta
compiler/ETA/Main/DriverPhases.hs
bsd-3-clause
haskellish_suffixes = haskellish_src_suffixes ++ ["hc", "raw_s"]
73
haskellish_suffixes = haskellish_src_suffixes ++ ["hc", "raw_s"]
73
haskellish_suffixes = haskellish_src_suffixes ++ ["hc", "raw_s"]
73
false
false
0
6
14
16
9
7
null
null
Javran/BigBunnyAndDeer
src/Data/BigBunnyAndDeer/Parens.hs
mit
lParens, rParens :: [] Char lParens = map fst parens
52
lParens, rParens :: [] Char lParens = map fst parens
52
lParens = map fst parens
24
false
true
0
6
9
23
12
11
null
null
ryna4c2e/chage
InstParser.hs
mit
parseDecimal :: Parser Word32 parseDecimal = read <$> many1 (oneOf ['0'..'9'])
78
parseDecimal :: Parser Word32 parseDecimal = read <$> many1 (oneOf ['0'..'9'])
78
parseDecimal = read <$> many1 (oneOf ['0'..'9'])
48
false
true
0
9
10
32
16
16
null
null
peteg/ADHOC
Apps/Cache/Tests/022_even_more_cache_like.hs
gpl-2.0
ackP i = "ack" ++ show i
24
ackP i = "ack" ++ show i
24
ackP i = "ack" ++ show i
24
false
false
0
6
6
16
7
9
null
null
aretoky/egison2
hs-src/Language/Egison/Parser.hs
mit
parsePatVar :: Parser EgisonExpr parsePatVar = do (name, nums) <- parsePatVar2 return $ PatVarExpr name nums
125
parsePatVar :: Parser EgisonExpr parsePatVar = do (name, nums) <- parsePatVar2 return $ PatVarExpr name nums
125
parsePatVar = do (name, nums) <- parsePatVar2 return $ PatVarExpr name nums
92
false
true
0
8
32
39
19
20
null
null
gridaphobe/ghc
compiler/utils/Outputable.hs
bsd-3-clause
-- | Special combinator for showing bytestring literals. pprHsBytes :: ByteString -> SDoc pprHsBytes bs = let escaped = concatMap escape $ BS.unpack bs in vcat (map text (showMultiLineString escaped)) <> char '#' where escape :: Word8 -> String escape w = let c = chr (fromIntegral w) in if isAscii c then [c] else '\\' : show w -- Postfix modifiers for unboxed literals. -- See Note [Printing of literals in Core] in `basicTypes/Literal.hs`.
542
pprHsBytes :: ByteString -> SDoc pprHsBytes bs = let escaped = concatMap escape $ BS.unpack bs in vcat (map text (showMultiLineString escaped)) <> char '#' where escape :: Word8 -> String escape w = let c = chr (fromIntegral w) in if isAscii c then [c] else '\\' : show w -- Postfix modifiers for unboxed literals. -- See Note [Printing of literals in Core] in `basicTypes/Literal.hs`.
485
pprHsBytes bs = let escaped = concatMap escape $ BS.unpack bs in vcat (map text (showMultiLineString escaped)) <> char '#' where escape :: Word8 -> String escape w = let c = chr (fromIntegral w) in if isAscii c then [c] else '\\' : show w -- Postfix modifiers for unboxed literals. -- See Note [Printing of literals in Core] in `basicTypes/Literal.hs`.
452
true
true
2
12
174
129
63
66
null
null
lucasdicioccio/laborantin-hs
Laborantin/Implementation.hs
apache-2.0
resolveDependencies :: Execution EnvIO -> EnvIO (Execution EnvIO) resolveDependencies exec = do pending <- getPendingDeps exec deps resolveDependencies' exec [] pending where deps = sDeps $ eScenario exec -- | Actual implementation for the dependency resolution. -- -- Iteratively tries dependencies. -- If there is no dependency left, suceed. -- Else tries the first unmet dependency pending. -- If the dependency failed, with no other unmet dependeny, error the program. -- If the dependency succeed, restart with all still unmet dependencies. -- If the dependency failed with other unmet dependency, reiterate until one succeeds or the program goes on error. -- -- A reason why we error the program is that at the time of the check, there -- should be no running experiments and we can easily notify the user. -- As there often are correlation between a batch of experiments, one unmet -- depedency is likely to impede other executions as well. Hence current choice -- to crash early. --
1,006
resolveDependencies :: Execution EnvIO -> EnvIO (Execution EnvIO) resolveDependencies exec = do pending <- getPendingDeps exec deps resolveDependencies' exec [] pending where deps = sDeps $ eScenario exec -- | Actual implementation for the dependency resolution. -- -- Iteratively tries dependencies. -- If there is no dependency left, suceed. -- Else tries the first unmet dependency pending. -- If the dependency failed, with no other unmet dependeny, error the program. -- If the dependency succeed, restart with all still unmet dependencies. -- If the dependency failed with other unmet dependency, reiterate until one succeeds or the program goes on error. -- -- A reason why we error the program is that at the time of the check, there -- should be no running experiments and we can easily notify the user. -- As there often are correlation between a batch of experiments, one unmet -- depedency is likely to impede other executions as well. Hence current choice -- to crash early. --
1,006
resolveDependencies exec = do pending <- getPendingDeps exec deps resolveDependencies' exec [] pending where deps = sDeps $ eScenario exec -- | Actual implementation for the dependency resolution. -- -- Iteratively tries dependencies. -- If there is no dependency left, suceed. -- Else tries the first unmet dependency pending. -- If the dependency failed, with no other unmet dependeny, error the program. -- If the dependency succeed, restart with all still unmet dependencies. -- If the dependency failed with other unmet dependency, reiterate until one succeeds or the program goes on error. -- -- A reason why we error the program is that at the time of the check, there -- should be no running experiments and we can easily notify the user. -- As there often are correlation between a batch of experiments, one unmet -- depedency is likely to impede other executions as well. Hence current choice -- to crash early. --
940
false
true
0
8
177
83
46
37
null
null
bananu7/Turnip
src/Turnip/Eval/Lib.hs
mit
-- luaselect (Str n : args) = return [args !! luatonuber n] -- cursed implicit coercion version -- it works in the original Lua but I'm not implementing this. luaselect (Number n : args) = case toInt n of Just i -> return $ drop (i-1) args Nothing -> throwErrorStr "Wrong argument to select (number has no integer representation)"
351
luaselect (Number n : args) = case toInt n of Just i -> return $ drop (i-1) args Nothing -> throwErrorStr "Wrong argument to select (number has no integer representation)"
192
luaselect (Number n : args) = case toInt n of Just i -> return $ drop (i-1) args Nothing -> throwErrorStr "Wrong argument to select (number has no integer representation)"
192
true
false
0
11
79
62
30
32
null
null
jotrk/zalora
Main.hs
bsd-2-clause
jsonItem :: ActionM (Item Text) jsonItem = jsonData
51
jsonItem :: ActionM (Item Text) jsonItem = jsonData
51
jsonItem = jsonData
19
false
true
0
7
7
20
10
10
null
null
andorp/grin
grin/src/AbstractInterpretation/HeapPointsTo/CodeGenBase.hs
bsd-3-clause
addExternal :: External -> CG () addExternal e = modify' $ \s@CGState{..} -> s {_sExternalMap = Map.insert (eName e) e _sExternalMap}
133
addExternal :: External -> CG () addExternal e = modify' $ \s@CGState{..} -> s {_sExternalMap = Map.insert (eName e) e _sExternalMap}
133
addExternal e = modify' $ \s@CGState{..} -> s {_sExternalMap = Map.insert (eName e) e _sExternalMap}
100
false
true
0
11
20
64
33
31
null
null
noinia/diagrams-ipe
src/Graphics/Rendering/Ipe/IpeWriteable.hs
bsd-3-clause
toStrictT :: L.Text -> T.Text toStrictT = mconcat . L.toChunks
62
toStrictT :: L.Text -> T.Text toStrictT = mconcat . L.toChunks
62
toStrictT = mconcat . L.toChunks
32
false
true
1
8
9
33
14
19
null
null
nevrenato/HetsAlloy
OWL2/AS.hs
gpl-2.0
xsdMap :: PreDefMaps xsdMap = makeXsdMap xsdKeys
48
xsdMap :: PreDefMaps xsdMap = makeXsdMap xsdKeys
48
xsdMap = makeXsdMap xsdKeys
27
false
true
0
6
6
21
8
13
null
null
egison/egison
hs-src/Language/Egison/Desugar.hs
mit
transVarIndex (VSymmScripts xs) = concatMap transVarIndex xs
68
transVarIndex (VSymmScripts xs) = concatMap transVarIndex xs
68
transVarIndex (VSymmScripts xs) = concatMap transVarIndex xs
68
false
false
0
7
14
20
9
11
null
null
shlevy/ghc
compiler/prelude/THNames.hs
bsd-3-clause
-- data Stmt = ... bindSIdKey, letSIdKey, noBindSIdKey, parSIdKey :: Unique bindSIdKey = mkPreludeMiscIdUnique 310
120
bindSIdKey, letSIdKey, noBindSIdKey, parSIdKey :: Unique bindSIdKey = mkPreludeMiscIdUnique 310
101
bindSIdKey = mkPreludeMiscIdUnique 310
44
true
true
0
5
20
21
14
7
null
null
vikraman/ghc
compiler/basicTypes/MkId.hs
bsd-3-clause
{- ************************************************************************ * * \subsection{Un-definable} * * ************************************************************************ These Ids can't be defined in Haskell. They could be defined in unfoldings in the wired-in GHC.Prim interface file, but we'd have to ensure that they were definitely, definitely inlined, because there is no curried identifier for them. That's what mkCompulsoryUnfolding does. If we had a way to get a compulsory unfolding from an interface file, we could do that, but we don't right now. unsafeCoerce# isn't so much a PrimOp as a phantom identifier, that just gets expanded into a type coercion wherever it occurs. Hence we add it as a built-in Id with an unfolding here. The type variables we use here are "open" type variables: this means they can unify with both unlifted and lifted types. Hence we provide another gun with which to shoot yourself in the foot. -} lazyIdName, unsafeCoerceName, nullAddrName, seqName, realWorldName, voidPrimIdName, coercionTokenName, magicDictName, coerceName, proxyName, dollarName, oneShotName, runRWName :: Name unsafeCoerceName = mkWiredInIdName gHC_PRIM (fsLit "unsafeCoerce#") unsafeCoerceIdKey unsafeCoerceId
1,394
lazyIdName, unsafeCoerceName, nullAddrName, seqName, realWorldName, voidPrimIdName, coercionTokenName, magicDictName, coerceName, proxyName, dollarName, oneShotName, runRWName :: Name unsafeCoerceName = mkWiredInIdName gHC_PRIM (fsLit "unsafeCoerce#") unsafeCoerceIdKey unsafeCoerceId
297
unsafeCoerceName = mkWiredInIdName gHC_PRIM (fsLit "unsafeCoerce#") unsafeCoerceIdKey unsafeCoerceId
104
true
true
3
7
323
58
38
20
null
null
stappit/okasaki-pfds
test/Chap05/Data/BatchedDeque/Test.hs
gpl-3.0
prop_BDSnocInv :: (Deque q) => (q a -> BatchedDeque a) -> a -> q a -> Bool prop_BDSnocInv f x = isBatchedDequeInv . f . (flip snoc) x
170
prop_BDSnocInv :: (Deque q) => (q a -> BatchedDeque a) -> a -> q a -> Bool prop_BDSnocInv f x = isBatchedDequeInv . f . (flip snoc) x
170
prop_BDSnocInv f x = isBatchedDequeInv . f . (flip snoc) x
58
false
true
0
10
64
75
35
40
null
null
GaloisInc/saw-script
src/SAWScript/AST.hs
bsd-3-clause
tTuple :: [Type] -> Type tTuple ts = TyCon (TupleCon $ fromIntegral $ length ts) ts
83
tTuple :: [Type] -> Type tTuple ts = TyCon (TupleCon $ fromIntegral $ length ts) ts
83
tTuple ts = TyCon (TupleCon $ fromIntegral $ length ts) ts
58
false
true
0
8
15
45
21
24
null
null