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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
amccausl/RDF4H
|
testsuite/tests/Text/RDF/RDF4H/XmlParser_Test.hs
|
bsd-3-clause
|
-- * XML Literals: rdf:parseType="Literal"
test_parseXmlRDF_example09 = testParse
"<rdf:RDF xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"\
\ xmlns:ex=\"http://example.org/stuff/1.0/\">\
\<rdf:Description rdf:about=\"http://example.org/item01\">\
\<ex:prop rdf:parseType=\"Literal\"\
\ xmlns:a=\"http://example.org/a#\"><a:Box required=\"true\">\
\<a:widget size=\"10\" />\
\<a:grommit id=\"23\" /></a:Box>\
\</ex:prop>\
\</rdf:Description>\
\</rdf:RDF>"
( mkRdf [ Triple ((unode . s2b) "http://example.org/item01")
((unode . s2b) "ex:prop")
(lnode (typedL (s2b "<a:Box required=\"true\">\
\<a:widget size=\"10\"/>\
\<a:grommit id=\"23\"/>\
\</a:Box>")
(mkFastString (s2b "http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral"))))
]
Nothing
( PrefixMappings (Map.fromList [ (s2b "ex", s2b "http://example.org/stuff/1.0/")
, (s2b "rdf", s2b "http://www.w3.org/1999/02/22-rdf-syntax-ns#") ]) )
)
| 1,273
|
test_parseXmlRDF_example09 = testParse
"<rdf:RDF xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"\
\ xmlns:ex=\"http://example.org/stuff/1.0/\">\
\<rdf:Description rdf:about=\"http://example.org/item01\">\
\<ex:prop rdf:parseType=\"Literal\"\
\ xmlns:a=\"http://example.org/a#\"><a:Box required=\"true\">\
\<a:widget size=\"10\" />\
\<a:grommit id=\"23\" /></a:Box>\
\</ex:prop>\
\</rdf:Description>\
\</rdf:RDF>"
( mkRdf [ Triple ((unode . s2b) "http://example.org/item01")
((unode . s2b) "ex:prop")
(lnode (typedL (s2b "<a:Box required=\"true\">\
\<a:widget size=\"10\"/>\
\<a:grommit id=\"23\"/>\
\</a:Box>")
(mkFastString (s2b "http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral"))))
]
Nothing
( PrefixMappings (Map.fromList [ (s2b "ex", s2b "http://example.org/stuff/1.0/")
, (s2b "rdf", s2b "http://www.w3.org/1999/02/22-rdf-syntax-ns#") ]) )
)
| 1,230
|
test_parseXmlRDF_example09 = testParse
"<rdf:RDF xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"\
\ xmlns:ex=\"http://example.org/stuff/1.0/\">\
\<rdf:Description rdf:about=\"http://example.org/item01\">\
\<ex:prop rdf:parseType=\"Literal\"\
\ xmlns:a=\"http://example.org/a#\"><a:Box required=\"true\">\
\<a:widget size=\"10\" />\
\<a:grommit id=\"23\" /></a:Box>\
\</ex:prop>\
\</rdf:Description>\
\</rdf:RDF>"
( mkRdf [ Triple ((unode . s2b) "http://example.org/item01")
((unode . s2b) "ex:prop")
(lnode (typedL (s2b "<a:Box required=\"true\">\
\<a:widget size=\"10\"/>\
\<a:grommit id=\"23\"/>\
\</a:Box>")
(mkFastString (s2b "http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral"))))
]
Nothing
( PrefixMappings (Map.fromList [ (s2b "ex", s2b "http://example.org/stuff/1.0/")
, (s2b "rdf", s2b "http://www.w3.org/1999/02/22-rdf-syntax-ns#") ]) )
)
| 1,230
| true
| false
| 0
| 17
| 438
| 134
| 69
| 65
| null | null |
mettekou/ghc
|
compiler/typecheck/TcGenDeriv.hs
|
bsd-3-clause
|
litConTbl :: [(Type, LHsExpr RdrName -> LHsExpr RdrName)]
litConTbl
= [(charPrimTy , nlHsApp (nlHsVar charPrimL_RDR))
,(intPrimTy , nlHsApp (nlHsVar intPrimL_RDR)
. nlHsApp (nlHsVar toInteger_RDR))
,(wordPrimTy , nlHsApp (nlHsVar wordPrimL_RDR)
. nlHsApp (nlHsVar toInteger_RDR))
,(addrPrimTy , nlHsApp (nlHsVar stringPrimL_RDR)
. nlHsApp (nlHsApp
(nlHsVar map_RDR)
(compose_RDR `nlHsApps`
[ nlHsVar fromIntegral_RDR
, nlHsVar fromEnum_RDR
])))
,(floatPrimTy , nlHsApp (nlHsVar floatPrimL_RDR)
. nlHsApp (nlHsVar toRational_RDR))
,(doublePrimTy, nlHsApp (nlHsVar doublePrimL_RDR)
. nlHsApp (nlHsVar toRational_RDR))
]
| 894
|
litConTbl :: [(Type, LHsExpr RdrName -> LHsExpr RdrName)]
litConTbl
= [(charPrimTy , nlHsApp (nlHsVar charPrimL_RDR))
,(intPrimTy , nlHsApp (nlHsVar intPrimL_RDR)
. nlHsApp (nlHsVar toInteger_RDR))
,(wordPrimTy , nlHsApp (nlHsVar wordPrimL_RDR)
. nlHsApp (nlHsVar toInteger_RDR))
,(addrPrimTy , nlHsApp (nlHsVar stringPrimL_RDR)
. nlHsApp (nlHsApp
(nlHsVar map_RDR)
(compose_RDR `nlHsApps`
[ nlHsVar fromIntegral_RDR
, nlHsVar fromEnum_RDR
])))
,(floatPrimTy , nlHsApp (nlHsVar floatPrimL_RDR)
. nlHsApp (nlHsVar toRational_RDR))
,(doublePrimTy, nlHsApp (nlHsVar doublePrimL_RDR)
. nlHsApp (nlHsVar toRational_RDR))
]
| 894
|
litConTbl
= [(charPrimTy , nlHsApp (nlHsVar charPrimL_RDR))
,(intPrimTy , nlHsApp (nlHsVar intPrimL_RDR)
. nlHsApp (nlHsVar toInteger_RDR))
,(wordPrimTy , nlHsApp (nlHsVar wordPrimL_RDR)
. nlHsApp (nlHsVar toInteger_RDR))
,(addrPrimTy , nlHsApp (nlHsVar stringPrimL_RDR)
. nlHsApp (nlHsApp
(nlHsVar map_RDR)
(compose_RDR `nlHsApps`
[ nlHsVar fromIntegral_RDR
, nlHsVar fromEnum_RDR
])))
,(floatPrimTy , nlHsApp (nlHsVar floatPrimL_RDR)
. nlHsApp (nlHsVar toRational_RDR))
,(doublePrimTy, nlHsApp (nlHsVar doublePrimL_RDR)
. nlHsApp (nlHsVar toRational_RDR))
]
| 836
| false
| true
| 0
| 14
| 346
| 235
| 122
| 113
| null | null |
ComputationWithBoundedResources/ara-inference
|
doc/tpdb_trs/Haskell/basic_haskell/index_2.hs
|
mit
|
compareMyInt :: MyInt -> MyInt -> Ordering
compareMyInt = primCmpInt
| 72
|
compareMyInt :: MyInt -> MyInt -> Ordering
compareMyInt = primCmpInt
| 72
|
compareMyInt = primCmpInt
| 25
| false
| true
| 0
| 6
| 13
| 19
| 10
| 9
| null | null |
DaMSL/K3
|
src/Language/K3/Parser/SQL.hs
|
apache-2.0
|
sqloperator "-" [x,y] = Just (BinaryOp OSub x y)
| 51
|
sqloperator "-" [x,y] = Just (BinaryOp OSub x y)
| 51
|
sqloperator "-" [x,y] = Just (BinaryOp OSub x y)
| 51
| false
| false
| 0
| 7
| 11
| 30
| 15
| 15
| null | null |
adnelson/Idris-dev
|
src/Idris/Reflection.hs
|
bsd-3-clause
|
reify _ t = fail ("Unknown tactic " ++ show t)
| 46
|
reify _ t = fail ("Unknown tactic " ++ show t)
| 46
|
reify _ t = fail ("Unknown tactic " ++ show t)
| 46
| false
| false
| 0
| 8
| 10
| 24
| 11
| 13
| null | null |
fpco/hs-webdriver
|
src/Test/WebDriver/Common/Profile.hs
|
bsd-3-clause
|
-- |Prepare a ByteString of raw zip data for network transmission
prepareRawZip :: ByteString -> PreparedProfile a
prepareRawZip = PreparedProfile . B64.encode
| 159
|
prepareRawZip :: ByteString -> PreparedProfile a
prepareRawZip = PreparedProfile . B64.encode
| 93
|
prepareRawZip = PreparedProfile . B64.encode
| 44
| true
| true
| 0
| 6
| 21
| 25
| 13
| 12
| null | null |
rkrzr/shcrabble
|
src/Lib.hs
|
bsd-3-clause
|
-- Parsing of command-line arguments
optionsParser :: Parser Options
optionsParser =
Options <$>
switch (long "generate-svg-per-turn" <> short 'g' <> help "Generate an svg for each turn.") <*>
argument str (metavar "INPUT_FILE" <> help "File to read the wordlist from.") <*>
argument str (metavar "OUTPUT_FILE" <> help "File to write the final SVG to.")
| 361
|
optionsParser :: Parser Options
optionsParser =
Options <$>
switch (long "generate-svg-per-turn" <> short 'g' <> help "Generate an svg for each turn.") <*>
argument str (metavar "INPUT_FILE" <> help "File to read the wordlist from.") <*>
argument str (metavar "OUTPUT_FILE" <> help "File to write the final SVG to.")
| 324
|
optionsParser =
Options <$>
switch (long "generate-svg-per-turn" <> short 'g' <> help "Generate an svg for each turn.") <*>
argument str (metavar "INPUT_FILE" <> help "File to read the wordlist from.") <*>
argument str (metavar "OUTPUT_FILE" <> help "File to write the final SVG to.")
| 292
| true
| true
| 0
| 12
| 61
| 86
| 40
| 46
| null | null |
xmonad/xmonad-contrib
|
XMonad/Layout/LayoutCombinators.hs
|
bsd-3-clause
|
(***//**) = combineTwo (dragPane Horizontal 0.1 (3/5))
| 56
|
(***//**) = combineTwo (dragPane Horizontal 0.1 (3/5))
| 56
|
(***//**) = combineTwo (dragPane Horizontal 0.1 (3/5))
| 56
| false
| false
| 0
| 9
| 8
| 28
| 15
| 13
| null | null |
acowley/language-c
|
src/Language/C/Parser/Tokens.hs
|
bsd-3-clause
|
posLenOfTok (CTokRegister pos ) = pos
| 38
|
posLenOfTok (CTokRegister pos ) = pos
| 38
|
posLenOfTok (CTokRegister pos ) = pos
| 38
| false
| false
| 0
| 6
| 6
| 16
| 7
| 9
| null | null |
TomMD/crypto-api-tests
|
Test/Crypto.hs
|
bsd-3-clause
|
prop_BlockLengthIsByteAligned :: Hash c d => d -> Bool
prop_BlockLengthIsByteAligned d = blockLength .::. d `rem` 8 == 0
| 120
|
prop_BlockLengthIsByteAligned :: Hash c d => d -> Bool
prop_BlockLengthIsByteAligned d = blockLength .::. d `rem` 8 == 0
| 120
|
prop_BlockLengthIsByteAligned d = blockLength .::. d `rem` 8 == 0
| 65
| false
| true
| 0
| 8
| 18
| 47
| 22
| 25
| null | null |
urbanslug/ghc
|
compiler/simplCore/SimplEnv.hs
|
bsd-3-clause
|
substNonCoVarIdBndr
:: SimplEnv
-> InBndr -- Env and binder to transform
-> (SimplEnv, OutBndr)
-- Clone Id if necessary, substitute its type
-- Return an Id with its
-- * Type substituted
-- * UnfoldingInfo, Rules, WorkerInfo zapped
-- * Fragile OccInfo (only) zapped: Note [Robust OccInfo]
-- * Robust info, retained especially arity and demand info,
-- so that they are available to occurrences that occur in an
-- earlier binding of a letrec
--
-- For the robust info, see Note [Arity robustness]
--
-- Augment the substitution if the unique changed
-- Extend the in-scope set with the new Id
--
-- Similar to CoreSubst.substIdBndr, except that
-- the type of id_subst differs
-- all fragile info is zapped
substNonCoVarIdBndr env@(SimplEnv { seInScope = in_scope, seIdSubst = id_subst })
old_id
= ASSERT2( not (isCoVar old_id), ppr old_id )
(env { seInScope = in_scope `extendInScopeSet` new_id,
seIdSubst = new_subst }, new_id)
where
id1 = uniqAway in_scope old_id
id2 = substIdType env id1
new_id = zapFragileIdInfo id2 -- Zaps rules, worker-info, unfolding
-- and fragile OccInfo
-- Extend the substitution if the unique has changed,
-- or there's some useful occurrence information
-- See the notes with substTyVarBndr for the delSubstEnv
new_subst | new_id /= old_id
= extendVarEnv id_subst old_id (DoneId new_id)
| otherwise
= delVarEnv id_subst old_id
------------------------------------
| 1,634
|
substNonCoVarIdBndr
:: SimplEnv
-> InBndr -- Env and binder to transform
-> (SimplEnv, OutBndr)
substNonCoVarIdBndr env@(SimplEnv { seInScope = in_scope, seIdSubst = id_subst })
old_id
= ASSERT2( not (isCoVar old_id), ppr old_id )
(env { seInScope = in_scope `extendInScopeSet` new_id,
seIdSubst = new_subst }, new_id)
where
id1 = uniqAway in_scope old_id
id2 = substIdType env id1
new_id = zapFragileIdInfo id2 -- Zaps rules, worker-info, unfolding
-- and fragile OccInfo
-- Extend the substitution if the unique has changed,
-- or there's some useful occurrence information
-- See the notes with substTyVarBndr for the delSubstEnv
new_subst | new_id /= old_id
= extendVarEnv id_subst old_id (DoneId new_id)
| otherwise
= delVarEnv id_subst old_id
------------------------------------
| 972
|
substNonCoVarIdBndr env@(SimplEnv { seInScope = in_scope, seIdSubst = id_subst })
old_id
= ASSERT2( not (isCoVar old_id), ppr old_id )
(env { seInScope = in_scope `extendInScopeSet` new_id,
seIdSubst = new_subst }, new_id)
where
id1 = uniqAway in_scope old_id
id2 = substIdType env id1
new_id = zapFragileIdInfo id2 -- Zaps rules, worker-info, unfolding
-- and fragile OccInfo
-- Extend the substitution if the unique has changed,
-- or there's some useful occurrence information
-- See the notes with substTyVarBndr for the delSubstEnv
new_subst | new_id /= old_id
= extendVarEnv id_subst old_id (DoneId new_id)
| otherwise
= delVarEnv id_subst old_id
------------------------------------
| 864
| true
| true
| 6
| 9
| 453
| 209
| 116
| 93
| null | null |
mstksg/hledger
|
hledger-lib/Hledger/Data/Dates.hs
|
gpl-3.0
|
lc = T.toLower
| 14
|
lc = T.toLower
| 14
|
lc = T.toLower
| 14
| false
| false
| 0
| 5
| 2
| 8
| 4
| 4
| null | null |
GaloisInc/halvm-ghc
|
compiler/ghci/ByteCodeAsm.hs
|
bsd-3-clause
|
iNTERP_STACK_CHECK_THRESH :: Int
iNTERP_STACK_CHECK_THRESH = INTERP_STACK_CHECK_THRESH
| 86
|
iNTERP_STACK_CHECK_THRESH :: Int
iNTERP_STACK_CHECK_THRESH = INTERP_STACK_CHECK_THRESH
| 86
|
iNTERP_STACK_CHECK_THRESH = INTERP_STACK_CHECK_THRESH
| 53
| false
| true
| 0
| 4
| 5
| 11
| 6
| 5
| null | null |
josefs/deep-shallow-paper
|
DeepShallow.hs
|
mit
|
(&&) :: FunC Bool -> FunC Bool -> FunC Bool
(&&) = fromFunC $ Prim "(&&)" (Prelude.&&)
| 86
|
(&&) :: FunC Bool -> FunC Bool -> FunC Bool
(&&) = fromFunC $ Prim "(&&)" (Prelude.&&)
| 86
|
(&&) = fromFunC $ Prim "(&&)" (Prelude.&&)
| 42
| false
| true
| 0
| 7
| 16
| 45
| 24
| 21
| null | null |
phylake/avm3
|
abc/util.hs
|
mit
|
toBytes {- 0xD5 -} (SetLocal1) = 1
| 34
|
toBytes {- 0xD5 -} (SetLocal1) = 1
| 34
|
toBytes {- 0xD5 -} (SetLocal1) = 1
| 34
| false
| false
| 0
| 6
| 6
| 13
| 7
| 6
| null | null |
kmate/HaRe
|
old/testing/moveDefBtwMods/C6.hs
|
bsd-3-clause
|
Fringe (Branch left right) = myFringe left
| 44
|
myFringe (Branch left right) = myFringe left
| 44
|
myFringe (Branch left right) = myFringe left
| 44
| false
| false
| 0
| 6
| 8
| 21
| 9
| 12
| null | null |
frontrowed/wai
|
wai-extra/Network/Wai/Middleware/RequestLogger.hs
|
mit
|
-- | Generates terminal-friendly heading and content for logging a response
-- body.
--
-- If the response body is long, or if we don't consider it a printable
-- content type, then this generates log info with the content length. For
-- short, textual responses, this filters potentially terminal-unfriendly
-- characters out of the response body. Generates a heading appropriate for
-- the type of info logged (content length, response body, or filtered
-- response body).
makeLoggedBodyInfo :: Maybe S8.ByteString -> BS.ByteString -> LoggedBodyInfo
makeLoggedBodyInfo contentType body
| not (isPrintableContentType contentType) || len > maxLength =
LoggedBodyInfo " Response Content Length: " . encodeUtf8 . T.pack . show $ len
| otherwise = logFilteredBody $ S8.filter terminalFriendly body
where
len = S8.length body
logFilteredBody body'
| S8.length body' == len = LoggedBodyInfo " Response Body: " $ body'
| otherwise = LoggedBodyInfo " Response Body (filtered): " $ body'
-- Allow only printable, basic ASCII characters
terminalFriendly w
| ord w < 8 = False -- Problematic control characters
| ord w < 14 = True -- Plausibly useful control characters (like \t)
| ord w < 32 = False -- More control characters
| ord w < 128 = True -- Vanilla 7-bit ASCII text
| otherwise = False
| 1,376
|
makeLoggedBodyInfo :: Maybe S8.ByteString -> BS.ByteString -> LoggedBodyInfo
makeLoggedBodyInfo contentType body
| not (isPrintableContentType contentType) || len > maxLength =
LoggedBodyInfo " Response Content Length: " . encodeUtf8 . T.pack . show $ len
| otherwise = logFilteredBody $ S8.filter terminalFriendly body
where
len = S8.length body
logFilteredBody body'
| S8.length body' == len = LoggedBodyInfo " Response Body: " $ body'
| otherwise = LoggedBodyInfo " Response Body (filtered): " $ body'
-- Allow only printable, basic ASCII characters
terminalFriendly w
| ord w < 8 = False -- Problematic control characters
| ord w < 14 = True -- Plausibly useful control characters (like \t)
| ord w < 32 = False -- More control characters
| ord w < 128 = True -- Vanilla 7-bit ASCII text
| otherwise = False
| 900
|
makeLoggedBodyInfo contentType body
| not (isPrintableContentType contentType) || len > maxLength =
LoggedBodyInfo " Response Content Length: " . encodeUtf8 . T.pack . show $ len
| otherwise = logFilteredBody $ S8.filter terminalFriendly body
where
len = S8.length body
logFilteredBody body'
| S8.length body' == len = LoggedBodyInfo " Response Body: " $ body'
| otherwise = LoggedBodyInfo " Response Body (filtered): " $ body'
-- Allow only printable, basic ASCII characters
terminalFriendly w
| ord w < 8 = False -- Problematic control characters
| ord w < 14 = True -- Plausibly useful control characters (like \t)
| ord w < 32 = False -- More control characters
| ord w < 128 = True -- Vanilla 7-bit ASCII text
| otherwise = False
| 823
| true
| true
| 1
| 12
| 300
| 245
| 118
| 127
| null | null |
kvnesterov/IdaHaskell
|
src/Cli.hs
|
gpl-3.0
|
evalString :: HscEnv -> (String -> IO()) -> String -> IO (Either String HscEnv)
evalString session _ s | (':' : cmd) <- s = evalSpecCommand session cmd
| 151
|
evalString :: HscEnv -> (String -> IO()) -> String -> IO (Either String HscEnv)
evalString session _ s | (':' : cmd) <- s = evalSpecCommand session cmd
| 151
|
evalString session _ s | (':' : cmd) <- s = evalSpecCommand session cmd
| 71
| false
| true
| 0
| 10
| 27
| 75
| 36
| 39
| null | null |
unknownloner/calccomp
|
Asm/InstrSize.hs
|
mit
|
instrSize CPDR _ = 2
| 20
|
instrSize CPDR _ = 2
| 20
|
instrSize CPDR _ = 2
| 20
| false
| false
| 0
| 4
| 4
| 13
| 5
| 8
| null | null |
ml9951/ghc
|
compiler/main/DynFlags.hs
|
bsd-3-clause
|
wayOptl _ WayProf = []
| 28
|
wayOptl _ WayProf = []
| 28
|
wayOptl _ WayProf = []
| 28
| false
| false
| 1
| 6
| 10
| 15
| 6
| 9
| null | null |
peter-fogg/pardoc
|
src/Text/Pandoc/Writers/Shared.hs
|
gpl-2.0
|
metaValueToJSON :: Monad m
=> ([Block] -> m String)
-> ([Inline] -> m String)
-> MetaValue
-> m Value
metaValueToJSON blockWriter inlineWriter (MetaMap metamap) = liftM toJSON $
Traversable.mapM (metaValueToJSON blockWriter inlineWriter) metamap
| 311
|
metaValueToJSON :: Monad m
=> ([Block] -> m String)
-> ([Inline] -> m String)
-> MetaValue
-> m Value
metaValueToJSON blockWriter inlineWriter (MetaMap metamap) = liftM toJSON $
Traversable.mapM (metaValueToJSON blockWriter inlineWriter) metamap
| 311
|
metaValueToJSON blockWriter inlineWriter (MetaMap metamap) = liftM toJSON $
Traversable.mapM (metaValueToJSON blockWriter inlineWriter) metamap
| 145
| false
| true
| 0
| 10
| 98
| 94
| 46
| 48
| null | null |
haskell-compat/base-compat
|
base-compat/src/Data/Complex/Compat.hs
|
mit
|
-- | Extracts the imaginary part of a complex number.
imagPart :: Complex a -> a
imagPart (_ :+ y) = y
| 103
|
imagPart :: Complex a -> a
imagPart (_ :+ y) = y
| 49
|
imagPart (_ :+ y) = y
| 22
| true
| true
| 0
| 9
| 22
| 35
| 16
| 19
| null | null |
sdiehl/ghc
|
compiler/nativeGen/SPARC/Ppr.hs
|
bsd-3-clause
|
pprInstr (FxTOy format1 format2 reg1 reg2)
= hcat [
text "\tf",
ptext
(case format1 of
II32 -> sLit "ito"
FF32 -> sLit "sto"
FF64 -> sLit "dto"
_ -> panic "SPARC.Ppr.pprInstr.FxToY: no match"),
ptext
(case format2 of
II32 -> sLit "i\t"
II64 -> sLit "x\t"
FF32 -> sLit "s\t"
FF64 -> sLit "d\t"
_ -> panic "SPARC.Ppr.pprInstr.FxToY: no match"),
pprReg reg1, comma, pprReg reg2
]
| 553
|
pprInstr (FxTOy format1 format2 reg1 reg2)
= hcat [
text "\tf",
ptext
(case format1 of
II32 -> sLit "ito"
FF32 -> sLit "sto"
FF64 -> sLit "dto"
_ -> panic "SPARC.Ppr.pprInstr.FxToY: no match"),
ptext
(case format2 of
II32 -> sLit "i\t"
II64 -> sLit "x\t"
FF32 -> sLit "s\t"
FF64 -> sLit "d\t"
_ -> panic "SPARC.Ppr.pprInstr.FxToY: no match"),
pprReg reg1, comma, pprReg reg2
]
| 553
|
pprInstr (FxTOy format1 format2 reg1 reg2)
= hcat [
text "\tf",
ptext
(case format1 of
II32 -> sLit "ito"
FF32 -> sLit "sto"
FF64 -> sLit "dto"
_ -> panic "SPARC.Ppr.pprInstr.FxToY: no match"),
ptext
(case format2 of
II32 -> sLit "i\t"
II64 -> sLit "x\t"
FF32 -> sLit "s\t"
FF64 -> sLit "d\t"
_ -> panic "SPARC.Ppr.pprInstr.FxToY: no match"),
pprReg reg1, comma, pprReg reg2
]
| 553
| false
| false
| 0
| 11
| 241
| 153
| 72
| 81
| null | null |
facebookincubator/duckling
|
Duckling/Time/KO/Rules.hs
|
bsd-3-clause
|
ruleHourofdayHalfAsRelativeMinutes :: Rule
ruleHourofdayHalfAsRelativeMinutes = Rule
{ name = "<hour-of-day> half (as relative minutes)"
, pattern =
[ Predicate isAnHourOfDay
, regex "반"
]
, prod = \tokens -> case tokens of
(Token Time TimeData {TTime.form = Just (TTime.TimeOfDay (Just hours) _)}:
_) -> tt $ hourMinute True hours 30
_ -> Nothing
}
| 388
|
ruleHourofdayHalfAsRelativeMinutes :: Rule
ruleHourofdayHalfAsRelativeMinutes = Rule
{ name = "<hour-of-day> half (as relative minutes)"
, pattern =
[ Predicate isAnHourOfDay
, regex "반"
]
, prod = \tokens -> case tokens of
(Token Time TimeData {TTime.form = Just (TTime.TimeOfDay (Just hours) _)}:
_) -> tt $ hourMinute True hours 30
_ -> Nothing
}
| 388
|
ruleHourofdayHalfAsRelativeMinutes = Rule
{ name = "<hour-of-day> half (as relative minutes)"
, pattern =
[ Predicate isAnHourOfDay
, regex "반"
]
, prod = \tokens -> case tokens of
(Token Time TimeData {TTime.form = Just (TTime.TimeOfDay (Just hours) _)}:
_) -> tt $ hourMinute True hours 30
_ -> Nothing
}
| 345
| false
| true
| 0
| 22
| 92
| 121
| 63
| 58
| null | null |
ribag/ganeti-experiments
|
src/Ganeti/OpParams.hs
|
gpl-2.0
|
pHypervisor :: Field
pHypervisor =
withDoc "Selected hypervisor for an instance" .
optionalField $
simpleField "hypervisor" [t| Hypervisor |]
| 147
|
pHypervisor :: Field
pHypervisor =
withDoc "Selected hypervisor for an instance" .
optionalField $
simpleField "hypervisor" [t| Hypervisor |]
| 147
|
pHypervisor =
withDoc "Selected hypervisor for an instance" .
optionalField $
simpleField "hypervisor" [t| Hypervisor |]
| 126
| false
| true
| 0
| 6
| 24
| 38
| 18
| 20
| null | null |
brendanhay/gogol
|
gogol-youtube/gen/Network/Google/Resource/YouTube/ThirdPartyLinks/Insert.hs
|
mpl-2.0
|
-- | JSONP
tpliCallback :: Lens' ThirdPartyLinksInsert (Maybe Text)
tpliCallback
= lens _tpliCallback (\ s a -> s{_tpliCallback = a})
| 135
|
tpliCallback :: Lens' ThirdPartyLinksInsert (Maybe Text)
tpliCallback
= lens _tpliCallback (\ s a -> s{_tpliCallback = a})
| 124
|
tpliCallback
= lens _tpliCallback (\ s a -> s{_tpliCallback = a})
| 67
| true
| true
| 1
| 9
| 21
| 52
| 25
| 27
| null | null |
sdiehl/ghc
|
compiler/GHC/Cmm/Utils.hs
|
bsd-3-clause
|
mapGraphNodes1 :: (forall e x. CmmNode e x -> CmmNode e x) -> CmmGraph -> CmmGraph
mapGraphNodes1 f = modifyGraph (mapGraph f)
| 126
|
mapGraphNodes1 :: (forall e x. CmmNode e x -> CmmNode e x) -> CmmGraph -> CmmGraph
mapGraphNodes1 f = modifyGraph (mapGraph f)
| 126
|
mapGraphNodes1 f = modifyGraph (mapGraph f)
| 43
| false
| true
| 0
| 9
| 21
| 54
| 27
| 27
| null | null |
headprogrammingczar/cabal
|
cabal-install/Distribution/Client/ProjectConfig.hs
|
bsd-3-clause
|
readSourcePackage :: Verbosity -> ProjectPackageLocation
-> Rebuild UnresolvedSourcePackage
readSourcePackage verbosity (ProjectPackageLocalCabalFile cabalFile) =
readSourcePackage verbosity (ProjectPackageLocalDirectory dir cabalFile)
where
dir = takeDirectory cabalFile
| 299
|
readSourcePackage :: Verbosity -> ProjectPackageLocation
-> Rebuild UnresolvedSourcePackage
readSourcePackage verbosity (ProjectPackageLocalCabalFile cabalFile) =
readSourcePackage verbosity (ProjectPackageLocalDirectory dir cabalFile)
where
dir = takeDirectory cabalFile
| 299
|
readSourcePackage verbosity (ProjectPackageLocalCabalFile cabalFile) =
readSourcePackage verbosity (ProjectPackageLocalDirectory dir cabalFile)
where
dir = takeDirectory cabalFile
| 189
| false
| true
| 0
| 7
| 50
| 57
| 27
| 30
| null | null |
PavelClaudiuStefan/FMI
|
An_3_Semestru_1/ProgramareDeclarativa/Extra/Laborator/Laborator 9/Nondet.hs
|
cc0-1.0
|
test_unit2 = quickCheck $ check_unit2 sqrts
| 43
|
test_unit2 = quickCheck $ check_unit2 sqrts
| 43
|
test_unit2 = quickCheck $ check_unit2 sqrts
| 43
| false
| false
| 1
| 6
| 5
| 16
| 6
| 10
| null | null |
basvandijk/explicit-iomodes
|
System/IO/ExplicitIOModes.hs
|
bsd-3-clause
|
stdin ∷ Handle ReadMode
stdin = Handle SIO.stdin
| 48
|
stdin ∷ Handle ReadMode
stdin = Handle SIO.stdin
| 48
|
stdin = Handle SIO.stdin
| 24
| false
| true
| 0
| 6
| 7
| 25
| 10
| 15
| null | null |
ekmett/wl-pprint-extras
|
src/Text/PrettyPrint/Free/Internal.hs
|
bsd-2-clause
|
-- | The document @(x \<\/\/\> y)@ concatenates document @x@ and @y@ with
-- a 'softbreak' in between. This effectively puts @x@ and @y@ either
-- right next to each other or underneath each other. (infixr 5)
(<//>) :: Doc a e -> Doc a e -> Doc a e
x <//> y = x <> softbreak <> y
| 286
|
(<//>) :: Doc a e -> Doc a e -> Doc a e
x <//> y = x <> softbreak <> y
| 77
|
x <//> y = x <> softbreak <> y
| 37
| true
| true
| 0
| 9
| 65
| 53
| 27
| 26
| null | null |
sgillespie/ghc
|
compiler/stgSyn/StgSyn.hs
|
bsd-3-clause
|
isAddrRep PtrRep = True
| 24
|
isAddrRep PtrRep = True
| 24
|
isAddrRep PtrRep = True
| 24
| false
| false
| 0
| 5
| 4
| 9
| 4
| 5
| null | null |
efoley/csv2json
|
Main.hs
|
bsd-2-clause
|
main :: IO ()
main = do
margs <- cmdArgs margsDef
csv2Json (head $ files margs) >> return ()
| 96
|
main :: IO ()
main = do
margs <- cmdArgs margsDef
csv2Json (head $ files margs) >> return ()
| 96
|
main = do
margs <- cmdArgs margsDef
csv2Json (head $ files margs) >> return ()
| 82
| false
| true
| 0
| 12
| 22
| 57
| 24
| 33
| null | null |
zoomhub/zoomhub
|
src/ZoomHub/API.hs
|
mit
|
-- NOTE: Enable Chrome developer console ‘[x] Disable cache’ to test
-- permanent HTTP 301 redirects:
redirect :: URI -> Handler a
redirect location =
-- HACK: Redirect using error: http://git.io/vBCz9
throwError $ err301 {errHeaders = [("Location", BC.pack (show location))]}
| 280
|
redirect :: URI -> Handler a
redirect location =
-- HACK: Redirect using error: http://git.io/vBCz9
throwError $ err301 {errHeaders = [("Location", BC.pack (show location))]}
| 178
|
redirect location =
-- HACK: Redirect using error: http://git.io/vBCz9
throwError $ err301 {errHeaders = [("Location", BC.pack (show location))]}
| 149
| true
| true
| 0
| 12
| 43
| 56
| 31
| 25
| null | null |
craynafinal/cs557_functional_languages
|
practice/week2/practice.hs
|
mit
|
map3 = [map id, reverse, map not]
| 33
|
map3 = [map id, reverse, map not]
| 33
|
map3 = [map id, reverse, map not]
| 33
| false
| false
| 1
| 7
| 6
| 25
| 11
| 14
| null | null |
lukemaurer/sequent-core
|
src/Language/SequentCore/Driver/Flags.hs
|
bsd-3-clause
|
turnOff :: TurnOnFlag; turnOff = False
| 38
|
turnOff :: TurnOnFlag
turnOff = False
| 37
|
turnOff = False
| 15
| false
| true
| 0
| 4
| 5
| 12
| 7
| 5
| null | null |
briansteffens/basm
|
src/Shared.hs
|
gpl-2.0
|
fromLeft (Right _) = error("Invalid call to fromLeft")
| 54
|
fromLeft (Right _) = error("Invalid call to fromLeft")
| 54
|
fromLeft (Right _) = error("Invalid call to fromLeft")
| 54
| false
| false
| 0
| 7
| 7
| 21
| 10
| 11
| null | null |
rueshyna/gogol
|
gogol-dfareporting/gen/Network/Google/DFAReporting/Types/Product.hs
|
mpl-2.0
|
-- | Creates a value of 'AccountPermissionGroupsListResponse' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'apglrKind'
--
-- * 'apglrAccountPermissionGroups'
accountPermissionGroupsListResponse
:: AccountPermissionGroupsListResponse
accountPermissionGroupsListResponse =
AccountPermissionGroupsListResponse'
{ _apglrKind = "dfareporting#accountPermissionGroupsListResponse"
, _apglrAccountPermissionGroups = Nothing
}
| 525
|
accountPermissionGroupsListResponse
:: AccountPermissionGroupsListResponse
accountPermissionGroupsListResponse =
AccountPermissionGroupsListResponse'
{ _apglrKind = "dfareporting#accountPermissionGroupsListResponse"
, _apglrAccountPermissionGroups = Nothing
}
| 279
|
accountPermissionGroupsListResponse =
AccountPermissionGroupsListResponse'
{ _apglrKind = "dfareporting#accountPermissionGroupsListResponse"
, _apglrAccountPermissionGroups = Nothing
}
| 200
| true
| true
| 1
| 7
| 72
| 39
| 23
| 16
| null | null |
llllllllll/false
|
False/Compiler.hs
|
gpl-2.0
|
compileTarget :: String -> Target -> Either CompileError (String,Target)
compileTarget cs t = case lexFalse initPosition cs of
Left (e,p) -> Left $ CompileLexError e p
Right ts -> case parseFalse ts of
Left e -> Left $ CompileParseError e
Right ns -> Right (uncurry3 (compile t)
$ ppLambdas ns,t)
where
uncurry3 f (a,b,c) = f a b c
| 534
|
compileTarget :: String -> Target -> Either CompileError (String,Target)
compileTarget cs t = case lexFalse initPosition cs of
Left (e,p) -> Left $ CompileLexError e p
Right ts -> case parseFalse ts of
Left e -> Left $ CompileParseError e
Right ns -> Right (uncurry3 (compile t)
$ ppLambdas ns,t)
where
uncurry3 f (a,b,c) = f a b c
| 534
|
compileTarget cs t = case lexFalse initPosition cs of
Left (e,p) -> Left $ CompileLexError e p
Right ts -> case parseFalse ts of
Left e -> Left $ CompileParseError e
Right ns -> Right (uncurry3 (compile t)
$ ppLambdas ns,t)
where
uncurry3 f (a,b,c) = f a b c
| 461
| false
| true
| 0
| 16
| 261
| 162
| 79
| 83
| null | null |
acowley/ghc
|
libraries/base/Control/Exception/Base.hs
|
bsd-3-clause
|
-- No location info unfortunately
absentError s = error ("Oops! Entered absent arg " ++ unpackCStringUtf8# s)
| 123
|
absentError s = error ("Oops! Entered absent arg " ++ unpackCStringUtf8# s)
| 89
|
absentError s = error ("Oops! Entered absent arg " ++ unpackCStringUtf8# s)
| 89
| true
| false
| 1
| 8
| 30
| 27
| 11
| 16
| null | null |
icyfork/shellcheck
|
ShellCheck/Analytics.hs
|
gpl-3.0
|
prop_checkReturn7 = verify checkReturn "return 'hello world'"
| 61
|
prop_checkReturn7 = verify checkReturn "return 'hello world'"
| 61
|
prop_checkReturn7 = verify checkReturn "return 'hello world'"
| 61
| false
| false
| 1
| 5
| 6
| 15
| 5
| 10
| null | null |
beni55/bayes-stack
|
network-topic-models/DumpCI.hs
|
bsd-3-clause
|
showB :: Show a => a -> TB.Builder
showB = TB.fromString . show
| 63
|
showB :: Show a => a -> TB.Builder
showB = TB.fromString . show
| 63
|
showB = TB.fromString . show
| 28
| false
| true
| 0
| 9
| 12
| 37
| 16
| 21
| null | null |
bgamari/pandoc
|
src/Text/Pandoc/Writers/OpenDocument.hs
|
gpl-2.0
|
rmTextStyleAttr :: TextStyle -> State WriterState ()
rmTextStyleAttr ts = modify $ \s -> s { stTextStyleAttr = Map.delete ts (stTextStyleAttr s) }
| 146
|
rmTextStyleAttr :: TextStyle -> State WriterState ()
rmTextStyleAttr ts = modify $ \s -> s { stTextStyleAttr = Map.delete ts (stTextStyleAttr s) }
| 146
|
rmTextStyleAttr ts = modify $ \s -> s { stTextStyleAttr = Map.delete ts (stTextStyleAttr s) }
| 93
| false
| true
| 0
| 11
| 22
| 55
| 28
| 27
| null | null |
athanclark/lh-bug
|
deps/unordered-containers/tests/HashMapProperties.hs
|
bsd-3-clause
|
------------------------------------------------------------------------
-- ** Folds
pFoldr :: [(Int, Int)] -> Bool
pFoldr = (L.sort . M.fold (:) []) `eq` (L.sort . HM.foldr (:) [])
| 182
|
pFoldr :: [(Int, Int)] -> Bool
pFoldr = (L.sort . M.fold (:) []) `eq` (L.sort . HM.foldr (:) [])
| 96
|
pFoldr = (L.sort . M.fold (:) []) `eq` (L.sort . HM.foldr (:) [])
| 65
| true
| true
| 0
| 9
| 23
| 72
| 42
| 30
| null | null |
Gabriel439/suns-search
|
src/Structure.hs
|
gpl-3.0
|
bonds :: Graph -> [Edge]
bonds = filter (uncurry (<=)) . edges
| 62
|
bonds :: Graph -> [Edge]
bonds = filter (uncurry (<=)) . edges
| 62
|
bonds = filter (uncurry (<=)) . edges
| 37
| false
| true
| 0
| 8
| 11
| 33
| 18
| 15
| null | null |
iquiw/hsbin
|
src/Hsbin/Types.hs
|
mit
|
hsBinPath :: HsbinEnv -> HsbinScript -> FilePath
hsBinPath henv hscr = heBinDir henv </> exe (hsName hscr)
| 106
|
hsBinPath :: HsbinEnv -> HsbinScript -> FilePath
hsBinPath henv hscr = heBinDir henv </> exe (hsName hscr)
| 106
|
hsBinPath henv hscr = heBinDir henv </> exe (hsName hscr)
| 57
| false
| true
| 0
| 8
| 16
| 40
| 19
| 21
| null | null |
pparkkin/eta
|
compiler/ETA/TypeCheck/TcGenGenerics.hs
|
bsd-3-clause
|
canDoGenerics :: TyCon -> [Type] -> Validity
-- canDoGenerics rep_tc tc_args determines if Generic/Rep can be derived for a
-- type expression (rep_tc tc_arg0 tc_arg1 ... tc_argn).
--
-- Check (b) from Note [Requirements for deriving Generic and Rep] is taken
-- care of because canDoGenerics is applied to rep tycons.
--
-- It returns Nothing if deriving is possible. It returns (Just reason) if not.
canDoGenerics tc tc_args
= mergeErrors (
-- Check (c) from Note [Requirements for deriving Generic and Rep].
(if (not (null (tyConStupidTheta tc)))
then (NotValid (tc_name <+> text "must not have a datatype context"))
else IsValid) :
-- Check (a) from Note [Requirements for deriving Generic and Rep].
--
-- Data family indices can be instantiated; the `tc_args` here are
-- the representation tycon args
(if (all isTyVarTy (filterOut isKind tc_args))
then IsValid
else NotValid (tc_name <+> text "must not be instantiated;" <+>
text "try deriving `" <> tc_name <+> tc_tys <>
text "' instead"))
-- See comment below
: (map bad_con (tyConDataCons tc)))
where
-- The tc can be a representation tycon. When we want to display it to the
-- user (in an error message) we should print its parent
(tc_name, tc_tys) = case tyConParent tc of
FamInstTyCon _ ptc tys -> (ppr ptc, hsep (map ppr
(tys ++ drop (length tys) tc_args)))
_ -> (ppr tc, hsep (map ppr (tyConTyVars tc)))
-- Check (d) from Note [Requirements for deriving Generic and Rep].
--
-- If any of the constructors has an unboxed type as argument,
-- then we can't build the embedding-projection pair, because
-- it relies on instantiating *polymorphic* sum and product types
-- at the argument types of the constructors
bad_con dc = if (any bad_arg_type (dataConOrigArgTys dc))
then (NotValid (ppr dc <+> text "must not have unlifted or polymorphic arguments"))
else (if (not (isVanillaDataCon dc))
then (NotValid (ppr dc <+> text "must be a vanilla data constructor"))
else IsValid)
-- Nor can we do the job if it's an existential data constructor,
-- Nor if the args are polymorphic types (I don't think)
bad_arg_type ty = isUnLiftedType ty || not (isTauTy ty)
| 2,603
|
canDoGenerics :: TyCon -> [Type] -> Validity
canDoGenerics tc tc_args
= mergeErrors (
-- Check (c) from Note [Requirements for deriving Generic and Rep].
(if (not (null (tyConStupidTheta tc)))
then (NotValid (tc_name <+> text "must not have a datatype context"))
else IsValid) :
-- Check (a) from Note [Requirements for deriving Generic and Rep].
--
-- Data family indices can be instantiated; the `tc_args` here are
-- the representation tycon args
(if (all isTyVarTy (filterOut isKind tc_args))
then IsValid
else NotValid (tc_name <+> text "must not be instantiated;" <+>
text "try deriving `" <> tc_name <+> tc_tys <>
text "' instead"))
-- See comment below
: (map bad_con (tyConDataCons tc)))
where
-- The tc can be a representation tycon. When we want to display it to the
-- user (in an error message) we should print its parent
(tc_name, tc_tys) = case tyConParent tc of
FamInstTyCon _ ptc tys -> (ppr ptc, hsep (map ppr
(tys ++ drop (length tys) tc_args)))
_ -> (ppr tc, hsep (map ppr (tyConTyVars tc)))
-- Check (d) from Note [Requirements for deriving Generic and Rep].
--
-- If any of the constructors has an unboxed type as argument,
-- then we can't build the embedding-projection pair, because
-- it relies on instantiating *polymorphic* sum and product types
-- at the argument types of the constructors
bad_con dc = if (any bad_arg_type (dataConOrigArgTys dc))
then (NotValid (ppr dc <+> text "must not have unlifted or polymorphic arguments"))
else (if (not (isVanillaDataCon dc))
then (NotValid (ppr dc <+> text "must be a vanilla data constructor"))
else IsValid)
-- Nor can we do the job if it's an existential data constructor,
-- Nor if the args are polymorphic types (I don't think)
bad_arg_type ty = isUnLiftedType ty || not (isTauTy ty)
| 2,246
|
canDoGenerics tc tc_args
= mergeErrors (
-- Check (c) from Note [Requirements for deriving Generic and Rep].
(if (not (null (tyConStupidTheta tc)))
then (NotValid (tc_name <+> text "must not have a datatype context"))
else IsValid) :
-- Check (a) from Note [Requirements for deriving Generic and Rep].
--
-- Data family indices can be instantiated; the `tc_args` here are
-- the representation tycon args
(if (all isTyVarTy (filterOut isKind tc_args))
then IsValid
else NotValid (tc_name <+> text "must not be instantiated;" <+>
text "try deriving `" <> tc_name <+> tc_tys <>
text "' instead"))
-- See comment below
: (map bad_con (tyConDataCons tc)))
where
-- The tc can be a representation tycon. When we want to display it to the
-- user (in an error message) we should print its parent
(tc_name, tc_tys) = case tyConParent tc of
FamInstTyCon _ ptc tys -> (ppr ptc, hsep (map ppr
(tys ++ drop (length tys) tc_args)))
_ -> (ppr tc, hsep (map ppr (tyConTyVars tc)))
-- Check (d) from Note [Requirements for deriving Generic and Rep].
--
-- If any of the constructors has an unboxed type as argument,
-- then we can't build the embedding-projection pair, because
-- it relies on instantiating *polymorphic* sum and product types
-- at the argument types of the constructors
bad_con dc = if (any bad_arg_type (dataConOrigArgTys dc))
then (NotValid (ppr dc <+> text "must not have unlifted or polymorphic arguments"))
else (if (not (isVanillaDataCon dc))
then (NotValid (ppr dc <+> text "must be a vanilla data constructor"))
else IsValid)
-- Nor can we do the job if it's an existential data constructor,
-- Nor if the args are polymorphic types (I don't think)
bad_arg_type ty = isUnLiftedType ty || not (isTauTy ty)
| 2,201
| true
| true
| 2
| 17
| 837
| 416
| 217
| 199
| null | null |
tolysz/hiccup
|
TclParse.hs
|
lgpl-2.1
|
trimmed p = tryWhite *> p <* tryWhite
where tryWhite = try (B.concat <$> many1 whiteSpace) <|> return B.empty
| 110
|
trimmed p = tryWhite *> p <* tryWhite
where tryWhite = try (B.concat <$> many1 whiteSpace) <|> return B.empty
| 110
|
trimmed p = tryWhite *> p <* tryWhite
where tryWhite = try (B.concat <$> many1 whiteSpace) <|> return B.empty
| 110
| false
| false
| 0
| 9
| 19
| 49
| 23
| 26
| null | null |
agomezl/tstp2agda
|
test/Test/Function.hs
|
mit
|
ignature1 ∷ [AgdaSignature]
signature1 = catMaybes . toList . fmap (buildSignature map1) $ tree1
| 97
|
signature1 ∷ [AgdaSignature]
signature1 = catMaybes . toList . fmap (buildSignature map1) $ tree1
| 97
|
signature1 = catMaybes . toList . fmap (buildSignature map1) $ tree1
| 68
| false
| true
| 0
| 9
| 14
| 35
| 18
| 17
| null | null |
nkpart/score-writer
|
src/Score/Parser.hs
|
bsd-3-clause
|
defaultParseScoreFile ::
DeltaParsing m => m (RenderingOptions, [Score])
defaultParseScoreFile = evalStateT parseScoreFile initParseState
| 139
|
defaultParseScoreFile ::
DeltaParsing m => m (RenderingOptions, [Score])
defaultParseScoreFile = evalStateT parseScoreFile initParseState
| 139
|
defaultParseScoreFile = evalStateT parseScoreFile initParseState
| 64
| false
| true
| 0
| 8
| 14
| 35
| 18
| 17
| null | null |
mathfur/grep-tree
|
src/RunCommand.hs
|
mit
|
execute :: Text -> [Text] -> Maybe FilePath -> IO (Either Text [Text])
execute command_name args wdir = do
(_,hdl,_,_) <- runInteractiveProcess (unpack command_name) (map unpack args) ((unpack . fromRight . toText) <$> wdir) Nothing
hSetBinaryMode hdl False
hSetBuffering hdl LineBuffering
catch (hGetLineToEOF hdl <* (hClose hdl)) exception_handler
where
exception_handler :: SomeException -> IO (Either Text [Text])
exception_handler e = return $ Left $ "Failed at: "
`mappend` command_name `mappend` " "
`mappend` (show args) `mappend` " "
`mappend` (show wdir) `mappend` " : "
`mappend` (show e)
fromRight x = case x of
Left _ -> error "fromRight is failed"
Right y -> y
| 932
|
execute :: Text -> [Text] -> Maybe FilePath -> IO (Either Text [Text])
execute command_name args wdir = do
(_,hdl,_,_) <- runInteractiveProcess (unpack command_name) (map unpack args) ((unpack . fromRight . toText) <$> wdir) Nothing
hSetBinaryMode hdl False
hSetBuffering hdl LineBuffering
catch (hGetLineToEOF hdl <* (hClose hdl)) exception_handler
where
exception_handler :: SomeException -> IO (Either Text [Text])
exception_handler e = return $ Left $ "Failed at: "
`mappend` command_name `mappend` " "
`mappend` (show args) `mappend` " "
`mappend` (show wdir) `mappend` " : "
`mappend` (show e)
fromRight x = case x of
Left _ -> error "fromRight is failed"
Right y -> y
| 932
|
execute command_name args wdir = do
(_,hdl,_,_) <- runInteractiveProcess (unpack command_name) (map unpack args) ((unpack . fromRight . toText) <$> wdir) Nothing
hSetBinaryMode hdl False
hSetBuffering hdl LineBuffering
catch (hGetLineToEOF hdl <* (hClose hdl)) exception_handler
where
exception_handler :: SomeException -> IO (Either Text [Text])
exception_handler e = return $ Left $ "Failed at: "
`mappend` command_name `mappend` " "
`mappend` (show args) `mappend` " "
`mappend` (show wdir) `mappend` " : "
`mappend` (show e)
fromRight x = case x of
Left _ -> error "fromRight is failed"
Right y -> y
| 861
| false
| true
| 0
| 13
| 362
| 285
| 147
| 138
| null | null |
pascal-knodel/haskell-craft
|
Examples/· Recursion/· Primitive Recursion/Lists/Count.hs
|
mit
|
count :: (Eq t) => t -> [t] -> Integer
count _ [] = 0
| 53
|
count :: (Eq t) => t -> [t] -> Integer
count _ [] = 0
| 53
|
count _ [] = 0
| 14
| false
| true
| 0
| 8
| 14
| 38
| 20
| 18
| null | null |
haroldcarr/learn-haskell-coq-ml-etc
|
haskell/topic/type-level/2017-08-justin-le-fixed-length-vector-types/src/L2.hs
|
unlicense
|
{-
------------------------------------------------------------------------------
Between Sized and Unsized
-}
toList :: Vec n a -> [a]
toList = \case
VNil -> []
(a :+ as) -> a : toList as
{-
API of converting unsized to sized vectors is the same as sized-vectors
-}
| 276
|
toList :: Vec n a -> [a]
toList = \case
VNil -> []
(a :+ as) -> a : toList as
{-
API of converting unsized to sized vectors is the same as sized-vectors
-}
| 165
|
toList = \case
VNil -> []
(a :+ as) -> a : toList as
{-
API of converting unsized to sized vectors is the same as sized-vectors
-}
| 140
| true
| true
| 0
| 9
| 51
| 55
| 29
| 26
| null | null |
johnpmayer/elm-compiler
|
src/Canonicalize/Result.hs
|
bsd-3-clause
|
errors :: [e] -> Result e a
errors msgs =
Result Set.empty (Err msgs)
| 71
|
errors :: [e] -> Result e a
errors msgs =
Result Set.empty (Err msgs)
| 71
|
errors msgs =
Result Set.empty (Err msgs)
| 43
| false
| true
| 0
| 7
| 15
| 44
| 20
| 24
| null | null |
keera-studios/hssdl
|
Examples/NeHe/lesson06/Fun_Loader.hs
|
bsd-3-clause
|
--loads a bitmap from a file
loadBitmap :: FilePath -> Maybe ColorList3 -> IO AwbfBitmap
loadBitmap bmName invList = do
bmFile <- openFile bmName (ReadMode)
bmString <- hGetContents bmFile
(bmW,bmH) <- getWH (dropGLsizei 18 bmString)
bmData <- getBmData (dropGLsizei 54 bmString) (bmW,bmH) invList
hClose bmFile
return (bmW,bmH,bmData)
-- loads n bitmaps from n files
| 435
|
loadBitmap :: FilePath -> Maybe ColorList3 -> IO AwbfBitmap
loadBitmap bmName invList = do
bmFile <- openFile bmName (ReadMode)
bmString <- hGetContents bmFile
(bmW,bmH) <- getWH (dropGLsizei 18 bmString)
bmData <- getBmData (dropGLsizei 54 bmString) (bmW,bmH) invList
hClose bmFile
return (bmW,bmH,bmData)
-- loads n bitmaps from n files
| 404
|
loadBitmap bmName invList = do
bmFile <- openFile bmName (ReadMode)
bmString <- hGetContents bmFile
(bmW,bmH) <- getWH (dropGLsizei 18 bmString)
bmData <- getBmData (dropGLsizei 54 bmString) (bmW,bmH) invList
hClose bmFile
return (bmW,bmH,bmData)
-- loads n bitmaps from n files
| 344
| true
| true
| 0
| 10
| 121
| 130
| 63
| 67
| null | null |
beni55/aeson
|
Data/Aeson/Types/Instances.hs
|
bsd-3-clause
|
-- | @withArray expected f value@ applies @f@ to the 'Array' when @value@ is an @Array@
-- and fails using @'typeMismatch' expected@ otherwise.
withArray :: String -> (Array -> Parser a) -> Value -> Parser a
withArray _ f (Array arr) = f arr
| 250
|
withArray :: String -> (Array -> Parser a) -> Value -> Parser a
withArray _ f (Array arr) = f arr
| 104
|
withArray _ f (Array arr) = f arr
| 40
| true
| true
| 0
| 11
| 52
| 58
| 28
| 30
| null | null |
vladimir-ipatov/ganeti
|
src/Ganeti/Runtime.hs
|
gpl-2.0
|
-- | Returns the log file base for a daemon.
daemonLogBase :: GanetiDaemon -> String
daemonLogBase GanetiMasterd = "master-daemon"
| 130
|
daemonLogBase :: GanetiDaemon -> String
daemonLogBase GanetiMasterd = "master-daemon"
| 85
|
daemonLogBase GanetiMasterd = "master-daemon"
| 45
| true
| true
| 0
| 5
| 18
| 19
| 10
| 9
| null | null |
ideas-edu/ideas
|
src/Ideas/Common/Id.hs
|
apache-2.0
|
-- | Get the current description.
description :: HasId a => a -> String
description = idDescription . getId
| 109
|
description :: HasId a => a -> String
description = idDescription . getId
| 73
|
description = idDescription . getId
| 35
| true
| true
| 0
| 6
| 20
| 27
| 14
| 13
| null | null |
chemist/highlighter
|
src/Text/Highlighter/Lexers/Lua.hs
|
bsd-3-clause
|
sqs' :: TokenMatcher
sqs' =
[ tokNext "'" (Arbitrary "Literal" :. Arbitrary "String") Pop
, anyOf string'
]
| 119
|
sqs' :: TokenMatcher
sqs' =
[ tokNext "'" (Arbitrary "Literal" :. Arbitrary "String") Pop
, anyOf string'
]
| 119
|
sqs' =
[ tokNext "'" (Arbitrary "Literal" :. Arbitrary "String") Pop
, anyOf string'
]
| 98
| false
| true
| 0
| 10
| 29
| 47
| 21
| 26
| null | null |
ScrambledEggsOnToast/hi3status
|
lib-src/Hi3Status/Blocks/Weather.hs
|
mit
|
weather :: String -> Bool -> String -> String -> IO (Conditions, Int)
weather loc celsius long lat = do
w <- readProcess "weather" (if celsius then ["-m",loc] else [loc]) ""
temp <- readProcess "grep" ["emperature"] w >>= readProcess "awk" ["{print $2}"]
con <- if "cloud" `isInfixOf` w then return Cloudy else if "rain" `isInfixOf` w then return Rain
else do
(daynight,_,_) <- readProcessWithExitCode "sunwait" ["poll", long, lat] ""
case daynight of
ExitFailure 3 -> return ClearNight
otherwise -> return ClearDay
return (con,read temp)
| 618
|
weather :: String -> Bool -> String -> String -> IO (Conditions, Int)
weather loc celsius long lat = do
w <- readProcess "weather" (if celsius then ["-m",loc] else [loc]) ""
temp <- readProcess "grep" ["emperature"] w >>= readProcess "awk" ["{print $2}"]
con <- if "cloud" `isInfixOf` w then return Cloudy else if "rain" `isInfixOf` w then return Rain
else do
(daynight,_,_) <- readProcessWithExitCode "sunwait" ["poll", long, lat] ""
case daynight of
ExitFailure 3 -> return ClearNight
otherwise -> return ClearDay
return (con,read temp)
| 618
|
weather loc celsius long lat = do
w <- readProcess "weather" (if celsius then ["-m",loc] else [loc]) ""
temp <- readProcess "grep" ["emperature"] w >>= readProcess "awk" ["{print $2}"]
con <- if "cloud" `isInfixOf` w then return Cloudy else if "rain" `isInfixOf` w then return Rain
else do
(daynight,_,_) <- readProcessWithExitCode "sunwait" ["poll", long, lat] ""
case daynight of
ExitFailure 3 -> return ClearNight
otherwise -> return ClearDay
return (con,read temp)
| 548
| false
| true
| 0
| 15
| 163
| 224
| 116
| 108
| null | null |
rueshyna/gogol
|
gogol-adexchange-buyer/gen/Network/Google/AdExchangeBuyer/Types/Product.hs
|
mpl-2.0
|
-- | Marketplace publisher profile Id. This Id differs from the regular
-- publisher_profile_id in that 1. This is a new id, the old Id will be
-- deprecated in 2017. 2. This id uniquely identifies a publisher profile
-- by itself.
proMarketplacePublisherProFileId :: Lens' Product (Maybe Text)
proMarketplacePublisherProFileId
= lens _proMarketplacePublisherProFileId
(\ s a -> s{_proMarketplacePublisherProFileId = a})
| 428
|
proMarketplacePublisherProFileId :: Lens' Product (Maybe Text)
proMarketplacePublisherProFileId
= lens _proMarketplacePublisherProFileId
(\ s a -> s{_proMarketplacePublisherProFileId = a})
| 196
|
proMarketplacePublisherProFileId
= lens _proMarketplacePublisherProFileId
(\ s a -> s{_proMarketplacePublisherProFileId = a})
| 133
| true
| true
| 0
| 8
| 66
| 52
| 28
| 24
| null | null |
lucasfcosta/haskell-experiences
|
Chapter 2/anIntroToLists.hs
|
mit
|
-- `elem` tells if something belongs to a list
belongs = 4 `elem` oneToTen
| 74
|
belongs = 4 `elem` oneToTen
| 27
|
belongs = 4 `elem` oneToTen
| 27
| true
| false
| 0
| 5
| 13
| 13
| 8
| 5
| null | null |
tolysz/postgresql-simple
|
src/Database/PostgreSQL/Simple/TypeInfo/Static.hs
|
bsd-3-clause
|
array_polygon :: TypeInfo
array_polygon = Array {
typoid = Oid 1027,
typcategory = 'A',
typdelim = ',',
typname = "_polygon",
typelem = polygon
}
| 184
|
array_polygon :: TypeInfo
array_polygon = Array {
typoid = Oid 1027,
typcategory = 'A',
typdelim = ',',
typname = "_polygon",
typelem = polygon
}
| 184
|
array_polygon = Array {
typoid = Oid 1027,
typcategory = 'A',
typdelim = ',',
typname = "_polygon",
typelem = polygon
}
| 158
| false
| true
| 0
| 7
| 62
| 46
| 28
| 18
| null | null |
AlexanderPankiv/ghc
|
compiler/basicTypes/Id.hs
|
bsd-3-clause
|
isConLikeId :: Id -> Bool
isConLikeId id = isDataConWorkId id || isConLike (idRuleMatchInfo id)
| 95
|
isConLikeId :: Id -> Bool
isConLikeId id = isDataConWorkId id || isConLike (idRuleMatchInfo id)
| 95
|
isConLikeId id = isDataConWorkId id || isConLike (idRuleMatchInfo id)
| 69
| false
| true
| 0
| 8
| 13
| 34
| 16
| 18
| null | null |
joeschmo/joebot2
|
src/Joebot/Plugins/Mail/Cmds.hs
|
mit
|
runMailServer :: Chan Msg -> IO ()
runMailServer = mailProc
| 59
|
runMailServer :: Chan Msg -> IO ()
runMailServer = mailProc
| 59
|
runMailServer = mailProc
| 24
| false
| true
| 0
| 8
| 9
| 29
| 12
| 17
| null | null |
scrive/ntp-control
|
Network/NTP/Control/Packet.hs
|
bsd-3-clause
|
decodeOp 8 = return RuntimeConfiguration
| 41
|
decodeOp 8 = return RuntimeConfiguration
| 41
|
decodeOp 8 = return RuntimeConfiguration
| 41
| false
| false
| 1
| 5
| 5
| 16
| 5
| 11
| null | null |
danr/hipspec
|
examples/old-examples/hip/IWC.hs
|
gpl-3.0
|
choose (S x) (S y) = choose x (S y) `plus` choose x y
| 53
|
choose (S x) (S y) = choose x (S y) `plus` choose x y
| 53
|
choose (S x) (S y) = choose x (S y) `plus` choose x y
| 53
| false
| false
| 0
| 8
| 13
| 45
| 22
| 23
| null | null |
imalsogreg/tetrode-ephys
|
utils/drawSpline.hs
|
gpl-3.0
|
vectSum :: Location -> Location -> Location
vectSum (Location x0 y0 z0) (Location x1 y1 z1) =
Location (x0+x1) (y0+y1) (z0+z1)
| 128
|
vectSum :: Location -> Location -> Location
vectSum (Location x0 y0 z0) (Location x1 y1 z1) =
Location (x0+x1) (y0+y1) (z0+z1)
| 128
|
vectSum (Location x0 y0 z0) (Location x1 y1 z1) =
Location (x0+x1) (y0+y1) (z0+z1)
| 84
| false
| true
| 0
| 10
| 22
| 80
| 38
| 42
| null | null |
mettekou/ghc
|
compiler/basicTypes/Var.hs
|
bsd-3-clause
|
setTyVarName :: TyVar -> Name -> TyVar
setTyVarName = setVarName
| 66
|
setTyVarName :: TyVar -> Name -> TyVar
setTyVarName = setVarName
| 66
|
setTyVarName = setVarName
| 27
| false
| true
| 0
| 8
| 11
| 26
| 11
| 15
| null | null |
JPMoresmau/haddock
|
haddock-api/src/Haddock/Backends/Xhtml/Decl.hs
|
bsd-2-clause
|
ppAssocType :: Bool -> LinksInfo -> DocForDecl DocName -> LFamilyDecl DocName
-> [(DocName, Fixity)] -> Splice -> Unicode -> Qualification -> Html
ppAssocType summ links doc (L loc decl) fixities splice unicode qual =
ppTyFam summ True links [] fixities loc (fst doc) decl splice unicode qual
| 307
|
ppAssocType :: Bool -> LinksInfo -> DocForDecl DocName -> LFamilyDecl DocName
-> [(DocName, Fixity)] -> Splice -> Unicode -> Qualification -> Html
ppAssocType summ links doc (L loc decl) fixities splice unicode qual =
ppTyFam summ True links [] fixities loc (fst doc) decl splice unicode qual
| 307
|
ppAssocType summ links doc (L loc decl) fixities splice unicode qual =
ppTyFam summ True links [] fixities loc (fst doc) decl splice unicode qual
| 148
| false
| true
| 0
| 12
| 61
| 114
| 57
| 57
| null | null |
martinvlk/cis194-homeworks
|
src/HW12/Risk.hs
|
gpl-3.0
|
die :: Rand StdGen DieValue
die = getRandom
| 43
|
die :: Rand StdGen DieValue
die = getRandom
| 43
|
die = getRandom
| 15
| false
| true
| 0
| 6
| 7
| 22
| 9
| 13
| null | null |
apyrgio/ganeti
|
src/Ganeti/Constants.hs
|
bsd-2-clause
|
_opcodeReasonSrcDaemon :: String
_opcodeReasonSrcDaemon = "gnt:daemon"
| 70
|
_opcodeReasonSrcDaemon :: String
_opcodeReasonSrcDaemon = "gnt:daemon"
| 70
|
_opcodeReasonSrcDaemon = "gnt:daemon"
| 37
| false
| true
| 0
| 4
| 5
| 11
| 6
| 5
| null | null |
expipiplus1/vulkan
|
generate-new/src/Bespoke/MarshalParams.hs
|
bsd-3-clause
|
marshalParams :: KnownSpecFlavor t => Spec t -> Sem r MarshalParams
marshalParams spec@Spec {..} = do
bespokeSchemes <- bespokeSchemes spec
let
aliasMap :: Map.HashMap CName CName
aliasMap = fromList [ (aName, aTarget) | Alias {..} <- toList specAliases ]
resolveAlias :: CName -> CName
resolveAlias t = maybe t resolveAlias (Map.lookup t aliasMap) -- TODO: handle cycles!
bitmaskNames :: HashSet CName
bitmaskNames = fromList
[ n
| Enum {..} <- toList specEnums
, ABitmask flags _ <- pure eType
, n <- [eName, flags]
]
isBitmask = (`member` bitmaskNames)
isBitmaskType = \case
TypeName n -> isBitmask n || isBitmask (resolveAlias n)
_ -> False
nonDispatchableHandleNames :: HashSet CName
nonDispatchableHandleNames = fromList
[ hName
| Handle {..} <- toList specHandles
, hDispatchable == NonDispatchable
]
isNonDispatchableHandle = (`member` nonDispatchableHandleNames)
isNonDispatchableHandleType = \case
TypeName n ->
isNonDispatchableHandle n || isNonDispatchableHandle (resolveAlias n)
_ -> False
dispatchableHandleNames :: HashSet CName
dispatchableHandleNames = fromList
[ hName
| Handle {..} <- toList specHandles
, hDispatchable == Dispatchable
]
-- TODO Remove, these will not be defaultable once we bundle the
-- command pointers
isDispatchableHandle = (`member` dispatchableHandleNames)
isDispatchableHandleType = \case
TypeName n ->
isDispatchableHandle n || isDispatchableHandle (resolveAlias n)
_ -> False
atomNames :: HashSet CName
atomNames = fromList [ atName | Atom {..} <- toList specAtoms ]
isAtomType = \case
TypeName n -> n `member` atomNames
_ -> False
pure MarshalParams
{ isDefaultable = isDefaultable'
<||> isBitmaskType
<||> isNonDispatchableHandleType
<||> isDispatchableHandleType
<||> isAtomType
, isPassAsPointerType = isPassAsPointerType'
, isForeignStruct = isForeignStruct'
, getBespokeScheme = \p a ->
asum . fmap (\(BespokeScheme f) -> f p a) $ bespokeSchemes
}
----------------------------------------------------------------
-- Bespoke Vulkan stuff
----------------------------------------------------------------
| 2,490
|
marshalParams :: KnownSpecFlavor t => Spec t -> Sem r MarshalParams
marshalParams spec@Spec {..} = do
bespokeSchemes <- bespokeSchemes spec
let
aliasMap :: Map.HashMap CName CName
aliasMap = fromList [ (aName, aTarget) | Alias {..} <- toList specAliases ]
resolveAlias :: CName -> CName
resolveAlias t = maybe t resolveAlias (Map.lookup t aliasMap) -- TODO: handle cycles!
bitmaskNames :: HashSet CName
bitmaskNames = fromList
[ n
| Enum {..} <- toList specEnums
, ABitmask flags _ <- pure eType
, n <- [eName, flags]
]
isBitmask = (`member` bitmaskNames)
isBitmaskType = \case
TypeName n -> isBitmask n || isBitmask (resolveAlias n)
_ -> False
nonDispatchableHandleNames :: HashSet CName
nonDispatchableHandleNames = fromList
[ hName
| Handle {..} <- toList specHandles
, hDispatchable == NonDispatchable
]
isNonDispatchableHandle = (`member` nonDispatchableHandleNames)
isNonDispatchableHandleType = \case
TypeName n ->
isNonDispatchableHandle n || isNonDispatchableHandle (resolveAlias n)
_ -> False
dispatchableHandleNames :: HashSet CName
dispatchableHandleNames = fromList
[ hName
| Handle {..} <- toList specHandles
, hDispatchable == Dispatchable
]
-- TODO Remove, these will not be defaultable once we bundle the
-- command pointers
isDispatchableHandle = (`member` dispatchableHandleNames)
isDispatchableHandleType = \case
TypeName n ->
isDispatchableHandle n || isDispatchableHandle (resolveAlias n)
_ -> False
atomNames :: HashSet CName
atomNames = fromList [ atName | Atom {..} <- toList specAtoms ]
isAtomType = \case
TypeName n -> n `member` atomNames
_ -> False
pure MarshalParams
{ isDefaultable = isDefaultable'
<||> isBitmaskType
<||> isNonDispatchableHandleType
<||> isDispatchableHandleType
<||> isAtomType
, isPassAsPointerType = isPassAsPointerType'
, isForeignStruct = isForeignStruct'
, getBespokeScheme = \p a ->
asum . fmap (\(BespokeScheme f) -> f p a) $ bespokeSchemes
}
----------------------------------------------------------------
-- Bespoke Vulkan stuff
----------------------------------------------------------------
| 2,490
|
marshalParams spec@Spec {..} = do
bespokeSchemes <- bespokeSchemes spec
let
aliasMap :: Map.HashMap CName CName
aliasMap = fromList [ (aName, aTarget) | Alias {..} <- toList specAliases ]
resolveAlias :: CName -> CName
resolveAlias t = maybe t resolveAlias (Map.lookup t aliasMap) -- TODO: handle cycles!
bitmaskNames :: HashSet CName
bitmaskNames = fromList
[ n
| Enum {..} <- toList specEnums
, ABitmask flags _ <- pure eType
, n <- [eName, flags]
]
isBitmask = (`member` bitmaskNames)
isBitmaskType = \case
TypeName n -> isBitmask n || isBitmask (resolveAlias n)
_ -> False
nonDispatchableHandleNames :: HashSet CName
nonDispatchableHandleNames = fromList
[ hName
| Handle {..} <- toList specHandles
, hDispatchable == NonDispatchable
]
isNonDispatchableHandle = (`member` nonDispatchableHandleNames)
isNonDispatchableHandleType = \case
TypeName n ->
isNonDispatchableHandle n || isNonDispatchableHandle (resolveAlias n)
_ -> False
dispatchableHandleNames :: HashSet CName
dispatchableHandleNames = fromList
[ hName
| Handle {..} <- toList specHandles
, hDispatchable == Dispatchable
]
-- TODO Remove, these will not be defaultable once we bundle the
-- command pointers
isDispatchableHandle = (`member` dispatchableHandleNames)
isDispatchableHandleType = \case
TypeName n ->
isDispatchableHandle n || isDispatchableHandle (resolveAlias n)
_ -> False
atomNames :: HashSet CName
atomNames = fromList [ atName | Atom {..} <- toList specAtoms ]
isAtomType = \case
TypeName n -> n `member` atomNames
_ -> False
pure MarshalParams
{ isDefaultable = isDefaultable'
<||> isBitmaskType
<||> isNonDispatchableHandleType
<||> isDispatchableHandleType
<||> isAtomType
, isPassAsPointerType = isPassAsPointerType'
, isForeignStruct = isForeignStruct'
, getBespokeScheme = \p a ->
asum . fmap (\(BespokeScheme f) -> f p a) $ bespokeSchemes
}
----------------------------------------------------------------
-- Bespoke Vulkan stuff
----------------------------------------------------------------
| 2,422
| false
| true
| 0
| 17
| 707
| 592
| 306
| 286
| null | null |
frontrowed/stratosphere
|
library-gen/Stratosphere/ResourceProperties/Route53HostedZoneVPC.hs
|
mit
|
-- | http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-route53-hostedzone-hostedzonevpcs.html#cfn-route53-hostedzone-hostedzonevpcs-vpcregion
rhzvpcVPCRegion :: Lens' Route53HostedZoneVPC (Val Text)
rhzvpcVPCRegion = lens _route53HostedZoneVPCVPCRegion (\s a -> s { _route53HostedZoneVPCVPCRegion = a })
| 328
|
rhzvpcVPCRegion :: Lens' Route53HostedZoneVPC (Val Text)
rhzvpcVPCRegion = lens _route53HostedZoneVPCVPCRegion (\s a -> s { _route53HostedZoneVPCVPCRegion = a })
| 161
|
rhzvpcVPCRegion = lens _route53HostedZoneVPCVPCRegion (\s a -> s { _route53HostedZoneVPCVPCRegion = a })
| 104
| true
| true
| 0
| 9
| 21
| 46
| 25
| 21
| null | null |
ribag/ganeti-experiments
|
src/Ganeti/HTools/Program/Hcheck.hs
|
gpl-2.0
|
-- | Format a list of key, value as a shell fragment.
printKeysHTC :: [(String, String)] -> IO ()
printKeysHTC = printKeys htcPrefix
| 132
|
printKeysHTC :: [(String, String)] -> IO ()
printKeysHTC = printKeys htcPrefix
| 78
|
printKeysHTC = printKeys htcPrefix
| 34
| true
| true
| 0
| 7
| 22
| 33
| 18
| 15
| null | null |
FunctionalThinking/ninety-nine
|
src/Exercises.hs
|
mit
|
-- 35
primeFactors :: Int -> [Int]
primeFactors 1 = []
| 54
|
primeFactors :: Int -> [Int]
primeFactors 1 = []
| 48
|
primeFactors 1 = []
| 19
| true
| true
| 0
| 8
| 10
| 30
| 14
| 16
| null | null |
asilvestre/haskell-neo4j-rest-client
|
tests/IntegrationTests.hs
|
mit
|
case_deleteUnexistingRelationshipProperties :: Assertion
case_deleteUnexistingRelationshipProperties = do
(nodeFrom, nodeTo, r) <- withAuthConnection host port creds setupRelTests
let expException = Neo4jNoEntityException $ runRelIdentifier r
assertException expException $ withAuthConnection host port creds $ do
deleteRelationship r
_ <- deleteProperties r
return ()
withAuthConnection host port creds $ teardownRelTests nodeFrom nodeTo r
-- | Delete a relationship property
| 518
|
case_deleteUnexistingRelationshipProperties :: Assertion
case_deleteUnexistingRelationshipProperties = do
(nodeFrom, nodeTo, r) <- withAuthConnection host port creds setupRelTests
let expException = Neo4jNoEntityException $ runRelIdentifier r
assertException expException $ withAuthConnection host port creds $ do
deleteRelationship r
_ <- deleteProperties r
return ()
withAuthConnection host port creds $ teardownRelTests nodeFrom nodeTo r
-- | Delete a relationship property
| 518
|
case_deleteUnexistingRelationshipProperties = do
(nodeFrom, nodeTo, r) <- withAuthConnection host port creds setupRelTests
let expException = Neo4jNoEntityException $ runRelIdentifier r
assertException expException $ withAuthConnection host port creds $ do
deleteRelationship r
_ <- deleteProperties r
return ()
withAuthConnection host port creds $ teardownRelTests nodeFrom nodeTo r
-- | Delete a relationship property
| 461
| false
| true
| 0
| 11
| 95
| 119
| 54
| 65
| null | null |
skadinyo/conc
|
haskell/solution5.hs
|
epl-1.0
|
eul42 = length $ filter (\c -> elem c triangleNumberRefs) $ map nameNumber problem42
| 84
|
eul42 = length $ filter (\c -> elem c triangleNumberRefs) $ map nameNumber problem42
| 84
|
eul42 = length $ filter (\c -> elem c triangleNumberRefs) $ map nameNumber problem42
| 84
| false
| false
| 0
| 10
| 13
| 35
| 17
| 18
| null | null |
phaazon/OpenGLRaw
|
src/Graphics/Rendering/OpenGL/Raw/Tokens.hs
|
bsd-3-clause
|
gl_VERTEX_WEIGHT_ARRAY_STRIDE_EXT :: GLenum
gl_VERTEX_WEIGHT_ARRAY_STRIDE_EXT = 0x850F
| 86
|
gl_VERTEX_WEIGHT_ARRAY_STRIDE_EXT :: GLenum
gl_VERTEX_WEIGHT_ARRAY_STRIDE_EXT = 0x850F
| 86
|
gl_VERTEX_WEIGHT_ARRAY_STRIDE_EXT = 0x850F
| 42
| false
| true
| 0
| 4
| 5
| 11
| 6
| 5
| null | null |
DanielG/kvm-in-a-box
|
src/Types.hs
|
agpl-3.0
|
unProto :: Proto -> String
unProto UDP = "udp"
| 46
|
unProto :: Proto -> String
unProto UDP = "udp"
| 46
|
unProto UDP = "udp"
| 19
| false
| true
| 0
| 5
| 8
| 18
| 9
| 9
| null | null |
jeyoor/haskell-learning-challenge
|
lyah_book/starting-out/.stack-work/dist/d96ab9d9/build/autogen/Paths_starting_out.hs
|
bsd-3-clause
|
bindir, libdir, datadir, libexecdir, sysconfdir :: FilePath
bindir = "C:\\development\\learning\\haskell\\for_great\\starting-out\\.stack-work\\install\\9827668f\\bin"
| 172
|
bindir, libdir, datadir, libexecdir, sysconfdir :: FilePath
bindir = "C:\\development\\learning\\haskell\\for_great\\starting-out\\.stack-work\\install\\9827668f\\bin"
| 171
|
bindir = "C:\\development\\learning\\haskell\\for_great\\starting-out\\.stack-work\\install\\9827668f\\bin"
| 111
| false
| true
| 0
| 4
| 14
| 19
| 14
| 5
| null | null |
rueshyna/gogol
|
gogol-bigquery/gen/Network/Google/BigQuery/Types/Product.hs
|
mpl-2.0
|
-- | Creates a value of 'JobStatistics' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'jsCreationTime'
--
-- * 'jsStartTime'
--
-- * 'jsLoad'
--
-- * 'jsTotalBytesProcessed'
--
-- * 'jsEndTime'
--
-- * 'jsQuery'
--
-- * 'jsExtract'
jobStatistics
:: JobStatistics
jobStatistics =
JobStatistics'
{ _jsCreationTime = Nothing
, _jsStartTime = Nothing
, _jsLoad = Nothing
, _jsTotalBytesProcessed = Nothing
, _jsEndTime = Nothing
, _jsQuery = Nothing
, _jsExtract = Nothing
}
| 597
|
jobStatistics
:: JobStatistics
jobStatistics =
JobStatistics'
{ _jsCreationTime = Nothing
, _jsStartTime = Nothing
, _jsLoad = Nothing
, _jsTotalBytesProcessed = Nothing
, _jsEndTime = Nothing
, _jsQuery = Nothing
, _jsExtract = Nothing
}
| 278
|
jobStatistics =
JobStatistics'
{ _jsCreationTime = Nothing
, _jsStartTime = Nothing
, _jsLoad = Nothing
, _jsTotalBytesProcessed = Nothing
, _jsEndTime = Nothing
, _jsQuery = Nothing
, _jsExtract = Nothing
}
| 243
| true
| true
| 0
| 6
| 132
| 72
| 52
| 20
| null | null |
tpsinnem/Idris-dev
|
src/Idris/Core/Evaluate.hs
|
bsd-3-clause
|
-- | Get the list of pairs of fully-qualified names and their types that match some name
lookupTyName :: Name -> Context -> [(Name, Type)]
lookupTyName n ctxt = do
(name, def) <- lookupCtxtName n (definitions ctxt)
ty <- case tfst def of
(Function ty _) -> return ty
(TyDecl _ ty) -> return ty
(Operator ty _ _) -> return ty
(CaseOp _ ty _ _ _ _) -> return ty
return (name, ty)
-- | Get the pair of a fully-qualified name and its type, if there is a unique one matching the name used as a key.
| 592
|
lookupTyName :: Name -> Context -> [(Name, Type)]
lookupTyName n ctxt = do
(name, def) <- lookupCtxtName n (definitions ctxt)
ty <- case tfst def of
(Function ty _) -> return ty
(TyDecl _ ty) -> return ty
(Operator ty _ _) -> return ty
(CaseOp _ ty _ _ _ _) -> return ty
return (name, ty)
-- | Get the pair of a fully-qualified name and its type, if there is a unique one matching the name used as a key.
| 503
|
lookupTyName n ctxt = do
(name, def) <- lookupCtxtName n (definitions ctxt)
ty <- case tfst def of
(Function ty _) -> return ty
(TyDecl _ ty) -> return ty
(Operator ty _ _) -> return ty
(CaseOp _ ty _ _ _ _) -> return ty
return (name, ty)
-- | Get the pair of a fully-qualified name and its type, if there is a unique one matching the name used as a key.
| 453
| true
| true
| 0
| 13
| 198
| 169
| 82
| 87
| null | null |
pjones/xmonad-test
|
vendor/xmonad-contrib/XMonad/Actions/BluetileCommands.hs
|
bsd-2-clause
|
activateScreen :: Int -> X ()
activateScreen sid = screenWorkspace (S sid) >>= flip whenJust (windows . W.view)
| 111
|
activateScreen :: Int -> X ()
activateScreen sid = screenWorkspace (S sid) >>= flip whenJust (windows . W.view)
| 111
|
activateScreen sid = screenWorkspace (S sid) >>= flip whenJust (windows . W.view)
| 81
| false
| true
| 0
| 9
| 17
| 50
| 24
| 26
| null | null |
tonyfloatersu/solution-haskell-craft-of-FP
|
Chapter14_2.hs
|
mit
|
eitherEG2 = Right 33312 :: Either String Int
| 54
|
eitherEG2 = Right 33312 :: Either String Int
| 54
|
eitherEG2 = Right 33312 :: Either String Int
| 54
| false
| false
| 0
| 5
| 17
| 20
| 9
| 11
| null | null |
mithrandi/lambdacircus
|
Handler/Quotes.hs
|
mit
|
getQuotesR :: Integer -> Handler TypedContent
getQuotesR fromId = do
let limit = 10
quotes <- runDB $ selectList
[QuoteId <=. toSqlKey (fromInteger fromId)]
[Desc QuoteId, LimitTo limit]
r <- getUrlRender
let prev = Just . r . QuotesR $ fromId + limit
next = guard (fromId > 1) >> (Just . r . QuotesR) (max (fromId - limit) 1)
renderQuotes quotes prev next
| 400
|
getQuotesR :: Integer -> Handler TypedContent
getQuotesR fromId = do
let limit = 10
quotes <- runDB $ selectList
[QuoteId <=. toSqlKey (fromInteger fromId)]
[Desc QuoteId, LimitTo limit]
r <- getUrlRender
let prev = Just . r . QuotesR $ fromId + limit
next = guard (fromId > 1) >> (Just . r . QuotesR) (max (fromId - limit) 1)
renderQuotes quotes prev next
| 400
|
getQuotesR fromId = do
let limit = 10
quotes <- runDB $ selectList
[QuoteId <=. toSqlKey (fromInteger fromId)]
[Desc QuoteId, LimitTo limit]
r <- getUrlRender
let prev = Just . r . QuotesR $ fromId + limit
next = guard (fromId > 1) >> (Just . r . QuotesR) (max (fromId - limit) 1)
renderQuotes quotes prev next
| 354
| false
| true
| 0
| 15
| 107
| 164
| 79
| 85
| null | null |
phischu/fragnix
|
tests/packages/scotty/Network.Wai.Handler.Warp.File.hs
|
bsd-3-clause
|
----------------------------------------------------------------
conditionalRequest :: I.FileInfo
-> H.ResponseHeaders -> IndexedHeader
-> RspFileInfo
conditionalRequest finfo hs0 reqidx = case condition of
nobody@(WithoutBody _) -> nobody
WithBody s _ off len -> let !hs = (H.hLastModified,date) :
addContentHeaders hs0 off len size
in WithBody s hs off len
where
!mtime = I.fileInfoTime finfo
!size = I.fileInfoSize finfo
!date = I.fileInfoDate finfo
!mcondition = ifmodified reqidx size mtime
<|> ifunmodified reqidx size mtime
<|> ifrange reqidx size mtime
!condition = fromMaybe (unconditional reqidx size) mcondition
----------------------------------------------------------------
| 869
|
conditionalRequest :: I.FileInfo
-> H.ResponseHeaders -> IndexedHeader
-> RspFileInfo
conditionalRequest finfo hs0 reqidx = case condition of
nobody@(WithoutBody _) -> nobody
WithBody s _ off len -> let !hs = (H.hLastModified,date) :
addContentHeaders hs0 off len size
in WithBody s hs off len
where
!mtime = I.fileInfoTime finfo
!size = I.fileInfoSize finfo
!date = I.fileInfoDate finfo
!mcondition = ifmodified reqidx size mtime
<|> ifunmodified reqidx size mtime
<|> ifrange reqidx size mtime
!condition = fromMaybe (unconditional reqidx size) mcondition
----------------------------------------------------------------
| 803
|
conditionalRequest finfo hs0 reqidx = case condition of
nobody@(WithoutBody _) -> nobody
WithBody s _ off len -> let !hs = (H.hLastModified,date) :
addContentHeaders hs0 off len size
in WithBody s hs off len
where
!mtime = I.fileInfoTime finfo
!size = I.fileInfoSize finfo
!date = I.fileInfoDate finfo
!mcondition = ifmodified reqidx size mtime
<|> ifunmodified reqidx size mtime
<|> ifrange reqidx size mtime
!condition = fromMaybe (unconditional reqidx size) mcondition
----------------------------------------------------------------
| 679
| true
| true
| 4
| 14
| 262
| 211
| 101
| 110
| null | null |
kim/amazonka
|
amazonka-kms/gen/Network/AWS/KMS/ReEncrypt.hs
|
mpl-2.0
|
-- | A unique identifier for the customer master key used to re-encrypt the data.
-- This value can be a globally unique identifier, a fully specified ARN to
-- either an alias or a key, or an alias name prefixed by "alias/". Key ARN
-- Example -
-- arn:aws:kms:us-east-1:123456789012:key/12345678-1234-1234-1234-123456789012 Alias ARN Example - arn:aws:kms:us-east-1:123456789012:/alias/MyAliasName
-- Globally Unique Key ID Example - 12345678-1234-1234-123456789012 Alias Name
-- Example - alias/MyAliasName
reDestinationKeyId :: Lens' ReEncrypt Text
reDestinationKeyId =
lens _reDestinationKeyId (\s a -> s { _reDestinationKeyId = a })
| 643
|
reDestinationKeyId :: Lens' ReEncrypt Text
reDestinationKeyId =
lens _reDestinationKeyId (\s a -> s { _reDestinationKeyId = a })
| 132
|
reDestinationKeyId =
lens _reDestinationKeyId (\s a -> s { _reDestinationKeyId = a })
| 89
| true
| true
| 0
| 9
| 91
| 46
| 28
| 18
| null | null |
DavidAlphaFox/darcs
|
src/Darcs/Util/Text.hs
|
gpl-2.0
|
-- |Take a list of words and split it up so that each chunk fits into the specified width
-- when spaces are included. Any words longer than the specified width end up in a chunk
-- of their own.
formatPara :: Int -> [[a]] -> [[[a]]]
formatPara w = para'
where para' [] = []
para' xs = uncurry (:) $ para'' w xs
para'' r (x:xs) | w == r || length x < r = first (x:) $ para'' (r - length x - 1) xs
para'' _ xs = ([], para' xs)
| 451
|
formatPara :: Int -> [[a]] -> [[[a]]]
formatPara w = para'
where para' [] = []
para' xs = uncurry (:) $ para'' w xs
para'' r (x:xs) | w == r || length x < r = first (x:) $ para'' (r - length x - 1) xs
para'' _ xs = ([], para' xs)
| 255
|
formatPara w = para'
where para' [] = []
para' xs = uncurry (:) $ para'' w xs
para'' r (x:xs) | w == r || length x < r = first (x:) $ para'' (r - length x - 1) xs
para'' _ xs = ([], para' xs)
| 217
| true
| true
| 4
| 12
| 121
| 163
| 86
| 77
| null | null |
michalkonecny/aern2
|
aern2-mp/src/AERN2/MP/Float/Operators.hs
|
bsd-3-clause
|
fromRationalUp :: Precision -> Rational -> MPFloat
fromRationalUp p = up1 (fromRationalCEDU p)
| 94
|
fromRationalUp :: Precision -> Rational -> MPFloat
fromRationalUp p = up1 (fromRationalCEDU p)
| 94
|
fromRationalUp p = up1 (fromRationalCEDU p)
| 43
| false
| true
| 0
| 8
| 12
| 37
| 16
| 21
| null | null |
Numberartificial/workflow
|
snipets/src/Craft/Chapter19/RegExp.hs
|
mit
|
enumerate (Ch ch) = [[ch]]
| 26
|
enumerate (Ch ch) = [[ch]]
| 26
|
enumerate (Ch ch) = [[ch]]
| 26
| false
| false
| 0
| 6
| 4
| 22
| 11
| 11
| null | null |
feliposz/learning-stuff
|
haskell/c9lectures-ch2.hs
|
mit
|
-- : is a list constructor operator. [] is the empty list
-- [1,2,3,4,5] is syntatic sugar for:
myOtherList = 1:2:3:4:5:[]
| 122
|
myOtherList = 1:2:3:4:5:[]
| 26
|
myOtherList = 1:2:3:4:5:[]
| 26
| true
| false
| 0
| 9
| 20
| 30
| 16
| 14
| null | null |
kim/amazonka
|
amazonka-ec2/gen/Network/AWS/EC2/TerminateInstances.hs
|
mpl-2.0
|
-- | 'TerminateInstancesResponse' constructor.
--
-- The fields accessible through corresponding lenses are:
--
-- * 'tirTerminatingInstances' @::@ ['InstanceStateChange']
--
terminateInstancesResponse :: TerminateInstancesResponse
terminateInstancesResponse = TerminateInstancesResponse
{ _tirTerminatingInstances = mempty
}
| 333
|
terminateInstancesResponse :: TerminateInstancesResponse
terminateInstancesResponse = TerminateInstancesResponse
{ _tirTerminatingInstances = mempty
}
| 158
|
terminateInstancesResponse = TerminateInstancesResponse
{ _tirTerminatingInstances = mempty
}
| 101
| true
| true
| 0
| 6
| 38
| 25
| 17
| 8
| null | null |
tjakway/ghcjvm
|
compiler/coreSyn/CoreFVs.hs
|
bsd-3-clause
|
expr_fvs (Lam bndr body) fv_cand in_scope acc =
addBndr bndr (expr_fvs body) fv_cand in_scope acc
| 99
|
expr_fvs (Lam bndr body) fv_cand in_scope acc =
addBndr bndr (expr_fvs body) fv_cand in_scope acc
| 99
|
expr_fvs (Lam bndr body) fv_cand in_scope acc =
addBndr bndr (expr_fvs body) fv_cand in_scope acc
| 99
| false
| false
| 0
| 7
| 16
| 40
| 19
| 21
| null | null |
flowbox-public/mainland-pretty
|
Text/PrettyPrint/Mainland.hs
|
bsd-3-clause
|
-- | The document @'dquotes' d@ encloses the aligned document @d@ in "...".
dquotes :: Doc -> Doc
dquotes = enclose dquote dquote . align
| 137
|
dquotes :: Doc -> Doc
dquotes = enclose dquote dquote . align
| 61
|
dquotes = enclose dquote dquote . align
| 39
| true
| true
| 0
| 6
| 24
| 25
| 13
| 12
| null | null |
atsukotakahashi/wi
|
src/library/Yi/Keymap/Vim/Motion.hs
|
gpl-2.0
|
matchGotoMarkMove :: String -> MatchResult Move
matchGotoMarkMove (m:_) | m `notElem` "'`" = NoMatch
| 100
|
matchGotoMarkMove :: String -> MatchResult Move
matchGotoMarkMove (m:_) | m `notElem` "'`" = NoMatch
| 100
|
matchGotoMarkMove (m:_) | m `notElem` "'`" = NoMatch
| 52
| false
| true
| 0
| 8
| 13
| 40
| 20
| 20
| null | null |
seppeljordan/hichachoe
|
Input.hs
|
gpl-3.0
|
numpadToCoord 9 = Just (2,0)
| 28
|
numpadToCoord 9 = Just (2,0)
| 28
|
numpadToCoord 9 = Just (2,0)
| 28
| false
| false
| 1
| 5
| 4
| 21
| 9
| 12
| null | null |
sgillespie/ghc
|
compiler/basicTypes/BasicTypes.hs
|
bsd-3-clause
|
tupleSortBoxity UnboxedTuple = Unboxed
| 41
|
tupleSortBoxity UnboxedTuple = Unboxed
| 41
|
tupleSortBoxity UnboxedTuple = Unboxed
| 41
| false
| false
| 1
| 5
| 6
| 13
| 4
| 9
| null | null |
yyotti/euler_haskell
|
src/P024.hs
|
mit
|
main :: IO ()
main = do
C.time "P024(Basic): " $ solveBasic [0..9] 1000000
C.time "P024 - 1: " $ solve1 [0..9] 1000000
C.time "P024 - 2: " $ solve2 [0..9] 1000000
-- 順列を作って指定された番号の要素をとる
-- Data.List.permutations だと並びが違うので自前で作る
| 233
|
main :: IO ()
main = do
C.time "P024(Basic): " $ solveBasic [0..9] 1000000
C.time "P024 - 1: " $ solve1 [0..9] 1000000
C.time "P024 - 2: " $ solve2 [0..9] 1000000
-- 順列を作って指定された番号の要素をとる
-- Data.List.permutations だと並びが違うので自前で作る
| 233
|
main = do
C.time "P024(Basic): " $ solveBasic [0..9] 1000000
C.time "P024 - 1: " $ solve1 [0..9] 1000000
C.time "P024 - 2: " $ solve2 [0..9] 1000000
-- 順列を作って指定された番号の要素をとる
-- Data.List.permutations だと並びが違うので自前で作る
| 219
| false
| true
| 0
| 10
| 43
| 90
| 41
| 49
| null | null |
oldmanmike/ghc
|
compiler/typecheck/TcType.hs
|
bsd-3-clause
|
isImprovementPred :: PredType -> Bool
-- Either it's an equality, or has some functional dependency
isImprovementPred ty
= case classifyPredType ty of
EqPred NomEq t1 t2 -> not (t1 `tcEqType` t2)
EqPred ReprEq _ _ -> False
ClassPred cls _ -> classHasFds cls
IrredPred {} -> True -- Might have equalities after reduction?
{-
Note [Inheriting implicit parameters]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Consider this:
f x = (x::Int) + ?y
where f is *not* a top-level binding.
From the RHS of f we'll get the constraint (?y::Int).
There are two types we might infer for f:
f :: Int -> Int
(so we get ?y from the context of f's definition), or
f :: (?y::Int) => Int -> Int
At first you might think the first was better, because then
?y behaves like a free variable of the definition, rather than
having to be passed at each call site. But of course, the WHOLE
IDEA is that ?y should be passed at each call site (that's what
dynamic binding means) so we'd better infer the second.
BOTTOM LINE: when *inferring types* you must quantify over implicit
parameters, *even if* they don't mention the bound type variables.
Reason: because implicit parameters, uniquely, have local instance
declarations. See pickQuantifiablePreds.
Note [Quantifying over equality constraints]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Should we quantify over an equality constraint (s ~ t)? In general, we don't.
Doing so may simply postpone a type error from the function definition site to
its call site. (At worst, imagine (Int ~ Bool)).
However, consider this
forall a. (F [a] ~ Int) => blah
Should we quantify over the (F [a] ~ Int). Perhaps yes, because at the call
site we will know 'a', and perhaps we have instance F [Bool] = Int.
So we *do* quantify over a type-family equality where the arguments mention
the quantified variables.
************************************************************************
* *
\subsection{Predicates}
* *
************************************************************************
-}
| 2,218
|
isImprovementPred :: PredType -> Bool
isImprovementPred ty
= case classifyPredType ty of
EqPred NomEq t1 t2 -> not (t1 `tcEqType` t2)
EqPred ReprEq _ _ -> False
ClassPred cls _ -> classHasFds cls
IrredPred {} -> True -- Might have equalities after reduction?
{-
Note [Inheriting implicit parameters]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Consider this:
f x = (x::Int) + ?y
where f is *not* a top-level binding.
From the RHS of f we'll get the constraint (?y::Int).
There are two types we might infer for f:
f :: Int -> Int
(so we get ?y from the context of f's definition), or
f :: (?y::Int) => Int -> Int
At first you might think the first was better, because then
?y behaves like a free variable of the definition, rather than
having to be passed at each call site. But of course, the WHOLE
IDEA is that ?y should be passed at each call site (that's what
dynamic binding means) so we'd better infer the second.
BOTTOM LINE: when *inferring types* you must quantify over implicit
parameters, *even if* they don't mention the bound type variables.
Reason: because implicit parameters, uniquely, have local instance
declarations. See pickQuantifiablePreds.
Note [Quantifying over equality constraints]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Should we quantify over an equality constraint (s ~ t)? In general, we don't.
Doing so may simply postpone a type error from the function definition site to
its call site. (At worst, imagine (Int ~ Bool)).
However, consider this
forall a. (F [a] ~ Int) => blah
Should we quantify over the (F [a] ~ Int). Perhaps yes, because at the call
site we will know 'a', and perhaps we have instance F [Bool] = Int.
So we *do* quantify over a type-family equality where the arguments mention
the quantified variables.
************************************************************************
* *
\subsection{Predicates}
* *
************************************************************************
-}
| 2,156
|
isImprovementPred ty
= case classifyPredType ty of
EqPred NomEq t1 t2 -> not (t1 `tcEqType` t2)
EqPred ReprEq _ _ -> False
ClassPred cls _ -> classHasFds cls
IrredPred {} -> True -- Might have equalities after reduction?
{-
Note [Inheriting implicit parameters]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Consider this:
f x = (x::Int) + ?y
where f is *not* a top-level binding.
From the RHS of f we'll get the constraint (?y::Int).
There are two types we might infer for f:
f :: Int -> Int
(so we get ?y from the context of f's definition), or
f :: (?y::Int) => Int -> Int
At first you might think the first was better, because then
?y behaves like a free variable of the definition, rather than
having to be passed at each call site. But of course, the WHOLE
IDEA is that ?y should be passed at each call site (that's what
dynamic binding means) so we'd better infer the second.
BOTTOM LINE: when *inferring types* you must quantify over implicit
parameters, *even if* they don't mention the bound type variables.
Reason: because implicit parameters, uniquely, have local instance
declarations. See pickQuantifiablePreds.
Note [Quantifying over equality constraints]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Should we quantify over an equality constraint (s ~ t)? In general, we don't.
Doing so may simply postpone a type error from the function definition site to
its call site. (At worst, imagine (Int ~ Bool)).
However, consider this
forall a. (F [a] ~ Int) => blah
Should we quantify over the (F [a] ~ Int). Perhaps yes, because at the call
site we will know 'a', and perhaps we have instance F [Bool] = Int.
So we *do* quantify over a type-family equality where the arguments mention
the quantified variables.
************************************************************************
* *
\subsection{Predicates}
* *
************************************************************************
-}
| 2,118
| true
| true
| 0
| 10
| 532
| 96
| 46
| 50
| null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.