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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
tdeekens/tda452-code | Exercises/exercise-4.hs | mit | listOf' n g = do
i <- arbitrary
return (i : listOf' (n - 1) g) | 92 | listOf' n g = do
i <- arbitrary
return (i : listOf' (n - 1) g) | 92 | listOf' n g = do
i <- arbitrary
return (i : listOf' (n - 1) g) | 92 | false | false | 1 | 13 | 45 | 48 | 20 | 28 | null | null |
shlevy/ghc | compiler/prelude/THNames.hs | bsd-3-clause | -- data Exp = ...
varEName, conEName, litEName, appEName, appTypeEName, infixEName, infixAppName,
sectionLName, sectionRName, lamEName, lamCaseEName, tupEName,
unboxedTupEName, unboxedSumEName, condEName, multiIfEName, letEName,
caseEName, doEName, compEName, staticEName, unboundVarEName,
labelEName :: Name
varEName = libFun (fsLit "varE") varEIdKey | 381 | varEName, conEName, litEName, appEName, appTypeEName, infixEName, infixAppName,
sectionLName, sectionRName, lamEName, lamCaseEName, tupEName,
unboxedTupEName, unboxedSumEName, condEName, multiIfEName, letEName,
caseEName, doEName, compEName, staticEName, unboundVarEName,
labelEName :: Name
varEName = libFun (fsLit "varE") varEIdKey | 363 | varEName = libFun (fsLit "varE") varEIdKey | 56 | true | true | 0 | 7 | 65 | 67 | 56 | 11 | null | null |
TomMD/ghc | compiler/prelude/PrelNames.hs | bsd-3-clause | typeNatExpTyFamNameKey = mkPreludeTyConUnique 164 | 52 | typeNatExpTyFamNameKey = mkPreludeTyConUnique 164 | 52 | typeNatExpTyFamNameKey = mkPreludeTyConUnique 164 | 52 | false | false | 0 | 5 | 6 | 9 | 4 | 5 | null | null |
k0001/gtk2hs | docs/tutorial/Tutorial_Port/Example_Code/GtkChap3-1.hs | gpl-3.0 | main :: IO ()
main = do
initGUI
window <- windowNew
hbox <- hBoxNew True 10
button1 <- buttonNewWithLabel "Button 1"
button2 <- buttonNewWithLabel "Button 2"
set window [windowDefaultWidth := 200, windowDefaultHeight := 200,
containerBorderWidth := 10, containerChild := hbox,
windowTitle := "Packing" ]
boxPackStart hbox button1 PackGrow 0
boxPackStart hbox button2 PackGrow 0
widgetShowAll window
onDestroy window mainQuit
mainGUI | 495 | main :: IO ()
main = do
initGUI
window <- windowNew
hbox <- hBoxNew True 10
button1 <- buttonNewWithLabel "Button 1"
button2 <- buttonNewWithLabel "Button 2"
set window [windowDefaultWidth := 200, windowDefaultHeight := 200,
containerBorderWidth := 10, containerChild := hbox,
windowTitle := "Packing" ]
boxPackStart hbox button1 PackGrow 0
boxPackStart hbox button2 PackGrow 0
widgetShowAll window
onDestroy window mainQuit
mainGUI | 495 | main = do
initGUI
window <- windowNew
hbox <- hBoxNew True 10
button1 <- buttonNewWithLabel "Button 1"
button2 <- buttonNewWithLabel "Button 2"
set window [windowDefaultWidth := 200, windowDefaultHeight := 200,
containerBorderWidth := 10, containerChild := hbox,
windowTitle := "Packing" ]
boxPackStart hbox button1 PackGrow 0
boxPackStart hbox button2 PackGrow 0
widgetShowAll window
onDestroy window mainQuit
mainGUI | 481 | false | true | 0 | 9 | 122 | 142 | 64 | 78 | null | null |
meiersi/bytestring | Data/ByteString/Lazy.hs | bsd-3-clause | tails cs@(Chunk c cs')
| S.length c == 1 = cs : tails cs'
| otherwise = cs : tails (Chunk (S.unsafeTail c) cs') | 121 | tails cs@(Chunk c cs')
| S.length c == 1 = cs : tails cs'
| otherwise = cs : tails (Chunk (S.unsafeTail c) cs') | 121 | tails cs@(Chunk c cs')
| S.length c == 1 = cs : tails cs'
| otherwise = cs : tails (Chunk (S.unsafeTail c) cs') | 121 | false | false | 4 | 10 | 33 | 84 | 36 | 48 | null | null |
raymoo/pins-ps | Pins/Handle.hs | gpl-3.0 | makeAction m = handleAny m | 46 | makeAction m = handleAny m | 46 | makeAction m = handleAny m | 46 | false | false | 0 | 5 | 24 | 12 | 5 | 7 | null | null |
dysinger/amazonka | amazonka-cloudwatch-logs/gen/Network/AWS/CloudWatchLogs/DescribeMetricFilters.hs | mpl-2.0 | -- | 'DescribeMetricFiltersResponse' constructor.
--
-- The fields accessible through corresponding lenses are:
--
-- * 'dmfrMetricFilters' @::@ ['MetricFilter']
--
-- * 'dmfrNextToken' @::@ 'Maybe' 'Text'
--
describeMetricFiltersResponse :: DescribeMetricFiltersResponse
describeMetricFiltersResponse = DescribeMetricFiltersResponse
{ _dmfrMetricFilters = mempty
, _dmfrNextToken = Nothing
} | 408 | describeMetricFiltersResponse :: DescribeMetricFiltersResponse
describeMetricFiltersResponse = DescribeMetricFiltersResponse
{ _dmfrMetricFilters = mempty
, _dmfrNextToken = Nothing
} | 199 | describeMetricFiltersResponse = DescribeMetricFiltersResponse
{ _dmfrMetricFilters = mempty
, _dmfrNextToken = Nothing
} | 136 | true | true | 0 | 7 | 57 | 43 | 25 | 18 | null | null |
DavidAlphaFox/ghc | libraries/Cabal/Cabal/tests/UnitTests/Distribution/Utils/NubList.hs | bsd-3-clause | tests :: [Test]
tests =
[ testCase "Numlist retains ordering" testOrdering
, testCase "Numlist removes duplicates" testDeDupe
, testProperty "Monoid Numlist Identity" prop_Identity
, testProperty "Monoid Numlist Associativity" prop_Associativity
] | 267 | tests :: [Test]
tests =
[ testCase "Numlist retains ordering" testOrdering
, testCase "Numlist removes duplicates" testDeDupe
, testProperty "Monoid Numlist Identity" prop_Identity
, testProperty "Monoid Numlist Associativity" prop_Associativity
] | 267 | tests =
[ testCase "Numlist retains ordering" testOrdering
, testCase "Numlist removes duplicates" testDeDupe
, testProperty "Monoid Numlist Identity" prop_Identity
, testProperty "Monoid Numlist Associativity" prop_Associativity
] | 251 | false | true | 0 | 7 | 49 | 53 | 25 | 28 | null | null |
fcostantini/QuickFuzz | src/Zip.hs | gpl-3.0 | -- $(devArbitrary ''Archive)
-- $(devMutationRec ''MArchive)
-- $(devMutation ''Entry Nothing)
-- $(devMutation ''L.ByteString Nothing)
-- $(devMutation ''Data.ByteString.Internal.ByteString Nothing)
-- $(devMutationRec ''MArchive)
mencode :: Archive -> ByteString
mencode = encode | 282 | mencode :: Archive -> ByteString
mencode = encode | 49 | mencode = encode | 16 | true | true | 0 | 7 | 29 | 28 | 15 | 13 | null | null |
castaway/pandoc | src/Tests/Writers/ConTeXt.hs | gpl-2.0 | context :: (ToString a, ToPandoc a) => a -> String
context = writeConTeXt defaultWriterOptions . toPandoc | 105 | context :: (ToString a, ToPandoc a) => a -> String
context = writeConTeXt defaultWriterOptions . toPandoc | 105 | context = writeConTeXt defaultWriterOptions . toPandoc | 54 | false | true | 0 | 6 | 15 | 37 | 19 | 18 | null | null |
jbracker/supermonad-plugin | examples/monad/session/MainSupermonad.hs | bsd-3-clause | pong :: Session (Cap (Pong, ()) Pong) () ()
pong = offer close $ do
rsp <- recv
io $ putStrLn rsp
send "Pong"
zero; pong | 136 | pong :: Session (Cap (Pong, ()) Pong) () ()
pong = offer close $ do
rsp <- recv
io $ putStrLn rsp
send "Pong"
zero; pong | 136 | pong = offer close $ do
rsp <- recv
io $ putStrLn rsp
send "Pong"
zero; pong | 92 | false | true | 0 | 9 | 41 | 75 | 35 | 40 | null | null |
ramirez7/configurator-applicative | src/Data/Configurator/Applicative/Parser.hs | bsd-3-clause | -- fail. Need to add context arg to 'parse' probably?
parse (LookupP lk) cfg = liftIO (doLookup lk cfg) `orThrowErrorM` () | 122 | parse (LookupP lk) cfg = liftIO (doLookup lk cfg) `orThrowErrorM` () | 68 | parse (LookupP lk) cfg = liftIO (doLookup lk cfg) `orThrowErrorM` () | 68 | true | false | 1 | 7 | 20 | 42 | 19 | 23 | null | null |
noteed/opengl-api | opengl-api.hs | bsd-3-clause | versionString :: String
versionString =
"opengl-api " ++ showVersion version ++"\n\
\Copyright (c) 2010-2011 Vo Minh Thu.\n\
\This is open source software. See the LICENSE file for conditions." | 195 | versionString :: String
versionString =
"opengl-api " ++ showVersion version ++"\n\
\Copyright (c) 2010-2011 Vo Minh Thu.\n\
\This is open source software. See the LICENSE file for conditions." | 195 | versionString =
"opengl-api " ++ showVersion version ++"\n\
\Copyright (c) 2010-2011 Vo Minh Thu.\n\
\This is open source software. See the LICENSE file for conditions." | 171 | false | true | 0 | 7 | 29 | 22 | 11 | 11 | null | null |
xenog/haskoin | src/Network/Haskoin/Script/Evaluator.hs | unlicense | popCond :: Program Bool
popCond = get >>= \case
[] -> lift $ programError "popCond: empty condStack"
(x:xs) -> put xs >> return x | 141 | popCond :: Program Bool
popCond = get >>= \case
[] -> lift $ programError "popCond: empty condStack"
(x:xs) -> put xs >> return x | 141 | popCond = get >>= \case
[] -> lift $ programError "popCond: empty condStack"
(x:xs) -> put xs >> return x | 117 | false | true | 2 | 10 | 35 | 66 | 30 | 36 | null | null |
vikraman/ghc | compiler/typecheck/TcGenDeriv.hs | bsd-3-clause | mkParentType :: TyCon -> Type
-- Turn the representation tycon of a family into
-- a use of its family constructor
mkParentType tc
= case tyConFamInst_maybe tc of
Nothing -> mkTyConApp tc (mkTyVarTys (tyConTyVars tc))
Just (fam_tc,tys) -> mkTyConApp fam_tc tys
{-
************************************************************************
* *
\subsection{Utility bits for generating bindings}
* *
************************************************************************
-} | 626 | mkParentType :: TyCon -> Type
mkParentType tc
= case tyConFamInst_maybe tc of
Nothing -> mkTyConApp tc (mkTyVarTys (tyConTyVars tc))
Just (fam_tc,tys) -> mkTyConApp fam_tc tys
{-
************************************************************************
* *
\subsection{Utility bits for generating bindings}
* *
************************************************************************
-} | 541 | mkParentType tc
= case tyConFamInst_maybe tc of
Nothing -> mkTyConApp tc (mkTyVarTys (tyConTyVars tc))
Just (fam_tc,tys) -> mkTyConApp fam_tc tys
{-
************************************************************************
* *
\subsection{Utility bits for generating bindings}
* *
************************************************************************
-} | 511 | true | true | 0 | 12 | 209 | 76 | 37 | 39 | null | null |
beni55/fay | src/Fay/Compiler/Exp.hs | bsd-3-clause | -- | Helper for compileApp.
compileApp' :: S.Exp -> S.Exp -> Compile JsExp
compileApp' exp1 exp2 = do
flattenApps <- config configFlattenApps
jsexp1 <- compileExp exp1
(if flattenApps then method2 else method1) jsexp1 exp2
where
-- Method 1:
-- In this approach code ends up looking like this:
-- a(a(a(a(a(a(a(a(a(a(L)(c))(b))(0))(0))(y))(t))(a(a(F)(3*a(a(d)+a(a(f)/20))))*a(a(f)/2)))(140+a(f)))(y))(t)})
-- Which might be OK for speed, but increases the JS stack a fair bit.
method1 :: JsExp -> S.Exp -> Compile JsExp
method1 e1 e2 =
JsApp <$> (forceFlatName <$> return e1)
<*> fmap return (compileExp e2)
where
forceFlatName name = JsApp (JsName JsForce) [name]
-- Method 2:
-- In this approach code ends up looking like this:
-- d(O,a,b,0,0,B,w,e(d(I,3*e(e(c)+e(e(g)/20))))*e(e(g)/2),140+e(g),B,w)}),d(K,g,e(c)+0.05))
-- Which should be much better for the stack and readability, but probably not great for speed.
method2 :: JsExp -> S.Exp -> Compile JsExp
method2 e1 e2 = fmap flatten $
JsApp <$> return e1
<*> fmap return (compileExp e2)
where
flatten (JsApp op args) =
case op of
JsApp l r -> JsApp l (r ++ args)
_ -> JsApp (JsName JsApply) (op : args)
flatten x = x
-- | Compile a negate application
compileNegApp :: S.Exp -> Compile JsExp
compileNegApp e = JsNegApp . force <$> compileExp e
-- | Compile a let expression.
compileLet :: [S.Decl] -> S.Exp -> Compile JsExp
compileLet decls exp = do
binds <- mapM compileLetDecl decls
body <- compileExp exp
return (JsApp (JsFun Nothing [] [] (Just $ stmtsThunk $ concat binds ++ [JsEarlyReturn body])) [])
-- | Compile let declaration.
compileLetDecl :: S.Decl -> Compile [JsStmt]
compileLetDecl decl = do
compileDecls <- asks readerCompileDecls
case decl of
PatBind{} -> compileDecls False [decl]
FunBind{} -> compileDecls False [decl]
TypeSig{} -> return []
_ -> throwError $ UnsupportedLetBinding decl
-- | Compile a list expression.
compileList :: [S.Exp] -> Compile JsExp
compileList xs = do
exps <- mapM compileExp xs
return (makeList exps)
-- | Compile an if.
compileIf :: S.Exp -> S.Exp -> S.Exp -> Compile JsExp
compileIf cond conseq alt =
JsTernaryIf <$> fmap force (compileExp cond)
<*> compileExp conseq
<*> compileExp alt
-- | Compile case expressions.
compileCase :: S.Exp -> [S.Alt] -> Compile JsExp
compileCase e alts = do
exp <- compileExp e
withScopedTmpJsName $ \tmpName -> do
pats <- optimizePatConditions <$> mapM (compilePatAlt (JsName tmpName)) alts
return $
JsApp (JsFun Nothing
[tmpName]
(concat pats)
(if any isWildCardAlt alts
then Nothing
else Just (throwExp "unhandled case" (JsName tmpName))))
[exp]
-- | Compile the given pattern against the given expression.
compilePatAlt :: JsExp -> S.Alt -> Compile [JsStmt]
compilePatAlt exp a@(Alt _ pat rhs wheres) = case wheres of
Just (BDecls _ (_ : _)) -> throwError $ UnsupportedWhereInAlt a
Just (IPBinds _ (_ : _)) -> throwError $ UnsupportedWhereInAlt a
_ -> do
alt <- compileGuardedAlt rhs
compilePat exp pat [alt]
-- | Compile a guarded alt.
compileGuardedAlt :: S.Rhs -> Compile JsStmt
compileGuardedAlt alt =
case alt of
UnGuardedRhs _ exp -> JsEarlyReturn <$> compileExp exp
GuardedRhss _ alts -> compileGuards alts
-- | Compile guards
compileGuards :: [S.GuardedRhs] -> Compile JsStmt
compileGuards (GuardedRhs _ (Qualifier _ guard:_) exp : rest) =
makeIf <$> fmap force (compileExp guard)
<*> compileExp exp
<*> if null rest then return [] else do
gs' <- compileGuards rest
return [gs']
where makeIf gs e gss = JsIf gs [JsEarlyReturn e] gss
compileGuards rhss = throwError . UnsupportedRhs . GuardedRhss noI $ rhss
-- | Compile a lambda.
compileLambda :: [S.Pat] -> S.Exp -> Compile JsExp
compileLambda pats = compileExp >=> \exp -> do
stmts <- generateStatements exp
case stmts of
[JsEarlyReturn fun@JsFun{}] -> return fun
_ -> error "Unexpected statements in compileLambda"
where unhandledcase = throw "unhandled case" . JsName
allfree = all isWildCardPat pats
generateStatements exp =
foldM (\inner (param,pat) -> do
stmts <- compilePat (JsName param) pat inner
return [JsEarlyReturn (JsFun Nothing [param] (stmts ++ [unhandledcase param | not allfree]) Nothing)])
[JsEarlyReturn exp]
(reverse (zip uniqueNames pats))
-- | Compile [e1..] arithmetic sequences.
compileEnumFrom :: S.Exp -> Compile JsExp
compileEnumFrom i = do
e <- compileExp i
return (JsApp (JsName (JsNameVar (Qual () "Prelude" "enumFrom"))) [e])
-- | Compile [e1..e3] arithmetic sequences.
compileEnumFromTo :: S.Exp -> S.Exp -> Compile JsExp
compileEnumFromTo i i' = do
f <- compileExp i
t <- compileExp i'
cfg <- config id
return $ case optEnumFromTo cfg f t of
Just s -> s
_ -> JsApp (JsApp (JsName (JsNameVar (Qual () "Prelude" "enumFromTo"))) [f]) [t]
-- | Compile [e1,e2..] arithmetic sequences.
compileEnumFromThen :: S.Exp -> S.Exp -> Compile JsExp
compileEnumFromThen a b = do
fr <- compileExp a
th <- compileExp b
return (JsApp (JsApp (JsName (JsNameVar (Qual () "Prelude" "enumFromThen"))) [fr]) [th])
-- | Compile [e1,e2..e3] arithmetic sequences.
compileEnumFromThenTo :: S.Exp -> S.Exp -> S.Exp -> Compile JsExp
compileEnumFromThenTo a b z = do
fr <- compileExp a
th <- compileExp b
to <- compileExp z
cfg <- config id
return $ case optEnumFromThenTo cfg fr th to of
Just s -> s
_ -> JsApp (JsApp (JsApp (JsName (JsNameVar (Qual () "Prelude" "enumFromThenTo"))) [fr]) [th]) [to]
-- | Compile a record construction with named fields
-- | GHC will warn on uninitialized fields, they will be undefined in JS.
compileRecConstr :: S.Exp -> S.QName -> [S.FieldUpdate] -> Compile JsExp
compileRecConstr origExp name fieldUpdates = do
-- var obj = new $_Type()
let unQualName = withIdent lowerFirst . unQualify $ unAnn name
qname <- unsafeResolveName name
let record = JsVar (JsNameVar unQualName) (JsNew (JsConstructor qname) [])
setFields <- liftM concat (forM fieldUpdates (updateStmt name))
return $ JsApp (JsFun Nothing [] (record:setFields) (Just . JsName . JsNameVar . withIdent lowerFirst . unQualify $ unAnn name)) []
where
-- updateStmt :: QName a -> S.FieldUpdate -> Compile [JsStmt]
updateStmt (unAnn -> o) (FieldUpdate _ (unAnn -> field) value) = do
exp <- compileExp value
return [JsSetProp (JsNameVar $ withIdent lowerFirst $ unQualify o) (JsNameVar $ unQualify field) exp]
updateStmt o (FieldWildcard (wildcardFields -> fields)) =
return $ for fields $ \fieldName -> JsSetProp (JsNameVar . withIdent lowerFirst . unQualify . unAnn $ o)
(JsNameVar fieldName)
(JsName $ JsNameVar fieldName)
-- I couldn't find a code that generates (FieldUpdate (FieldPun ..))
updateStmt _ _ = throwError $ UnsupportedExpression origExp
wildcardFields l = case l of
Scoped (RecExpWildcard es) _ -> map (unQualify . origName2QName . fst) es
_ -> []
lowerFirst :: String -> String
lowerFirst "" = ""
lowerFirst (x:xs) = '_' : Char.toLower x : xs
-- | Compile a record update.
compileRecUpdate :: S.Exp -> S.Exp -> [S.FieldUpdate] -> Compile JsExp
compileRecUpdate origExp rec fieldUpdates = do
record <- force <$> compileExp rec
let copyName = UnQual () $ Ident () "$_record_to_update"
copy = JsVar (JsNameVar copyName)
(JsRawExp ("Object.create(" ++ printJSString record ++ ")"))
setFields <- forM fieldUpdates (updateExp copyName)
return $ JsApp (JsFun Nothing [] (copy:setFields) (Just $ JsName $ JsNameVar copyName)) []
where
updateExp :: QName a -> S.FieldUpdate -> Compile JsStmt
updateExp (unAnn -> copyName) (FieldUpdate _ (unQualify . unAnn -> field) value) =
JsSetProp (JsNameVar copyName) (JsNameVar field) <$> compileExp value
updateExp _ f@FieldPun{} = shouldBeDesugared f
-- I also couldn't find a code that generates (FieldUpdate FieldWildCard)
updateExp _ FieldWildcard{} = throwError $ UnsupportedExpression origExp
-- | Make a Fay list.
makeList :: [JsExp] -> JsExp
makeList exps = JsApp (JsName $ JsBuiltIn "list") [JsList exps]
-- | Optimize short literal [e1..e3] arithmetic sequences.
optEnumFromTo :: Config -> JsExp -> JsExp -> Maybe JsExp
optEnumFromTo cfg (JsLit f) (JsLit t) =
if configOptimize cfg
then case (f,t) of
(JsInt fl, JsInt tl) -> strict JsInt fl tl
(JsFloating fl, JsFloating tl) -> strict JsFloating fl tl
_ -> Nothing
else Nothing
where strict :: (Enum a, Ord a, Num a) => (a -> JsLit) -> a -> a -> Maybe JsExp
strict litfn fr to =
if fromEnum to - fromEnum fr < maxStrictASLen
then Just . makeList . map (JsLit . litfn) $ enumFromTo fr to
else Nothing
optEnumFromTo _ _ _ = Nothing
-- | Optimize short literal [e1,e2..e3] arithmetic sequences.
optEnumFromThenTo :: Config -> JsExp -> JsExp -> JsExp -> Maybe JsExp
optEnumFromThenTo cfg (JsLit fr) (JsLit th) (JsLit to) =
if configOptimize cfg
then case (fr,th,to) of
(JsInt frl, JsInt thl, JsInt tol) -> strict JsInt frl thl tol
(JsFloating frl, JsFloating thl, JsFloating tol) -> strict JsFloating frl thl tol
_ -> Nothing
else Nothing
where strict :: (Enum a, Ord a, Num a) => (a -> JsLit) -> a -> a -> a -> Maybe JsExp
strict litfn fr' th' to' =
if (fromEnum to' - fromEnum fr') `div`
(fromEnum th' - fromEnum fr') + 1 < maxStrictASLen
then Just . makeList . map (JsLit . litfn) $ enumFromThenTo fr' th' to'
else Nothing
optEnumFromThenTo _ _ _ _ = Nothing
-- | Maximum number of elements to allow in strict list representation
-- of arithmetic sequences.
maxStrictASLen :: Int
maxStrictASLen = 10 | 10,241 | compileApp' :: S.Exp -> S.Exp -> Compile JsExp
compileApp' exp1 exp2 = do
flattenApps <- config configFlattenApps
jsexp1 <- compileExp exp1
(if flattenApps then method2 else method1) jsexp1 exp2
where
-- Method 1:
-- In this approach code ends up looking like this:
-- a(a(a(a(a(a(a(a(a(a(L)(c))(b))(0))(0))(y))(t))(a(a(F)(3*a(a(d)+a(a(f)/20))))*a(a(f)/2)))(140+a(f)))(y))(t)})
-- Which might be OK for speed, but increases the JS stack a fair bit.
method1 :: JsExp -> S.Exp -> Compile JsExp
method1 e1 e2 =
JsApp <$> (forceFlatName <$> return e1)
<*> fmap return (compileExp e2)
where
forceFlatName name = JsApp (JsName JsForce) [name]
-- Method 2:
-- In this approach code ends up looking like this:
-- d(O,a,b,0,0,B,w,e(d(I,3*e(e(c)+e(e(g)/20))))*e(e(g)/2),140+e(g),B,w)}),d(K,g,e(c)+0.05))
-- Which should be much better for the stack and readability, but probably not great for speed.
method2 :: JsExp -> S.Exp -> Compile JsExp
method2 e1 e2 = fmap flatten $
JsApp <$> return e1
<*> fmap return (compileExp e2)
where
flatten (JsApp op args) =
case op of
JsApp l r -> JsApp l (r ++ args)
_ -> JsApp (JsName JsApply) (op : args)
flatten x = x
-- | Compile a negate application
compileNegApp :: S.Exp -> Compile JsExp
compileNegApp e = JsNegApp . force <$> compileExp e
-- | Compile a let expression.
compileLet :: [S.Decl] -> S.Exp -> Compile JsExp
compileLet decls exp = do
binds <- mapM compileLetDecl decls
body <- compileExp exp
return (JsApp (JsFun Nothing [] [] (Just $ stmtsThunk $ concat binds ++ [JsEarlyReturn body])) [])
-- | Compile let declaration.
compileLetDecl :: S.Decl -> Compile [JsStmt]
compileLetDecl decl = do
compileDecls <- asks readerCompileDecls
case decl of
PatBind{} -> compileDecls False [decl]
FunBind{} -> compileDecls False [decl]
TypeSig{} -> return []
_ -> throwError $ UnsupportedLetBinding decl
-- | Compile a list expression.
compileList :: [S.Exp] -> Compile JsExp
compileList xs = do
exps <- mapM compileExp xs
return (makeList exps)
-- | Compile an if.
compileIf :: S.Exp -> S.Exp -> S.Exp -> Compile JsExp
compileIf cond conseq alt =
JsTernaryIf <$> fmap force (compileExp cond)
<*> compileExp conseq
<*> compileExp alt
-- | Compile case expressions.
compileCase :: S.Exp -> [S.Alt] -> Compile JsExp
compileCase e alts = do
exp <- compileExp e
withScopedTmpJsName $ \tmpName -> do
pats <- optimizePatConditions <$> mapM (compilePatAlt (JsName tmpName)) alts
return $
JsApp (JsFun Nothing
[tmpName]
(concat pats)
(if any isWildCardAlt alts
then Nothing
else Just (throwExp "unhandled case" (JsName tmpName))))
[exp]
-- | Compile the given pattern against the given expression.
compilePatAlt :: JsExp -> S.Alt -> Compile [JsStmt]
compilePatAlt exp a@(Alt _ pat rhs wheres) = case wheres of
Just (BDecls _ (_ : _)) -> throwError $ UnsupportedWhereInAlt a
Just (IPBinds _ (_ : _)) -> throwError $ UnsupportedWhereInAlt a
_ -> do
alt <- compileGuardedAlt rhs
compilePat exp pat [alt]
-- | Compile a guarded alt.
compileGuardedAlt :: S.Rhs -> Compile JsStmt
compileGuardedAlt alt =
case alt of
UnGuardedRhs _ exp -> JsEarlyReturn <$> compileExp exp
GuardedRhss _ alts -> compileGuards alts
-- | Compile guards
compileGuards :: [S.GuardedRhs] -> Compile JsStmt
compileGuards (GuardedRhs _ (Qualifier _ guard:_) exp : rest) =
makeIf <$> fmap force (compileExp guard)
<*> compileExp exp
<*> if null rest then return [] else do
gs' <- compileGuards rest
return [gs']
where makeIf gs e gss = JsIf gs [JsEarlyReturn e] gss
compileGuards rhss = throwError . UnsupportedRhs . GuardedRhss noI $ rhss
-- | Compile a lambda.
compileLambda :: [S.Pat] -> S.Exp -> Compile JsExp
compileLambda pats = compileExp >=> \exp -> do
stmts <- generateStatements exp
case stmts of
[JsEarlyReturn fun@JsFun{}] -> return fun
_ -> error "Unexpected statements in compileLambda"
where unhandledcase = throw "unhandled case" . JsName
allfree = all isWildCardPat pats
generateStatements exp =
foldM (\inner (param,pat) -> do
stmts <- compilePat (JsName param) pat inner
return [JsEarlyReturn (JsFun Nothing [param] (stmts ++ [unhandledcase param | not allfree]) Nothing)])
[JsEarlyReturn exp]
(reverse (zip uniqueNames pats))
-- | Compile [e1..] arithmetic sequences.
compileEnumFrom :: S.Exp -> Compile JsExp
compileEnumFrom i = do
e <- compileExp i
return (JsApp (JsName (JsNameVar (Qual () "Prelude" "enumFrom"))) [e])
-- | Compile [e1..e3] arithmetic sequences.
compileEnumFromTo :: S.Exp -> S.Exp -> Compile JsExp
compileEnumFromTo i i' = do
f <- compileExp i
t <- compileExp i'
cfg <- config id
return $ case optEnumFromTo cfg f t of
Just s -> s
_ -> JsApp (JsApp (JsName (JsNameVar (Qual () "Prelude" "enumFromTo"))) [f]) [t]
-- | Compile [e1,e2..] arithmetic sequences.
compileEnumFromThen :: S.Exp -> S.Exp -> Compile JsExp
compileEnumFromThen a b = do
fr <- compileExp a
th <- compileExp b
return (JsApp (JsApp (JsName (JsNameVar (Qual () "Prelude" "enumFromThen"))) [fr]) [th])
-- | Compile [e1,e2..e3] arithmetic sequences.
compileEnumFromThenTo :: S.Exp -> S.Exp -> S.Exp -> Compile JsExp
compileEnumFromThenTo a b z = do
fr <- compileExp a
th <- compileExp b
to <- compileExp z
cfg <- config id
return $ case optEnumFromThenTo cfg fr th to of
Just s -> s
_ -> JsApp (JsApp (JsApp (JsName (JsNameVar (Qual () "Prelude" "enumFromThenTo"))) [fr]) [th]) [to]
-- | Compile a record construction with named fields
-- | GHC will warn on uninitialized fields, they will be undefined in JS.
compileRecConstr :: S.Exp -> S.QName -> [S.FieldUpdate] -> Compile JsExp
compileRecConstr origExp name fieldUpdates = do
-- var obj = new $_Type()
let unQualName = withIdent lowerFirst . unQualify $ unAnn name
qname <- unsafeResolveName name
let record = JsVar (JsNameVar unQualName) (JsNew (JsConstructor qname) [])
setFields <- liftM concat (forM fieldUpdates (updateStmt name))
return $ JsApp (JsFun Nothing [] (record:setFields) (Just . JsName . JsNameVar . withIdent lowerFirst . unQualify $ unAnn name)) []
where
-- updateStmt :: QName a -> S.FieldUpdate -> Compile [JsStmt]
updateStmt (unAnn -> o) (FieldUpdate _ (unAnn -> field) value) = do
exp <- compileExp value
return [JsSetProp (JsNameVar $ withIdent lowerFirst $ unQualify o) (JsNameVar $ unQualify field) exp]
updateStmt o (FieldWildcard (wildcardFields -> fields)) =
return $ for fields $ \fieldName -> JsSetProp (JsNameVar . withIdent lowerFirst . unQualify . unAnn $ o)
(JsNameVar fieldName)
(JsName $ JsNameVar fieldName)
-- I couldn't find a code that generates (FieldUpdate (FieldPun ..))
updateStmt _ _ = throwError $ UnsupportedExpression origExp
wildcardFields l = case l of
Scoped (RecExpWildcard es) _ -> map (unQualify . origName2QName . fst) es
_ -> []
lowerFirst :: String -> String
lowerFirst "" = ""
lowerFirst (x:xs) = '_' : Char.toLower x : xs
-- | Compile a record update.
compileRecUpdate :: S.Exp -> S.Exp -> [S.FieldUpdate] -> Compile JsExp
compileRecUpdate origExp rec fieldUpdates = do
record <- force <$> compileExp rec
let copyName = UnQual () $ Ident () "$_record_to_update"
copy = JsVar (JsNameVar copyName)
(JsRawExp ("Object.create(" ++ printJSString record ++ ")"))
setFields <- forM fieldUpdates (updateExp copyName)
return $ JsApp (JsFun Nothing [] (copy:setFields) (Just $ JsName $ JsNameVar copyName)) []
where
updateExp :: QName a -> S.FieldUpdate -> Compile JsStmt
updateExp (unAnn -> copyName) (FieldUpdate _ (unQualify . unAnn -> field) value) =
JsSetProp (JsNameVar copyName) (JsNameVar field) <$> compileExp value
updateExp _ f@FieldPun{} = shouldBeDesugared f
-- I also couldn't find a code that generates (FieldUpdate FieldWildCard)
updateExp _ FieldWildcard{} = throwError $ UnsupportedExpression origExp
-- | Make a Fay list.
makeList :: [JsExp] -> JsExp
makeList exps = JsApp (JsName $ JsBuiltIn "list") [JsList exps]
-- | Optimize short literal [e1..e3] arithmetic sequences.
optEnumFromTo :: Config -> JsExp -> JsExp -> Maybe JsExp
optEnumFromTo cfg (JsLit f) (JsLit t) =
if configOptimize cfg
then case (f,t) of
(JsInt fl, JsInt tl) -> strict JsInt fl tl
(JsFloating fl, JsFloating tl) -> strict JsFloating fl tl
_ -> Nothing
else Nothing
where strict :: (Enum a, Ord a, Num a) => (a -> JsLit) -> a -> a -> Maybe JsExp
strict litfn fr to =
if fromEnum to - fromEnum fr < maxStrictASLen
then Just . makeList . map (JsLit . litfn) $ enumFromTo fr to
else Nothing
optEnumFromTo _ _ _ = Nothing
-- | Optimize short literal [e1,e2..e3] arithmetic sequences.
optEnumFromThenTo :: Config -> JsExp -> JsExp -> JsExp -> Maybe JsExp
optEnumFromThenTo cfg (JsLit fr) (JsLit th) (JsLit to) =
if configOptimize cfg
then case (fr,th,to) of
(JsInt frl, JsInt thl, JsInt tol) -> strict JsInt frl thl tol
(JsFloating frl, JsFloating thl, JsFloating tol) -> strict JsFloating frl thl tol
_ -> Nothing
else Nothing
where strict :: (Enum a, Ord a, Num a) => (a -> JsLit) -> a -> a -> a -> Maybe JsExp
strict litfn fr' th' to' =
if (fromEnum to' - fromEnum fr') `div`
(fromEnum th' - fromEnum fr') + 1 < maxStrictASLen
then Just . makeList . map (JsLit . litfn) $ enumFromThenTo fr' th' to'
else Nothing
optEnumFromThenTo _ _ _ _ = Nothing
-- | Maximum number of elements to allow in strict list representation
-- of arithmetic sequences.
maxStrictASLen :: Int
maxStrictASLen = 10 | 10,213 | compileApp' exp1 exp2 = do
flattenApps <- config configFlattenApps
jsexp1 <- compileExp exp1
(if flattenApps then method2 else method1) jsexp1 exp2
where
-- Method 1:
-- In this approach code ends up looking like this:
-- a(a(a(a(a(a(a(a(a(a(L)(c))(b))(0))(0))(y))(t))(a(a(F)(3*a(a(d)+a(a(f)/20))))*a(a(f)/2)))(140+a(f)))(y))(t)})
-- Which might be OK for speed, but increases the JS stack a fair bit.
method1 :: JsExp -> S.Exp -> Compile JsExp
method1 e1 e2 =
JsApp <$> (forceFlatName <$> return e1)
<*> fmap return (compileExp e2)
where
forceFlatName name = JsApp (JsName JsForce) [name]
-- Method 2:
-- In this approach code ends up looking like this:
-- d(O,a,b,0,0,B,w,e(d(I,3*e(e(c)+e(e(g)/20))))*e(e(g)/2),140+e(g),B,w)}),d(K,g,e(c)+0.05))
-- Which should be much better for the stack and readability, but probably not great for speed.
method2 :: JsExp -> S.Exp -> Compile JsExp
method2 e1 e2 = fmap flatten $
JsApp <$> return e1
<*> fmap return (compileExp e2)
where
flatten (JsApp op args) =
case op of
JsApp l r -> JsApp l (r ++ args)
_ -> JsApp (JsName JsApply) (op : args)
flatten x = x
-- | Compile a negate application
compileNegApp :: S.Exp -> Compile JsExp
compileNegApp e = JsNegApp . force <$> compileExp e
-- | Compile a let expression.
compileLet :: [S.Decl] -> S.Exp -> Compile JsExp
compileLet decls exp = do
binds <- mapM compileLetDecl decls
body <- compileExp exp
return (JsApp (JsFun Nothing [] [] (Just $ stmtsThunk $ concat binds ++ [JsEarlyReturn body])) [])
-- | Compile let declaration.
compileLetDecl :: S.Decl -> Compile [JsStmt]
compileLetDecl decl = do
compileDecls <- asks readerCompileDecls
case decl of
PatBind{} -> compileDecls False [decl]
FunBind{} -> compileDecls False [decl]
TypeSig{} -> return []
_ -> throwError $ UnsupportedLetBinding decl
-- | Compile a list expression.
compileList :: [S.Exp] -> Compile JsExp
compileList xs = do
exps <- mapM compileExp xs
return (makeList exps)
-- | Compile an if.
compileIf :: S.Exp -> S.Exp -> S.Exp -> Compile JsExp
compileIf cond conseq alt =
JsTernaryIf <$> fmap force (compileExp cond)
<*> compileExp conseq
<*> compileExp alt
-- | Compile case expressions.
compileCase :: S.Exp -> [S.Alt] -> Compile JsExp
compileCase e alts = do
exp <- compileExp e
withScopedTmpJsName $ \tmpName -> do
pats <- optimizePatConditions <$> mapM (compilePatAlt (JsName tmpName)) alts
return $
JsApp (JsFun Nothing
[tmpName]
(concat pats)
(if any isWildCardAlt alts
then Nothing
else Just (throwExp "unhandled case" (JsName tmpName))))
[exp]
-- | Compile the given pattern against the given expression.
compilePatAlt :: JsExp -> S.Alt -> Compile [JsStmt]
compilePatAlt exp a@(Alt _ pat rhs wheres) = case wheres of
Just (BDecls _ (_ : _)) -> throwError $ UnsupportedWhereInAlt a
Just (IPBinds _ (_ : _)) -> throwError $ UnsupportedWhereInAlt a
_ -> do
alt <- compileGuardedAlt rhs
compilePat exp pat [alt]
-- | Compile a guarded alt.
compileGuardedAlt :: S.Rhs -> Compile JsStmt
compileGuardedAlt alt =
case alt of
UnGuardedRhs _ exp -> JsEarlyReturn <$> compileExp exp
GuardedRhss _ alts -> compileGuards alts
-- | Compile guards
compileGuards :: [S.GuardedRhs] -> Compile JsStmt
compileGuards (GuardedRhs _ (Qualifier _ guard:_) exp : rest) =
makeIf <$> fmap force (compileExp guard)
<*> compileExp exp
<*> if null rest then return [] else do
gs' <- compileGuards rest
return [gs']
where makeIf gs e gss = JsIf gs [JsEarlyReturn e] gss
compileGuards rhss = throwError . UnsupportedRhs . GuardedRhss noI $ rhss
-- | Compile a lambda.
compileLambda :: [S.Pat] -> S.Exp -> Compile JsExp
compileLambda pats = compileExp >=> \exp -> do
stmts <- generateStatements exp
case stmts of
[JsEarlyReturn fun@JsFun{}] -> return fun
_ -> error "Unexpected statements in compileLambda"
where unhandledcase = throw "unhandled case" . JsName
allfree = all isWildCardPat pats
generateStatements exp =
foldM (\inner (param,pat) -> do
stmts <- compilePat (JsName param) pat inner
return [JsEarlyReturn (JsFun Nothing [param] (stmts ++ [unhandledcase param | not allfree]) Nothing)])
[JsEarlyReturn exp]
(reverse (zip uniqueNames pats))
-- | Compile [e1..] arithmetic sequences.
compileEnumFrom :: S.Exp -> Compile JsExp
compileEnumFrom i = do
e <- compileExp i
return (JsApp (JsName (JsNameVar (Qual () "Prelude" "enumFrom"))) [e])
-- | Compile [e1..e3] arithmetic sequences.
compileEnumFromTo :: S.Exp -> S.Exp -> Compile JsExp
compileEnumFromTo i i' = do
f <- compileExp i
t <- compileExp i'
cfg <- config id
return $ case optEnumFromTo cfg f t of
Just s -> s
_ -> JsApp (JsApp (JsName (JsNameVar (Qual () "Prelude" "enumFromTo"))) [f]) [t]
-- | Compile [e1,e2..] arithmetic sequences.
compileEnumFromThen :: S.Exp -> S.Exp -> Compile JsExp
compileEnumFromThen a b = do
fr <- compileExp a
th <- compileExp b
return (JsApp (JsApp (JsName (JsNameVar (Qual () "Prelude" "enumFromThen"))) [fr]) [th])
-- | Compile [e1,e2..e3] arithmetic sequences.
compileEnumFromThenTo :: S.Exp -> S.Exp -> S.Exp -> Compile JsExp
compileEnumFromThenTo a b z = do
fr <- compileExp a
th <- compileExp b
to <- compileExp z
cfg <- config id
return $ case optEnumFromThenTo cfg fr th to of
Just s -> s
_ -> JsApp (JsApp (JsApp (JsName (JsNameVar (Qual () "Prelude" "enumFromThenTo"))) [fr]) [th]) [to]
-- | Compile a record construction with named fields
-- | GHC will warn on uninitialized fields, they will be undefined in JS.
compileRecConstr :: S.Exp -> S.QName -> [S.FieldUpdate] -> Compile JsExp
compileRecConstr origExp name fieldUpdates = do
-- var obj = new $_Type()
let unQualName = withIdent lowerFirst . unQualify $ unAnn name
qname <- unsafeResolveName name
let record = JsVar (JsNameVar unQualName) (JsNew (JsConstructor qname) [])
setFields <- liftM concat (forM fieldUpdates (updateStmt name))
return $ JsApp (JsFun Nothing [] (record:setFields) (Just . JsName . JsNameVar . withIdent lowerFirst . unQualify $ unAnn name)) []
where
-- updateStmt :: QName a -> S.FieldUpdate -> Compile [JsStmt]
updateStmt (unAnn -> o) (FieldUpdate _ (unAnn -> field) value) = do
exp <- compileExp value
return [JsSetProp (JsNameVar $ withIdent lowerFirst $ unQualify o) (JsNameVar $ unQualify field) exp]
updateStmt o (FieldWildcard (wildcardFields -> fields)) =
return $ for fields $ \fieldName -> JsSetProp (JsNameVar . withIdent lowerFirst . unQualify . unAnn $ o)
(JsNameVar fieldName)
(JsName $ JsNameVar fieldName)
-- I couldn't find a code that generates (FieldUpdate (FieldPun ..))
updateStmt _ _ = throwError $ UnsupportedExpression origExp
wildcardFields l = case l of
Scoped (RecExpWildcard es) _ -> map (unQualify . origName2QName . fst) es
_ -> []
lowerFirst :: String -> String
lowerFirst "" = ""
lowerFirst (x:xs) = '_' : Char.toLower x : xs
-- | Compile a record update.
compileRecUpdate :: S.Exp -> S.Exp -> [S.FieldUpdate] -> Compile JsExp
compileRecUpdate origExp rec fieldUpdates = do
record <- force <$> compileExp rec
let copyName = UnQual () $ Ident () "$_record_to_update"
copy = JsVar (JsNameVar copyName)
(JsRawExp ("Object.create(" ++ printJSString record ++ ")"))
setFields <- forM fieldUpdates (updateExp copyName)
return $ JsApp (JsFun Nothing [] (copy:setFields) (Just $ JsName $ JsNameVar copyName)) []
where
updateExp :: QName a -> S.FieldUpdate -> Compile JsStmt
updateExp (unAnn -> copyName) (FieldUpdate _ (unQualify . unAnn -> field) value) =
JsSetProp (JsNameVar copyName) (JsNameVar field) <$> compileExp value
updateExp _ f@FieldPun{} = shouldBeDesugared f
-- I also couldn't find a code that generates (FieldUpdate FieldWildCard)
updateExp _ FieldWildcard{} = throwError $ UnsupportedExpression origExp
-- | Make a Fay list.
makeList :: [JsExp] -> JsExp
makeList exps = JsApp (JsName $ JsBuiltIn "list") [JsList exps]
-- | Optimize short literal [e1..e3] arithmetic sequences.
optEnumFromTo :: Config -> JsExp -> JsExp -> Maybe JsExp
optEnumFromTo cfg (JsLit f) (JsLit t) =
if configOptimize cfg
then case (f,t) of
(JsInt fl, JsInt tl) -> strict JsInt fl tl
(JsFloating fl, JsFloating tl) -> strict JsFloating fl tl
_ -> Nothing
else Nothing
where strict :: (Enum a, Ord a, Num a) => (a -> JsLit) -> a -> a -> Maybe JsExp
strict litfn fr to =
if fromEnum to - fromEnum fr < maxStrictASLen
then Just . makeList . map (JsLit . litfn) $ enumFromTo fr to
else Nothing
optEnumFromTo _ _ _ = Nothing
-- | Optimize short literal [e1,e2..e3] arithmetic sequences.
optEnumFromThenTo :: Config -> JsExp -> JsExp -> JsExp -> Maybe JsExp
optEnumFromThenTo cfg (JsLit fr) (JsLit th) (JsLit to) =
if configOptimize cfg
then case (fr,th,to) of
(JsInt frl, JsInt thl, JsInt tol) -> strict JsInt frl thl tol
(JsFloating frl, JsFloating thl, JsFloating tol) -> strict JsFloating frl thl tol
_ -> Nothing
else Nothing
where strict :: (Enum a, Ord a, Num a) => (a -> JsLit) -> a -> a -> a -> Maybe JsExp
strict litfn fr' th' to' =
if (fromEnum to' - fromEnum fr') `div`
(fromEnum th' - fromEnum fr') + 1 < maxStrictASLen
then Just . makeList . map (JsLit . litfn) $ enumFromThenTo fr' th' to'
else Nothing
optEnumFromThenTo _ _ _ _ = Nothing
-- | Maximum number of elements to allow in strict list representation
-- of arithmetic sequences.
maxStrictASLen :: Int
maxStrictASLen = 10 | 10,166 | true | true | 83 | 22 | 2,508 | 3,277 | 1,630 | 1,647 | null | null |
saffroy/buddhabrot | BBrotRender.hs | bsd-3-clause | ymax = imagPart hiCorner | 24 | ymax = imagPart hiCorner | 24 | ymax = imagPart hiCorner | 24 | false | false | 1 | 5 | 3 | 13 | 4 | 9 | null | null |
lenary/Idris-dev | src/Idris/AbsSyntaxTree.hs | bsd-3-clause | expandNS syn n = case syn_namespace syn of
[] -> n
xs -> sNS n xs
-- For inferring types of things | 148 | expandNS syn n = case syn_namespace syn of
[] -> n
xs -> sNS n xs
-- For inferring types of things | 148 | expandNS syn n = case syn_namespace syn of
[] -> n
xs -> sNS n xs
-- For inferring types of things | 148 | false | false | 1 | 8 | 71 | 42 | 18 | 24 | null | null |
fmapfmapfmap/amazonka | amazonka-cloudfront/test/Test/AWS/Gen/CloudFront.hs | mpl-2.0 | -- Responses
testDeleteStreamingDistributionResponse :: DeleteStreamingDistributionResponse -> TestTree
testDeleteStreamingDistributionResponse = res
"DeleteStreamingDistributionResponse"
"fixture/DeleteStreamingDistributionResponse.proto"
cloudFront
(Proxy :: Proxy DeleteStreamingDistribution) | 312 | testDeleteStreamingDistributionResponse :: DeleteStreamingDistributionResponse -> TestTree
testDeleteStreamingDistributionResponse = res
"DeleteStreamingDistributionResponse"
"fixture/DeleteStreamingDistributionResponse.proto"
cloudFront
(Proxy :: Proxy DeleteStreamingDistribution) | 298 | testDeleteStreamingDistributionResponse = res
"DeleteStreamingDistributionResponse"
"fixture/DeleteStreamingDistributionResponse.proto"
cloudFront
(Proxy :: Proxy DeleteStreamingDistribution) | 207 | true | true | 0 | 6 | 33 | 37 | 18 | 19 | null | null |
brendanhay/gogol | gogol-serviceusage/gen/Network/Google/ServiceUsage/Types/Product.hs | mpl-2.0 | -- | The URL to the root of documentation.
dDocumentationRootURL :: Lens' Documentation (Maybe Text)
dDocumentationRootURL
= lens _dDocumentationRootURL
(\ s a -> s{_dDocumentationRootURL = a}) | 201 | dDocumentationRootURL :: Lens' Documentation (Maybe Text)
dDocumentationRootURL
= lens _dDocumentationRootURL
(\ s a -> s{_dDocumentationRootURL = a}) | 158 | dDocumentationRootURL
= lens _dDocumentationRootURL
(\ s a -> s{_dDocumentationRootURL = a}) | 100 | true | true | 0 | 9 | 33 | 48 | 25 | 23 | null | null |
kim/amazonka | amazonka-codedeploy/gen/Network/AWS/CodeDeploy/GetOnPremisesInstance.hs | mpl-2.0 | -- | The name of the on-premises instance to get information about
gopiInstanceName :: Lens' GetOnPremisesInstance Text
gopiInstanceName = lens _gopiInstanceName (\s a -> s { _gopiInstanceName = a }) | 199 | gopiInstanceName :: Lens' GetOnPremisesInstance Text
gopiInstanceName = lens _gopiInstanceName (\s a -> s { _gopiInstanceName = a }) | 132 | gopiInstanceName = lens _gopiInstanceName (\s a -> s { _gopiInstanceName = a }) | 79 | true | true | 0 | 9 | 29 | 40 | 22 | 18 | null | null |
CRogers/stack | test/integration/lib/StackTest.hs | bsd-3-clause | stackErr :: [String] -> IO ()
stackErr args = do
ec <- stack' args
if ec == ExitSuccess
then error "stack was supposed to fail, but didn't"
else return () | 178 | stackErr :: [String] -> IO ()
stackErr args = do
ec <- stack' args
if ec == ExitSuccess
then error "stack was supposed to fail, but didn't"
else return () | 178 | stackErr args = do
ec <- stack' args
if ec == ExitSuccess
then error "stack was supposed to fail, but didn't"
else return () | 148 | false | true | 0 | 9 | 53 | 59 | 28 | 31 | null | null |
stu-smith/Brandy | src/DataAccess/Users.hs | mit | dbInsertUser :: PrivateUser -> DatabaseEnvironmentT (Maybe (WithId PrivateUser))
dbInsertUser =
standardInsert privateUserMapping | 133 | dbInsertUser :: PrivateUser -> DatabaseEnvironmentT (Maybe (WithId PrivateUser))
dbInsertUser =
standardInsert privateUserMapping | 133 | dbInsertUser =
standardInsert privateUserMapping | 52 | false | true | 0 | 10 | 15 | 33 | 16 | 17 | null | null |
christiaanb/Idris-dev | src/IRTS/Compiler.hs | bsd-3-clause | mkIntIty "ITNative" = FArith (ATInt ITNative) | 45 | mkIntIty "ITNative" = FArith (ATInt ITNative) | 45 | mkIntIty "ITNative" = FArith (ATInt ITNative) | 45 | false | false | 1 | 7 | 5 | 21 | 8 | 13 | null | null |
fffej/codekatas | 99Problems/31-41/Problems.hs | mit | isPrime :: Integer -> Bool
isPrime n = null [ x | x <- [2.. n-1], n `mod` x == 0] | 81 | isPrime :: Integer -> Bool
isPrime n = null [ x | x <- [2.. n-1], n `mod` x == 0] | 81 | isPrime n = null [ x | x <- [2.. n-1], n `mod` x == 0] | 54 | false | true | 0 | 10 | 20 | 60 | 30 | 30 | null | null |
antalsz/hs-to-coq | examples/graph/graph/Data/Graph/Inductive/Query/ArtPoint.hs | mit | dfsTree n u (v:vs) ls g = case match v g of
(Nothing, g1) -> dfsTree n u vs ls g1
(Just c , g1) -> (B (v,n+1,bck) ts:ts', g3, k)
where bck = getBackEdges v ls
(ts, g2,m) = dfsTree (n+1) v sc ls' g1
(ts',g3,k) = dfsTree m v vs ls g2
ls' = ((v,n+1):sc'):ls
sc' = map (\x->(x,0)) sc
sc = suc' c
------------------------------------------------------------------------------
-- Finds the minimum between a dfs number and a list of back edges' dfs
-- numbers.
------------------------------------------------------------------------------ | 829 | dfsTree n u (v:vs) ls g = case match v g of
(Nothing, g1) -> dfsTree n u vs ls g1
(Just c , g1) -> (B (v,n+1,bck) ts:ts', g3, k)
where bck = getBackEdges v ls
(ts, g2,m) = dfsTree (n+1) v sc ls' g1
(ts',g3,k) = dfsTree m v vs ls g2
ls' = ((v,n+1):sc'):ls
sc' = map (\x->(x,0)) sc
sc = suc' c
------------------------------------------------------------------------------
-- Finds the minimum between a dfs number and a list of back edges' dfs
-- numbers.
------------------------------------------------------------------------------ | 829 | dfsTree n u (v:vs) ls g = case match v g of
(Nothing, g1) -> dfsTree n u vs ls g1
(Just c , g1) -> (B (v,n+1,bck) ts:ts', g3, k)
where bck = getBackEdges v ls
(ts, g2,m) = dfsTree (n+1) v sc ls' g1
(ts',g3,k) = dfsTree m v vs ls g2
ls' = ((v,n+1):sc'):ls
sc' = map (\x->(x,0)) sc
sc = suc' c
------------------------------------------------------------------------------
-- Finds the minimum between a dfs number and a list of back edges' dfs
-- numbers.
------------------------------------------------------------------------------ | 829 | false | false | 0 | 14 | 380 | 235 | 129 | 106 | null | null |
jyp/lp-diagrams | Graphics/Diagrams/Path.hs | agpl-3.0 | -- | Circle approximated with 4 cubic bezier curves
circlePath :: Point -> Expr -> Path
circlePath center r =
Path (pt r zero)
[CurveTo (pt r k) (pt k r) (pt zero r),
CurveTo (pt (negate k) r) (pt (negate r) k) (pt (negate r) zero),
CurveTo (pt (negate r) (negate k)) (pt (negate k) (negate r)) (pt zero (negate r)),
CurveTo (pt k (negate r)) (pt r (negate k)) (pt r zero),
Cycle]
where k1 :: Double
k1 = fromInteger 4 * (sqrt (fromInteger 2) - (fromInteger 1)) / fromInteger 3
k = k1 *^ r
pt x y = center + (Point x y) | 557 | circlePath :: Point -> Expr -> Path
circlePath center r =
Path (pt r zero)
[CurveTo (pt r k) (pt k r) (pt zero r),
CurveTo (pt (negate k) r) (pt (negate r) k) (pt (negate r) zero),
CurveTo (pt (negate r) (negate k)) (pt (negate k) (negate r)) (pt zero (negate r)),
CurveTo (pt k (negate r)) (pt r (negate k)) (pt r zero),
Cycle]
where k1 :: Double
k1 = fromInteger 4 * (sqrt (fromInteger 2) - (fromInteger 1)) / fromInteger 3
k = k1 *^ r
pt x y = center + (Point x y) | 505 | circlePath center r =
Path (pt r zero)
[CurveTo (pt r k) (pt k r) (pt zero r),
CurveTo (pt (negate k) r) (pt (negate r) k) (pt (negate r) zero),
CurveTo (pt (negate r) (negate k)) (pt (negate k) (negate r)) (pt zero (negate r)),
CurveTo (pt k (negate r)) (pt r (negate k)) (pt r zero),
Cycle]
where k1 :: Double
k1 = fromInteger 4 * (sqrt (fromInteger 2) - (fromInteger 1)) / fromInteger 3
k = k1 *^ r
pt x y = center + (Point x y) | 469 | true | true | 3 | 13 | 144 | 322 | 159 | 163 | null | null |
bacchanalia/KitchenSink | KitchenSink/Qualified.hs | gpl-3.0 | -- |'BLC.putStrLn'
blc_putStrLn = BLC.putStrLn | 46 | blc_putStrLn = BLC.putStrLn | 27 | blc_putStrLn = BLC.putStrLn | 27 | true | false | 0 | 5 | 4 | 9 | 5 | 4 | null | null |
ahodgen/archer-calc | src/Syntax.hs | bsd-2-clause | pos :: Expr -> Pos
pos (Expr p _) = p | 37 | pos :: Expr -> Pos
pos (Expr p _) = p | 37 | pos (Expr p _) = p | 18 | false | true | 0 | 7 | 10 | 26 | 13 | 13 | null | null |
dotnetCarpenter/haskell1 | ch05/more_recursion.hs | isc | reverse' :: [a] -> [a]
reverse' [] = [] | 39 | reverse' :: [a] -> [a]
reverse' [] = [] | 39 | reverse' [] = [] | 16 | false | true | 0 | 6 | 8 | 28 | 15 | 13 | null | null |
schell/odin | odin-engine/src/Odin/Engine/Physics.hs | mit | emptyScene :: OdinScene
emptyScene = Scene world externals contactBehavior
where world = emptyWorld
externals = []
contactBehavior = ContactBehavior 0.01 0.02 | 176 | emptyScene :: OdinScene
emptyScene = Scene world externals contactBehavior
where world = emptyWorld
externals = []
contactBehavior = ContactBehavior 0.01 0.02 | 176 | emptyScene = Scene world externals contactBehavior
where world = emptyWorld
externals = []
contactBehavior = ContactBehavior 0.01 0.02 | 152 | false | true | 2 | 6 | 38 | 45 | 22 | 23 | null | null |
lynnard/cocos2d-hs | src/Graphics/UI/Cocos2d/Director.hs | bsd-3-clause | castEventDispatcherToNonconst (EventDispatcherConstGc fptr' ptr') = EventDispatcherGc fptr' $ HoppyF.castPtr ptr' | 113 | castEventDispatcherToNonconst (EventDispatcherConstGc fptr' ptr') = EventDispatcherGc fptr' $ HoppyF.castPtr ptr' | 113 | castEventDispatcherToNonconst (EventDispatcherConstGc fptr' ptr') = EventDispatcherGc fptr' $ HoppyF.castPtr ptr' | 113 | false | false | 0 | 7 | 9 | 29 | 13 | 16 | null | null |
shimanekb/Learn_Haskell | pp2/ppTwoTwo/.stack-work/dist/x86_64-osx/Cabal-1.18.1.5/build/autogen/Paths_ppTwoTwo.hs | gpl-2.0 | libexecdir = "/Users/brandonshimanek/Documents/Haskell_Workspaces/LYHGG/Learn_Haskell/pp2/ppTwoTwo/.stack-work/install/x86_64-osx/lts-2.18/7.8.4/libexec" | 153 | libexecdir = "/Users/brandonshimanek/Documents/Haskell_Workspaces/LYHGG/Learn_Haskell/pp2/ppTwoTwo/.stack-work/install/x86_64-osx/lts-2.18/7.8.4/libexec" | 153 | libexecdir = "/Users/brandonshimanek/Documents/Haskell_Workspaces/LYHGG/Learn_Haskell/pp2/ppTwoTwo/.stack-work/install/x86_64-osx/lts-2.18/7.8.4/libexec" | 153 | false | false | 1 | 5 | 2 | 10 | 3 | 7 | null | null |
CloudI/CloudI | src/api/haskell/external/binary-0.8.7.0/benchmarks/Put.hs | mit | word32s :: [Word32]
word32s = take 10000 $ cycle [minBound .. maxBound] | 71 | word32s :: [Word32]
word32s = take 10000 $ cycle [minBound .. maxBound] | 71 | word32s = take 10000 $ cycle [minBound .. maxBound] | 51 | false | true | 0 | 7 | 11 | 30 | 16 | 14 | null | null |
headprogrammingczar/cabal | cabal-install/Distribution/Client/Config.hs | bsd-3-clause | writeConfigFile :: FilePath -> SavedConfig -> SavedConfig -> IO ()
writeConfigFile file comments vals = do
let tmpFile = file <.> "tmp"
createDirectoryIfMissing True (takeDirectory file)
writeFile tmpFile $ explanation ++ showConfigWithComments comments vals ++ "\n"
renameFile tmpFile file
where
explanation = unlines
["-- This is the configuration file for the 'cabal' command line tool."
,""
,"-- The available configuration options are listed below."
,"-- Some of them have default values listed."
,""
,"-- Lines (like this one) beginning with '--' are comments."
,"-- Be careful with spaces and indentation because they are"
,"-- used to indicate layout for nested sections."
,""
,"-- Cabal library version: " ++ showVersion cabalVersion
,"-- cabal-install version: " ++ showVersion Paths_cabal_install.version
,"",""
]
-- | These are the default values that get used in Cabal if a no value is
-- given. We use these here to include in comments when we write out the
-- initial config file so that the user can see what default value they are
-- overriding.
-- | 1,158 | writeConfigFile :: FilePath -> SavedConfig -> SavedConfig -> IO ()
writeConfigFile file comments vals = do
let tmpFile = file <.> "tmp"
createDirectoryIfMissing True (takeDirectory file)
writeFile tmpFile $ explanation ++ showConfigWithComments comments vals ++ "\n"
renameFile tmpFile file
where
explanation = unlines
["-- This is the configuration file for the 'cabal' command line tool."
,""
,"-- The available configuration options are listed below."
,"-- Some of them have default values listed."
,""
,"-- Lines (like this one) beginning with '--' are comments."
,"-- Be careful with spaces and indentation because they are"
,"-- used to indicate layout for nested sections."
,""
,"-- Cabal library version: " ++ showVersion cabalVersion
,"-- cabal-install version: " ++ showVersion Paths_cabal_install.version
,"",""
]
-- | These are the default values that get used in Cabal if a no value is
-- given. We use these here to include in comments when we write out the
-- initial config file so that the user can see what default value they are
-- overriding.
-- | 1,158 | writeConfigFile file comments vals = do
let tmpFile = file <.> "tmp"
createDirectoryIfMissing True (takeDirectory file)
writeFile tmpFile $ explanation ++ showConfigWithComments comments vals ++ "\n"
renameFile tmpFile file
where
explanation = unlines
["-- This is the configuration file for the 'cabal' command line tool."
,""
,"-- The available configuration options are listed below."
,"-- Some of them have default values listed."
,""
,"-- Lines (like this one) beginning with '--' are comments."
,"-- Be careful with spaces and indentation because they are"
,"-- used to indicate layout for nested sections."
,""
,"-- Cabal library version: " ++ showVersion cabalVersion
,"-- cabal-install version: " ++ showVersion Paths_cabal_install.version
,"",""
]
-- | These are the default values that get used in Cabal if a no value is
-- given. We use these here to include in comments when we write out the
-- initial config file so that the user can see what default value they are
-- overriding.
-- | 1,091 | false | true | 0 | 10 | 261 | 164 | 85 | 79 | null | null |
cjp256/manager | xenmgr/Vm/Queries.hs | gpl-2.0 | getVmRunPreBoot uuid = readConfigProperty uuid vmRunPreBoot | 59 | getVmRunPreBoot uuid = readConfigProperty uuid vmRunPreBoot | 59 | getVmRunPreBoot uuid = readConfigProperty uuid vmRunPreBoot | 59 | false | false | 0 | 5 | 5 | 14 | 6 | 8 | null | null |
HIPERFIT/language-c-quote | Language/C/Quote/Base.hs | bsd-3-clause | qqExpP :: C.Exp -> Maybe (Q Pat)
qqExpP (C.AntiExp v _) = Just $ antiVarP v | 75 | qqExpP :: C.Exp -> Maybe (Q Pat)
qqExpP (C.AntiExp v _) = Just $ antiVarP v | 75 | qqExpP (C.AntiExp v _) = Just $ antiVarP v | 42 | false | true | 0 | 8 | 15 | 50 | 23 | 27 | null | null |
EduPH/Problemas | AB/AB.hs | gpl-3.0 | abProb' r = length [(r!i,r!j,r!k) | i <- [1..length r],
j <- (delete i [1..length r]),
k <-(delete j (delete i [1..length r])),
r!i+r!j== r!k] | 208 | abProb' r = length [(r!i,r!j,r!k) | i <- [1..length r],
j <- (delete i [1..length r]),
k <-(delete j (delete i [1..length r])),
r!i+r!j== r!k] | 208 | abProb' r = length [(r!i,r!j,r!k) | i <- [1..length r],
j <- (delete i [1..length r]),
k <-(delete j (delete i [1..length r])),
r!i+r!j== r!k] | 208 | false | false | 0 | 14 | 90 | 132 | 67 | 65 | null | null |
mcschroeder/ghc | compiler/basicTypes/OccName.hs | bsd-3-clause | -- Pretty inefficient!
-- | Test if the 'OccName' is that for any operator (whether
-- it is a data constructor or variable or whatever)
isSymOcc :: OccName -> Bool
isSymOcc (OccName DataName s) = isLexConSym s | 212 | isSymOcc :: OccName -> Bool
isSymOcc (OccName DataName s) = isLexConSym s | 74 | isSymOcc (OccName DataName s) = isLexConSym s | 46 | true | true | 0 | 7 | 38 | 32 | 17 | 15 | null | null |
badp/ganeti | src/Ganeti/Types.hs | gpl-2.0 | roleDescription NRDrained = "drained" | 39 | roleDescription NRDrained = "drained" | 39 | roleDescription NRDrained = "drained" | 39 | false | false | 0 | 4 | 5 | 10 | 4 | 6 | null | null |
vTurbine/ghc | compiler/deSugar/DsBinds.hs | bsd-3-clause | dsHsWrapper (WpCast co) e = ASSERT(coercionRole co == Representational)
return $ mkCastDs e co | 134 | dsHsWrapper (WpCast co) e = ASSERT(coercionRole co == Representational)
return $ mkCastDs e co | 134 | dsHsWrapper (WpCast co) e = ASSERT(coercionRole co == Representational)
return $ mkCastDs e co | 134 | false | false | 0 | 9 | 53 | 41 | 19 | 22 | null | null |
bch29/robo-monad | demo/ExampleLensed.hs | gpl-3.0 | myOnCollideWall ∷ WallCollisionData → ExampleLensed ()
myOnCollideWall w = do
return ()
-- | This is the actual robot specification to be passed to
-- @runWorld@. | 165 | myOnCollideWall ∷ WallCollisionData → ExampleLensed ()
myOnCollideWall w = do
return ()
-- | This is the actual robot specification to be passed to
-- @runWorld@. | 165 | myOnCollideWall w = do
return ()
-- | This is the actual robot specification to be passed to
-- @runWorld@. | 110 | false | true | 0 | 9 | 28 | 38 | 17 | 21 | null | null |
lamefun/haddock | haddock-api/src/Haddock/Utils.hs | bsd-2-clause | mkMeta :: Doc a -> MDoc a
mkMeta x = emptyMetaDoc { _doc = x } | 62 | mkMeta :: Doc a -> MDoc a
mkMeta x = emptyMetaDoc { _doc = x } | 62 | mkMeta x = emptyMetaDoc { _doc = x } | 36 | false | true | 0 | 6 | 15 | 32 | 16 | 16 | null | null |
dino-r/casttex | src/TexParser.hs | mit | inlineMath i =
do char '$'
arg <- manyTill anyChar (char '$')
return ((ExternalizeInline (Enclosed "$"), i+1), arg)
-- characters that should trigger to stop parsing text. | 187 | inlineMath i =
do char '$'
arg <- manyTill anyChar (char '$')
return ((ExternalizeInline (Enclosed "$"), i+1), arg)
-- characters that should trigger to stop parsing text. | 187 | inlineMath i =
do char '$'
arg <- manyTill anyChar (char '$')
return ((ExternalizeInline (Enclosed "$"), i+1), arg)
-- characters that should trigger to stop parsing text. | 187 | false | false | 0 | 12 | 42 | 65 | 31 | 34 | null | null |
fffej/HS-Poker | LookupPatternMatch.hs | bsd-3-clause | getValueFromProduct 229593 = 4191 | 33 | getValueFromProduct 229593 = 4191 | 33 | getValueFromProduct 229593 = 4191 | 33 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
NCrashed/hjass | src/library/Language/Jass/Parser/Grammar.hs | mit | localVar :: JassParser LocalVar
localVar = reserved "local" >> (try podLocalVar <|> arrayLocalVar)
where
podLocalVar = LocalVar <$> getPosition' <*> pure False <*> jassType <*> identifier <*> optionMaybe (reservedOp "=" >> expression)
arrayLocalVar = LocalVar <$> getPosition' <*> pure True <*> jassType <*> (reserved "array" >> identifier) <*> pure Nothing | 368 | localVar :: JassParser LocalVar
localVar = reserved "local" >> (try podLocalVar <|> arrayLocalVar)
where
podLocalVar = LocalVar <$> getPosition' <*> pure False <*> jassType <*> identifier <*> optionMaybe (reservedOp "=" >> expression)
arrayLocalVar = LocalVar <$> getPosition' <*> pure True <*> jassType <*> (reserved "array" >> identifier) <*> pure Nothing | 368 | localVar = reserved "local" >> (try podLocalVar <|> arrayLocalVar)
where
podLocalVar = LocalVar <$> getPosition' <*> pure False <*> jassType <*> identifier <*> optionMaybe (reservedOp "=" >> expression)
arrayLocalVar = LocalVar <$> getPosition' <*> pure True <*> jassType <*> (reserved "array" >> identifier) <*> pure Nothing | 336 | false | true | 0 | 9 | 60 | 116 | 56 | 60 | null | null |
brownplt/javascript-contracts | src/BrownPLT/JavaScript/Contracts.hs | bsd-3-clause | getContractLibraryPath :: IO FilePath
getContractLibraryPath = do
dataDir <- getDataDir
return $ dataDir </> "contracts.js" | 127 | getContractLibraryPath :: IO FilePath
getContractLibraryPath = do
dataDir <- getDataDir
return $ dataDir </> "contracts.js" | 127 | getContractLibraryPath = do
dataDir <- getDataDir
return $ dataDir </> "contracts.js" | 89 | false | true | 0 | 8 | 18 | 32 | 15 | 17 | null | null |
tolysz/wai | warp/Network/Wai/Handler/Warp/HTTP2/Receiver.hs | mit | control _ _ _ _ =
-- must not reach here
return False | 61 | control _ _ _ _ =
-- must not reach here
return False | 61 | control _ _ _ _ =
-- must not reach here
return False | 61 | false | false | 1 | 5 | 20 | 19 | 8 | 11 | null | null |
peterokagey/haskellOEIS | src/Sandbox/Sami/PermutationStatistics.hs | apache-2.0 | firstLetterKMDescents k m = firstStatistic ((==k) . mDescents m) | 66 | firstLetterKMDescents k m = firstStatistic ((==k) . mDescents m) | 66 | firstLetterKMDescents k m = firstStatistic ((==k) . mDescents m) | 66 | false | false | 0 | 8 | 10 | 28 | 14 | 14 | null | null |
mightymoose/liquidhaskell | benchmarks/ghc-7.4.1/IO/Handle/Text.hs | bsd-3-clause | hPutStr :: Handle -> String -> IO ()
hPutStr handle str = hPutStr' handle str False | 83 | hPutStr :: Handle -> String -> IO ()
hPutStr handle str = hPutStr' handle str False | 83 | hPutStr handle str = hPutStr' handle str False | 46 | false | true | 0 | 8 | 15 | 36 | 17 | 19 | null | null |
mattias-lundell/timber-llvm | src/Kind.hs | bsd-3-clause | kindOfType env (TAp t t') = k
where KFun k' k = kindOfType env t | 102 | kindOfType env (TAp t t') = k
where KFun k' k = kindOfType env t | 102 | kindOfType env (TAp t t') = k
where KFun k' k = kindOfType env t | 102 | false | false | 0 | 7 | 52 | 36 | 17 | 19 | null | null |
robdockins/edison | edison-core/src/Data/Edison/Concrete/FingerTree.hs | mit | appendTree3 :: (Measured v a) => FingerTree v a -> a -> a -> a -> FingerTree v a -> FingerTree v a
appendTree3 Empty a b c xs =
a `lcons` (b `lcons` (c `lcons` xs)) | 172 | appendTree3 :: (Measured v a) => FingerTree v a -> a -> a -> a -> FingerTree v a -> FingerTree v a
appendTree3 Empty a b c xs =
a `lcons` (b `lcons` (c `lcons` xs)) | 172 | appendTree3 Empty a b c xs =
a `lcons` (b `lcons` (c `lcons` xs)) | 73 | false | true | 0 | 12 | 44 | 100 | 51 | 49 | null | null |
samscott89/tamarin-prover | lib/theory/src/Theory/Model/Rule.hs | gpl-3.0 | prettyProtoRuleACInfo :: HighlightDocument d => ProtoRuleACInfo -> d
prettyProtoRuleACInfo i =
(ppVariants $ L.get pracVariants i) $-$
prettyLoopBreakers i
where
ppVariants (Disj [subst]) | subst == emptySubstVFresh = emptyDoc
ppVariants substs = kwVariantsModulo "AC" $-$ prettyDisjLNSubstsVFresh substs | 322 | prettyProtoRuleACInfo :: HighlightDocument d => ProtoRuleACInfo -> d
prettyProtoRuleACInfo i =
(ppVariants $ L.get pracVariants i) $-$
prettyLoopBreakers i
where
ppVariants (Disj [subst]) | subst == emptySubstVFresh = emptyDoc
ppVariants substs = kwVariantsModulo "AC" $-$ prettyDisjLNSubstsVFresh substs | 322 | prettyProtoRuleACInfo i =
(ppVariants $ L.get pracVariants i) $-$
prettyLoopBreakers i
where
ppVariants (Disj [subst]) | subst == emptySubstVFresh = emptyDoc
ppVariants substs = kwVariantsModulo "AC" $-$ prettyDisjLNSubstsVFresh substs | 253 | false | true | 1 | 9 | 54 | 101 | 45 | 56 | null | null |
AndreasPK/stack | src/Stack/Types/Config.hs | bsd-3-clause | configMonoidScmInitName :: Text
configMonoidScmInitName = "scm-init" | 68 | configMonoidScmInitName :: Text
configMonoidScmInitName = "scm-init" | 68 | configMonoidScmInitName = "scm-init" | 36 | false | true | 0 | 4 | 5 | 11 | 6 | 5 | null | null |
haskell-compat/base-compat | check/exes/dumpindex.hs | mit | removeTypeDefinitions :: [String] -> [String]
removeTypeDefinitions = filter (not . List.isPrefixOf "type ") | 108 | removeTypeDefinitions :: [String] -> [String]
removeTypeDefinitions = filter (not . List.isPrefixOf "type ") | 108 | removeTypeDefinitions = filter (not . List.isPrefixOf "type ") | 62 | false | true | 0 | 9 | 12 | 43 | 20 | 23 | null | null |
thomasdziedzic/hs-spotify | example/high-login.hs | mit | main :: IO ()
main = do
key <- B.readFile $ "spotify_appkey.key"
process_events_broadcast <- Broadcast.new
let sessionCallbacks = SessionCallbacks {
loggedIn = loggedInCb
, loggedOut = loggedOutCb
, metadataUpdated = metadataUpdatedCb
, connectionError = connectionErrorCb
, messageToUser = messageToUserCb
, notifyMainThread = notifyMainThreadCb process_events_broadcast
, musicDelivery = musicDeliveryCb
, playTokenLost = playTokenLostCb
, logMessage = logMessageCb
, endOfTrack = endOfTrackCb
, streamingError = streamingErrorCb
, userinfoUpdated = userinfoUpdatedCb
, startPlayback = startPlaybackCb
, stopPlayback = stopPlaybackCb
, getAudioBufferStats = getAudioBufferStatsCb
, offlineStatusUpdated = offlineStatusUpdatedCb
, offlineError = offlineErrorCb
, credentialsBlobUpdated = credentialsBlobUpdatedCb
, connectionstateUpdated = connectionstateUpdatedCb
, scrobbleError = scrobbleErrorCb
, privateSessionModeChanged = privateSessionModeChangedCb
}
let sessionConfig = SessionConfig {
cacheLocation = "/tmp/spotify"
, settingsLocation = "/tmp/spotify"
, applicationKey = key
, userAgent = "hs-spotify"
, callbacks = sessionCallbacks
, userdata = B.empty
, compressPlaylists = False
, dontSaveMetadataForPlaylists = False
, initiallyUnloadPlaylists = False
, deviceId = "deviceId"
, proxy = ""
, proxyUsername = ""
, proxyPassword = ""
, caCertsFilename = ""
, tracefile = "tracefile"
}
-- TODO error handling
(Right session) <- sessionCreate sessionConfig
putStrLn "Enter your username"
username <- getLine
putStrLn "Enter your password"
password <- getLine
-- TODO error handling
loginResult <- sessionLogin session username password False Nothing
case loginResult of
Nothing -> return ()
Just err -> putStrLn $ "login result: " ++ sp_error_message err
delay_process_events process_events_broadcast session | 2,488 | main :: IO ()
main = do
key <- B.readFile $ "spotify_appkey.key"
process_events_broadcast <- Broadcast.new
let sessionCallbacks = SessionCallbacks {
loggedIn = loggedInCb
, loggedOut = loggedOutCb
, metadataUpdated = metadataUpdatedCb
, connectionError = connectionErrorCb
, messageToUser = messageToUserCb
, notifyMainThread = notifyMainThreadCb process_events_broadcast
, musicDelivery = musicDeliveryCb
, playTokenLost = playTokenLostCb
, logMessage = logMessageCb
, endOfTrack = endOfTrackCb
, streamingError = streamingErrorCb
, userinfoUpdated = userinfoUpdatedCb
, startPlayback = startPlaybackCb
, stopPlayback = stopPlaybackCb
, getAudioBufferStats = getAudioBufferStatsCb
, offlineStatusUpdated = offlineStatusUpdatedCb
, offlineError = offlineErrorCb
, credentialsBlobUpdated = credentialsBlobUpdatedCb
, connectionstateUpdated = connectionstateUpdatedCb
, scrobbleError = scrobbleErrorCb
, privateSessionModeChanged = privateSessionModeChangedCb
}
let sessionConfig = SessionConfig {
cacheLocation = "/tmp/spotify"
, settingsLocation = "/tmp/spotify"
, applicationKey = key
, userAgent = "hs-spotify"
, callbacks = sessionCallbacks
, userdata = B.empty
, compressPlaylists = False
, dontSaveMetadataForPlaylists = False
, initiallyUnloadPlaylists = False
, deviceId = "deviceId"
, proxy = ""
, proxyUsername = ""
, proxyPassword = ""
, caCertsFilename = ""
, tracefile = "tracefile"
}
-- TODO error handling
(Right session) <- sessionCreate sessionConfig
putStrLn "Enter your username"
username <- getLine
putStrLn "Enter your password"
password <- getLine
-- TODO error handling
loginResult <- sessionLogin session username password False Nothing
case loginResult of
Nothing -> return ()
Just err -> putStrLn $ "login result: " ++ sp_error_message err
delay_process_events process_events_broadcast session | 2,488 | main = do
key <- B.readFile $ "spotify_appkey.key"
process_events_broadcast <- Broadcast.new
let sessionCallbacks = SessionCallbacks {
loggedIn = loggedInCb
, loggedOut = loggedOutCb
, metadataUpdated = metadataUpdatedCb
, connectionError = connectionErrorCb
, messageToUser = messageToUserCb
, notifyMainThread = notifyMainThreadCb process_events_broadcast
, musicDelivery = musicDeliveryCb
, playTokenLost = playTokenLostCb
, logMessage = logMessageCb
, endOfTrack = endOfTrackCb
, streamingError = streamingErrorCb
, userinfoUpdated = userinfoUpdatedCb
, startPlayback = startPlaybackCb
, stopPlayback = stopPlaybackCb
, getAudioBufferStats = getAudioBufferStatsCb
, offlineStatusUpdated = offlineStatusUpdatedCb
, offlineError = offlineErrorCb
, credentialsBlobUpdated = credentialsBlobUpdatedCb
, connectionstateUpdated = connectionstateUpdatedCb
, scrobbleError = scrobbleErrorCb
, privateSessionModeChanged = privateSessionModeChangedCb
}
let sessionConfig = SessionConfig {
cacheLocation = "/tmp/spotify"
, settingsLocation = "/tmp/spotify"
, applicationKey = key
, userAgent = "hs-spotify"
, callbacks = sessionCallbacks
, userdata = B.empty
, compressPlaylists = False
, dontSaveMetadataForPlaylists = False
, initiallyUnloadPlaylists = False
, deviceId = "deviceId"
, proxy = ""
, proxyUsername = ""
, proxyPassword = ""
, caCertsFilename = ""
, tracefile = "tracefile"
}
-- TODO error handling
(Right session) <- sessionCreate sessionConfig
putStrLn "Enter your username"
username <- getLine
putStrLn "Enter your password"
password <- getLine
-- TODO error handling
loginResult <- sessionLogin session username password False Nothing
case loginResult of
Nothing -> return ()
Just err -> putStrLn $ "login result: " ++ sp_error_message err
delay_process_events process_events_broadcast session | 2,474 | false | true | 0 | 12 | 895 | 389 | 221 | 168 | null | null |
diku-dk/futhark | src/Futhark/IR/Prop/Types.hs | isc | -- | Add the given uniqueness information to the types.
toDecl ::
TypeBase shape NoUniqueness ->
Uniqueness ->
TypeBase shape Uniqueness
toDecl (Prim t) _ = Prim t | 169 | toDecl ::
TypeBase shape NoUniqueness ->
Uniqueness ->
TypeBase shape Uniqueness
toDecl (Prim t) _ = Prim t | 113 | toDecl (Prim t) _ = Prim t | 26 | true | true | 0 | 10 | 33 | 48 | 22 | 26 | null | null |
harendra-kumar/asyncly | src/Streamly/Internal/Benchmark/Prelude.hs | bsd-3-clause | isSubsequenceOf src = S.isSubsequenceOf src src | 47 | isSubsequenceOf src = S.isSubsequenceOf src src | 47 | isSubsequenceOf src = S.isSubsequenceOf src src | 47 | false | false | 1 | 6 | 5 | 19 | 7 | 12 | null | null |
sinelaw/fresh | src/Fresh/Infer.hs | gpl-2.0 | flattenTyAp :: SType s -> FlatTy (SType s)
flattenTyAp (SType (TyAST (TyAp ap res))) = FlatTyAp (flattenTyAp ap) (flattenTyAp res) | 130 | flattenTyAp :: SType s -> FlatTy (SType s)
flattenTyAp (SType (TyAST (TyAp ap res))) = FlatTyAp (flattenTyAp ap) (flattenTyAp res) | 130 | flattenTyAp (SType (TyAST (TyAp ap res))) = FlatTyAp (flattenTyAp ap) (flattenTyAp res) | 87 | false | true | 0 | 13 | 19 | 71 | 33 | 38 | null | null |
ComputationWithBoundedResources/tct-common | src/Tct/Common/Graph.hs | bsd-3-clause | lookupNode' :: Eq nl => Graph nl el -> nl -> NodeId
lookupNode' gr n = err `fromMaybe` lookupNode gr n
where err = error "Graph.lookupNodeLabel': label not found" | 164 | lookupNode' :: Eq nl => Graph nl el -> nl -> NodeId
lookupNode' gr n = err `fromMaybe` lookupNode gr n
where err = error "Graph.lookupNodeLabel': label not found" | 164 | lookupNode' gr n = err `fromMaybe` lookupNode gr n
where err = error "Graph.lookupNodeLabel': label not found" | 112 | false | true | 0 | 7 | 30 | 58 | 28 | 30 | null | null |
dgvncsz0f/nws | src/Jerimum/Storage/LMDB/Device.hs | bsd-3-clause | getHandlePath :: S.Handle a -> IO FilePath
getHandlePath handle = S.getPath handle >>= getRealPath | 98 | getHandlePath :: S.Handle a -> IO FilePath
getHandlePath handle = S.getPath handle >>= getRealPath | 98 | getHandlePath handle = S.getPath handle >>= getRealPath | 55 | false | true | 0 | 7 | 13 | 35 | 16 | 19 | null | null |
AccelerateHS/accelerate-cuda | Data/Array/Accelerate/CUDA.hs | bsd-3-clause | -- | As 'run1', but the computation is executed asynchronously.
--
run1Async :: (Arrays a, Arrays b) => (Acc a -> Acc b) -> a -> IO (Async b)
run1Async = run1AsyncWith defaultContext | 182 | run1Async :: (Arrays a, Arrays b) => (Acc a -> Acc b) -> a -> IO (Async b)
run1Async = run1AsyncWith defaultContext | 115 | run1Async = run1AsyncWith defaultContext | 40 | true | true | 0 | 10 | 32 | 61 | 31 | 30 | null | null |
folivetti/BIGDATA | 03 - Distancias/DistancesPar.hs | mit | normaliza :: [[Double]] -> [[Double]]
normaliza x = map normaliza' x
where
normaliza' xi = xi ./ (norma xi)
norma xi = sqrt . sum $ xi .^ 2 | 154 | normaliza :: [[Double]] -> [[Double]]
normaliza x = map normaliza' x
where
normaliza' xi = xi ./ (norma xi)
norma xi = sqrt . sum $ xi .^ 2 | 154 | normaliza x = map normaliza' x
where
normaliza' xi = xi ./ (norma xi)
norma xi = sqrt . sum $ xi .^ 2 | 116 | false | true | 4 | 9 | 43 | 86 | 41 | 45 | null | null |
lukexi/ghc-7.8-arm64 | compiler/main/DynFlags.hs | bsd-3-clause | wayOptc _ WayDyn = [] | 28 | wayOptc _ WayDyn = [] | 28 | wayOptc _ WayDyn = [] | 28 | false | false | 1 | 6 | 11 | 15 | 6 | 9 | null | null |
sdiehl/ghc | compiler/prelude/TysPrim.hs | bsd-3-clause | mkTemplateTyVarsFrom :: Int -> [Kind] -> [TyVar]
-- a with unique (mkAlphaTyVarUnique n)
-- b with unique (mkAlphaTyVarUnique n+1)
-- ... etc
-- Typically called as
-- mkTemplateTyVarsFrom (length kv_bndrs) kinds
-- where kv_bndrs are the kind-level binders of a TyCon
mkTemplateTyVarsFrom n kinds
= [ mkTyVar name kind
| (kind, index) <- zip kinds [0..],
let ch_ord = index + ord 'a'
name_str | ch_ord <= ord 'z' = [chr ch_ord]
| otherwise = 't':show index
name = mk_tv_name (index + n) name_str
] | 565 | mkTemplateTyVarsFrom :: Int -> [Kind] -> [TyVar]
mkTemplateTyVarsFrom n kinds
= [ mkTyVar name kind
| (kind, index) <- zip kinds [0..],
let ch_ord = index + ord 'a'
name_str | ch_ord <= ord 'z' = [chr ch_ord]
| otherwise = 't':show index
name = mk_tv_name (index + n) name_str
] | 341 | mkTemplateTyVarsFrom n kinds
= [ mkTyVar name kind
| (kind, index) <- zip kinds [0..],
let ch_ord = index + ord 'a'
name_str | ch_ord <= ord 'z' = [chr ch_ord]
| otherwise = 't':show index
name = mk_tv_name (index + n) name_str
] | 292 | true | true | 0 | 15 | 151 | 146 | 74 | 72 | null | null |
brendanhay/gogol | gogol-dlp/gen/Network/Google/Resource/DLP/Organizations/InspectTemplates/List.hs | mpl-2.0 | -- | Legacy upload protocol for media (e.g. \"media\", \"multipart\").
oitlUploadType :: Lens' OrganizationsInspectTemplatesList (Maybe Text)
oitlUploadType
= lens _oitlUploadType
(\ s a -> s{_oitlUploadType = a}) | 221 | oitlUploadType :: Lens' OrganizationsInspectTemplatesList (Maybe Text)
oitlUploadType
= lens _oitlUploadType
(\ s a -> s{_oitlUploadType = a}) | 150 | oitlUploadType
= lens _oitlUploadType
(\ s a -> s{_oitlUploadType = a}) | 79 | true | true | 0 | 9 | 34 | 48 | 25 | 23 | null | null |
DaMSL/K3 | src/Language/K3/Codegen/CPP/Materialization/Constructors.hs | apache-2.0 | mAtom :: Method -> K3 (MExpr)
mAtom m = Node (MAtom m :@: []) [] | 64 | mAtom :: Method -> K3 (MExpr)
mAtom m = Node (MAtom m :@: []) [] | 64 | mAtom m = Node (MAtom m :@: []) [] | 34 | false | true | 0 | 8 | 14 | 47 | 22 | 25 | null | null |
skill-lang/skill | deps/haskell/Controls.hs | bsd-3-clause | serialize'' :: FilePath -> FilePath -> IO ()
serialize'' inPath outPath = readState'' inPath >>= \state -> serialize state outPath | 130 | serialize'' :: FilePath -> FilePath -> IO ()
serialize'' inPath outPath = readState'' inPath >>= \state -> serialize state outPath | 130 | serialize'' inPath outPath = readState'' inPath >>= \state -> serialize state outPath | 85 | false | true | 0 | 8 | 19 | 46 | 22 | 24 | null | null |
ezyang/ghc | libraries/template-haskell/Language/Haskell/TH/Lib/Internal.hs | bsd-3-clause | patSynSigD :: Name -> TypeQ -> DecQ
patSynSigD nm ty =
do ty' <- ty
return $ PatSynSigD nm ty' | 101 | patSynSigD :: Name -> TypeQ -> DecQ
patSynSigD nm ty =
do ty' <- ty
return $ PatSynSigD nm ty' | 101 | patSynSigD nm ty =
do ty' <- ty
return $ PatSynSigD nm ty' | 65 | false | true | 0 | 8 | 26 | 43 | 20 | 23 | null | null |
danr/hipspec | examples/old-examples/quickspec/SetList.hs | gpl-3.0 | prop_absorb_union :: SetList -> SetList -> Bool
prop_absorb_union a b = a /\ (a \/ b) == a | 90 | prop_absorb_union :: SetList -> SetList -> Bool
prop_absorb_union a b = a /\ (a \/ b) == a | 90 | prop_absorb_union a b = a /\ (a \/ b) == a | 42 | false | true | 0 | 8 | 17 | 39 | 20 | 19 | null | null |
lennart/tidal-midi | Sound/Tidal/Tetra.hs | gpl-3.0 | edcy = makeF oscPolysynth "edcy" | 37 | edcy = makeF oscPolysynth "edcy" | 37 | edcy = makeF oscPolysynth "edcy" | 37 | false | false | 0 | 5 | 9 | 11 | 5 | 6 | null | null |
ctford/Idris-Elba-dev | src/IRTS/CodegenJava.hs | bsd-3-clause | removePom :: FilePath -> IO ()
removePom tgtDir = removeFile (pomFileName tgtDir) | 81 | removePom :: FilePath -> IO ()
removePom tgtDir = removeFile (pomFileName tgtDir) | 81 | removePom tgtDir = removeFile (pomFileName tgtDir) | 50 | false | true | 0 | 7 | 11 | 32 | 15 | 17 | null | null |
brendanhay/gogol | gogol-bigquery/gen/Network/Google/BigQuery/Types/Product.hs | mpl-2.0 | -- | [Optional] The categories attached to this field, used for field-level
-- access control.
tfsCategories :: Lens' TableFieldSchema (Maybe TableFieldSchemaCategories)
tfsCategories
= lens _tfsCategories
(\ s a -> s{_tfsCategories = a}) | 246 | tfsCategories :: Lens' TableFieldSchema (Maybe TableFieldSchemaCategories)
tfsCategories
= lens _tfsCategories
(\ s a -> s{_tfsCategories = a}) | 151 | tfsCategories
= lens _tfsCategories
(\ s a -> s{_tfsCategories = a}) | 76 | true | true | 0 | 9 | 39 | 49 | 26 | 23 | null | null |
kosmoskatten/synthetic-web | src/SyntheticWeb/Plan/Writer.hs | mit | writeActivity (POST headers upload download rate) =
printf " POST headers %s upload %s download %s rate %s,"
(show headers)
(writeUpload upload)
(writeDownload download)
(writeRate rate) | 224 | writeActivity (POST headers upload download rate) =
printf " POST headers %s upload %s download %s rate %s,"
(show headers)
(writeUpload upload)
(writeDownload download)
(writeRate rate) | 224 | writeActivity (POST headers upload download rate) =
printf " POST headers %s upload %s download %s rate %s,"
(show headers)
(writeUpload upload)
(writeDownload download)
(writeRate rate) | 224 | false | false | 0 | 6 | 63 | 61 | 27 | 34 | null | null |
bitemyapp/ghc | libraries/base/GHC/Event/Manager.hs | bsd-3-clause | newDefaultBackend = KQueue.new | 30 | newDefaultBackend = KQueue.new | 30 | newDefaultBackend = KQueue.new | 30 | false | false | 0 | 5 | 2 | 8 | 4 | 4 | null | null |
firefrorefiddle/songmaker | src/SongMaker/Read/Header.hs | gpl-2.0 | skipHeader = dropWhile isEndOfHeaderMarker .
dropWhile (not . isEndOfHeaderMarker) .
lines | 116 | skipHeader = dropWhile isEndOfHeaderMarker .
dropWhile (not . isEndOfHeaderMarker) .
lines | 116 | skipHeader = dropWhile isEndOfHeaderMarker .
dropWhile (not . isEndOfHeaderMarker) .
lines | 116 | false | false | 0 | 9 | 36 | 27 | 13 | 14 | null | null |
ezyang/ghc | compiler/cmm/CmmType.hs | bsd-3-clause | isGcPtrType (CmmType GcPtrCat _) = True | 39 | isGcPtrType (CmmType GcPtrCat _) = True | 39 | isGcPtrType (CmmType GcPtrCat _) = True | 39 | false | false | 0 | 7 | 5 | 17 | 8 | 9 | null | null |
frontrowed/wai | wai-extra/test/WaiExtraSpec.hs | mit | streamLBSApp :: Application
streamLBSApp = streamFile $ \_ f -> f $ responseLBS status200
[("Content-Type", "text/plain")]
"test" | 137 | streamLBSApp :: Application
streamLBSApp = streamFile $ \_ f -> f $ responseLBS status200
[("Content-Type", "text/plain")]
"test" | 137 | streamLBSApp = streamFile $ \_ f -> f $ responseLBS status200
[("Content-Type", "text/plain")]
"test" | 109 | false | true | 0 | 8 | 24 | 44 | 23 | 21 | null | null |
NightRa/Idris-dev | src/Idris/AbsSyntaxTree.hs | bsd-3-clause | piBindp p ((n, ty):ns) t = PPi p n NoFC ty (piBindp p ns t) | 59 | piBindp p ((n, ty):ns) t = PPi p n NoFC ty (piBindp p ns t) | 59 | piBindp p ((n, ty):ns) t = PPi p n NoFC ty (piBindp p ns t) | 59 | false | false | 0 | 8 | 14 | 47 | 24 | 23 | null | null |
msakai/icfpc2014 | GHostCPU.hs | bsd-3-clause | execAnd m@(Machine ic pc regs mem code hdl) (AND d s) = do
{ modifyIORef pc succ
; modifyIORef ic succ
; c <- readIORef ic
; let reason = if c == 1024 then ResLim else ResNon
; v <- getValue pc regs mem s
; case d of
ArgPC -> return (m,ResErr)
ArgReg r -> modifyArray (v .&.) regs r >> return (m,reason)
ArgInd r -> readArray regs r >>= modifyArray (v .&.) mem >> return (m,reason)
ArgLoc w -> modifyArray (v .&.) mem w >> return (m,reason)
ArgConst _ -> return (m,ResErr)
} | 531 | execAnd m@(Machine ic pc regs mem code hdl) (AND d s) = do
{ modifyIORef pc succ
; modifyIORef ic succ
; c <- readIORef ic
; let reason = if c == 1024 then ResLim else ResNon
; v <- getValue pc regs mem s
; case d of
ArgPC -> return (m,ResErr)
ArgReg r -> modifyArray (v .&.) regs r >> return (m,reason)
ArgInd r -> readArray regs r >>= modifyArray (v .&.) mem >> return (m,reason)
ArgLoc w -> modifyArray (v .&.) mem w >> return (m,reason)
ArgConst _ -> return (m,ResErr)
} | 531 | execAnd m@(Machine ic pc regs mem code hdl) (AND d s) = do
{ modifyIORef pc succ
; modifyIORef ic succ
; c <- readIORef ic
; let reason = if c == 1024 then ResLim else ResNon
; v <- getValue pc regs mem s
; case d of
ArgPC -> return (m,ResErr)
ArgReg r -> modifyArray (v .&.) regs r >> return (m,reason)
ArgInd r -> readArray regs r >>= modifyArray (v .&.) mem >> return (m,reason)
ArgLoc w -> modifyArray (v .&.) mem w >> return (m,reason)
ArgConst _ -> return (m,ResErr)
} | 531 | false | false | 0 | 13 | 152 | 254 | 128 | 126 | null | null |
ganeti/ganeti | src/Ganeti/Constants.hs | bsd-2-clause | hvsParameters :: FrozenSet String
hvsParameters = ConstantUtils.mkSet $ Map.keys hvsParameterTypes | 98 | hvsParameters :: FrozenSet String
hvsParameters = ConstantUtils.mkSet $ Map.keys hvsParameterTypes | 98 | hvsParameters = ConstantUtils.mkSet $ Map.keys hvsParameterTypes | 64 | false | true | 0 | 7 | 9 | 25 | 12 | 13 | null | null |
rjohnsondev/haskellshop | src/Frontend/Frontend.hs | bsd-2-clause | handleProduct :: AppHandler ()
handleProduct = method GET handleProductGet <|> method POST handleProductPost
where
handleProductGet = cRender "product"
handleProductPost = do
pid <- getFormInt "product_id" 0
c <- getFormInt "c" 0
pvos <- getFormIntArray "variant_options"
b <- basket
saveBasket $ addToBasket pid (S.fromList pvos) b
info "Item added to your basket!\
\<div class=\"pull-right\"><a href=\"/basket\">Checkout Now \
\<i class=\"glyphicon glyphicon-chevron-right\"></i>\
\</a></div>"
redirect $ C8.pack $ printf "/product?c=%d&product_id=%d" c pid | 664 | handleProduct :: AppHandler ()
handleProduct = method GET handleProductGet <|> method POST handleProductPost
where
handleProductGet = cRender "product"
handleProductPost = do
pid <- getFormInt "product_id" 0
c <- getFormInt "c" 0
pvos <- getFormIntArray "variant_options"
b <- basket
saveBasket $ addToBasket pid (S.fromList pvos) b
info "Item added to your basket!\
\<div class=\"pull-right\"><a href=\"/basket\">Checkout Now \
\<i class=\"glyphicon glyphicon-chevron-right\"></i>\
\</a></div>"
redirect $ C8.pack $ printf "/product?c=%d&product_id=%d" c pid | 664 | handleProduct = method GET handleProductGet <|> method POST handleProductPost
where
handleProductGet = cRender "product"
handleProductPost = do
pid <- getFormInt "product_id" 0
c <- getFormInt "c" 0
pvos <- getFormIntArray "variant_options"
b <- basket
saveBasket $ addToBasket pid (S.fromList pvos) b
info "Item added to your basket!\
\<div class=\"pull-right\"><a href=\"/basket\">Checkout Now \
\<i class=\"glyphicon glyphicon-chevron-right\"></i>\
\</a></div>"
redirect $ C8.pack $ printf "/product?c=%d&product_id=%d" c pid | 633 | false | true | 0 | 11 | 172 | 135 | 60 | 75 | null | null |
sherwoodwang/wxHaskell | wxcore/src/haskell/Graphics/UI/WXCore/WxcDefs.hs | lgpl-2.1 | wxSTC_CMD_VCHOMEWRAPEXTEND :: Int
wxSTC_CMD_VCHOMEWRAPEXTEND = 2454 | 67 | wxSTC_CMD_VCHOMEWRAPEXTEND :: Int
wxSTC_CMD_VCHOMEWRAPEXTEND = 2454 | 67 | wxSTC_CMD_VCHOMEWRAPEXTEND = 2454 | 33 | false | true | 0 | 6 | 5 | 18 | 7 | 11 | null | null |
alexvong1995/pandoc | src/Text/Pandoc/Readers/Markdown.hs | gpl-2.0 | -- | Read markdown from an input string and return a Pandoc document.
readMarkdown :: ReaderOptions -- ^ Reader options
-> String -- ^ String to parse (assuming @'\n'@ line endings)
-> Either PandocError Pandoc
readMarkdown opts s =
(readWith parseMarkdown) def{ stateOptions = opts } (s ++ "\n\n") | 333 | readMarkdown :: ReaderOptions -- ^ Reader options
-> String -- ^ String to parse (assuming @'\n'@ line endings)
-> Either PandocError Pandoc
readMarkdown opts s =
(readWith parseMarkdown) def{ stateOptions = opts } (s ++ "\n\n") | 263 | readMarkdown opts s =
(readWith parseMarkdown) def{ stateOptions = opts } (s ++ "\n\n") | 89 | true | true | 0 | 7 | 83 | 58 | 31 | 27 | null | null |
k0001/haskell-opaleye | Opaleye/Order.hs | bsd-3-clause | limit :: Int -> Query a -> Query a
limit n a = Q.simpleQueryArr (O.limit' n . Q.runSimpleQueryArr a) | 100 | limit :: Int -> Query a -> Query a
limit n a = Q.simpleQueryArr (O.limit' n . Q.runSimpleQueryArr a) | 100 | limit n a = Q.simpleQueryArr (O.limit' n . Q.runSimpleQueryArr a) | 65 | false | true | 0 | 9 | 18 | 56 | 25 | 31 | null | null |
ghcjs/ghcjs | src/Gen2/Archive.hs | mit | readIndex :: FilePath -> IO Index
readIndex file =
withArchive "readIndex" file $ \_sections index _h -> return index | 119 | readIndex :: FilePath -> IO Index
readIndex file =
withArchive "readIndex" file $ \_sections index _h -> return index | 119 | readIndex file =
withArchive "readIndex" file $ \_sections index _h -> return index | 85 | false | true | 0 | 7 | 20 | 42 | 20 | 22 | null | null |
jjingram/satori | src/Curry.hs | bsd-3-clause | curry (Fix name e) = Fix name (curry e) | 39 | curry (Fix name e) = Fix name (curry e) | 39 | curry (Fix name e) = Fix name (curry e) | 39 | false | false | 0 | 7 | 8 | 28 | 13 | 15 | null | null |
joshuaunderwood7/HaskeLinGeom | R.hs | gpl-3.0 | r_q' x@(x1, x2) y@(y1, y2) = or [r_r x y, r_b x y] | 50 | r_q' x@(x1, x2) y@(y1, y2) = or [r_r x y, r_b x y] | 50 | r_q' x@(x1, x2) y@(y1, y2) = or [r_r x y, r_b x y] | 50 | false | false | 0 | 7 | 12 | 48 | 26 | 22 | null | null |
facebookincubator/duckling | Duckling/Time/HR/Rules.hs | bsd-3-clause | ruleTimeBeforeLast :: Rule
ruleTimeBeforeLast = Rule
{ name = "<time> before last"
, pattern =
[ dimension Time
, regex "prije (prethodn(e|o(ga?)?)|pro(s|š)l(ih?|u|a|e|o(ga?)?))"
]
, prod = \tokens -> case tokens of
(Token Time td:_) ->
tt $ predNth (-2) False td
_ -> Nothing
} | 318 | ruleTimeBeforeLast :: Rule
ruleTimeBeforeLast = Rule
{ name = "<time> before last"
, pattern =
[ dimension Time
, regex "prije (prethodn(e|o(ga?)?)|pro(s|š)l(ih?|u|a|e|o(ga?)?))"
]
, prod = \tokens -> case tokens of
(Token Time td:_) ->
tt $ predNth (-2) False td
_ -> Nothing
} | 318 | ruleTimeBeforeLast = Rule
{ name = "<time> before last"
, pattern =
[ dimension Time
, regex "prije (prethodn(e|o(ga?)?)|pro(s|š)l(ih?|u|a|e|o(ga?)?))"
]
, prod = \tokens -> case tokens of
(Token Time td:_) ->
tt $ predNth (-2) False td
_ -> Nothing
} | 291 | false | true | 0 | 15 | 84 | 96 | 51 | 45 | null | null |
FalsePsyche/ProgrammingLanguages | finalproject/main.hs | unlicense | newImage16 :: String -> Int -> Int -> Pixel16 -> IO ()
newImage16 path width height blue = writePng path $ generateImage pixelRenderer width height
where pixelRenderer x y = PixelRGB16 (fromIntegral x) (fromIntegral y) (fromIntegral blue)
-- createPixelRGB16 :: Int -> Int -> Int -> PixelRGB16 ()
-- createPixelRGB16 red green blue = PixelRGB16 red green blue | 364 | newImage16 :: String -> Int -> Int -> Pixel16 -> IO ()
newImage16 path width height blue = writePng path $ generateImage pixelRenderer width height
where pixelRenderer x y = PixelRGB16 (fromIntegral x) (fromIntegral y) (fromIntegral blue)
-- createPixelRGB16 :: Int -> Int -> Int -> PixelRGB16 ()
-- createPixelRGB16 red green blue = PixelRGB16 red green blue | 364 | newImage16 path width height blue = writePng path $ generateImage pixelRenderer width height
where pixelRenderer x y = PixelRGB16 (fromIntegral x) (fromIntegral y) (fromIntegral blue)
-- createPixelRGB16 :: Int -> Int -> Int -> PixelRGB16 ()
-- createPixelRGB16 red green blue = PixelRGB16 red green blue | 309 | false | true | 0 | 10 | 62 | 99 | 47 | 52 | null | null |
jonte/ircbot | Network/IRC/Bot/Core.hs | bsd-3-clause | writeMaybeChan (Just chan) a = writeChan chan a | 47 | writeMaybeChan (Just chan) a = writeChan chan a | 47 | writeMaybeChan (Just chan) a = writeChan chan a | 47 | false | false | 0 | 7 | 7 | 22 | 10 | 12 | null | null |
jdnavarro/smallcheck | src/Test/SmallCheck/Series.hs | bsd-3-clause | cons4 :: (Serial m a, Serial m b, Serial m c, Serial m d) =>
(a->b->c->d->e) -> Series m e
cons4 f = decDepth $
f <$> series
<~> series
<~> series
<~> series | 180 | cons4 :: (Serial m a, Serial m b, Serial m c, Serial m d) =>
(a->b->c->d->e) -> Series m e
cons4 f = decDepth $
f <$> series
<~> series
<~> series
<~> series | 180 | cons4 f = decDepth $
f <$> series
<~> series
<~> series
<~> series | 80 | false | true | 0 | 11 | 56 | 97 | 49 | 48 | null | null |
TomMD/ghc | compiler/main/DriverMkDepend.hs | bsd-3-clause | -- Handle of the open temporary file
beginMkDependHS :: DynFlags -> IO MkDepFiles
beginMkDependHS dflags = do
-- open a new temp file in which to stuff the dependency info
-- as we go along.
tmp_file <- newTempName dflags "dep"
tmp_hdl <- openFile tmp_file WriteMode
-- open the makefile
let makefile = depMakefile dflags
exists <- doesFileExist makefile
mb_make_hdl <-
if not exists
then return Nothing
else do
makefile_hdl <- openFile makefile ReadMode
-- slurp through until we get the magic start string,
-- copying the contents into dep_makefile
let slurp = do
l <- hGetLine makefile_hdl
if (l == depStartMarker)
then return ()
else do hPutStrLn tmp_hdl l; slurp
-- slurp through until we get the magic end marker,
-- throwing away the contents
let chuck = do
l <- hGetLine makefile_hdl
if (l == depEndMarker)
then return ()
else chuck
catchIO slurp
(\e -> if isEOFError e then return () else ioError e)
catchIO chuck
(\e -> if isEOFError e then return () else ioError e)
return (Just makefile_hdl)
-- write the magic marker into the tmp file
hPutStrLn tmp_hdl depStartMarker
return (MkDep { mkd_make_file = makefile, mkd_make_hdl = mb_make_hdl,
mkd_tmp_file = tmp_file, mkd_tmp_hdl = tmp_hdl})
-----------------------------------------------------------------
--
-- processDeps
--
----------------------------------------------------------------- | 1,788 | beginMkDependHS :: DynFlags -> IO MkDepFiles
beginMkDependHS dflags = do
-- open a new temp file in which to stuff the dependency info
-- as we go along.
tmp_file <- newTempName dflags "dep"
tmp_hdl <- openFile tmp_file WriteMode
-- open the makefile
let makefile = depMakefile dflags
exists <- doesFileExist makefile
mb_make_hdl <-
if not exists
then return Nothing
else do
makefile_hdl <- openFile makefile ReadMode
-- slurp through until we get the magic start string,
-- copying the contents into dep_makefile
let slurp = do
l <- hGetLine makefile_hdl
if (l == depStartMarker)
then return ()
else do hPutStrLn tmp_hdl l; slurp
-- slurp through until we get the magic end marker,
-- throwing away the contents
let chuck = do
l <- hGetLine makefile_hdl
if (l == depEndMarker)
then return ()
else chuck
catchIO slurp
(\e -> if isEOFError e then return () else ioError e)
catchIO chuck
(\e -> if isEOFError e then return () else ioError e)
return (Just makefile_hdl)
-- write the magic marker into the tmp file
hPutStrLn tmp_hdl depStartMarker
return (MkDep { mkd_make_file = makefile, mkd_make_hdl = mb_make_hdl,
mkd_tmp_file = tmp_file, mkd_tmp_hdl = tmp_hdl})
-----------------------------------------------------------------
--
-- processDeps
--
----------------------------------------------------------------- | 1,750 | beginMkDependHS dflags = do
-- open a new temp file in which to stuff the dependency info
-- as we go along.
tmp_file <- newTempName dflags "dep"
tmp_hdl <- openFile tmp_file WriteMode
-- open the makefile
let makefile = depMakefile dflags
exists <- doesFileExist makefile
mb_make_hdl <-
if not exists
then return Nothing
else do
makefile_hdl <- openFile makefile ReadMode
-- slurp through until we get the magic start string,
-- copying the contents into dep_makefile
let slurp = do
l <- hGetLine makefile_hdl
if (l == depStartMarker)
then return ()
else do hPutStrLn tmp_hdl l; slurp
-- slurp through until we get the magic end marker,
-- throwing away the contents
let chuck = do
l <- hGetLine makefile_hdl
if (l == depEndMarker)
then return ()
else chuck
catchIO slurp
(\e -> if isEOFError e then return () else ioError e)
catchIO chuck
(\e -> if isEOFError e then return () else ioError e)
return (Just makefile_hdl)
-- write the magic marker into the tmp file
hPutStrLn tmp_hdl depStartMarker
return (MkDep { mkd_make_file = makefile, mkd_make_hdl = mb_make_hdl,
mkd_tmp_file = tmp_file, mkd_tmp_hdl = tmp_hdl})
-----------------------------------------------------------------
--
-- processDeps
--
----------------------------------------------------------------- | 1,705 | true | true | 0 | 19 | 639 | 335 | 166 | 169 | null | null |
elordin/haskell-tetris | font.hs | mit | letterPath 'z' = [ (1 , 0 , 0) , (0 , 0 , 0) , (1 , 0.16, 0)
, (0 , 0.16, 0) , (0.33, 0.16, 0) , (0.67, 0.83, 0)
, (1 , 0.83, 0) , (0 , 0.83, 0) , (1 , 1 , 0)
, (0 , 1 , 0) ] | 249 | letterPath 'z' = [ (1 , 0 , 0) , (0 , 0 , 0) , (1 , 0.16, 0)
, (0 , 0.16, 0) , (0.33, 0.16, 0) , (0.67, 0.83, 0)
, (1 , 0.83, 0) , (0 , 0.83, 0) , (1 , 1 , 0)
, (0 , 1 , 0) ] | 249 | letterPath 'z' = [ (1 , 0 , 0) , (0 , 0 , 0) , (1 , 0.16, 0)
, (0 , 0.16, 0) , (0.33, 0.16, 0) , (0.67, 0.83, 0)
, (1 , 0.83, 0) , (0 , 0.83, 0) , (1 , 1 , 0)
, (0 , 1 , 0) ] | 249 | false | false | 1 | 6 | 130 | 132 | 84 | 48 | null | null |
jonsterling/ETT-Lite | src/Equal.hs | bsd-3-clause | -- | Determine whether the pattern matches the argument
-- If so return the appropriate substitution
patternMatches :: Arg -> Pattern -> TcMonad [(TName, Term)]
patternMatches (Arg t) (PatVar x) = return [(x, t)] | 212 | patternMatches :: Arg -> Pattern -> TcMonad [(TName, Term)]
patternMatches (Arg t) (PatVar x) = return [(x, t)] | 111 | patternMatches (Arg t) (PatVar x) = return [(x, t)] | 51 | true | true | 0 | 10 | 33 | 66 | 35 | 31 | null | null |
PeterBeard/project-euler | haskell/src/problem-008.hs | gpl-2.0 | -- Return a list of all windows of size n from the list xs
windows :: Int -> [Int] -> [[Int]]
windows n xs = map (\i -> window i n xs) $ [0..(length xs - n)] | 157 | windows :: Int -> [Int] -> [[Int]]
windows n xs = map (\i -> window i n xs) $ [0..(length xs - n)] | 98 | windows n xs = map (\i -> window i n xs) $ [0..(length xs - n)] | 63 | true | true | 0 | 9 | 36 | 71 | 38 | 33 | null | null |
sinelaw/stackage | Stackage/InstallInfo.hs | mit | showDep :: (PackageName, BuildInfo) -> String
showDep (PackageName name, BuildInfo {..}) =
concat
[ name
, "-"
, showVersion biVersion
, " ("
, unMaintainer biMaintainer
, case biGithubUser of
Nothing -> ""
Just x -> " @" ++ x
, ")"
, ": "
, unwords $ map unP biUsers
]
where
unP (PackageName p) = p
-- | Convert to format used by Hackage for displaying distribution versions.
-- For more info, see https://github.com/fpco/stackage/issues/38. | 557 | showDep :: (PackageName, BuildInfo) -> String
showDep (PackageName name, BuildInfo {..}) =
concat
[ name
, "-"
, showVersion biVersion
, " ("
, unMaintainer biMaintainer
, case biGithubUser of
Nothing -> ""
Just x -> " @" ++ x
, ")"
, ": "
, unwords $ map unP biUsers
]
where
unP (PackageName p) = p
-- | Convert to format used by Hackage for displaying distribution versions.
-- For more info, see https://github.com/fpco/stackage/issues/38. | 557 | showDep (PackageName name, BuildInfo {..}) =
concat
[ name
, "-"
, showVersion biVersion
, " ("
, unMaintainer biMaintainer
, case biGithubUser of
Nothing -> ""
Just x -> " @" ++ x
, ")"
, ": "
, unwords $ map unP biUsers
]
where
unP (PackageName p) = p
-- | Convert to format used by Hackage for displaying distribution versions.
-- For more info, see https://github.com/fpco/stackage/issues/38. | 511 | false | true | 0 | 10 | 190 | 126 | 67 | 59 | null | null |
dysinger/amazonka | core/src/Network/AWS/Types.hs | mpl-2.0 | -- | Determine the full host address and credential scope for a 'Service' within
-- the specified 'Region'.
endpoint :: Service a -> Region -> Endpoint
endpoint Service{..} r = go (CI.mk _svcPrefix)
where
go = \case
"iam"
| china -> region "iam.cn-north-1.amazonaws.com.cn"
| govcloud -> region "iam.us-gov.amazonaws.com"
| otherwise -> global "iam.amazonaws.com"
"sdb"
| virginia -> region "sdb.amazonaws.com"
"sts"
| china -> region "sts.cn-north-1.amazonaws.com.cn"
| govcloud -> region ("sts." <> reg <> ".amazonaws.com")
| otherwise -> global "sts.amazonaws.com"
"s3"
| virginia -> global "s3.amazonaws.com"
| china -> region ("s3." <> reg <> ".amazonaws.com.cn")
| s3 -> region ("s3-" <> reg <> ".amazonaws.com")
"rds"
| virginia -> global "rds.amazonaws.com"
"route53"
| not china -> global "route53.amazonaws.com"
"emr"
| virginia -> global "elasticmapreduce.us-east-1.amazonaws.com"
| otherwise -> region (reg <> ".elasticmapreduce.amazonaws.com")
"sqs"
| virginia -> global "queue.amazonaws.com"
| china -> region (reg <> ".queue.amazonaws.com.cn")
"importexport"
| not china -> region "importexport.amazonaws.com"
"cloudfront"
| not china -> global "cloudfront.amazonaws.com"
_ | china -> region (_svcPrefix <> "." <> reg <> ".amazonaws.com.cn")
| otherwise -> region (_svcPrefix <> "." <> reg <> ".amazonaws.com")
virginia = r == NorthVirginia
s3 = r `Set.member` except
govcloud = "us-gov" `BS.isPrefixOf` reg
china = "cn-" `BS.isPrefixOf` reg
region h = Endpoint { _endpointHost = h, _endpointScope = reg }
global h = Endpoint { _endpointHost = h, _endpointScope = "us-east-1" }
reg = toBS r
except = Set.fromList
[ GovCloud
, GovCloudFIPS
, Ireland
, NorthCalifornia
, NorthVirginia
, Oregon
, SaoPaulo
, Singapore
, Sydney
, Tokyo
]
-- | Attributes specific to an AWS service. | 2,293 | endpoint :: Service a -> Region -> Endpoint
endpoint Service{..} r = go (CI.mk _svcPrefix)
where
go = \case
"iam"
| china -> region "iam.cn-north-1.amazonaws.com.cn"
| govcloud -> region "iam.us-gov.amazonaws.com"
| otherwise -> global "iam.amazonaws.com"
"sdb"
| virginia -> region "sdb.amazonaws.com"
"sts"
| china -> region "sts.cn-north-1.amazonaws.com.cn"
| govcloud -> region ("sts." <> reg <> ".amazonaws.com")
| otherwise -> global "sts.amazonaws.com"
"s3"
| virginia -> global "s3.amazonaws.com"
| china -> region ("s3." <> reg <> ".amazonaws.com.cn")
| s3 -> region ("s3-" <> reg <> ".amazonaws.com")
"rds"
| virginia -> global "rds.amazonaws.com"
"route53"
| not china -> global "route53.amazonaws.com"
"emr"
| virginia -> global "elasticmapreduce.us-east-1.amazonaws.com"
| otherwise -> region (reg <> ".elasticmapreduce.amazonaws.com")
"sqs"
| virginia -> global "queue.amazonaws.com"
| china -> region (reg <> ".queue.amazonaws.com.cn")
"importexport"
| not china -> region "importexport.amazonaws.com"
"cloudfront"
| not china -> global "cloudfront.amazonaws.com"
_ | china -> region (_svcPrefix <> "." <> reg <> ".amazonaws.com.cn")
| otherwise -> region (_svcPrefix <> "." <> reg <> ".amazonaws.com")
virginia = r == NorthVirginia
s3 = r `Set.member` except
govcloud = "us-gov" `BS.isPrefixOf` reg
china = "cn-" `BS.isPrefixOf` reg
region h = Endpoint { _endpointHost = h, _endpointScope = reg }
global h = Endpoint { _endpointHost = h, _endpointScope = "us-east-1" }
reg = toBS r
except = Set.fromList
[ GovCloud
, GovCloudFIPS
, Ireland
, NorthCalifornia
, NorthVirginia
, Oregon
, SaoPaulo
, Singapore
, Sydney
, Tokyo
]
-- | Attributes specific to an AWS service. | 2,185 | endpoint Service{..} r = go (CI.mk _svcPrefix)
where
go = \case
"iam"
| china -> region "iam.cn-north-1.amazonaws.com.cn"
| govcloud -> region "iam.us-gov.amazonaws.com"
| otherwise -> global "iam.amazonaws.com"
"sdb"
| virginia -> region "sdb.amazonaws.com"
"sts"
| china -> region "sts.cn-north-1.amazonaws.com.cn"
| govcloud -> region ("sts." <> reg <> ".amazonaws.com")
| otherwise -> global "sts.amazonaws.com"
"s3"
| virginia -> global "s3.amazonaws.com"
| china -> region ("s3." <> reg <> ".amazonaws.com.cn")
| s3 -> region ("s3-" <> reg <> ".amazonaws.com")
"rds"
| virginia -> global "rds.amazonaws.com"
"route53"
| not china -> global "route53.amazonaws.com"
"emr"
| virginia -> global "elasticmapreduce.us-east-1.amazonaws.com"
| otherwise -> region (reg <> ".elasticmapreduce.amazonaws.com")
"sqs"
| virginia -> global "queue.amazonaws.com"
| china -> region (reg <> ".queue.amazonaws.com.cn")
"importexport"
| not china -> region "importexport.amazonaws.com"
"cloudfront"
| not china -> global "cloudfront.amazonaws.com"
_ | china -> region (_svcPrefix <> "." <> reg <> ".amazonaws.com.cn")
| otherwise -> region (_svcPrefix <> "." <> reg <> ".amazonaws.com")
virginia = r == NorthVirginia
s3 = r `Set.member` except
govcloud = "us-gov" `BS.isPrefixOf` reg
china = "cn-" `BS.isPrefixOf` reg
region h = Endpoint { _endpointHost = h, _endpointScope = reg }
global h = Endpoint { _endpointHost = h, _endpointScope = "us-east-1" }
reg = toBS r
except = Set.fromList
[ GovCloud
, GovCloudFIPS
, Ireland
, NorthCalifornia
, NorthVirginia
, Oregon
, SaoPaulo
, Singapore
, Sydney
, Tokyo
]
-- | Attributes specific to an AWS service. | 2,141 | true | true | 8 | 18 | 759 | 565 | 269 | 296 | null | null |
harendra-kumar/asyncly | src/Streamly/Internal/Data/Fold/Types.hs | bsd-3-clause | duplicate :: Applicative m => Fold m a b -> Fold m a (Fold m a b)
duplicate (Fold step begin done) =
Fold step begin (\x -> pure (Fold step (pure x) done)) | 159 | duplicate :: Applicative m => Fold m a b -> Fold m a (Fold m a b)
duplicate (Fold step begin done) =
Fold step begin (\x -> pure (Fold step (pure x) done)) | 159 | duplicate (Fold step begin done) =
Fold step begin (\x -> pure (Fold step (pure x) done)) | 93 | false | true | 0 | 12 | 37 | 93 | 45 | 48 | null | null |
facebookincubator/duckling | Duckling/Rules/UK.hs | bsd-3-clause | langRules (Seal Distance) = [] | 30 | langRules (Seal Distance) = [] | 30 | langRules (Seal Distance) = [] | 30 | false | false | 0 | 7 | 4 | 17 | 8 | 9 | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.