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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
snoyberg/ghc | libraries/template-haskell/Language/Haskell/TH/Syntax.hs | bsd-3-clause | -----------------------------------------------------
--
-- Generic Lift implementations
--
-----------------------------------------------------
-- | 'dataToQa' is an internal utility function for constructing generic
-- conversion functions from types with 'Data' instances to various
-- quasi-quoting representations. See the source of 'dataToExpQ' and
-- 'dataToPatQ' for two example usages: @mkCon@, @mkLit@
-- and @appQ@ are overloadable to account for different syntax for
-- expressions and patterns; @antiQ@ allows you to override type-specific
-- cases, a common usage is just @const Nothing@, which results in
-- no overloading.
dataToQa :: forall a k q. Data a
=> (Name -> k)
-> (Lit -> Q q)
-> (k -> [Q q] -> Q q)
-> (forall b . Data b => b -> Maybe (Q q))
-> a
-> Q q
dataToQa mkCon mkLit appCon antiQ t =
case antiQ t of
Nothing ->
case constrRep constr of
AlgConstr _ ->
appCon (mkCon funOrConName) conArgs
where
funOrConName :: Name
funOrConName =
case showConstr constr of
"(:)" -> Name (mkOccName ":")
(NameG DataName
(mkPkgName "ghc-prim")
(mkModName "GHC.Types"))
con@"[]" -> Name (mkOccName con)
(NameG DataName
(mkPkgName "ghc-prim")
(mkModName "GHC.Types"))
con@('(':_) -> Name (mkOccName con)
(NameG DataName
(mkPkgName "ghc-prim")
(mkModName "GHC.Tuple"))
-- Tricky case: see Note [Data for non-algebraic types]
fun@(x:_) | startsVarSym x || startsVarId x
-> mkNameG_v tyconPkg tyconMod fun
con -> mkNameG_d tyconPkg tyconMod con
where
tycon :: TyCon
tycon = (typeRepTyCon . typeOf) t
tyconPkg, tyconMod :: String
tyconPkg = tyConPackage tycon
tyconMod = tyConModule tycon
conArgs :: [Q q]
conArgs = gmapQ (dataToQa mkCon mkLit appCon antiQ) t
IntConstr n ->
mkLit $ IntegerL n
FloatConstr n ->
mkLit $ RationalL n
CharConstr c ->
mkLit $ CharL c
where
constr :: Constr
constr = toConstr t
Just y -> y
{- Note [Data for non-algebraic types]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Class Data was originally intended for algebraic data types. But
it is possible to use it for abstract types too. For example, in
package `text` we find
instance Data Text where
...
toConstr _ = packConstr
packConstr :: Constr
packConstr = mkConstr textDataType "pack" [] Prefix
Here `packConstr` isn't a real data constructor, it's an ordiary
function. Two complications
* In such a case, we must take care to build the Name using
mkNameG_v (for values), not mkNameG_d (for data constructors).
See Trac #10796.
* The pseudo-constructor is named only by its string, here "pack".
But 'dataToQa' needs the TyCon of its defining module, and has
to assume it's defined in the same module as the TyCon itself.
But nothing enforces that; Trac #12596 shows what goes wrong if
"pack" is defined in a different module than the data type "Text".
-}
-- | 'dataToExpQ' converts a value to a 'Q Exp' representation of the
-- same value, in the SYB style. It is generalized to take a function
-- override type-specific cases; see 'liftData' for a more commonly
-- used variant. | 4,078 | dataToQa :: forall a k q. Data a
=> (Name -> k)
-> (Lit -> Q q)
-> (k -> [Q q] -> Q q)
-> (forall b . Data b => b -> Maybe (Q q))
-> a
-> Q q
dataToQa mkCon mkLit appCon antiQ t =
case antiQ t of
Nothing ->
case constrRep constr of
AlgConstr _ ->
appCon (mkCon funOrConName) conArgs
where
funOrConName :: Name
funOrConName =
case showConstr constr of
"(:)" -> Name (mkOccName ":")
(NameG DataName
(mkPkgName "ghc-prim")
(mkModName "GHC.Types"))
con@"[]" -> Name (mkOccName con)
(NameG DataName
(mkPkgName "ghc-prim")
(mkModName "GHC.Types"))
con@('(':_) -> Name (mkOccName con)
(NameG DataName
(mkPkgName "ghc-prim")
(mkModName "GHC.Tuple"))
-- Tricky case: see Note [Data for non-algebraic types]
fun@(x:_) | startsVarSym x || startsVarId x
-> mkNameG_v tyconPkg tyconMod fun
con -> mkNameG_d tyconPkg tyconMod con
where
tycon :: TyCon
tycon = (typeRepTyCon . typeOf) t
tyconPkg, tyconMod :: String
tyconPkg = tyConPackage tycon
tyconMod = tyConModule tycon
conArgs :: [Q q]
conArgs = gmapQ (dataToQa mkCon mkLit appCon antiQ) t
IntConstr n ->
mkLit $ IntegerL n
FloatConstr n ->
mkLit $ RationalL n
CharConstr c ->
mkLit $ CharL c
where
constr :: Constr
constr = toConstr t
Just y -> y
{- Note [Data for non-algebraic types]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Class Data was originally intended for algebraic data types. But
it is possible to use it for abstract types too. For example, in
package `text` we find
instance Data Text where
...
toConstr _ = packConstr
packConstr :: Constr
packConstr = mkConstr textDataType "pack" [] Prefix
Here `packConstr` isn't a real data constructor, it's an ordiary
function. Two complications
* In such a case, we must take care to build the Name using
mkNameG_v (for values), not mkNameG_d (for data constructors).
See Trac #10796.
* The pseudo-constructor is named only by its string, here "pack".
But 'dataToQa' needs the TyCon of its defining module, and has
to assume it's defined in the same module as the TyCon itself.
But nothing enforces that; Trac #12596 shows what goes wrong if
"pack" is defined in a different module than the data type "Text".
-}
-- | 'dataToExpQ' converts a value to a 'Q Exp' representation of the
-- same value, in the SYB style. It is generalized to take a function
-- override type-specific cases; see 'liftData' for a more commonly
-- used variant. | 3,423 | dataToQa mkCon mkLit appCon antiQ t =
case antiQ t of
Nothing ->
case constrRep constr of
AlgConstr _ ->
appCon (mkCon funOrConName) conArgs
where
funOrConName :: Name
funOrConName =
case showConstr constr of
"(:)" -> Name (mkOccName ":")
(NameG DataName
(mkPkgName "ghc-prim")
(mkModName "GHC.Types"))
con@"[]" -> Name (mkOccName con)
(NameG DataName
(mkPkgName "ghc-prim")
(mkModName "GHC.Types"))
con@('(':_) -> Name (mkOccName con)
(NameG DataName
(mkPkgName "ghc-prim")
(mkModName "GHC.Tuple"))
-- Tricky case: see Note [Data for non-algebraic types]
fun@(x:_) | startsVarSym x || startsVarId x
-> mkNameG_v tyconPkg tyconMod fun
con -> mkNameG_d tyconPkg tyconMod con
where
tycon :: TyCon
tycon = (typeRepTyCon . typeOf) t
tyconPkg, tyconMod :: String
tyconPkg = tyConPackage tycon
tyconMod = tyConModule tycon
conArgs :: [Q q]
conArgs = gmapQ (dataToQa mkCon mkLit appCon antiQ) t
IntConstr n ->
mkLit $ IntegerL n
FloatConstr n ->
mkLit $ RationalL n
CharConstr c ->
mkLit $ CharL c
where
constr :: Constr
constr = toConstr t
Just y -> y
{- Note [Data for non-algebraic types]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Class Data was originally intended for algebraic data types. But
it is possible to use it for abstract types too. For example, in
package `text` we find
instance Data Text where
...
toConstr _ = packConstr
packConstr :: Constr
packConstr = mkConstr textDataType "pack" [] Prefix
Here `packConstr` isn't a real data constructor, it's an ordiary
function. Two complications
* In such a case, we must take care to build the Name using
mkNameG_v (for values), not mkNameG_d (for data constructors).
See Trac #10796.
* The pseudo-constructor is named only by its string, here "pack".
But 'dataToQa' needs the TyCon of its defining module, and has
to assume it's defined in the same module as the TyCon itself.
But nothing enforces that; Trac #12596 shows what goes wrong if
"pack" is defined in a different module than the data type "Text".
-}
-- | 'dataToExpQ' converts a value to a 'Q Exp' representation of the
-- same value, in the SYB style. It is generalized to take a function
-- override type-specific cases; see 'liftData' for a more commonly
-- used variant. | 3,213 | true | true | 0 | 20 | 1,583 | 534 | 274 | 260 | null | null |
phischu/fragnix | tests/packages/scotty/Data.Vector.Generic.hs | bsd-3-clause | replicate n x = elemseq (undefined :: v a) x
$ unstream
$ Bundle.replicate n x | 106 | replicate n x = elemseq (undefined :: v a) x
$ unstream
$ Bundle.replicate n x | 106 | replicate n x = elemseq (undefined :: v a) x
$ unstream
$ Bundle.replicate n x | 106 | false | false | 0 | 9 | 43 | 40 | 19 | 21 | null | null |
ancientlanguage/haskell-analysis | greek-script/src/Grammar/Greek/Script/Rounds/UnicodeSymbol.hs | mit | symbolToChar S_Μ = 'Μ' | 22 | symbolToChar S_Μ = 'Μ' | 22 | symbolToChar S_Μ = 'Μ' | 22 | false | false | 0 | 5 | 3 | 11 | 5 | 6 | null | null |
timjs/spl-compiler | Old/Analyzer.hs | bsd-3-clause | --report :: (Show a, MonadWriter Errors m) => a -> String -> m ()
--report p m = tell $ [show p ++ ": " ++ m]
--warn
--error
--inform
ask :: Name -> Type
ask = undefined | 170 | ask :: Name -> Type
ask = undefined | 35 | ask = undefined | 15 | true | true | 0 | 7 | 38 | 27 | 14 | 13 | null | null |
gambogi/csh-eval | src/CSH/Eval/DB/Statements.hs | mit | -- | Fetch all event(s) with the given title.
getEventsTitleP :: T.Text -- ^ Event title
-> H.Stmt HP.Postgres
getEventsTitleP = [H.stmt|select * from "event" where "title" = ?|] | 194 | getEventsTitleP :: T.Text -- ^ Event title
-> H.Stmt HP.Postgres
getEventsTitleP = [H.stmt|select * from "event" where "title" = ?|] | 148 | getEventsTitleP = [H.stmt|select * from "event" where "title" = ?|] | 67 | true | true | 0 | 7 | 44 | 32 | 19 | 13 | null | null |
dimitri-xyz/market-model | test/Test.hs | bsd-3-clause | a1 = Quote { side = Ask, price = 10, volume = 40, qtail = -4} | 61 | a1 = Quote { side = Ask, price = 10, volume = 40, qtail = -4} | 61 | a1 = Quote { side = Ask, price = 10, volume = 40, qtail = -4} | 61 | false | false | 1 | 7 | 15 | 37 | 21 | 16 | null | null |
brendanhay/gogol | gogol-admin-directory/gen/Network/Google/Resource/Directory/Notifications/Update.hs | mpl-2.0 | -- | The unique ID for the customer\'s G Suite account.
nuCustomer :: Lens' NotificationsUpdate Text
nuCustomer
= lens _nuCustomer (\ s a -> s{_nuCustomer = a}) | 162 | nuCustomer :: Lens' NotificationsUpdate Text
nuCustomer
= lens _nuCustomer (\ s a -> s{_nuCustomer = a}) | 106 | nuCustomer
= lens _nuCustomer (\ s a -> s{_nuCustomer = a}) | 61 | true | true | 1 | 9 | 28 | 46 | 22 | 24 | null | null |
xldenis/ruby | src/Ruby/Parser/Lexer.hs | bsd-3-clause | revSym :: Parser Text
revSym = label "keyword" . lexeme $ pack <$> ((:) <$> letterChar <*> many midLetter <* char ':') | 118 | revSym :: Parser Text
revSym = label "keyword" . lexeme $ pack <$> ((:) <$> letterChar <*> many midLetter <* char ':') | 118 | revSym = label "keyword" . lexeme $ pack <$> ((:) <$> letterChar <*> many midLetter <* char ':') | 96 | false | true | 1 | 10 | 21 | 56 | 26 | 30 | null | null |
iconnect/aws-sign4 | Aws/Sign4.hs | bsd-3-clause | bunch_hs (p@(hn,_):ps) =
( CI.mk $ BC.map toLower $ CI.original hn
, BC.intercalate (BC.singleton ',') $ map snd $ p:ps
) | 145 | bunch_hs (p@(hn,_):ps) =
( CI.mk $ BC.map toLower $ CI.original hn
, BC.intercalate (BC.singleton ',') $ map snd $ p:ps
) | 145 | bunch_hs (p@(hn,_):ps) =
( CI.mk $ BC.map toLower $ CI.original hn
, BC.intercalate (BC.singleton ',') $ map snd $ p:ps
) | 145 | false | false | 0 | 12 | 44 | 80 | 40 | 40 | null | null |
phischu/fragnix | builtins/base/Text.ParserCombinators.ReadPrec.hs | bsd-3-clause | (+++) :: ReadPrec a -> ReadPrec a -> ReadPrec a
-- ^ Symmetric choice.
P f1 +++ P f2 = P (\n -> f1 n ReadP.+++ f2 n) | 116 | (+++) :: ReadPrec a -> ReadPrec a -> ReadPrec a
P f1 +++ P f2 = P (\n -> f1 n ReadP.+++ f2 n) | 93 | P f1 +++ P f2 = P (\n -> f1 n ReadP.+++ f2 n) | 45 | true | true | 0 | 9 | 27 | 66 | 31 | 35 | null | null |
kmels/hledger | hledger-lib/Hledger/Query.hs | gpl-3.0 | -- | Extract all date (or secondary date) spans specified in this query.
-- NOT is ignored.
queryDateSpans :: Bool -> Query -> [DateSpan]
queryDateSpans secondary (Or qs) = concatMap (queryDateSpans secondary) qs | 212 | queryDateSpans :: Bool -> Query -> [DateSpan]
queryDateSpans secondary (Or qs) = concatMap (queryDateSpans secondary) qs | 120 | queryDateSpans secondary (Or qs) = concatMap (queryDateSpans secondary) qs | 74 | true | true | 0 | 10 | 32 | 51 | 25 | 26 | null | null |
ekmett/wxHaskell | samples/test/Resize.hs | lgpl-2.1 | hello st pos
= do set st [text := "Hi!"
,on click ::= goodbye]
refitMinimal st | 106 | hello st pos
= do set st [text := "Hi!"
,on click ::= goodbye]
refitMinimal st | 106 | hello st pos
= do set st [text := "Hi!"
,on click ::= goodbye]
refitMinimal st | 106 | false | false | 0 | 10 | 43 | 43 | 19 | 24 | null | null |
a143753/AOJ | 2018.hs | apache-2.0 | main = do
c <- getContents
let i = map (map read) $ map words $ lines c :: [[Int]]
o = ans i
mapM_ print o | 118 | main = do
c <- getContents
let i = map (map read) $ map words $ lines c :: [[Int]]
o = ans i
mapM_ print o | 118 | main = do
c <- getContents
let i = map (map read) $ map words $ lines c :: [[Int]]
o = ans i
mapM_ print o | 118 | false | false | 0 | 14 | 38 | 70 | 33 | 37 | null | null |
ezyang/ghc | libraries/base/GHC/IO/Handle/FD.hs | bsd-3-clause | setBinaryMode fd = do _ <- setmode (FD.fdFD fd) True
return ()
#else
setBinaryMode _ = return ()
#endif
#if defined(mingw32_HOST_OS) | 155 | setBinaryMode fd = do _ <- setmode (FD.fdFD fd) True
return ()
#else
setBinaryMode _ = return ()
#endif
#if defined(mingw32_HOST_OS) | 155 | setBinaryMode fd = do _ <- setmode (FD.fdFD fd) True
return ()
#else
setBinaryMode _ = return ()
#endif
#if defined(mingw32_HOST_OS) | 155 | false | false | 1 | 12 | 43 | 44 | 19 | 25 | null | null |
brendanhay/gogol | gogol-sheets/gen/Network/Google/Sheets/Types/Product.hs | mpl-2.0 | -- | Adds a new conditional format rule.
reqAddConditionalFormatRule :: Lens' Request' (Maybe AddConditionalFormatRuleRequest)
reqAddConditionalFormatRule
= lens _reqAddConditionalFormatRule
(\ s a -> s{_reqAddConditionalFormatRule = a}) | 245 | reqAddConditionalFormatRule :: Lens' Request' (Maybe AddConditionalFormatRuleRequest)
reqAddConditionalFormatRule
= lens _reqAddConditionalFormatRule
(\ s a -> s{_reqAddConditionalFormatRule = a}) | 204 | reqAddConditionalFormatRule
= lens _reqAddConditionalFormatRule
(\ s a -> s{_reqAddConditionalFormatRule = a}) | 118 | true | true | 1 | 9 | 32 | 51 | 25 | 26 | null | null |
Bolt64/my_code | haskell/FixLines.hs | mit | splitLines cs =
let (pre, suf) = break isLineTerminator cs
in pre: case suf of
('\r':'\n':rest) ->splitLines rest
('\r':rest) ->splitLines rest
('\n':rest) ->splitLines rest
_ ->[] | 221 | splitLines cs =
let (pre, suf) = break isLineTerminator cs
in pre: case suf of
('\r':'\n':rest) ->splitLines rest
('\r':rest) ->splitLines rest
('\n':rest) ->splitLines rest
_ ->[] | 221 | splitLines cs =
let (pre, suf) = break isLineTerminator cs
in pre: case suf of
('\r':'\n':rest) ->splitLines rest
('\r':rest) ->splitLines rest
('\n':rest) ->splitLines rest
_ ->[] | 221 | false | false | 4 | 9 | 66 | 100 | 47 | 53 | null | null |
axman6/HLZ4 | src/Codec/Compression/HLZ4/Decode.hs | bsd-3-clause | advanceBothState :: Int -> PtrState -> PtrState
advanceBothState n st =
st {_soff = _soff st + n, _doff = _doff st + n} | 123 | advanceBothState :: Int -> PtrState -> PtrState
advanceBothState n st =
st {_soff = _soff st + n, _doff = _doff st + n} | 123 | advanceBothState n st =
st {_soff = _soff st + n, _doff = _doff st + n} | 75 | false | true | 0 | 9 | 27 | 56 | 28 | 28 | null | null |
satai/FrozenBeagle | Simulation/Lib/testsuite/UnitTests/SchemaSpec.hs | bsd-3-clause | allMatchingSchema :: Schema
allMatchingSchema = Schema $ replicate 8 Nothing | 76 | allMatchingSchema :: Schema
allMatchingSchema = Schema $ replicate 8 Nothing | 76 | allMatchingSchema = Schema $ replicate 8 Nothing | 48 | false | true | 0 | 6 | 9 | 20 | 10 | 10 | null | null |
SKA-ScienceDataProcessor/RC | MS5/programs/imaging.hs | apache-2.0 | dft :: Flow Image -> Flow UVGrid
dft = flow "dft" | 49 | dft :: Flow Image -> Flow UVGrid
dft = flow "dft" | 49 | dft = flow "dft" | 16 | false | true | 0 | 7 | 10 | 29 | 12 | 17 | null | null |
silky/MonadicRP | src/RPListTest.hs | gpl-3.0 | compactShow :: (Show a, Eq a) => [a] -> String
compactShow xs = intercalate ", " $ map (\xs -> show (length xs) ++ " x " ++ show (head xs)) $ group xs | 150 | compactShow :: (Show a, Eq a) => [a] -> String
compactShow xs = intercalate ", " $ map (\xs -> show (length xs) ++ " x " ++ show (head xs)) $ group xs | 150 | compactShow xs = intercalate ", " $ map (\xs -> show (length xs) ++ " x " ++ show (head xs)) $ group xs | 103 | false | true | 0 | 14 | 33 | 87 | 43 | 44 | null | null |
CulpaBS/wbBach | src/Futhark/CodeGen/Backends/GenericPython.hs | bsd-3-clause | compileFunc :: (Name, Imp.Function op) -> CompilerM op s PyFunDef
compileFunc (fname, Imp.Function _ outputs inputs body _ _) = do
body' <- collect $ compileCode body
let inputs' = map (pretty . Imp.paramName) inputs
let ret = Return $ tupleOrSingle $ compileOutput outputs
return $ Def (futharkFun . nameToString $ fname) ("self" : inputs') (body'++[ret]) | 364 | compileFunc :: (Name, Imp.Function op) -> CompilerM op s PyFunDef
compileFunc (fname, Imp.Function _ outputs inputs body _ _) = do
body' <- collect $ compileCode body
let inputs' = map (pretty . Imp.paramName) inputs
let ret = Return $ tupleOrSingle $ compileOutput outputs
return $ Def (futharkFun . nameToString $ fname) ("self" : inputs') (body'++[ret]) | 364 | compileFunc (fname, Imp.Function _ outputs inputs body _ _) = do
body' <- collect $ compileCode body
let inputs' = map (pretty . Imp.paramName) inputs
let ret = Return $ tupleOrSingle $ compileOutput outputs
return $ Def (futharkFun . nameToString $ fname) ("self" : inputs') (body'++[ret]) | 298 | false | true | 2 | 14 | 63 | 160 | 77 | 83 | null | null |
UCSD-PL/nano-js | Language/Nano/Typecheck/Types.hs | bsd-3-clause | ppTC (TDef x) = pprint x | 32 | ppTC (TDef x) = pprint x | 32 | ppTC (TDef x) = pprint x | 32 | false | false | 0 | 6 | 13 | 19 | 8 | 11 | null | null |
pparkkin/eta | compiler/ETA/Prelude/PrimOp.hs | bsd-3-clause | primOpInfo Narrow8WordOp = mkMonadic (fsLit "narrow8Word#") wordPrimTy | 70 | primOpInfo Narrow8WordOp = mkMonadic (fsLit "narrow8Word#") wordPrimTy | 70 | primOpInfo Narrow8WordOp = mkMonadic (fsLit "narrow8Word#") wordPrimTy | 70 | false | false | 0 | 7 | 6 | 20 | 9 | 11 | null | null |
rimmington/cabal | Cabal/tests/PackageTests.hs | bsd-3-clause | getPersistBuildConfig_ :: FilePath -> IO LocalBuildInfo
getPersistBuildConfig_ filename = do
eLBI <- try $ getConfigStateFile filename
case eLBI of
Left (ConfigStateFileBadVersion _ _ (Right lbi)) -> return lbi
Left (ConfigStateFileBadVersion _ _ (Left err)) -> throw err
Left err -> throw err
Right lbi -> return lbi | 349 | getPersistBuildConfig_ :: FilePath -> IO LocalBuildInfo
getPersistBuildConfig_ filename = do
eLBI <- try $ getConfigStateFile filename
case eLBI of
Left (ConfigStateFileBadVersion _ _ (Right lbi)) -> return lbi
Left (ConfigStateFileBadVersion _ _ (Left err)) -> throw err
Left err -> throw err
Right lbi -> return lbi | 349 | getPersistBuildConfig_ filename = do
eLBI <- try $ getConfigStateFile filename
case eLBI of
Left (ConfigStateFileBadVersion _ _ (Right lbi)) -> return lbi
Left (ConfigStateFileBadVersion _ _ (Left err)) -> throw err
Left err -> throw err
Right lbi -> return lbi | 293 | false | true | 0 | 14 | 78 | 122 | 55 | 67 | null | null |
alexander-at-github/eta | compiler/ETA/Utils/Pretty.hs | bsd-3-clause | text s = case iUnbox (length s) of {sl -> textBeside_ (Str s) sl Empty} | 75 | text s = case iUnbox (length s) of {sl -> textBeside_ (Str s) sl Empty} | 75 | text s = case iUnbox (length s) of {sl -> textBeside_ (Str s) sl Empty} | 75 | false | false | 1 | 10 | 18 | 46 | 21 | 25 | null | null |
green-haskell/ghc | libraries/template-haskell/Language/Haskell/TH/Ppr.hs | bsd-3-clause | pprTyApp (EqualityT, [arg1, arg2]) =
sep [pprFunArgType arg1 <+> text "~", ppr arg2] | 88 | pprTyApp (EqualityT, [arg1, arg2]) =
sep [pprFunArgType arg1 <+> text "~", ppr arg2] | 88 | pprTyApp (EqualityT, [arg1, arg2]) =
sep [pprFunArgType arg1 <+> text "~", ppr arg2] | 88 | false | false | 0 | 8 | 16 | 43 | 22 | 21 | null | null |
timjb/lens | src/Data/Text/Lazy/Lens.hs | bsd-3-clause | ifoldrLazy :: (Int -> Char -> a -> a) -> a -> Text -> a
ifoldrLazy f z xs = Text.foldr (\ x g i -> i `seq` f i x (g (i+1))) (const z) xs 0 | 138 | ifoldrLazy :: (Int -> Char -> a -> a) -> a -> Text -> a
ifoldrLazy f z xs = Text.foldr (\ x g i -> i `seq` f i x (g (i+1))) (const z) xs 0 | 138 | ifoldrLazy f z xs = Text.foldr (\ x g i -> i `seq` f i x (g (i+1))) (const z) xs 0 | 82 | false | true | 0 | 13 | 36 | 100 | 52 | 48 | null | null |
markflorisson/hpack | src/HPack/Monads.hs | bsd-3-clause | throw :: Monad m => e -> HPackT e s m a
throw = HPackT . M.throwE | 65 | throw :: Monad m => e -> HPackT e s m a
throw = HPackT . M.throwE | 65 | throw = HPackT . M.throwE | 25 | false | true | 0 | 7 | 16 | 37 | 18 | 19 | null | null |
capitanbatata/sandbox | leaves-of-a-tree/src/Data/BinTree.hs | gpl-3.0 | -- | Compute the leaves in a state monad.
leavesS :: BinTree a -> [a]
leavesS t = execState (leavesS' t) []
where leavesS' :: BinTree a -> State [a] ()
leavesS' Nil = return ()
leavesS' (Fork x Nil Nil) = modify (\xs -> x:xs)
leavesS' (Fork _ lt rt) = leavesS' lt >> leavesS' rt
-- | Generate a tree from a list. | 339 | leavesS :: BinTree a -> [a]
leavesS t = execState (leavesS' t) []
where leavesS' :: BinTree a -> State [a] ()
leavesS' Nil = return ()
leavesS' (Fork x Nil Nil) = modify (\xs -> x:xs)
leavesS' (Fork _ lt rt) = leavesS' lt >> leavesS' rt
-- | Generate a tree from a list. | 297 | leavesS t = execState (leavesS' t) []
where leavesS' :: BinTree a -> State [a] ()
leavesS' Nil = return ()
leavesS' (Fork x Nil Nil) = modify (\xs -> x:xs)
leavesS' (Fork _ lt rt) = leavesS' lt >> leavesS' rt
-- | Generate a tree from a list. | 269 | true | true | 4 | 9 | 91 | 134 | 68 | 66 | null | null |
spinda/liquidhaskell | src/Language/Haskell/Liquid/Desugar710/StaticPtrTable.hs | bsd-3-clause | sptInitCode this_mod entries = vcat
[ text "static void hs_spt_init_" <> ppr this_mod
<> text "(void) __attribute__((constructor));"
, text "static void hs_spt_init_" <> ppr this_mod <> text "(void)"
, braces $ vcat $
[ text "static StgWord64 k" <> int i <> text "[2] = "
<> pprFingerprint fp <> semi
$$ text "extern StgPtr "
<> (ppr $ mkClosureLabel (idName n) (idCafInfo n)) <> semi
$$ text "hs_spt_insert" <> parens
(hcat $ punctuate comma
[ char 'k' <> int i
, char '&' <> ppr (mkClosureLabel (idName n) (idCafInfo n))
]
)
<> semi
| (i, (fp, (n, _))) <- zip [0..] entries
]
, text "static void hs_spt_fini_" <> ppr this_mod
<> text "(void) __attribute__((destructor));"
, text "static void hs_spt_fini_" <> ppr this_mod <> text "(void)"
, braces $ vcat $
[ text "StgWord64 k" <> int i <> text "[2] = "
<> pprFingerprint fp <> semi
$$ text "hs_spt_remove" <> parens (char 'k' <> int i) <> semi
| (i, (fp, _)) <- zip [0..] entries
]
]
where
pprFingerprint :: Fingerprint -> SDoc
pprFingerprint (Fingerprint w1 w2) =
braces $ hcat $ punctuate comma
[ integer (fromIntegral w1) <> text "ULL"
, integer (fromIntegral w2) <> text "ULL"
] | 1,444 | sptInitCode this_mod entries = vcat
[ text "static void hs_spt_init_" <> ppr this_mod
<> text "(void) __attribute__((constructor));"
, text "static void hs_spt_init_" <> ppr this_mod <> text "(void)"
, braces $ vcat $
[ text "static StgWord64 k" <> int i <> text "[2] = "
<> pprFingerprint fp <> semi
$$ text "extern StgPtr "
<> (ppr $ mkClosureLabel (idName n) (idCafInfo n)) <> semi
$$ text "hs_spt_insert" <> parens
(hcat $ punctuate comma
[ char 'k' <> int i
, char '&' <> ppr (mkClosureLabel (idName n) (idCafInfo n))
]
)
<> semi
| (i, (fp, (n, _))) <- zip [0..] entries
]
, text "static void hs_spt_fini_" <> ppr this_mod
<> text "(void) __attribute__((destructor));"
, text "static void hs_spt_fini_" <> ppr this_mod <> text "(void)"
, braces $ vcat $
[ text "StgWord64 k" <> int i <> text "[2] = "
<> pprFingerprint fp <> semi
$$ text "hs_spt_remove" <> parens (char 'k' <> int i) <> semi
| (i, (fp, _)) <- zip [0..] entries
]
]
where
pprFingerprint :: Fingerprint -> SDoc
pprFingerprint (Fingerprint w1 w2) =
braces $ hcat $ punctuate comma
[ integer (fromIntegral w1) <> text "ULL"
, integer (fromIntegral w2) <> text "ULL"
] | 1,444 | sptInitCode this_mod entries = vcat
[ text "static void hs_spt_init_" <> ppr this_mod
<> text "(void) __attribute__((constructor));"
, text "static void hs_spt_init_" <> ppr this_mod <> text "(void)"
, braces $ vcat $
[ text "static StgWord64 k" <> int i <> text "[2] = "
<> pprFingerprint fp <> semi
$$ text "extern StgPtr "
<> (ppr $ mkClosureLabel (idName n) (idCafInfo n)) <> semi
$$ text "hs_spt_insert" <> parens
(hcat $ punctuate comma
[ char 'k' <> int i
, char '&' <> ppr (mkClosureLabel (idName n) (idCafInfo n))
]
)
<> semi
| (i, (fp, (n, _))) <- zip [0..] entries
]
, text "static void hs_spt_fini_" <> ppr this_mod
<> text "(void) __attribute__((destructor));"
, text "static void hs_spt_fini_" <> ppr this_mod <> text "(void)"
, braces $ vcat $
[ text "StgWord64 k" <> int i <> text "[2] = "
<> pprFingerprint fp <> semi
$$ text "hs_spt_remove" <> parens (char 'k' <> int i) <> semi
| (i, (fp, _)) <- zip [0..] entries
]
]
where
pprFingerprint :: Fingerprint -> SDoc
pprFingerprint (Fingerprint w1 w2) =
braces $ hcat $ punctuate comma
[ integer (fromIntegral w1) <> text "ULL"
, integer (fromIntegral w2) <> text "ULL"
] | 1,444 | false | false | 0 | 20 | 512 | 465 | 225 | 240 | null | null |
hpacheco/HAAP | src/HAAP/Web/Hakyll.hs | mit | funRoute :: (FilePath -> FilePath) -> Routes
funRoute f = customRoute (f . toFilePath) | 86 | funRoute :: (FilePath -> FilePath) -> Routes
funRoute f = customRoute (f . toFilePath) | 86 | funRoute f = customRoute (f . toFilePath) | 41 | false | true | 0 | 7 | 13 | 35 | 18 | 17 | null | null |
Numberartificial/workflow | haskell-first-principles/haskell-from-first-principles-master/03/03.08.02-textTransforms.hs | mit | forthChar text = text !! 4 | 26 | forthChar text = text !! 4 | 26 | forthChar text = text !! 4 | 26 | false | false | 0 | 5 | 5 | 13 | 6 | 7 | null | null |
ducis/cassandra-minimalist | cassandra-cql-0.3.0.1/Database/Cassandra/CQL1.hs | apache-2.0 | putFlags :: [Flag] -> Put
putFlags flags = putWord8 $ foldl' (+) 0 $ map toWord8 flags
where
toWord8 Compression = 0x01
toWord8 Tracing = 0x02 | 152 | putFlags :: [Flag] -> Put
putFlags flags = putWord8 $ foldl' (+) 0 $ map toWord8 flags
where
toWord8 Compression = 0x01
toWord8 Tracing = 0x02 | 152 | putFlags flags = putWord8 $ foldl' (+) 0 $ map toWord8 flags
where
toWord8 Compression = 0x01
toWord8 Tracing = 0x02 | 126 | false | true | 2 | 7 | 35 | 72 | 31 | 41 | null | null |
spinda/liquidhaskell | tests/gsoc15/unknown/pos/maps.hs | bsd-3-clause | get :: k -> Map k v -> v
get = undefined | 40 | get :: k -> Map k v -> v
get = undefined | 40 | get = undefined | 15 | false | true | 0 | 8 | 11 | 31 | 13 | 18 | null | null |
sviperll/LambdaInterpreter | src/Lambda/Zipper.hs | gpl-3.0 | -- liftZipper takes zipper transformer and creates term transformer from it.
termToZipper :: Term -> Zipper
termToZipper = Zipper . Zip [] | 139 | termToZipper :: Term -> Zipper
termToZipper = Zipper . Zip [] | 61 | termToZipper = Zipper . Zip [] | 30 | true | true | 0 | 7 | 22 | 25 | 13 | 12 | null | null |
robbinch/tinc | src/Util.hs | mit | listDirectoryContents :: FilePath -> IO [FilePath]
listDirectoryContents dir = sort . map (dir </>) <$> getDirectoryContents dir | 128 | listDirectoryContents :: FilePath -> IO [FilePath]
listDirectoryContents dir = sort . map (dir </>) <$> getDirectoryContents dir | 128 | listDirectoryContents dir = sort . map (dir </>) <$> getDirectoryContents dir | 77 | false | true | 0 | 8 | 16 | 46 | 22 | 24 | null | null |
nushio3/Paraiso | Test/Paraiso/Option.hs | bsd-3-clause | cudac :: FilePath -- external cuda compiler to use.
cudac = "nvcc" | 66 | cudac :: FilePath
cudac = "nvcc" | 32 | cudac = "nvcc" | 14 | true | true | 0 | 4 | 11 | 12 | 7 | 5 | null | null |
joranvar/GCJ | src/gcj-lib/Y2008/R1A/A.hs | gpl-3.0 | read :: (Read a) => a -> String -> a
read d = maybe d fst . head . reads | 72 | read :: (Read a) => a -> String -> a
read d = maybe d fst . head . reads | 72 | read d = maybe d fst . head . reads | 35 | false | true | 2 | 9 | 19 | 53 | 23 | 30 | null | null |
HIPERFIT/futhark | src/Futhark/IR/SegOp.hs | isc | checkSegSpace :: TC.Checkable rep => SegSpace -> TC.TypeM rep ()
checkSegSpace (SegSpace _ dims) =
mapM_ (TC.require [Prim int64] . snd) dims | 143 | checkSegSpace :: TC.Checkable rep => SegSpace -> TC.TypeM rep ()
checkSegSpace (SegSpace _ dims) =
mapM_ (TC.require [Prim int64] . snd) dims | 143 | checkSegSpace (SegSpace _ dims) =
mapM_ (TC.require [Prim int64] . snd) dims | 78 | false | true | 0 | 10 | 23 | 67 | 32 | 35 | null | null |
juanmab37/HOpenCV-0.5.0.1 | src/HOpenCV/CV/ImgProc.hs | gpl-2.0 | fromCvtColorFlag LBGR2Lab = 74 | 34 | fromCvtColorFlag LBGR2Lab = 74 | 34 | fromCvtColorFlag LBGR2Lab = 74 | 34 | false | false | 0 | 5 | 7 | 9 | 4 | 5 | null | null |
acowley/ghc | compiler/prelude/PrelNames.hs | bsd-3-clause | -- Word module
word16TyConName, word32TyConName, word64TyConName :: Name
word16TyConName = tcQual gHC_WORD (fsLit "Word16") word16TyConKey | 141 | word16TyConName, word32TyConName, word64TyConName :: Name
word16TyConName = tcQual gHC_WORD (fsLit "Word16") word16TyConKey | 126 | word16TyConName = tcQual gHC_WORD (fsLit "Word16") word16TyConKey | 68 | true | true | 0 | 7 | 17 | 29 | 17 | 12 | null | null |
ariskou/skroutz-haskell-api | examples/example1/Main.hs | apache-2.0 | exampleApiCall :: Text -> IO ()
exampleApiCall authToken = do
manager <- newManager Skroutz.defaultDataManagerSettings
eitherResult <- Skroutz.runAPIMethod manager Skroutz.defaultDataBaseUrl (Skroutz.withStdParamsPagedDefaults Skroutz.getCategories authToken)
putStrLn $ either show showResult eitherResult | 312 | exampleApiCall :: Text -> IO ()
exampleApiCall authToken = do
manager <- newManager Skroutz.defaultDataManagerSettings
eitherResult <- Skroutz.runAPIMethod manager Skroutz.defaultDataBaseUrl (Skroutz.withStdParamsPagedDefaults Skroutz.getCategories authToken)
putStrLn $ either show showResult eitherResult | 312 | exampleApiCall authToken = do
manager <- newManager Skroutz.defaultDataManagerSettings
eitherResult <- Skroutz.runAPIMethod manager Skroutz.defaultDataBaseUrl (Skroutz.withStdParamsPagedDefaults Skroutz.getCategories authToken)
putStrLn $ either show showResult eitherResult | 280 | false | true | 0 | 11 | 33 | 79 | 36 | 43 | null | null |
ghorn/dynobud | dynobud/examples/Quadrature.hs | lgpl-3.0 | bcBnds :: QuadBc Bounds
bcBnds =
QuadBc
(QuadX
{ xP = (Just 0, Just 0)
, xV = (Just 0, Just 0)
}) | 110 | bcBnds :: QuadBc Bounds
bcBnds =
QuadBc
(QuadX
{ xP = (Just 0, Just 0)
, xV = (Just 0, Just 0)
}) | 110 | bcBnds =
QuadBc
(QuadX
{ xP = (Just 0, Just 0)
, xV = (Just 0, Just 0)
}) | 86 | false | true | 0 | 9 | 35 | 63 | 32 | 31 | null | null |
rayl/gedcom-tools | Main.hs | bsd-3-clause | rNSFX = chk "NSFX" | 18 | rNSFX = chk "NSFX" | 18 | rNSFX = chk "NSFX" | 18 | false | false | 1 | 5 | 3 | 13 | 4 | 9 | null | null |
aminb/blog | src/Main.hs | gpl-3.0 | writeTalksArchive :: Template.Context -> Template.Template -> [P.Talk] -> Config -> IO Artifact
writeTalksArchive globalContext template talks = writePage 2 "/talks" context template
where context = M.unions [ P.talksContext talks
, Template.stringField "title" "Talks by Amin Bandali"
, Template.stringField "bold-font" "true"
, globalContext ]
-- Given the contact template and the global context, writes the contact page
-- to the destination directory. | 544 | writeTalksArchive :: Template.Context -> Template.Template -> [P.Talk] -> Config -> IO Artifact
writeTalksArchive globalContext template talks = writePage 2 "/talks" context template
where context = M.unions [ P.talksContext talks
, Template.stringField "title" "Talks by Amin Bandali"
, Template.stringField "bold-font" "true"
, globalContext ]
-- Given the contact template and the global context, writes the contact page
-- to the destination directory. | 544 | writeTalksArchive globalContext template talks = writePage 2 "/talks" context template
where context = M.unions [ P.talksContext talks
, Template.stringField "title" "Talks by Amin Bandali"
, Template.stringField "bold-font" "true"
, globalContext ]
-- Given the contact template and the global context, writes the contact page
-- to the destination directory. | 448 | false | true | 0 | 9 | 148 | 101 | 51 | 50 | null | null |
aleator/CV | performance/Iterators.hs | bsd-3-clause | repaMax img = foldAllP min (100) $
fromFunction (Z :. w :. h)
(\(Z :. x :. y) -> getPixel (x,y) img)
where (w,h) = getSize img | 171 | repaMax img = foldAllP min (100) $
fromFunction (Z :. w :. h)
(\(Z :. x :. y) -> getPixel (x,y) img)
where (w,h) = getSize img | 171 | repaMax img = foldAllP min (100) $
fromFunction (Z :. w :. h)
(\(Z :. x :. y) -> getPixel (x,y) img)
where (w,h) = getSize img | 171 | false | false | 0 | 11 | 71 | 84 | 44 | 40 | null | null |
abooij/sudbury | Graphics/Sudbury/Lifetime.hs | mit | localCreate :: Lifetime a -> Id -> a -> STM ()
localCreate = foreignCreate | 74 | localCreate :: Lifetime a -> Id -> a -> STM ()
localCreate = foreignCreate | 74 | localCreate = foreignCreate | 27 | false | true | 0 | 9 | 13 | 31 | 15 | 16 | null | null |
mapinguari/SC_HS_Proxy | src/Proxy/Query/Unit.hs | mit | supplyRequired ZergEgg = 0 | 26 | supplyRequired ZergEgg = 0 | 26 | supplyRequired ZergEgg = 0 | 26 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
nevrenato/Hets_Fork | Lottery/Zaehler.hs | gpl-2.0 | {- getPredSorts liefert die Liste der "Parameter"-Sorten des
uebergebenen Praedikats -}
getPredSorts (Pred p_name (Pred_type s_list pos_list)) = s_list | 154 | getPredSorts (Pred p_name (Pred_type s_list pos_list)) = s_list | 63 | getPredSorts (Pred p_name (Pred_type s_list pos_list)) = s_list | 63 | true | false | 0 | 9 | 21 | 26 | 13 | 13 | null | null |
fpco/schoolofhaskell.com | src/Import/Migration.hs | mit | -- | Migrations performed /after/ the Persistent migration.
performPostMigrations :: MigrationSettings -> App -> M ()
performPostMigrations _ms _app = return () | 160 | performPostMigrations :: MigrationSettings -> App -> M ()
performPostMigrations _ms _app = return () | 100 | performPostMigrations _ms _app = return () | 42 | true | true | 0 | 8 | 21 | 35 | 17 | 18 | null | null |
KukovecJ/Nemogoci_Funkcionali | Find_X.hs | gpl-2.0 | -- | Saves the result yielded by the evaluation of the given predicate, to be used when needed.
find_iii :: (Cantor -> Bool) -> Cantor
find_iii p = h # find_iii(\a -> p(h # a))
where h = if p(Zero # find_iii(\a -> p(Zero # a))) then Zero else One
-- | An improvement over 'Functions.find_i', but worse that 'find_iii', due to not having pruned its branching via laziness. | 376 | find_iii :: (Cantor -> Bool) -> Cantor
find_iii p = h # find_iii(\a -> p(h # a))
where h = if p(Zero # find_iii(\a -> p(Zero # a))) then Zero else One
-- | An improvement over 'Functions.find_i', but worse that 'find_iii', due to not having pruned its branching via laziness. | 280 | find_iii p = h # find_iii(\a -> p(h # a))
where h = if p(Zero # find_iii(\a -> p(Zero # a))) then Zero else One
-- | An improvement over 'Functions.find_i', but worse that 'find_iii', due to not having pruned its branching via laziness. | 241 | true | true | 0 | 14 | 73 | 99 | 53 | 46 | null | null |
jtojnar/haste-compiler | libraries/ghc-7.8/base/GHC/IO/Handle/Text.hs | bsd-3-clause | hPutBuf':: Handle -- handle to write to
-> Ptr a -- address of buffer
-> Int -- number of bytes of data in buffer
-> Bool -- allow blocking?
-> IO Int
hPutBuf' handle ptr count can_block
| count == 0 = return 0
| count < 0 = illegalBufferSize handle "hPutBuf" count
| otherwise =
wantWritableHandle "hPutBuf" handle $
\ h_@Handle__{..} -> do
debugIO ("hPutBuf count=" ++ show count)
r <- bufWrite h_ (castPtr ptr) count can_block
-- we must flush if this Handle is set to NoBuffering. If
-- it is set to LineBuffering, be conservative and flush
-- anyway (we didn't check for newlines in the data).
case haBufferMode of
BlockBuffering _ -> do return ()
_line_or_no_buffering -> do flushWriteBuffer h_
return r | 958 | hPutBuf':: Handle -- handle to write to
-> Ptr a -- address of buffer
-> Int -- number of bytes of data in buffer
-> Bool -- allow blocking?
-> IO Int
hPutBuf' handle ptr count can_block
| count == 0 = return 0
| count < 0 = illegalBufferSize handle "hPutBuf" count
| otherwise =
wantWritableHandle "hPutBuf" handle $
\ h_@Handle__{..} -> do
debugIO ("hPutBuf count=" ++ show count)
r <- bufWrite h_ (castPtr ptr) count can_block
-- we must flush if this Handle is set to NoBuffering. If
-- it is set to LineBuffering, be conservative and flush
-- anyway (we didn't check for newlines in the data).
case haBufferMode of
BlockBuffering _ -> do return ()
_line_or_no_buffering -> do flushWriteBuffer h_
return r | 958 | hPutBuf' handle ptr count can_block
| count == 0 = return 0
| count < 0 = illegalBufferSize handle "hPutBuf" count
| otherwise =
wantWritableHandle "hPutBuf" handle $
\ h_@Handle__{..} -> do
debugIO ("hPutBuf count=" ++ show count)
r <- bufWrite h_ (castPtr ptr) count can_block
-- we must flush if this Handle is set to NoBuffering. If
-- it is set to LineBuffering, be conservative and flush
-- anyway (we didn't check for newlines in the data).
case haBufferMode of
BlockBuffering _ -> do return ()
_line_or_no_buffering -> do flushWriteBuffer h_
return r | 681 | false | true | 2 | 16 | 374 | 193 | 91 | 102 | null | null |
bonnefoa/Shaker | src/Shaker/Conductor.hs | isc | threadExecutor' :: ConductorData -> Shaker IO Bool
threadExecutor' (ConductorData listenState fun) = lift $ takeMVar (mvModifiedFiles listenState) >>= fun >> return True | 169 | threadExecutor' :: ConductorData -> Shaker IO Bool
threadExecutor' (ConductorData listenState fun) = lift $ takeMVar (mvModifiedFiles listenState) >>= fun >> return True | 169 | threadExecutor' (ConductorData listenState fun) = lift $ takeMVar (mvModifiedFiles listenState) >>= fun >> return True | 118 | false | true | 0 | 10 | 21 | 55 | 26 | 29 | null | null |
TomMD/cryptol | sbv/Data/SBV/Provers/Prover.hs | bsd-3-clause | -- | Default configuration for the CVC4 SMT Solver.
cvc4 :: SMTConfig
cvc4 = mkConfig CVC4.cvc4 True [] | 103 | cvc4 :: SMTConfig
cvc4 = mkConfig CVC4.cvc4 True [] | 51 | cvc4 = mkConfig CVC4.cvc4 True [] | 33 | true | true | 0 | 6 | 17 | 23 | 12 | 11 | null | null |
smaccm/capDL-tool | CapDL/PrintIsabelle.hs | bsd-2-clause | showID (name, Just num) = name ++ "_" ++ show num | 49 | showID (name, Just num) = name ++ "_" ++ show num | 49 | showID (name, Just num) = name ++ "_" ++ show num | 49 | false | false | 0 | 6 | 10 | 30 | 14 | 16 | null | null |
sgillespie/ghc | compiler/basicTypes/OccName.hs | bsd-3-clause | plusOccEnv (A x) (A y) = A $ plusUFM x y | 42 | plusOccEnv (A x) (A y) = A $ plusUFM x y | 42 | plusOccEnv (A x) (A y) = A $ plusUFM x y | 42 | false | false | 0 | 7 | 12 | 32 | 15 | 17 | null | null |
eklavya/Idris-dev | src/Idris/Delaborate.hs | bsd-3-clause | pprintErr' i (UniqueError _ n) = text "Unique name" <+> annName' n (showbasic n)
<+> text "is used more than once" | 148 | pprintErr' i (UniqueError _ n) = text "Unique name" <+> annName' n (showbasic n)
<+> text "is used more than once" | 148 | pprintErr' i (UniqueError _ n) = text "Unique name" <+> annName' n (showbasic n)
<+> text "is used more than once" | 148 | false | false | 0 | 9 | 54 | 44 | 20 | 24 | null | null |
jvoigtlaender/elm-lang.org | src/backend/Init/FileTree.hs | bsd-3-clause | init :: IO ()
init =
mapM_ (initFileTree ".") fileTree | 56 | init :: IO ()
init =
mapM_ (initFileTree ".") fileTree | 56 | init =
mapM_ (initFileTree ".") fileTree | 42 | false | true | 1 | 7 | 11 | 30 | 13 | 17 | null | null |
ambiata/zodiac | zodiac-tsrp/src/Zodiac/TSRP/Data/Symmetric.hs | bsd-3-clause | symmetricAuthHeaderP :: AB.Parser SymmetricAuthHeader
symmetricAuthHeaderP = do
proto <- liftP parseSymmetricProtocol =<< next
kid <- liftP parseKeyId =<< next
rts <- liftP parseRequestTimestamp =<< next
re <- liftP parseRequestExpiry =<< next
sh <- liftP parseCSignedHeaders =<< next
mac <- utf8P (liftP parseMAC) =<< AB.takeByteString
pure $ SymmetricAuthHeader proto kid rts re sh mac
where
utf8P p bs = case T.decodeUtf8' bs of
Left e -> fail $ "error decoding UTF-8: " <> show e
Right t -> p t
next = do
p <- AB.takeTill isSpace
AB.skip isSpace
pure p
isSpace 0x20 = True
isSpace _ = False
liftP f bs = case f bs of
Just' x -> pure x
Nothing' -> fail "Zodiac.Data.Symmetric.parseSymmetricAuthHeader" | 791 | symmetricAuthHeaderP :: AB.Parser SymmetricAuthHeader
symmetricAuthHeaderP = do
proto <- liftP parseSymmetricProtocol =<< next
kid <- liftP parseKeyId =<< next
rts <- liftP parseRequestTimestamp =<< next
re <- liftP parseRequestExpiry =<< next
sh <- liftP parseCSignedHeaders =<< next
mac <- utf8P (liftP parseMAC) =<< AB.takeByteString
pure $ SymmetricAuthHeader proto kid rts re sh mac
where
utf8P p bs = case T.decodeUtf8' bs of
Left e -> fail $ "error decoding UTF-8: " <> show e
Right t -> p t
next = do
p <- AB.takeTill isSpace
AB.skip isSpace
pure p
isSpace 0x20 = True
isSpace _ = False
liftP f bs = case f bs of
Just' x -> pure x
Nothing' -> fail "Zodiac.Data.Symmetric.parseSymmetricAuthHeader" | 791 | symmetricAuthHeaderP = do
proto <- liftP parseSymmetricProtocol =<< next
kid <- liftP parseKeyId =<< next
rts <- liftP parseRequestTimestamp =<< next
re <- liftP parseRequestExpiry =<< next
sh <- liftP parseCSignedHeaders =<< next
mac <- utf8P (liftP parseMAC) =<< AB.takeByteString
pure $ SymmetricAuthHeader proto kid rts re sh mac
where
utf8P p bs = case T.decodeUtf8' bs of
Left e -> fail $ "error decoding UTF-8: " <> show e
Right t -> p t
next = do
p <- AB.takeTill isSpace
AB.skip isSpace
pure p
isSpace 0x20 = True
isSpace _ = False
liftP f bs = case f bs of
Just' x -> pure x
Nothing' -> fail "Zodiac.Data.Symmetric.parseSymmetricAuthHeader" | 737 | false | true | 5 | 11 | 201 | 285 | 119 | 166 | null | null |
michaelbjames/ecma6-parser | Parse/Language.hs | bsd-2-clause | reservedOperators =
[ "..."
, "<", ">", "<=", ">=", "==", "!=", "===", "!=="
, "+", "-", "*", "%", "/"
, "++", "--"
, "<<", ">>", ">>>", "&", "|", "^"
, "!", "~", "&&", "||", "?", ":"
, "=", "+=", "-=", "*=", "%=", "<<=", ">>=", ">>>=", "&=", "|=", "^=", "/="
, "=>"] | 299 | reservedOperators =
[ "..."
, "<", ">", "<=", ">=", "==", "!=", "===", "!=="
, "+", "-", "*", "%", "/"
, "++", "--"
, "<<", ">>", ">>>", "&", "|", "^"
, "!", "~", "&&", "||", "?", ":"
, "=", "+=", "-=", "*=", "%=", "<<=", ">>=", ">>>=", "&=", "|=", "^=", "/="
, "=>"] | 299 | reservedOperators =
[ "..."
, "<", ">", "<=", ">=", "==", "!=", "===", "!=="
, "+", "-", "*", "%", "/"
, "++", "--"
, "<<", ">>", ">>>", "&", "|", "^"
, "!", "~", "&&", "||", "?", ":"
, "=", "+=", "-=", "*=", "%=", "<<=", ">>=", ">>>=", "&=", "|=", "^=", "/="
, "=>"] | 299 | false | false | 0 | 5 | 82 | 129 | 85 | 44 | null | null |
ghc-android/ghc | testsuite/tests/ghci/should_run/ghcirun004.hs | bsd-3-clause | 720 = 719 | 9 | 720 = 719 | 9 | 720 = 719 | 9 | false | false | 1 | 5 | 2 | 10 | 3 | 7 | null | null |
anup-2s/project-euler | src/Problem12.hs | bsd-3-clause | atLeastNFactors :: Int -> [Int]
atLeastNFactors x =
let triangles = scanl1 (+) [1 ..]
in map fst . filter (\(_, f) -> (f > x)) . zip triangles . map numFactors $ triangles | 175 | atLeastNFactors :: Int -> [Int]
atLeastNFactors x =
let triangles = scanl1 (+) [1 ..]
in map fst . filter (\(_, f) -> (f > x)) . zip triangles . map numFactors $ triangles | 175 | atLeastNFactors x =
let triangles = scanl1 (+) [1 ..]
in map fst . filter (\(_, f) -> (f > x)) . zip triangles . map numFactors $ triangles | 143 | false | true | 0 | 15 | 37 | 94 | 48 | 46 | null | null |
k32/QFL | tools/Lam2W.hs | unlicense | lamb id term | not (id `freeIn` term) = App K term | 50 | lamb id term | not (id `freeIn` term) = App K term | 50 | lamb id term | not (id `freeIn` term) = App K term | 50 | false | false | 0 | 10 | 11 | 34 | 16 | 18 | null | null |
ComputationWithBoundedResources/jat | src/Jat/PState/Fun.hs | bsd-3-clause | -- | Checks if current state is a terminal state, ie. a state with an empty
-- frame list or an exceptional state.
isTerminal :: PState i a -> Bool
isTerminal (PState _ frms _) = null frms | 188 | isTerminal :: PState i a -> Bool
isTerminal (PState _ frms _) = null frms | 73 | isTerminal (PState _ frms _) = null frms | 40 | true | true | 0 | 7 | 37 | 38 | 19 | 19 | null | null |
hakuch/Pulsar | src/Pulsar/Parse.hs | apache-2.0 | label :: Parser (Statement SourcePos)
label =
do pos <- getPosition
Statement pos . Label <$> choice [try backwardsLabel, normalLabel]
<?> "label"
where
normalLabel =
do name <- identifier
_ <- colon
return . BS.pack $ name
backwardsLabel =
do _ <- colon
fmap BS.pack identifier | 339 | label :: Parser (Statement SourcePos)
label =
do pos <- getPosition
Statement pos . Label <$> choice [try backwardsLabel, normalLabel]
<?> "label"
where
normalLabel =
do name <- identifier
_ <- colon
return . BS.pack $ name
backwardsLabel =
do _ <- colon
fmap BS.pack identifier | 339 | label =
do pos <- getPosition
Statement pos . Label <$> choice [try backwardsLabel, normalLabel]
<?> "label"
where
normalLabel =
do name <- identifier
_ <- colon
return . BS.pack $ name
backwardsLabel =
do _ <- colon
fmap BS.pack identifier | 301 | false | true | 2 | 10 | 106 | 116 | 53 | 63 | null | null |
ezyang/ghc | compiler/typecheck/TcRnTypes.hs | bsd-3-clause | thLevel (Brack s _) = thLevel s + 1 | 37 | thLevel (Brack s _) = thLevel s + 1 | 37 | thLevel (Brack s _) = thLevel s + 1 | 37 | false | false | 0 | 7 | 10 | 24 | 11 | 13 | null | null |
ezyang/ghc | libraries/base/Data/Typeable.hs | bsd-3-clause | -- | Takes a value of type @a@ and returns a concrete representation
-- of that type.
--
-- @since 4.7.0.0
typeRep :: forall proxy a. Typeable a => proxy a -> TypeRep
typeRep = I.someTypeRep | 190 | typeRep :: forall proxy a. Typeable a => proxy a -> TypeRep
typeRep = I.someTypeRep | 83 | typeRep = I.someTypeRep | 23 | true | true | 0 | 9 | 35 | 44 | 22 | 22 | null | null |
alphalambda/codeworld | codeworld-api/src/CodeWorld/EntryPoints.hs | apache-2.0 | drawControl _ alpha (FastForwardButton (x, y)) = translated x y p
where
p =
colored
(RGBA 0 0 0 alpha)
( solidPolygon [(-0.3, 0.25), (-0.3, -0.25), (-0.05, 0)]
<> solidPolygon [(0.05, 0.25), (0.05, -0.25), (0.3, 0)]
)
<> colored (RGBA 0.2 0.2 0.2 alpha) (rectangle 0.8 0.8)
<> colored (RGBA 0.8 0.8 0.8 alpha) (solidRectangle 0.8 0.8) | 398 | drawControl _ alpha (FastForwardButton (x, y)) = translated x y p
where
p =
colored
(RGBA 0 0 0 alpha)
( solidPolygon [(-0.3, 0.25), (-0.3, -0.25), (-0.05, 0)]
<> solidPolygon [(0.05, 0.25), (0.05, -0.25), (0.3, 0)]
)
<> colored (RGBA 0.2 0.2 0.2 alpha) (rectangle 0.8 0.8)
<> colored (RGBA 0.8 0.8 0.8 alpha) (solidRectangle 0.8 0.8) | 398 | drawControl _ alpha (FastForwardButton (x, y)) = translated x y p
where
p =
colored
(RGBA 0 0 0 alpha)
( solidPolygon [(-0.3, 0.25), (-0.3, -0.25), (-0.05, 0)]
<> solidPolygon [(0.05, 0.25), (0.05, -0.25), (0.3, 0)]
)
<> colored (RGBA 0.2 0.2 0.2 alpha) (rectangle 0.8 0.8)
<> colored (RGBA 0.8 0.8 0.8 alpha) (solidRectangle 0.8 0.8) | 398 | false | false | 0 | 13 | 120 | 192 | 103 | 89 | null | null |
narrative/stack | src/Stack/Types/Internal.hs | bsd-3-clause | buildOptsMonoidHaddock :: Lens' BuildOptsMonoid (Maybe Bool)
buildOptsMonoidHaddock = lens (buildMonoidHaddock)
(\buildMonoid t -> buildMonoid {buildMonoidHaddock = t}) | 196 | buildOptsMonoidHaddock :: Lens' BuildOptsMonoid (Maybe Bool)
buildOptsMonoidHaddock = lens (buildMonoidHaddock)
(\buildMonoid t -> buildMonoid {buildMonoidHaddock = t}) | 196 | buildOptsMonoidHaddock = lens (buildMonoidHaddock)
(\buildMonoid t -> buildMonoid {buildMonoidHaddock = t}) | 135 | false | true | 0 | 9 | 44 | 48 | 26 | 22 | null | null |
inq/agitpunkt | app/Handler/Article.hs | agpl-3.0 | indexH :: Handler
-- ^ The main page
indexH = doPage 0 | 54 | indexH :: Handler
indexH = doPage 0 | 35 | indexH = doPage 0 | 17 | true | true | 0 | 5 | 11 | 15 | 8 | 7 | null | null |
snapframework/snap-core | src/Snap/Internal/Http/Types.hs | bsd-3-clause | normalizeMethod :: Method -> Method
normalizeMethod m@(Method name) = case name of
"GET" -> GET
"HEAD" -> HEAD
"POST" -> POST
"PUT" -> PUT
"DELETE" -> DELETE
"TRACE" -> TRACE
"OPTIONS" -> OPTIONS
"CONNECT" -> CONNECT
"PATCH" -> PATCH
_ -> m | 627 | normalizeMethod :: Method -> Method
normalizeMethod m@(Method name) = case name of
"GET" -> GET
"HEAD" -> HEAD
"POST" -> POST
"PUT" -> PUT
"DELETE" -> DELETE
"TRACE" -> TRACE
"OPTIONS" -> OPTIONS
"CONNECT" -> CONNECT
"PATCH" -> PATCH
_ -> m | 627 | normalizeMethod m@(Method name) = case name of
"GET" -> GET
"HEAD" -> HEAD
"POST" -> POST
"PUT" -> PUT
"DELETE" -> DELETE
"TRACE" -> TRACE
"OPTIONS" -> OPTIONS
"CONNECT" -> CONNECT
"PATCH" -> PATCH
_ -> m | 591 | false | true | 0 | 8 | 428 | 91 | 46 | 45 | null | null |
yav/smtLib | src/SMTLib1/QF_BV.hs | mit | isBitVec :: Sort -> Maybe Integer
isBitVec (I "BitVec" [n]) = Just n | 68 | isBitVec :: Sort -> Maybe Integer
isBitVec (I "BitVec" [n]) = Just n | 68 | isBitVec (I "BitVec" [n]) = Just n | 34 | false | true | 0 | 8 | 12 | 35 | 17 | 18 | null | null |
olorin/amazonka | amazonka-ec2/gen/Network/AWS/EC2/Types/Product.hs | mpl-2.0 | -- | The ID of the subnet.
iniSubnetId :: Lens' InstanceNetworkInterface (Maybe Text)
iniSubnetId = lens _iniSubnetId (\ s a -> s{_iniSubnetId = a}) | 148 | iniSubnetId :: Lens' InstanceNetworkInterface (Maybe Text)
iniSubnetId = lens _iniSubnetId (\ s a -> s{_iniSubnetId = a}) | 121 | iniSubnetId = lens _iniSubnetId (\ s a -> s{_iniSubnetId = a}) | 62 | true | true | 0 | 9 | 23 | 46 | 25 | 21 | null | null |
tonyday567/lucid-page | src/Web/Rep/Mathjax.hs | mit | -- | A 'Page' that tries to enable mathjax inside svg (which is tricky).
mathjaxSvgPage :: Text -> Page
mathjaxSvgPage cl =
mempty
& #jsGlobal .~ RepJsText (scriptMathjaxConfigSvg cl)
& #libsJs
.~ [ mathjax3Lib,
jqueryLib
] | 259 | mathjaxSvgPage :: Text -> Page
mathjaxSvgPage cl =
mempty
& #jsGlobal .~ RepJsText (scriptMathjaxConfigSvg cl)
& #libsJs
.~ [ mathjax3Lib,
jqueryLib
] | 186 | mathjaxSvgPage cl =
mempty
& #jsGlobal .~ RepJsText (scriptMathjaxConfigSvg cl)
& #libsJs
.~ [ mathjax3Lib,
jqueryLib
] | 155 | true | true | 8 | 7 | 71 | 61 | 29 | 32 | null | null |
dmp1ce/DMSS | src-test/StorageTest.hs | unlicense | dummyHashSalt :: HashSalt
dummyHashSalt = HashSalt "password string store" "salt" | 81 | dummyHashSalt :: HashSalt
dummyHashSalt = HashSalt "password string store" "salt" | 81 | dummyHashSalt = HashSalt "password string store" "salt" | 55 | false | true | 0 | 5 | 9 | 16 | 8 | 8 | null | null |
mightybyte/reflex-dom-stubs | src/GHCJS/DOM/HTMLInputElement.hs | bsd-3-clause | ghcjs_dom_html_input_element_get_checked = undefined | 52 | ghcjs_dom_html_input_element_get_checked = undefined | 52 | ghcjs_dom_html_input_element_get_checked = undefined | 52 | false | false | 0 | 4 | 2 | 6 | 3 | 3 | null | null |
ml9951/ghc | libraries/base/Data/List/NonEmpty.hs | bsd-3-clause | -- | The 'unwords' function is an inverse operation to 'words'. It
-- joins words with separating spaces.
--
-- /Beware/: the input @(\"\" :| [])@ will cause an error.
unwords :: NonEmpty String -> NonEmpty Char
unwords = lift List.unwords | 239 | unwords :: NonEmpty String -> NonEmpty Char
unwords = lift List.unwords | 71 | unwords = lift List.unwords | 27 | true | true | 0 | 7 | 40 | 36 | 17 | 19 | null | null |
HIPERFIT/futhark | src/Futhark/IR/SOACS/Simplify.hs | isc | bottomUpRules :: [BottomUpRule (Wise SOACS)]
bottomUpRules =
[ RuleOp removeDeadMapping,
RuleOp removeDeadReduction,
RuleOp removeDeadWrite,
RuleBasicOp removeUnnecessaryCopy,
RuleOp liftIdentityStreaming,
RuleOp mapOpToOp
] | 248 | bottomUpRules :: [BottomUpRule (Wise SOACS)]
bottomUpRules =
[ RuleOp removeDeadMapping,
RuleOp removeDeadReduction,
RuleOp removeDeadWrite,
RuleBasicOp removeUnnecessaryCopy,
RuleOp liftIdentityStreaming,
RuleOp mapOpToOp
] | 248 | bottomUpRules =
[ RuleOp removeDeadMapping,
RuleOp removeDeadReduction,
RuleOp removeDeadWrite,
RuleBasicOp removeUnnecessaryCopy,
RuleOp liftIdentityStreaming,
RuleOp mapOpToOp
] | 203 | false | true | 0 | 8 | 44 | 59 | 30 | 29 | null | null |
kim/amazonka | amazonka-ml/gen/Network/AWS/MachineLearning/Types.hs | mpl-2.0 | -- | The status of the 'BatchPrediction'. This element can have one of the following
-- values:
--
-- 'PENDING' - Amazon Machine Learning (Amazon ML) submitted a request to
-- generate predictions for a batch of observations. 'INPROGRESS' - The process
-- is underway. 'FAILED' - The request to peform a batch prediction did not run
-- to completion. It is not usable. 'COMPLETED' - The batch prediction process
-- completed successfully. 'DELETED' - The 'BatchPrediction' is marked as deleted.
-- It is not usable.
bpStatus :: Lens' BatchPrediction (Maybe EntityStatus)
bpStatus = lens _bpStatus (\s a -> s { _bpStatus = a }) | 630 | bpStatus :: Lens' BatchPrediction (Maybe EntityStatus)
bpStatus = lens _bpStatus (\s a -> s { _bpStatus = a }) | 110 | bpStatus = lens _bpStatus (\s a -> s { _bpStatus = a }) | 55 | true | true | 1 | 9 | 108 | 57 | 33 | 24 | null | null |
UU-ComputerScience/uu-cco | uu-cco/src/CCO/Printing.hs | bsd-3-clause | -- | Immediate choice: @choose = foldr (>^<) empty@.
choose :: [Doc] -> Doc
choose = foldr (>^<) empty | 102 | choose :: [Doc] -> Doc
choose = foldr (>^<) empty | 49 | choose = foldr (>^<) empty | 26 | true | true | 0 | 6 | 18 | 26 | 15 | 11 | null | null |
brendanhay/gogol | gogol-cloudiot/gen/Network/Google/Resource/CloudIOT/Projects/Locations/Registries/Groups/Devices/States/List.hs | mpl-2.0 | -- | The name of the device. For example,
-- \`projects\/p0\/locations\/us-central1\/registries\/registry0\/devices\/device0\`
-- or
-- \`projects\/p0\/locations\/us-central1\/registries\/registry0\/devices\/{num_id}\`.
plrgdslName :: Lens' ProjectsLocationsRegistriesGroupsDevicesStatesList Text
plrgdslName
= lens _plrgdslName (\ s a -> s{_plrgdslName = a}) | 361 | plrgdslName :: Lens' ProjectsLocationsRegistriesGroupsDevicesStatesList Text
plrgdslName
= lens _plrgdslName (\ s a -> s{_plrgdslName = a}) | 141 | plrgdslName
= lens _plrgdslName (\ s a -> s{_plrgdslName = a}) | 64 | true | true | 1 | 9 | 32 | 47 | 25 | 22 | null | null |
hsyl20/ViperVM | haskus-system/src/lib/Haskus/System/Linux/Devices.hs | bsd-3-clause | sysfsReadDevFile :: MonadInIO m => Handle -> FilePath -> m (Maybe DeviceID)
sysfsReadDevFile hdl path = do
withOpenAt hdl (path </> "dev") BitSet.empty BitSet.empty sysfsReadDevFile'
||> Just
|> evalCatchFlowT (const (return Nothing))
-- | Read subsystem link | 275 | sysfsReadDevFile :: MonadInIO m => Handle -> FilePath -> m (Maybe DeviceID)
sysfsReadDevFile hdl path = do
withOpenAt hdl (path </> "dev") BitSet.empty BitSet.empty sysfsReadDevFile'
||> Just
|> evalCatchFlowT (const (return Nothing))
-- | Read subsystem link | 275 | sysfsReadDevFile hdl path = do
withOpenAt hdl (path </> "dev") BitSet.empty BitSet.empty sysfsReadDevFile'
||> Just
|> evalCatchFlowT (const (return Nothing))
-- | Read subsystem link | 199 | false | true | 0 | 12 | 52 | 89 | 43 | 46 | null | null |
diagrams/diagrams-contrib | src/Diagrams/Color/XKCD.hs | bsd-3-clause | coralPink = fromJust $ readHexColor "#ff6163" | 57 | coralPink = fromJust $ readHexColor "#ff6163" | 57 | coralPink = fromJust $ readHexColor "#ff6163" | 57 | false | false | 0 | 6 | 17 | 13 | 6 | 7 | null | null |
bernstein/ircfs | tests/TestDecode.hs | bsd-3-clause | genShortname :: Gen B.ByteString
genShortname = B.pack <$> ((:) <$> oneof [genLetter,genDigit] <*> listOf (oneof [genLetter, genDigit, pure 0x2D])) | 147 | genShortname :: Gen B.ByteString
genShortname = B.pack <$> ((:) <$> oneof [genLetter,genDigit] <*> listOf (oneof [genLetter, genDigit, pure 0x2D])) | 147 | genShortname = B.pack <$> ((:) <$> oneof [genLetter,genDigit] <*> listOf (oneof [genLetter, genDigit, pure 0x2D])) | 114 | false | true | 0 | 12 | 18 | 65 | 35 | 30 | null | null |
jprider63/aeson-ios-0.8.0.2 | tests/Encoders.hs | bsd-3-clause | gSomeTypeParseJSON2ElemArray :: FromJSON a => Value -> Parser (SomeType a)
gSomeTypeParseJSON2ElemArray = genericParseJSON opts2ElemArray | 137 | gSomeTypeParseJSON2ElemArray :: FromJSON a => Value -> Parser (SomeType a)
gSomeTypeParseJSON2ElemArray = genericParseJSON opts2ElemArray | 137 | gSomeTypeParseJSON2ElemArray = genericParseJSON opts2ElemArray | 62 | false | true | 0 | 9 | 13 | 34 | 16 | 18 | null | null |
nikki-and-the-robots/nikki | src/Sorts/Nikki/Initialisation.hs | lgpl-3.0 | headUp = up - 0 | 15 | headUp = up - 0 | 15 | headUp = up - 0 | 15 | false | false | 0 | 5 | 4 | 10 | 5 | 5 | null | null |
crabtw/hsplurk | Web/Plurk/Types.hs | bsd-3-clause | jsToKarmaStat (JSObject o) = stat
where stat = nullKarmaStat
{ karma_stat_karma_trend = toStats $ val "karma_trend"
, karma_stat_karma_fall_reason =
jsToStr $ val "karma_fall_reason"
, karma_stat_current_karma =
jsToDouble $ val "current_karma"
, karma_stat_karma_graph = jsToStr $ val "karma_graph"
}
toStats = map (strToStat . span (/= '-') . jsToStr) . jsToList
strToStat (t, k) = (intToTime t, read $ tail k)
intToTime = posixSecondsToUTCTime . fromInteger . read
val n = getMapVal n m
m = M.fromList $ fromJSObject o | 723 | jsToKarmaStat (JSObject o) = stat
where stat = nullKarmaStat
{ karma_stat_karma_trend = toStats $ val "karma_trend"
, karma_stat_karma_fall_reason =
jsToStr $ val "karma_fall_reason"
, karma_stat_current_karma =
jsToDouble $ val "current_karma"
, karma_stat_karma_graph = jsToStr $ val "karma_graph"
}
toStats = map (strToStat . span (/= '-') . jsToStr) . jsToList
strToStat (t, k) = (intToTime t, read $ tail k)
intToTime = posixSecondsToUTCTime . fromInteger . read
val n = getMapVal n m
m = M.fromList $ fromJSObject o | 723 | jsToKarmaStat (JSObject o) = stat
where stat = nullKarmaStat
{ karma_stat_karma_trend = toStats $ val "karma_trend"
, karma_stat_karma_fall_reason =
jsToStr $ val "karma_fall_reason"
, karma_stat_current_karma =
jsToDouble $ val "current_karma"
, karma_stat_karma_graph = jsToStr $ val "karma_graph"
}
toStats = map (strToStat . span (/= '-') . jsToStr) . jsToList
strToStat (t, k) = (intToTime t, read $ tail k)
intToTime = posixSecondsToUTCTime . fromInteger . read
val n = getMapVal n m
m = M.fromList $ fromJSObject o | 723 | false | false | 0 | 13 | 280 | 176 | 92 | 84 | null | null |
gambogi/csh-eval | src/CSH/Eval/DB/Statements.hs | mit | -- *** Freshman Project Participant
-- | Grant a freshman project participant context to the given evaluation
-- instance for the given freshman project.
grFreshmanProjectParticipantP :: Word64 -- ^ Freshman Project ID
-> Word64 -- ^ Evaluation ID
-> H.Stmt HP.Postgres
grFreshmanProjectParticipantP = [H.stmt|insert into "freshman_project_participant" ("freshman_project_id", "evaluation_id") values (?, ?)|] | 472 | grFreshmanProjectParticipantP :: Word64 -- ^ Freshman Project ID
-> Word64 -- ^ Evaluation ID
-> H.Stmt HP.Postgres
grFreshmanProjectParticipantP = [H.stmt|insert into "freshman_project_participant" ("freshman_project_id", "evaluation_id") values (?, ?)|] | 315 | grFreshmanProjectParticipantP = [H.stmt|insert into "freshman_project_participant" ("freshman_project_id", "evaluation_id") values (?, ?)|] | 139 | true | true | 0 | 8 | 113 | 37 | 23 | 14 | null | null |
Fermat/higher-rank | src/TypeChecker.hs | bsd-3-clause | replace (App t1 t2) (x:xs) r
| x ==1 = App t1 (replace t2 xs r)
| x ==0 = App (replace t1 xs r) t2 | 102 | replace (App t1 t2) (x:xs) r
| x ==1 = App t1 (replace t2 xs r)
| x ==0 = App (replace t1 xs r) t2 | 102 | replace (App t1 t2) (x:xs) r
| x ==1 = App t1 (replace t2 xs r)
| x ==0 = App (replace t1 xs r) t2 | 102 | false | false | 0 | 8 | 29 | 83 | 39 | 44 | null | null |
thsutton/hcsv | src/HCSV/CSV.hs | bsd-3-clause | escapeField' :: HCSVOptions -> Field -> Field
escapeField' opt f = let quote = (optQuoteAll opt) || BS.any (inClass ",\n\r\"") f
in if quote then BS.concat ["\"", escapeField f, "\""] else f | 210 | escapeField' :: HCSVOptions -> Field -> Field
escapeField' opt f = let quote = (optQuoteAll opt) || BS.any (inClass ",\n\r\"") f
in if quote then BS.concat ["\"", escapeField f, "\""] else f | 210 | escapeField' opt f = let quote = (optQuoteAll opt) || BS.any (inClass ",\n\r\"") f
in if quote then BS.concat ["\"", escapeField f, "\""] else f | 164 | false | true | 0 | 12 | 51 | 89 | 43 | 46 | null | null |
johnyhlee/media-tracker | src/Main.hs | gpl-2.0 | getFile :: String -> String
getFile "2014" = movies2014 | 55 | getFile :: String -> String
getFile "2014" = movies2014 | 55 | getFile "2014" = movies2014 | 27 | false | true | 0 | 5 | 8 | 22 | 10 | 12 | null | null |
oldmanmike/ghc | compiler/main/DynFlags.hs | bsd-3-clause | --------------------------
setDumpFlag' :: DumpFlag -> DynP ()
setDumpFlag' dump_flag
= do upd (\dfs -> dopt_set dfs dump_flag)
when want_recomp forceRecompile
where -- Certain dumpy-things are really interested in what's going
-- on during recompilation checking, so in those cases we
-- don't want to turn it off.
want_recomp = dump_flag `notElem` [Opt_D_dump_if_trace,
Opt_D_dump_hi_diffs] | 480 | setDumpFlag' :: DumpFlag -> DynP ()
setDumpFlag' dump_flag
= do upd (\dfs -> dopt_set dfs dump_flag)
when want_recomp forceRecompile
where -- Certain dumpy-things are really interested in what's going
-- on during recompilation checking, so in those cases we
-- don't want to turn it off.
want_recomp = dump_flag `notElem` [Opt_D_dump_if_trace,
Opt_D_dump_hi_diffs] | 453 | setDumpFlag' dump_flag
= do upd (\dfs -> dopt_set dfs dump_flag)
when want_recomp forceRecompile
where -- Certain dumpy-things are really interested in what's going
-- on during recompilation checking, so in those cases we
-- don't want to turn it off.
want_recomp = dump_flag `notElem` [Opt_D_dump_if_trace,
Opt_D_dump_hi_diffs] | 417 | true | true | 1 | 10 | 140 | 81 | 40 | 41 | null | null |
ghc-android/ghc | compiler/prelude/PrelNames.hs | bsd-3-clause | pure_RDR = nameRdrName pureAName | 47 | pure_RDR = nameRdrName pureAName | 47 | pure_RDR = nameRdrName pureAName | 47 | false | false | 0 | 5 | 18 | 9 | 4 | 5 | null | null |
alexander-at-github/eta | compiler/ETA/SimplCore/SimplEnv.hs | bsd-3-clause | pprSimplEnv :: SimplEnv -> SDoc
-- Used for debugging; selective
pprSimplEnv env
= vcat [ptext (sLit "TvSubst:") <+> ppr (seTvSubst env),
ptext (sLit "IdSubst:") <+> ppr (seIdSubst env),
ptext (sLit "InScope:") <+> vcat (map ppr_one in_scope_vars)
]
where
in_scope_vars = varEnvElts (getInScopeVars (seInScope env))
ppr_one v | isId v = ppr v <+> ppr (idUnfolding v)
| otherwise = ppr v | 433 | pprSimplEnv :: SimplEnv -> SDoc
pprSimplEnv env
= vcat [ptext (sLit "TvSubst:") <+> ppr (seTvSubst env),
ptext (sLit "IdSubst:") <+> ppr (seIdSubst env),
ptext (sLit "InScope:") <+> vcat (map ppr_one in_scope_vars)
]
where
in_scope_vars = varEnvElts (getInScopeVars (seInScope env))
ppr_one v | isId v = ppr v <+> ppr (idUnfolding v)
| otherwise = ppr v | 400 | pprSimplEnv env
= vcat [ptext (sLit "TvSubst:") <+> ppr (seTvSubst env),
ptext (sLit "IdSubst:") <+> ppr (seIdSubst env),
ptext (sLit "InScope:") <+> vcat (map ppr_one in_scope_vars)
]
where
in_scope_vars = varEnvElts (getInScopeVars (seInScope env))
ppr_one v | isId v = ppr v <+> ppr (idUnfolding v)
| otherwise = ppr v | 368 | true | true | 0 | 10 | 107 | 167 | 78 | 89 | null | null |
mindriot101/pandoc | src/Text/Pandoc/Readers/LaTeX.hs | gpl-2.0 | unescapeURL :: String -> String
unescapeURL ('\\':x:xs) | isEscapable x = x:unescapeURL xs
where isEscapable c = c `elem` ("#$%&~_^\\{}" :: String) | 149 | unescapeURL :: String -> String
unescapeURL ('\\':x:xs) | isEscapable x = x:unescapeURL xs
where isEscapable c = c `elem` ("#$%&~_^\\{}" :: String) | 149 | unescapeURL ('\\':x:xs) | isEscapable x = x:unescapeURL xs
where isEscapable c = c `elem` ("#$%&~_^\\{}" :: String) | 117 | false | true | 0 | 8 | 23 | 67 | 34 | 33 | null | null |
dalaing/free | src/Control/Monad/Free/TH.hs | bsd-3-clause | usesTV n (ForallT bs _ t) = usesTV n t && n `notElem` map tyVarBndrName bs | 74 | usesTV n (ForallT bs _ t) = usesTV n t && n `notElem` map tyVarBndrName bs | 74 | usesTV n (ForallT bs _ t) = usesTV n t && n `notElem` map tyVarBndrName bs | 74 | false | false | 0 | 7 | 15 | 41 | 20 | 21 | null | null |
seereason/cabal | Cabal/Distribution/Simple/PreProcess.hs | bsd-3-clause | -- |Convenience function; get the suffixes of these preprocessors.
ppSuffixes :: [ PPSuffixHandler ] -> [String]
ppSuffixes = map fst | 133 | ppSuffixes :: [ PPSuffixHandler ] -> [String]
ppSuffixes = map fst | 66 | ppSuffixes = map fst | 20 | true | true | 0 | 6 | 19 | 25 | 14 | 11 | null | null |
ghcjs/ghcjs-base | JavaScript/JSON/Types/Instances.hs | mit | left, right :: JSString
left = "Left" | 38 | left, right :: JSString
left = "Left" | 38 | left = "Left" | 14 | false | true | 2 | 6 | 7 | 24 | 9 | 15 | null | null |
beni55/ghcjs | test/nofib/spectral/clausify/Main.hs | mit | conjunct (Con p q) = True | 25 | conjunct (Con p q) = True | 25 | conjunct (Con p q) = True | 25 | false | false | 0 | 6 | 5 | 18 | 8 | 10 | null | null |
andyfriesen/hs-sajson | src/Sajson.hs | mit | getArrayElement :: Array -> Word -> Value
getArrayElement (Array (Value parserPtr valPtr)) index = unsafePerformIO $
withForeignPtr valPtr $ \vp -> do
result <- sj_value_get_array_element vp index
mkValue parserPtr result | 241 | getArrayElement :: Array -> Word -> Value
getArrayElement (Array (Value parserPtr valPtr)) index = unsafePerformIO $
withForeignPtr valPtr $ \vp -> do
result <- sj_value_get_array_element vp index
mkValue parserPtr result | 241 | getArrayElement (Array (Value parserPtr valPtr)) index = unsafePerformIO $
withForeignPtr valPtr $ \vp -> do
result <- sj_value_get_array_element vp index
mkValue parserPtr result | 199 | false | true | 0 | 10 | 49 | 74 | 35 | 39 | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.