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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
kevinjardine/gruzeSnaplet | src/Snap/Snaplet/Gruze/Query.hs | gpl-2.0 | groupByToString _ = [] | 22 | groupByToString _ = [] | 22 | groupByToString _ = [] | 22 | false | false | 0 | 5 | 3 | 11 | 5 | 6 | null | null |
mikeplus64/plissken | src/Editor.hs | gpl-3.0 | editorStageToGame :: IORef GameS -> IORef Editor -> IO ()
editorStageToGame game' editor' = do
estage <- view editStage <$> readIORef editor'
modifyIORef' game' (stage .~ estage) | 186 | editorStageToGame :: IORef GameS -> IORef Editor -> IO ()
editorStageToGame game' editor' = do
estage <- view editStage <$> readIORef editor'
modifyIORef' game' (stage .~ estage) | 186 | editorStageToGame game' editor' = do
estage <- view editStage <$> readIORef editor'
modifyIORef' game' (stage .~ estage) | 128 | false | true | 0 | 9 | 34 | 67 | 30 | 37 | null | null |
kolmodin/cabal | cabal-install/Distribution/Solver/Modular/Tree.hs | bsd-3-clause | choices (GoalChoice _ ) = 1 | 35 | choices (GoalChoice _ ) = 1 | 35 | choices (GoalChoice _ ) = 1 | 35 | false | false | 0 | 6 | 13 | 16 | 7 | 9 | null | null |
alanz/annotations-play | src/main.hs | unlicense | pTerm = chainl1 pFactor (Mul <$ pToken TStar
T.<|> Div <$ pToken TSlash) | 93 | pTerm = chainl1 pFactor (Mul <$ pToken TStar
T.<|> Div <$ pToken TSlash) | 93 | pTerm = chainl1 pFactor (Mul <$ pToken TStar
T.<|> Div <$ pToken TSlash) | 93 | false | false | 0 | 10 | 33 | 34 | 16 | 18 | null | null |
andorp/hs-bluesnap | src/Bluesnap/API/Response.hs | gpl-3.0 | elementToXMLLocal_bank_transfer :: Local_bank_transfer -> [Content ()]
elementToXMLLocal_bank_transfer = schemaTypeToXML "local-bank-transfer" | 142 | elementToXMLLocal_bank_transfer :: Local_bank_transfer -> [Content ()]
elementToXMLLocal_bank_transfer = schemaTypeToXML "local-bank-transfer" | 142 | elementToXMLLocal_bank_transfer = schemaTypeToXML "local-bank-transfer" | 71 | false | true | 0 | 8 | 9 | 26 | 13 | 13 | null | null |
green-haskell/ghc | compiler/deSugar/DsBinds.hs | bsd-3-clause | dsSpecs :: CoreExpr -- Its rhs
-> TcSpecPrags
-> DsM ( OrdList (Id,CoreExpr) -- Binding for specialised Ids
, [CoreRule] ) -- Rules for the Global Ids
-- See Note [Handling SPECIALISE pragmas] in TcBinds
dsSpecs _ IsDefaultMethod = return (nilOL, []) | 296 | dsSpecs :: CoreExpr -- Its rhs
-> TcSpecPrags
-> DsM ( OrdList (Id,CoreExpr) -- Binding for specialised Ids
, [CoreRule] )
dsSpecs _ IsDefaultMethod = return (nilOL, []) | 205 | dsSpecs _ IsDefaultMethod = return (nilOL, []) | 46 | true | true | 0 | 10 | 87 | 60 | 34 | 26 | null | null |
lancelotsix/hs-tls | core/Network/TLS/Receiving.hs | bsd-3-clause | processPacket ctx (Record ProtocolType_Handshake ver fragment) = do
keyxchg <- getHState ctx >>= \hs -> return $ (hs >>= hstPendingCipher >>= Just . cipherKeyExchange)
usingState ctx $ do
npn <- getExtensionNPN
let currentParams = CurrentParams
{ cParamsVersion = ver
, cParamsKeyXchgType = keyxchg
, cParamsSupportNPN = npn
}
-- get back the optional continuation, and parse as many handshake record as possible.
mCont <- gets stHandshakeRecordCont
modify (\st -> st { stHandshakeRecordCont = Nothing })
hss <- parseMany currentParams mCont (fragmentGetBytes fragment)
return $ Handshake hss
where parseMany currentParams mCont bs =
case maybe decodeHandshakeRecord id mCont $ bs of
GotError err -> throwError err
GotPartial cont -> modify (\st -> st { stHandshakeRecordCont = Just cont }) >> return []
GotSuccess (ty,content) ->
either throwError (return . (:[])) $ decodeHandshake currentParams ty content
GotSuccessRemaining (ty,content) left ->
case decodeHandshake currentParams ty content of
Left err -> throwError err
Right hh -> (hh:) `fmap` parseMany currentParams Nothing left | 1,471 | processPacket ctx (Record ProtocolType_Handshake ver fragment) = do
keyxchg <- getHState ctx >>= \hs -> return $ (hs >>= hstPendingCipher >>= Just . cipherKeyExchange)
usingState ctx $ do
npn <- getExtensionNPN
let currentParams = CurrentParams
{ cParamsVersion = ver
, cParamsKeyXchgType = keyxchg
, cParamsSupportNPN = npn
}
-- get back the optional continuation, and parse as many handshake record as possible.
mCont <- gets stHandshakeRecordCont
modify (\st -> st { stHandshakeRecordCont = Nothing })
hss <- parseMany currentParams mCont (fragmentGetBytes fragment)
return $ Handshake hss
where parseMany currentParams mCont bs =
case maybe decodeHandshakeRecord id mCont $ bs of
GotError err -> throwError err
GotPartial cont -> modify (\st -> st { stHandshakeRecordCont = Just cont }) >> return []
GotSuccess (ty,content) ->
either throwError (return . (:[])) $ decodeHandshake currentParams ty content
GotSuccessRemaining (ty,content) left ->
case decodeHandshake currentParams ty content of
Left err -> throwError err
Right hh -> (hh:) `fmap` parseMany currentParams Nothing left | 1,471 | processPacket ctx (Record ProtocolType_Handshake ver fragment) = do
keyxchg <- getHState ctx >>= \hs -> return $ (hs >>= hstPendingCipher >>= Just . cipherKeyExchange)
usingState ctx $ do
npn <- getExtensionNPN
let currentParams = CurrentParams
{ cParamsVersion = ver
, cParamsKeyXchgType = keyxchg
, cParamsSupportNPN = npn
}
-- get back the optional continuation, and parse as many handshake record as possible.
mCont <- gets stHandshakeRecordCont
modify (\st -> st { stHandshakeRecordCont = Nothing })
hss <- parseMany currentParams mCont (fragmentGetBytes fragment)
return $ Handshake hss
where parseMany currentParams mCont bs =
case maybe decodeHandshakeRecord id mCont $ bs of
GotError err -> throwError err
GotPartial cont -> modify (\st -> st { stHandshakeRecordCont = Just cont }) >> return []
GotSuccess (ty,content) ->
either throwError (return . (:[])) $ decodeHandshake currentParams ty content
GotSuccessRemaining (ty,content) left ->
case decodeHandshake currentParams ty content of
Left err -> throwError err
Right hh -> (hh:) `fmap` parseMany currentParams Nothing left | 1,471 | false | false | 0 | 14 | 541 | 363 | 178 | 185 | null | null |
ladinu/macros | cut.hs | mit | appleMedium = Ingredient "Apple (medium - 70z w/ refuse 3\" dia)" 0.3 25 0.5 (Unit 1 "medium") | 94 | appleMedium = Ingredient "Apple (medium - 70z w/ refuse 3\" dia)" 0.3 25 0.5 (Unit 1 "medium") | 94 | appleMedium = Ingredient "Apple (medium - 70z w/ refuse 3\" dia)" 0.3 25 0.5 (Unit 1 "medium") | 94 | false | false | 0 | 7 | 16 | 25 | 12 | 13 | null | null |
randen/cabal | Cabal/Distribution/PackageDescription/Check.hs | bsd-3-clause | checkFields :: PackageDescription -> [PackageCheck]
checkFields pkg =
catMaybes [
check (not . FilePath.Windows.isValid . display . packageName $ pkg) $
PackageDistInexcusable $
"Unfortunately, the package name '" ++ display (packageName pkg)
++ "' is one of the reserved system file names on Windows. Many tools "
++ "need to convert package names to file names so using this name "
++ "would cause problems."
, check (isNothing (buildType pkg)) $
PackageBuildWarning $
"No 'build-type' specified. If you do not need a custom Setup.hs or "
++ "./configure script then use 'build-type: Simple'."
, case buildType pkg of
Just (UnknownBuildType unknown) -> Just $
PackageBuildWarning $
quote unknown ++ " is not a known 'build-type'. "
++ "The known build types are: "
++ commaSep (map display knownBuildTypes)
_ -> Nothing
, check (isJust (setupBuildInfo pkg) && buildType pkg /= Just Custom) $
PackageBuildWarning $
"Ignoring the 'custom-setup' section because the 'build-type' is "
++ "not 'Custom'. Use 'build-type: Custom' if you need to use a "
++ "custom Setup.hs script."
, check (not (null unknownCompilers)) $
PackageBuildWarning $
"Unknown compiler " ++ commaSep (map quote unknownCompilers)
++ " in 'tested-with' field."
, check (not (null unknownLanguages)) $
PackageBuildWarning $
"Unknown languages: " ++ commaSep unknownLanguages
, check (not (null unknownExtensions)) $
PackageBuildWarning $
"Unknown extensions: " ++ commaSep unknownExtensions
, check (not (null languagesUsedAsExtensions)) $
PackageBuildWarning $
"Languages listed as extensions: "
++ commaSep languagesUsedAsExtensions
++ ". Languages must be specified in either the 'default-language' "
++ " or the 'other-languages' field."
, check (not (null deprecatedExtensions)) $
PackageDistSuspicious $
"Deprecated extensions: "
++ commaSep (map (quote . display . fst) deprecatedExtensions)
++ ". " ++ unwords
[ "Instead of '" ++ display ext
++ "' use '" ++ display replacement ++ "'."
| (ext, Just replacement) <- deprecatedExtensions ]
, check (null (category pkg)) $
PackageDistSuspicious "No 'category' field."
, check (null (maintainer pkg)) $
PackageDistSuspicious "No 'maintainer' field."
, check (null (synopsis pkg) && null (description pkg)) $
PackageDistInexcusable "No 'synopsis' or 'description' field."
, check (null (description pkg) && not (null (synopsis pkg))) $
PackageDistSuspicious "No 'description' field."
, check (null (synopsis pkg) && not (null (description pkg))) $
PackageDistSuspicious "No 'synopsis' field."
--TODO: recommend the bug reports URL, author and homepage fields
--TODO: recommend not using the stability field
--TODO: recommend specifying a source repo
, check (length (synopsis pkg) >= 80) $
PackageDistSuspicious
"The 'synopsis' field is rather long (max 80 chars is recommended)."
-- check use of impossible constraints "tested-with: GHC== 6.10 && ==6.12"
, check (not (null testedWithImpossibleRanges)) $
PackageDistInexcusable $
"Invalid 'tested-with' version range: "
++ commaSep (map display testedWithImpossibleRanges)
++ ". To indicate that you have tested a package with multiple "
++ "different versions of the same compiler use multiple entries, "
++ "for example 'tested-with: GHC==6.10.4, GHC==6.12.3' and not "
++ "'tested-with: GHC==6.10.4 && ==6.12.3'."
]
where
unknownCompilers = [ name | (OtherCompiler name, _) <- testedWith pkg ]
unknownLanguages = [ name | bi <- allBuildInfo pkg
, UnknownLanguage name <- allLanguages bi ]
unknownExtensions = [ name | bi <- allBuildInfo pkg
, UnknownExtension name <- allExtensions bi
, name `notElem` map display knownLanguages ]
deprecatedExtensions = nub $ catMaybes
[ find ((==ext) . fst) Extension.deprecatedExtensions
| bi <- allBuildInfo pkg
, ext <- allExtensions bi ]
languagesUsedAsExtensions =
[ name | bi <- allBuildInfo pkg
, UnknownExtension name <- allExtensions bi
, name `elem` map display knownLanguages ]
testedWithImpossibleRanges =
[ Dependency (PackageName (display compiler)) vr
| (compiler, vr) <- testedWith pkg
, isNoVersion vr ] | 4,727 | checkFields :: PackageDescription -> [PackageCheck]
checkFields pkg =
catMaybes [
check (not . FilePath.Windows.isValid . display . packageName $ pkg) $
PackageDistInexcusable $
"Unfortunately, the package name '" ++ display (packageName pkg)
++ "' is one of the reserved system file names on Windows. Many tools "
++ "need to convert package names to file names so using this name "
++ "would cause problems."
, check (isNothing (buildType pkg)) $
PackageBuildWarning $
"No 'build-type' specified. If you do not need a custom Setup.hs or "
++ "./configure script then use 'build-type: Simple'."
, case buildType pkg of
Just (UnknownBuildType unknown) -> Just $
PackageBuildWarning $
quote unknown ++ " is not a known 'build-type'. "
++ "The known build types are: "
++ commaSep (map display knownBuildTypes)
_ -> Nothing
, check (isJust (setupBuildInfo pkg) && buildType pkg /= Just Custom) $
PackageBuildWarning $
"Ignoring the 'custom-setup' section because the 'build-type' is "
++ "not 'Custom'. Use 'build-type: Custom' if you need to use a "
++ "custom Setup.hs script."
, check (not (null unknownCompilers)) $
PackageBuildWarning $
"Unknown compiler " ++ commaSep (map quote unknownCompilers)
++ " in 'tested-with' field."
, check (not (null unknownLanguages)) $
PackageBuildWarning $
"Unknown languages: " ++ commaSep unknownLanguages
, check (not (null unknownExtensions)) $
PackageBuildWarning $
"Unknown extensions: " ++ commaSep unknownExtensions
, check (not (null languagesUsedAsExtensions)) $
PackageBuildWarning $
"Languages listed as extensions: "
++ commaSep languagesUsedAsExtensions
++ ". Languages must be specified in either the 'default-language' "
++ " or the 'other-languages' field."
, check (not (null deprecatedExtensions)) $
PackageDistSuspicious $
"Deprecated extensions: "
++ commaSep (map (quote . display . fst) deprecatedExtensions)
++ ". " ++ unwords
[ "Instead of '" ++ display ext
++ "' use '" ++ display replacement ++ "'."
| (ext, Just replacement) <- deprecatedExtensions ]
, check (null (category pkg)) $
PackageDistSuspicious "No 'category' field."
, check (null (maintainer pkg)) $
PackageDistSuspicious "No 'maintainer' field."
, check (null (synopsis pkg) && null (description pkg)) $
PackageDistInexcusable "No 'synopsis' or 'description' field."
, check (null (description pkg) && not (null (synopsis pkg))) $
PackageDistSuspicious "No 'description' field."
, check (null (synopsis pkg) && not (null (description pkg))) $
PackageDistSuspicious "No 'synopsis' field."
--TODO: recommend the bug reports URL, author and homepage fields
--TODO: recommend not using the stability field
--TODO: recommend specifying a source repo
, check (length (synopsis pkg) >= 80) $
PackageDistSuspicious
"The 'synopsis' field is rather long (max 80 chars is recommended)."
-- check use of impossible constraints "tested-with: GHC== 6.10 && ==6.12"
, check (not (null testedWithImpossibleRanges)) $
PackageDistInexcusable $
"Invalid 'tested-with' version range: "
++ commaSep (map display testedWithImpossibleRanges)
++ ". To indicate that you have tested a package with multiple "
++ "different versions of the same compiler use multiple entries, "
++ "for example 'tested-with: GHC==6.10.4, GHC==6.12.3' and not "
++ "'tested-with: GHC==6.10.4 && ==6.12.3'."
]
where
unknownCompilers = [ name | (OtherCompiler name, _) <- testedWith pkg ]
unknownLanguages = [ name | bi <- allBuildInfo pkg
, UnknownLanguage name <- allLanguages bi ]
unknownExtensions = [ name | bi <- allBuildInfo pkg
, UnknownExtension name <- allExtensions bi
, name `notElem` map display knownLanguages ]
deprecatedExtensions = nub $ catMaybes
[ find ((==ext) . fst) Extension.deprecatedExtensions
| bi <- allBuildInfo pkg
, ext <- allExtensions bi ]
languagesUsedAsExtensions =
[ name | bi <- allBuildInfo pkg
, UnknownExtension name <- allExtensions bi
, name `elem` map display knownLanguages ]
testedWithImpossibleRanges =
[ Dependency (PackageName (display compiler)) vr
| (compiler, vr) <- testedWith pkg
, isNoVersion vr ] | 4,727 | checkFields pkg =
catMaybes [
check (not . FilePath.Windows.isValid . display . packageName $ pkg) $
PackageDistInexcusable $
"Unfortunately, the package name '" ++ display (packageName pkg)
++ "' is one of the reserved system file names on Windows. Many tools "
++ "need to convert package names to file names so using this name "
++ "would cause problems."
, check (isNothing (buildType pkg)) $
PackageBuildWarning $
"No 'build-type' specified. If you do not need a custom Setup.hs or "
++ "./configure script then use 'build-type: Simple'."
, case buildType pkg of
Just (UnknownBuildType unknown) -> Just $
PackageBuildWarning $
quote unknown ++ " is not a known 'build-type'. "
++ "The known build types are: "
++ commaSep (map display knownBuildTypes)
_ -> Nothing
, check (isJust (setupBuildInfo pkg) && buildType pkg /= Just Custom) $
PackageBuildWarning $
"Ignoring the 'custom-setup' section because the 'build-type' is "
++ "not 'Custom'. Use 'build-type: Custom' if you need to use a "
++ "custom Setup.hs script."
, check (not (null unknownCompilers)) $
PackageBuildWarning $
"Unknown compiler " ++ commaSep (map quote unknownCompilers)
++ " in 'tested-with' field."
, check (not (null unknownLanguages)) $
PackageBuildWarning $
"Unknown languages: " ++ commaSep unknownLanguages
, check (not (null unknownExtensions)) $
PackageBuildWarning $
"Unknown extensions: " ++ commaSep unknownExtensions
, check (not (null languagesUsedAsExtensions)) $
PackageBuildWarning $
"Languages listed as extensions: "
++ commaSep languagesUsedAsExtensions
++ ". Languages must be specified in either the 'default-language' "
++ " or the 'other-languages' field."
, check (not (null deprecatedExtensions)) $
PackageDistSuspicious $
"Deprecated extensions: "
++ commaSep (map (quote . display . fst) deprecatedExtensions)
++ ". " ++ unwords
[ "Instead of '" ++ display ext
++ "' use '" ++ display replacement ++ "'."
| (ext, Just replacement) <- deprecatedExtensions ]
, check (null (category pkg)) $
PackageDistSuspicious "No 'category' field."
, check (null (maintainer pkg)) $
PackageDistSuspicious "No 'maintainer' field."
, check (null (synopsis pkg) && null (description pkg)) $
PackageDistInexcusable "No 'synopsis' or 'description' field."
, check (null (description pkg) && not (null (synopsis pkg))) $
PackageDistSuspicious "No 'description' field."
, check (null (synopsis pkg) && not (null (description pkg))) $
PackageDistSuspicious "No 'synopsis' field."
--TODO: recommend the bug reports URL, author and homepage fields
--TODO: recommend not using the stability field
--TODO: recommend specifying a source repo
, check (length (synopsis pkg) >= 80) $
PackageDistSuspicious
"The 'synopsis' field is rather long (max 80 chars is recommended)."
-- check use of impossible constraints "tested-with: GHC== 6.10 && ==6.12"
, check (not (null testedWithImpossibleRanges)) $
PackageDistInexcusable $
"Invalid 'tested-with' version range: "
++ commaSep (map display testedWithImpossibleRanges)
++ ". To indicate that you have tested a package with multiple "
++ "different versions of the same compiler use multiple entries, "
++ "for example 'tested-with: GHC==6.10.4, GHC==6.12.3' and not "
++ "'tested-with: GHC==6.10.4 && ==6.12.3'."
]
where
unknownCompilers = [ name | (OtherCompiler name, _) <- testedWith pkg ]
unknownLanguages = [ name | bi <- allBuildInfo pkg
, UnknownLanguage name <- allLanguages bi ]
unknownExtensions = [ name | bi <- allBuildInfo pkg
, UnknownExtension name <- allExtensions bi
, name `notElem` map display knownLanguages ]
deprecatedExtensions = nub $ catMaybes
[ find ((==ext) . fst) Extension.deprecatedExtensions
| bi <- allBuildInfo pkg
, ext <- allExtensions bi ]
languagesUsedAsExtensions =
[ name | bi <- allBuildInfo pkg
, UnknownExtension name <- allExtensions bi
, name `elem` map display knownLanguages ]
testedWithImpossibleRanges =
[ Dependency (PackageName (display compiler)) vr
| (compiler, vr) <- testedWith pkg
, isNoVersion vr ] | 4,675 | false | true | 0 | 18 | 1,286 | 1,021 | 502 | 519 | null | null |
spechub/Hets | Common/Parsec.hs | gpl-2.0 | -- | text in double quotes
stringLit :: CharParser st String
stringLit = quotedLit '"' | 86 | stringLit :: CharParser st String
stringLit = quotedLit '"' | 59 | stringLit = quotedLit '"' | 25 | true | true | 0 | 5 | 14 | 20 | 10 | 10 | null | null |
gcampax/ghc | compiler/nativeGen/PPC/CodeGen.hs | bsd-3-clause | -- -----------------------------------------------------------------------------
-- Conditional jumps
{-
Conditional jumps are always to local labels, so we can use branch
instructions. We peek at the arguments to decide what kind of
comparison to do.
-}
genCondJump
:: BlockId -- the branch target
-> CmmExpr -- the condition on which to branch
-> NatM InstrBlock
genCondJump id bool = do
CondCode _ cond code <- getCondCode bool
return (code `snocOL` BCC cond id)
-- -----------------------------------------------------------------------------
-- Generating C calls
-- Now the biggest nightmare---calls. Most of the nastiness is buried in
-- @get_arg@, which moves the arguments to the correct registers/stack
-- locations. Apart from that, the code is easy.
--
-- (If applicable) Do not fill the delay slots here; you will confuse the
-- register allocator. | 900 | genCondJump
:: BlockId -- the branch target
-> CmmExpr -- the condition on which to branch
-> NatM InstrBlock
genCondJump id bool = do
CondCode _ cond code <- getCondCode bool
return (code `snocOL` BCC cond id)
-- -----------------------------------------------------------------------------
-- Generating C calls
-- Now the biggest nightmare---calls. Most of the nastiness is buried in
-- @get_arg@, which moves the arguments to the correct registers/stack
-- locations. Apart from that, the code is easy.
--
-- (If applicable) Do not fill the delay slots here; you will confuse the
-- register allocator. | 639 | genCondJump id bool = do
CondCode _ cond code <- getCondCode bool
return (code `snocOL` BCC cond id)
-- -----------------------------------------------------------------------------
-- Generating C calls
-- Now the biggest nightmare---calls. Most of the nastiness is buried in
-- @get_arg@, which moves the arguments to the correct registers/stack
-- locations. Apart from that, the code is easy.
--
-- (If applicable) Do not fill the delay slots here; you will confuse the
-- register allocator. | 507 | true | true | 0 | 11 | 163 | 82 | 44 | 38 | null | null |
ComputationWithBoundedResources/ara-inference | doc/tpdb_trs/Haskell/basic_haskell/unlines_1.hs | mit | psPs :: (List a) -> (List a) -> (List a);
psPs Nil ys = ys | 62 | psPs :: (List a) -> (List a) -> (List a)
psPs Nil ys = ys | 61 | psPs Nil ys = ys | 16 | false | true | 1 | 8 | 18 | 51 | 23 | 28 | null | null |
fmapfmapfmap/amazonka | amazonka-ec2/gen/Network/AWS/EC2/Types/Product.hs | mpl-2.0 | -- | The recurring charge tag assigned to the resource.
rioRecurringCharges :: Lens' ReservedInstancesOffering [RecurringCharge]
rioRecurringCharges = lens _rioRecurringCharges (\ s a -> s{_rioRecurringCharges = a}) . _Default . _Coerce | 236 | rioRecurringCharges :: Lens' ReservedInstancesOffering [RecurringCharge]
rioRecurringCharges = lens _rioRecurringCharges (\ s a -> s{_rioRecurringCharges = a}) . _Default . _Coerce | 180 | rioRecurringCharges = lens _rioRecurringCharges (\ s a -> s{_rioRecurringCharges = a}) . _Default . _Coerce | 107 | true | true | 0 | 11 | 29 | 51 | 28 | 23 | null | null |
syanidar/Sophy | src/Test/HashKeyTest.hs | bsd-3-clause | hashMatch :: Position -> Bool
hashMatch x = _zobristKey x == calcHashKey x | 74 | hashMatch :: Position -> Bool
hashMatch x = _zobristKey x == calcHashKey x | 74 | hashMatch x = _zobristKey x == calcHashKey x | 44 | false | true | 0 | 6 | 12 | 28 | 13 | 15 | null | null |
goshakkk/lisley | src/Lisley/Builtins.hs | mit | colToList :: Expr -> Action [Expr]
colToList (List xs) = return xs | 68 | colToList :: Expr -> Action [Expr]
colToList (List xs) = return xs | 68 | colToList (List xs) = return xs | 33 | false | true | 0 | 9 | 13 | 38 | 17 | 21 | null | null |
mfpi/q-inqu | Game/World/Gen/Types.hs | mit | --runGenContext ::
runGenContext :: GenMap () -> StdGen -> ((), Map)
runGenContext m g = evalRWS m () (GenState g) | 115 | runGenContext :: GenMap () -> StdGen -> ((), Map)
runGenContext m g = evalRWS m () (GenState g) | 95 | runGenContext m g = evalRWS m () (GenState g) | 45 | true | true | 0 | 8 | 20 | 53 | 27 | 26 | null | null |
ddssff/haskell-extra | Extra/CIO.hs | bsd-3-clause | magenta s = "\ESC[35m" ++ s ++ "\ESC[30m" | 41 | magenta s = "\ESC[35m" ++ s ++ "\ESC[30m" | 41 | magenta s = "\ESC[35m" ++ s ++ "\ESC[30m" | 41 | false | false | 3 | 5 | 7 | 21 | 8 | 13 | null | null |
spockwangs/scheme.in.haskell | list6.2.hs | unlicense | -- | Primitive functions.
primitives :: [(String, [LispVal] -> ThrowsError LispVal)]
primitives = [("+", numericBinop (+)),
("-", numericBinop (-)),
("*", numericBinop (*)),
("/", numericBinop div),
("mod", numericBinop mod),
("quotient", numericBinop quot),
("remainder", numericBinop rem),
("symbol?", isSymbol),
("string?", isString),
("number?", isNumber),
("symbol->string", symbolToString),
("=", numBoolBinop (==)),
("<", numBoolBinop (<)),
(">", numBoolBinop (>)),
("/=", numBoolBinop (/=)),
(">=", numBoolBinop (>=)),
("<=", numBoolBinop (<=)),
("&&", boolBoolBinop (&&)),
("||", boolBoolBinop (||)),
("string=?", strBoolBinop (==)),
("string?", strBoolBinop (>)),
("string<=?", strBoolBinop (<=)),
("string>=?", strBoolBinop (>=))] | 1,049 | primitives :: [(String, [LispVal] -> ThrowsError LispVal)]
primitives = [("+", numericBinop (+)),
("-", numericBinop (-)),
("*", numericBinop (*)),
("/", numericBinop div),
("mod", numericBinop mod),
("quotient", numericBinop quot),
("remainder", numericBinop rem),
("symbol?", isSymbol),
("string?", isString),
("number?", isNumber),
("symbol->string", symbolToString),
("=", numBoolBinop (==)),
("<", numBoolBinop (<)),
(">", numBoolBinop (>)),
("/=", numBoolBinop (/=)),
(">=", numBoolBinop (>=)),
("<=", numBoolBinop (<=)),
("&&", boolBoolBinop (&&)),
("||", boolBoolBinop (||)),
("string=?", strBoolBinop (==)),
("string?", strBoolBinop (>)),
("string<=?", strBoolBinop (<=)),
("string>=?", strBoolBinop (>=))] | 1,023 | primitives = [("+", numericBinop (+)),
("-", numericBinop (-)),
("*", numericBinop (*)),
("/", numericBinop div),
("mod", numericBinop mod),
("quotient", numericBinop quot),
("remainder", numericBinop rem),
("symbol?", isSymbol),
("string?", isString),
("number?", isNumber),
("symbol->string", symbolToString),
("=", numBoolBinop (==)),
("<", numBoolBinop (<)),
(">", numBoolBinop (>)),
("/=", numBoolBinop (/=)),
(">=", numBoolBinop (>=)),
("<=", numBoolBinop (<=)),
("&&", boolBoolBinop (&&)),
("||", boolBoolBinop (||)),
("string=?", strBoolBinop (==)),
("string?", strBoolBinop (>)),
("string<=?", strBoolBinop (<=)),
("string>=?", strBoolBinop (>=))] | 964 | true | true | 0 | 10 | 385 | 332 | 206 | 126 | null | null |
tedkornish/stack | src/Stack/Types/Config.hs | bsd-3-clause | -- | Path to .shake files.
configShakeFilesDir :: (MonadReader env m, HasBuildConfig env) => m (Path Abs Dir)
configShakeFilesDir = liftM (</> $(mkRelDir "shake")) configProjectWorkDir | 184 | configShakeFilesDir :: (MonadReader env m, HasBuildConfig env) => m (Path Abs Dir)
configShakeFilesDir = liftM (</> $(mkRelDir "shake")) configProjectWorkDir | 157 | configShakeFilesDir = liftM (</> $(mkRelDir "shake")) configProjectWorkDir | 74 | true | true | 0 | 9 | 24 | 56 | 29 | 27 | null | null |
fredokun/piccolo | src/Backend/SeqASTUtils.hs | gpl-3.0 | -- | Flag for a terminated process
statusEnded :: BExpr
statusEnded = Enum StatusEnded | 86 | statusEnded :: BExpr
statusEnded = Enum StatusEnded | 51 | statusEnded = Enum StatusEnded | 30 | true | true | 0 | 5 | 13 | 15 | 8 | 7 | null | null |
mettekou/ghc | compiler/cmm/CmmNode.hs | bsd-3-clause | mapExpM _ (CmmComment _) = Nothing | 45 | mapExpM _ (CmmComment _) = Nothing | 45 | mapExpM _ (CmmComment _) = Nothing | 45 | false | false | 1 | 6 | 16 | 20 | 8 | 12 | null | null |
haskell-opengl/OpenGLRaw | src/Graphics/GL/Functions/F05.hs | bsd-3-clause | -- glDeleteStatesNV ------------------------------------------------------------
glDeleteStatesNV
:: MonadIO m
=> GLsizei -- ^ @n@.
-> Ptr GLuint -- ^ @states@ pointing to @n@ elements of type @GLuint@.
-> m ()
glDeleteStatesNV v1 v2 = liftIO $ dyn200 ptr_glDeleteStatesNV v1 v2 | 287 | glDeleteStatesNV
:: MonadIO m
=> GLsizei -- ^ @n@.
-> Ptr GLuint -- ^ @states@ pointing to @n@ elements of type @GLuint@.
-> m ()
glDeleteStatesNV v1 v2 = liftIO $ dyn200 ptr_glDeleteStatesNV v1 v2 | 205 | glDeleteStatesNV v1 v2 = liftIO $ dyn200 ptr_glDeleteStatesNV v1 v2 | 67 | true | true | 0 | 10 | 46 | 57 | 27 | 30 | null | null |
dysinger/amazonka | amazonka-cloudtrail/gen/Network/AWS/CloudTrail/UpdateTrail.hs | mpl-2.0 | -- | Specifies whether the trail is publishing events from global services such as
-- IAM to the log files.
utIncludeGlobalServiceEvents :: Lens' UpdateTrail (Maybe Bool)
utIncludeGlobalServiceEvents =
lens _utIncludeGlobalServiceEvents
(\s a -> s { _utIncludeGlobalServiceEvents = a }) | 298 | utIncludeGlobalServiceEvents :: Lens' UpdateTrail (Maybe Bool)
utIncludeGlobalServiceEvents =
lens _utIncludeGlobalServiceEvents
(\s a -> s { _utIncludeGlobalServiceEvents = a }) | 190 | utIncludeGlobalServiceEvents =
lens _utIncludeGlobalServiceEvents
(\s a -> s { _utIncludeGlobalServiceEvents = a }) | 127 | true | true | 0 | 8 | 50 | 48 | 26 | 22 | null | null |
andrewthad/yesod | yesod-bin/GhcBuild.hs | mit | isShowVersionMode :: Mode -> Bool
isShowVersionMode (Left ShowVersion) = True | 77 | isShowVersionMode :: Mode -> Bool
isShowVersionMode (Left ShowVersion) = True | 77 | isShowVersionMode (Left ShowVersion) = True | 43 | false | true | 0 | 7 | 9 | 24 | 12 | 12 | null | null |
tanishiking/hscc | src/Semantic.hs | mit | checkStmt lev (CompoundStmt pos dList stmts) =
let declsInfo = map (makeVarInfo pos (lev+1)) dList
cstmts = mapM (checkStmt (lev+1)) stmts in do
levCheckedStmts <- withNewEnv (lev+1)
(mapM_ (appendWithDupCheck pos (lev+1)) declsInfo)
cstmts
return $ CheckedCompoundStmt declsInfo levCheckedStmts | 374 | checkStmt lev (CompoundStmt pos dList stmts) =
let declsInfo = map (makeVarInfo pos (lev+1)) dList
cstmts = mapM (checkStmt (lev+1)) stmts in do
levCheckedStmts <- withNewEnv (lev+1)
(mapM_ (appendWithDupCheck pos (lev+1)) declsInfo)
cstmts
return $ CheckedCompoundStmt declsInfo levCheckedStmts | 374 | checkStmt lev (CompoundStmt pos dList stmts) =
let declsInfo = map (makeVarInfo pos (lev+1)) dList
cstmts = mapM (checkStmt (lev+1)) stmts in do
levCheckedStmts <- withNewEnv (lev+1)
(mapM_ (appendWithDupCheck pos (lev+1)) declsInfo)
cstmts
return $ CheckedCompoundStmt declsInfo levCheckedStmts | 374 | false | false | 0 | 16 | 116 | 131 | 64 | 67 | null | null |
dylex/blaze-markup | src/Text/Blaze/Renderer/String.hs | bsd-3-clause | -- | Render markup to a lazy 'String'.
--
renderMarkup :: Markup -> String
renderMarkup html = renderString html "" | 115 | renderMarkup :: Markup -> String
renderMarkup html = renderString html "" | 73 | renderMarkup html = renderString html "" | 40 | true | true | 0 | 5 | 19 | 25 | 13 | 12 | null | null |
rgleichman/glance | examples/advantages.hs | gpl-3.0 | badMapFirstAndSwap f (x, y) = (x', x') where
x' = f x
{-
If you were curious, here is what the good version of mapFirstAndSwap
looks like.
-} | 144 | badMapFirstAndSwap f (x, y) = (x', x') where
x' = f x
{-
If you were curious, here is what the good version of mapFirstAndSwap
looks like.
-} | 144 | badMapFirstAndSwap f (x, y) = (x', x') where
x' = f x
{-
If you were curious, here is what the good version of mapFirstAndSwap
looks like.
-} | 144 | false | false | 0 | 6 | 30 | 33 | 19 | 14 | null | null |
siddhanathan/ghc | compiler/basicTypes/SrcLoc.hs | bsd-3-clause | cmpSrcLoc (UnhelpfulLoc _) (RealSrcLoc _) = GT | 50 | cmpSrcLoc (UnhelpfulLoc _) (RealSrcLoc _) = GT | 50 | cmpSrcLoc (UnhelpfulLoc _) (RealSrcLoc _) = GT | 50 | false | false | 0 | 7 | 10 | 23 | 11 | 12 | null | null |
jgm/citeproc | src/Citeproc/Types.hs | bsd-2-clause | variableType "number" = NumberVariable | 38 | variableType "number" = NumberVariable | 38 | variableType "number" = NumberVariable | 38 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
norm2782/uuagc | src-generated/PrintCode.hs | bsd-3-clause | wrap_NamedType :: T_NamedType -> Inh_NamedType -> (Syn_NamedType )
wrap_NamedType !(T_NamedType act) !(Inh_NamedType _lhsInested) =
Control.Monad.Identity.runIdentity (
do !sem <- act
let arg = T_NamedType_vIn34 _lhsInested
!(T_NamedType_vOut34 _lhsOpp) <- return (inv_NamedType_s35 sem arg)
return (Syn_NamedType _lhsOpp)
) | 361 | wrap_NamedType :: T_NamedType -> Inh_NamedType -> (Syn_NamedType )
wrap_NamedType !(T_NamedType act) !(Inh_NamedType _lhsInested) =
Control.Monad.Identity.runIdentity (
do !sem <- act
let arg = T_NamedType_vIn34 _lhsInested
!(T_NamedType_vOut34 _lhsOpp) <- return (inv_NamedType_s35 sem arg)
return (Syn_NamedType _lhsOpp)
) | 361 | wrap_NamedType !(T_NamedType act) !(Inh_NamedType _lhsInested) =
Control.Monad.Identity.runIdentity (
do !sem <- act
let arg = T_NamedType_vIn34 _lhsInested
!(T_NamedType_vOut34 _lhsOpp) <- return (inv_NamedType_s35 sem arg)
return (Syn_NamedType _lhsOpp)
) | 292 | false | true | 0 | 12 | 72 | 108 | 50 | 58 | null | null |
changlinli/nikki | src/Base/Types.hs | lgpl-3.0 | levelUID (EpisodeLevel _ dir package file meta) =
"storyModeLevels" <//> package <//> file | 94 | levelUID (EpisodeLevel _ dir package file meta) =
"storyModeLevels" <//> package <//> file | 94 | levelUID (EpisodeLevel _ dir package file meta) =
"storyModeLevels" <//> package <//> file | 94 | false | false | 0 | 7 | 16 | 31 | 15 | 16 | null | null |
Martoon-00/toy-compiler | src/Toy/Lang/Data.hs | bsd-3-clause | -- | Array initializer, which imideatelly writes to variable.
storeArrayS :: Var -> [Exp] -> Stmt
storeArrayS var exps = mconcat
[ var := ArrayUninitE (fromIntegral $ length exps)
, uncurry (ArrayAssign $ VarE var) `foldMap` (zip (map ValueE [0..]) exps)
] | 268 | storeArrayS :: Var -> [Exp] -> Stmt
storeArrayS var exps = mconcat
[ var := ArrayUninitE (fromIntegral $ length exps)
, uncurry (ArrayAssign $ VarE var) `foldMap` (zip (map ValueE [0..]) exps)
] | 206 | storeArrayS var exps = mconcat
[ var := ArrayUninitE (fromIntegral $ length exps)
, uncurry (ArrayAssign $ VarE var) `foldMap` (zip (map ValueE [0..]) exps)
] | 170 | true | true | 0 | 11 | 53 | 92 | 48 | 44 | null | null |
gentoo-haskell/hackport | tests/Portage/VersionSpec.hs | gpl-3.0 | spec :: Spec
spec = do
describe "is_live" $ do
prop "determines if a Portage version is live" $ do
\(ComplexVersion v) -> is_live v `shouldBe`
if last (versionNumber v) >= 9999
then True else False
describe "fromCabalVersion" $ do
prop "converts from a Cabal version to a Portage version" $ do
\verNum -> fromCabalVersion (Cabal.mkVersion verNum) == Version verNum Nothing [] 0
describe "toCabalVersion" $ do
prop "converts from a Portage version to a Cabal version" $ do
\(ComplexVersion v) -> toCabalVersion v `shouldBe`
if versionChar v == Nothing && versionSuffix v == []
then Just (Cabal.mkVersion (versionNumber v)) else Nothing | 718 | spec :: Spec
spec = do
describe "is_live" $ do
prop "determines if a Portage version is live" $ do
\(ComplexVersion v) -> is_live v `shouldBe`
if last (versionNumber v) >= 9999
then True else False
describe "fromCabalVersion" $ do
prop "converts from a Cabal version to a Portage version" $ do
\verNum -> fromCabalVersion (Cabal.mkVersion verNum) == Version verNum Nothing [] 0
describe "toCabalVersion" $ do
prop "converts from a Portage version to a Cabal version" $ do
\(ComplexVersion v) -> toCabalVersion v `shouldBe`
if versionChar v == Nothing && versionSuffix v == []
then Just (Cabal.mkVersion (versionNumber v)) else Nothing | 718 | spec = do
describe "is_live" $ do
prop "determines if a Portage version is live" $ do
\(ComplexVersion v) -> is_live v `shouldBe`
if last (versionNumber v) >= 9999
then True else False
describe "fromCabalVersion" $ do
prop "converts from a Cabal version to a Portage version" $ do
\verNum -> fromCabalVersion (Cabal.mkVersion verNum) == Version verNum Nothing [] 0
describe "toCabalVersion" $ do
prop "converts from a Portage version to a Cabal version" $ do
\(ComplexVersion v) -> toCabalVersion v `shouldBe`
if versionChar v == Nothing && versionSuffix v == []
then Just (Cabal.mkVersion (versionNumber v)) else Nothing | 705 | false | true | 0 | 20 | 185 | 217 | 103 | 114 | null | null |
jystic/QuickSpec | new/TestTree.hs | bsd-3-clause | NonNil t1 `union` NonNil t2 = NonNil (t1 `union'` t2) | 53 | NonNil t1 `union` NonNil t2 = NonNil (t1 `union'` t2) | 53 | NonNil t1 `union` NonNil t2 = NonNil (t1 `union'` t2) | 53 | false | false | 0 | 7 | 9 | 32 | 16 | 16 | null | null |
alexander-at-github/eta | compiler/ETA/Prelude/PrimOp.hs | bsd-3-clause | tagOf_PrimOp NewAlignedPinnedByteArrayOp_Char = _ILIT(173) | 58 | tagOf_PrimOp NewAlignedPinnedByteArrayOp_Char = _ILIT(173) | 58 | tagOf_PrimOp NewAlignedPinnedByteArrayOp_Char = _ILIT(173) | 58 | false | false | 0 | 6 | 3 | 15 | 7 | 8 | null | null |
alanz/Alex | src/NFA.hs | bsd-3-clause | anyBytes from n to = do
s <- newState
byteEdge from (byteSetRange 0 0xff) s
anyBytes s (n-1) to | 119 | anyBytes from n to = do
s <- newState
byteEdge from (byteSetRange 0 0xff) s
anyBytes s (n-1) to | 119 | anyBytes from n to = do
s <- newState
byteEdge from (byteSetRange 0 0xff) s
anyBytes s (n-1) to | 119 | false | false | 0 | 9 | 42 | 55 | 25 | 30 | null | null |
ekmett/wxHaskell | wxcore/src/haskell/Graphics/UI/WXCore/WxcDefs.hs | lgpl-2.1 | wxLANGUAGE_AZERI :: Int
wxLANGUAGE_AZERI = 28 | 45 | wxLANGUAGE_AZERI :: Int
wxLANGUAGE_AZERI = 28 | 45 | wxLANGUAGE_AZERI = 28 | 21 | false | true | 0 | 6 | 5 | 18 | 7 | 11 | null | null |
kumasento/accelerate | Data/Array/Accelerate/Analysis/Match.hs | bsd-3-clause | matchIntegralType (TypeCInt _) (TypeCInt _) = Just REFL | 61 | matchIntegralType (TypeCInt _) (TypeCInt _) = Just REFL | 61 | matchIntegralType (TypeCInt _) (TypeCInt _) = Just REFL | 61 | false | false | 0 | 7 | 13 | 26 | 12 | 14 | null | null |
psibi/yesod | yesod-core/Yesod/Core/Handler.hs | mit | defaultCsrfParamName :: Text
defaultCsrfParamName = "_token" | 60 | defaultCsrfParamName :: Text
defaultCsrfParamName = "_token" | 60 | defaultCsrfParamName = "_token" | 31 | false | true | 0 | 4 | 5 | 11 | 6 | 5 | null | null |
kajigor/uKanren_transformations | src/Syntax.hs | bsd-3-clause | success :: G a
success = Invoke successName [] | 46 | success :: G a
success = Invoke successName [] | 46 | success = Invoke successName [] | 31 | false | true | 0 | 6 | 8 | 21 | 10 | 11 | null | null |
christiaanb/ghc | compiler/cmm/CmmUtils.hs | bsd-3-clause | -- | like 'toBlockList', but the entry block always comes first
toBlockListEntryFirst :: CmmGraph -> [CmmBlock]
toBlockListEntryFirst g
| mapNull m = []
| otherwise = entry_block : others
where
m = toBlockMap g
entry_id = g_entry g
Just entry_block = mapLookup entry_id m
others = filter ((/= entry_id) . entryLabel) (mapElems m)
-- | Like 'toBlockListEntryFirst', but we strive to ensure that we order blocks
-- so that the false case of a conditional jumps to the next block in the output
-- list of blocks. This matches the way OldCmm blocks were output since in
-- OldCmm the false case was a fallthrough, whereas in Cmm conditional branches
-- have both true and false successors. Block ordering can make a big difference
-- in performance in the LLVM backend. Note that we rely crucially on the order
-- of successors returned for CmmCondBranch by the NonLocal instance for CmmNode
-- defind in cmm/CmmNode.hs. -GBM | 946 | toBlockListEntryFirst :: CmmGraph -> [CmmBlock]
toBlockListEntryFirst g
| mapNull m = []
| otherwise = entry_block : others
where
m = toBlockMap g
entry_id = g_entry g
Just entry_block = mapLookup entry_id m
others = filter ((/= entry_id) . entryLabel) (mapElems m)
-- | Like 'toBlockListEntryFirst', but we strive to ensure that we order blocks
-- so that the false case of a conditional jumps to the next block in the output
-- list of blocks. This matches the way OldCmm blocks were output since in
-- OldCmm the false case was a fallthrough, whereas in Cmm conditional branches
-- have both true and false successors. Block ordering can make a big difference
-- in performance in the LLVM backend. Note that we rely crucially on the order
-- of successors returned for CmmCondBranch by the NonLocal instance for CmmNode
-- defind in cmm/CmmNode.hs. -GBM | 882 | toBlockListEntryFirst g
| mapNull m = []
| otherwise = entry_block : others
where
m = toBlockMap g
entry_id = g_entry g
Just entry_block = mapLookup entry_id m
others = filter ((/= entry_id) . entryLabel) (mapElems m)
-- | Like 'toBlockListEntryFirst', but we strive to ensure that we order blocks
-- so that the false case of a conditional jumps to the next block in the output
-- list of blocks. This matches the way OldCmm blocks were output since in
-- OldCmm the false case was a fallthrough, whereas in Cmm conditional branches
-- have both true and false successors. Block ordering can make a big difference
-- in performance in the LLVM backend. Note that we rely crucially on the order
-- of successors returned for CmmCondBranch by the NonLocal instance for CmmNode
-- defind in cmm/CmmNode.hs. -GBM | 834 | true | true | 1 | 8 | 180 | 112 | 60 | 52 | null | null |
thalerjonathan/phd | coding/learning/haskell/grahambook/src/Slides/Chapter6.hs | gpl-3.0 | -- Solutions for the exercises of the SLIDES "Programming In Haskell" by Graham Hutton: CHAPTER 6 (Recursive Functions)
{--
(1)
Without looking at the standard prelude, define the following library functions using recursion:
Decide if all logical values in a list are true:
and :: [Bool] -> Bool
Concatenate a list of lists:
concat :: [[a]] -> [a]
Produce a list with n identical elements:
replicate :: Int -> a -> [a]
Select the nth element of a list:
(!!) :: [a] -> Int -> a
Decide if a value is an element of a list:
elem :: Eq a => a -> [a] -> Bool
--}
and' :: [Bool] -> Bool
and' [] = True | 601 | and' :: [Bool] -> Bool
and' [] = True | 37 | and' [] = True | 14 | true | true | 0 | 6 | 122 | 25 | 14 | 11 | null | null |
CloudI/CloudI | src/api/haskell/external/bytestring-0.10.10.0/Data/ByteString/Lazy.hs | mit | null :: ByteString -> Bool
null Empty = True | 44 | null :: ByteString -> Bool
null Empty = True | 44 | null Empty = True | 17 | false | true | 0 | 5 | 8 | 18 | 9 | 9 | null | null |
heathweiss/Tricad | src/Tests/RadiusTest.hs | gpl-2.0 | setRadiusWithPrecedingRadiusIfNullTest2 = TestCase $ assertEqual
"setRadiusWithPrecedingRadiusIfNullTest2"
([Radius 1, Radius 1])
(setRadiusWithPrecedingValueIfNull 2 [ Radius 1, Radius $ averageValueOf []]) | 215 | setRadiusWithPrecedingRadiusIfNullTest2 = TestCase $ assertEqual
"setRadiusWithPrecedingRadiusIfNullTest2"
([Radius 1, Radius 1])
(setRadiusWithPrecedingValueIfNull 2 [ Radius 1, Radius $ averageValueOf []]) | 215 | setRadiusWithPrecedingRadiusIfNullTest2 = TestCase $ assertEqual
"setRadiusWithPrecedingRadiusIfNullTest2"
([Radius 1, Radius 1])
(setRadiusWithPrecedingValueIfNull 2 [ Radius 1, Radius $ averageValueOf []]) | 215 | false | false | 0 | 10 | 26 | 60 | 29 | 31 | null | null |
ambiata/highlighting-kate | Text/Highlighting/Kate/Syntax/Eiffel.hs | gpl-2.0 | list_predefined'2dentities = Set.fromList $ words $ "Current False Precursor Result True TUPLE" | 95 | list_predefined'2dentities = Set.fromList $ words $ "Current False Precursor Result True TUPLE" | 95 | list_predefined'2dentities = Set.fromList $ words $ "Current False Precursor Result True TUPLE" | 95 | false | false | 0 | 7 | 11 | 16 | 8 | 8 | null | null |
Teaspot-Studio/gore-and-ash-lambdacube | src/Game/GoreAndAsh/LambdaCube/Module.hs | bsd-3-clause | registerPipelineInternal :: PipelineId -> Pipeline -> PipelineSchema -> GLRenderer -> LambdaCubeEnv t -> IO ()
registerPipelineInternal i ps pl r LambdaCubeEnv{..} = do
atomicModifyIORef' lambdaEnvPipelines $ (, ()) . M.insert i info
where
info = PipelineInfo {
pipeInfoRenderer = r
, pipeInfoSchema = pl
, pipeInfoPipeline = ps
}
-- | Removes pipeline from state and deletes it, also destroys all storages of the pipeline | 457 | registerPipelineInternal :: PipelineId -> Pipeline -> PipelineSchema -> GLRenderer -> LambdaCubeEnv t -> IO ()
registerPipelineInternal i ps pl r LambdaCubeEnv{..} = do
atomicModifyIORef' lambdaEnvPipelines $ (, ()) . M.insert i info
where
info = PipelineInfo {
pipeInfoRenderer = r
, pipeInfoSchema = pl
, pipeInfoPipeline = ps
}
-- | Removes pipeline from state and deletes it, also destroys all storages of the pipeline | 457 | registerPipelineInternal i ps pl r LambdaCubeEnv{..} = do
atomicModifyIORef' lambdaEnvPipelines $ (, ()) . M.insert i info
where
info = PipelineInfo {
pipeInfoRenderer = r
, pipeInfoSchema = pl
, pipeInfoPipeline = ps
}
-- | Removes pipeline from state and deletes it, also destroys all storages of the pipeline | 346 | false | true | 0 | 11 | 99 | 112 | 58 | 54 | null | null |
phadej/scientific | src/Utils.hs | bsd-3-clause | roundTo :: Int -> [Int] -> (Int, [Int])
roundTo d is =
case f d True is of
x@(0,_) -> x
(1,xs) -> (1, 1:xs)
_ -> error "roundTo: bad Value"
where
base = 10
b2 = base `quot` 2
f n _ [] = (0, replicate n 0)
f 0 e (x:xs) | x == b2 && e && all (== 0) xs = (0, []) -- Round to even when at exactly half the base
| otherwise = (if x >= b2 then 1 else 0, [])
f n _ (i:xs)
| i' == base = (1,0:ds)
| otherwise = (0,i':ds)
where
(c,ds) = f (n-1) (even i) xs
i' = c + i
-- | Unsafe conversion for decimal digits.
| 593 | roundTo :: Int -> [Int] -> (Int, [Int])
roundTo d is =
case f d True is of
x@(0,_) -> x
(1,xs) -> (1, 1:xs)
_ -> error "roundTo: bad Value"
where
base = 10
b2 = base `quot` 2
f n _ [] = (0, replicate n 0)
f 0 e (x:xs) | x == b2 && e && all (== 0) xs = (0, []) -- Round to even when at exactly half the base
| otherwise = (if x >= b2 then 1 else 0, [])
f n _ (i:xs)
| i' == base = (1,0:ds)
| otherwise = (0,i':ds)
where
(c,ds) = f (n-1) (even i) xs
i' = c + i
-- | Unsafe conversion for decimal digits.
| 593 | roundTo d is =
case f d True is of
x@(0,_) -> x
(1,xs) -> (1, 1:xs)
_ -> error "roundTo: bad Value"
where
base = 10
b2 = base `quot` 2
f n _ [] = (0, replicate n 0)
f 0 e (x:xs) | x == b2 && e && all (== 0) xs = (0, []) -- Round to even when at exactly half the base
| otherwise = (if x >= b2 then 1 else 0, [])
f n _ (i:xs)
| i' == base = (1,0:ds)
| otherwise = (0,i':ds)
where
(c,ds) = f (n-1) (even i) xs
i' = c + i
-- | Unsafe conversion for decimal digits.
| 553 | false | true | 5 | 10 | 214 | 336 | 174 | 162 | null | null |
thielema/wxhaskell | wx/src/Graphics/UI/WX/Attributes.hs | lgpl-2.1 | -- | Get the value of an attribute
--
-- > t <- get w text
--
get :: w -> Attr w a -> IO a
get w (Attr name reflect getter setter updater)
= getter w | 151 | get :: w -> Attr w a -> IO a
get w (Attr name reflect getter setter updater)
= getter w | 89 | get w (Attr name reflect getter setter updater)
= getter w | 60 | true | true | 0 | 7 | 39 | 53 | 27 | 26 | null | null |
rolph-recto/liquid-fixpoint | src/Language/Fixpoint/Solver.hs | bsd-3-clause | substBinds :: [(Symbol, SortedReft)] -> ([(Symbol,Sort)],[Expr])
substBinds = unzip . map substBind | 99 | substBinds :: [(Symbol, SortedReft)] -> ([(Symbol,Sort)],[Expr])
substBinds = unzip . map substBind | 99 | substBinds = unzip . map substBind | 34 | false | true | 1 | 10 | 11 | 56 | 30 | 26 | null | null |
danr/structural-induction | example/Example.hs | lgpl-3.0 | -- | A small test envirenment of Ordinals, Naturals, Integers,
-- Lists, Trees and Expressions.
testEnv :: TyEnv String String
testEnv t = case t of
"Ord" -> Just [("zero",[])
,("succ",[Rec "Ord"])
,("lim",[Exp "Nat -> Ord" ["Nat"]])
]
"Nat" -> Just [("zero",[])
,("succ",[Rec "Nat"])
]
"Int" -> Just [("pos",[NonRec "Nat"])
,("neg",[NonRec "Nat"])
]
_ | ("List ",a) <- splitAt 5 t ->
Just [("nil",[])
,("cons",[NonRec a,Rec t])
]
| ("Tree ",a) <- splitAt 5 t ->
Just [("leaf",[NonRec a])
,("fork",[Rec t,Rec t])
]
| ("Tree' ",a) <- splitAt 6 t ->
Just [("empty",[])
,("branch",[Rec t,NonRec a,Rec t])
]
| ("Expr ",v) <- splitAt 5 t ->
Just [("var",[NonRec v])
,("lit",[NonRec "Int"])
,("add",[Rec t,Rec t])
,("mul",[Rec t,Rec t])
,("neg",[Rec t,Rec t])
]
_ -> Nothing
-- | Specify the type of every variable, then on which coordinates of
-- P to do induction on. This function then takes care of the
-- plumbing and prints the results. | 1,342 | testEnv :: TyEnv String String
testEnv t = case t of
"Ord" -> Just [("zero",[])
,("succ",[Rec "Ord"])
,("lim",[Exp "Nat -> Ord" ["Nat"]])
]
"Nat" -> Just [("zero",[])
,("succ",[Rec "Nat"])
]
"Int" -> Just [("pos",[NonRec "Nat"])
,("neg",[NonRec "Nat"])
]
_ | ("List ",a) <- splitAt 5 t ->
Just [("nil",[])
,("cons",[NonRec a,Rec t])
]
| ("Tree ",a) <- splitAt 5 t ->
Just [("leaf",[NonRec a])
,("fork",[Rec t,Rec t])
]
| ("Tree' ",a) <- splitAt 6 t ->
Just [("empty",[])
,("branch",[Rec t,NonRec a,Rec t])
]
| ("Expr ",v) <- splitAt 5 t ->
Just [("var",[NonRec v])
,("lit",[NonRec "Int"])
,("add",[Rec t,Rec t])
,("mul",[Rec t,Rec t])
,("neg",[Rec t,Rec t])
]
_ -> Nothing
-- | Specify the type of every variable, then on which coordinates of
-- P to do induction on. This function then takes care of the
-- plumbing and prints the results. | 1,244 | testEnv t = case t of
"Ord" -> Just [("zero",[])
,("succ",[Rec "Ord"])
,("lim",[Exp "Nat -> Ord" ["Nat"]])
]
"Nat" -> Just [("zero",[])
,("succ",[Rec "Nat"])
]
"Int" -> Just [("pos",[NonRec "Nat"])
,("neg",[NonRec "Nat"])
]
_ | ("List ",a) <- splitAt 5 t ->
Just [("nil",[])
,("cons",[NonRec a,Rec t])
]
| ("Tree ",a) <- splitAt 5 t ->
Just [("leaf",[NonRec a])
,("fork",[Rec t,Rec t])
]
| ("Tree' ",a) <- splitAt 6 t ->
Just [("empty",[])
,("branch",[Rec t,NonRec a,Rec t])
]
| ("Expr ",v) <- splitAt 5 t ->
Just [("var",[NonRec v])
,("lit",[NonRec "Int"])
,("add",[Rec t,Rec t])
,("mul",[Rec t,Rec t])
,("neg",[Rec t,Rec t])
]
_ -> Nothing
-- | Specify the type of every variable, then on which coordinates of
-- P to do induction on. This function then takes care of the
-- plumbing and prints the results. | 1,213 | true | true | 12 | 9 | 561 | 472 | 262 | 210 | null | null |
ctford/Idris-Elba-dev | src/Idris/ParseData.hs | bsd-3-clause | {- | Parses a data type declaration
Data ::= DocComment? Accessibility? DataI DefaultEliminator FnName TypeSig ExplicitTypeDataRest?
| DocComment? Accessibility? DataI DefaultEliminator FnName Name* DataRest?
;
Constructor' ::= Constructor KeepTerminator;
ExplicitTypeDataRest ::= 'where' OpenBlock Constructor'* CloseBlock;
DataRest ::= '=' SimpleConstructorList Terminator
| 'where'!
;
SimpleConstructorList ::=
SimpleConstructor
| SimpleConstructor '|' SimpleConstructorList
;
-}
data_ :: SyntaxInfo -> IdrisParser PDecl
data_ syn = do (doc, acc, dataOpts) <- try (do
doc <- option "" (docComment '|')
pushIndent
acc <- optional accessibility
elim <- dataOpts []
co <- dataI
let dataOpts = combineDataOpts(elim ++ co)
return (doc, acc, dataOpts))
fc <- getFC
tyn_in <- fnName
(do try (lchar ':')
popIndent
ty <- typeExpr (allowImp syn)
let tyn = expandNS syn tyn_in
option (PData doc syn fc dataOpts (PLaterdecl tyn ty)) (do
reserved "where"
cons <- indentedBlock (constructor syn)
accData acc tyn (map (\ (_, n, _, _, _) -> n) cons)
return $ PData doc syn fc dataOpts (PDatadecl tyn ty cons))) <|> (do
args <- many name
let ty = bindArgs (map (const PType) args) PType
let tyn = expandNS syn tyn_in
option (PData doc syn fc dataOpts (PLaterdecl tyn ty)) (do
try (lchar '=') <|> do reserved "where"
let kw = (if DefaultEliminator `elem` dataOpts then "" else "%noelim ") ++ (if Codata `elem` dataOpts then "co" else "") ++ "data "
let n = show tyn_in ++ " "
let s = kw ++ n
let as = concat (intersperse " " $ map show args) ++ " "
let ns = concat (intersperse " -> " $ map ((\x -> "(" ++ x ++ " : Type)") . show) args)
let ss = concat (intersperse " -> " $ map (const "Type") args)
let fix1 = s ++ as ++ " = ..."
let fix2 = s ++ ": " ++ ns ++ " -> Type where\n ..."
let fix3 = s ++ ": " ++ ss ++ " -> Type where\n ..."
fail $ fixErrorMsg "unexpected \"where\"" [fix1, fix2, fix3]
cons <- sepBy1 (simpleConstructor syn) (lchar '|')
terminator
let conty = mkPApp fc (PRef fc tyn) (map (PRef fc) args)
cons' <- mapM (\ (doc, x, cargs, cfc, fs) ->
do let cty = bindArgs cargs conty
return (doc, x, cty, cfc, fs)) cons
accData acc tyn (map (\ (_, n, _, _, _) -> n) cons')
return $ PData doc syn fc dataOpts (PDatadecl tyn ty cons')))
<?> "data type declaration"
where
mkPApp :: FC -> PTerm -> [PTerm] -> PTerm
mkPApp fc t [] = t
mkPApp fc t xs = PApp fc t (map pexp xs)
bindArgs :: [PTerm] -> PTerm -> PTerm
bindArgs xs t = foldr (PPi expl (sMN 0 "_t")) t xs
combineDataOpts :: DataOpts -> DataOpts
combineDataOpts opts = if Codata `elem` opts
then delete DefaultEliminator opts
else opts
{- | Parses a type constructor declaration
Constructor ::= DocComment? FnName TypeSig;
-} | 3,937 | data_ :: SyntaxInfo -> IdrisParser PDecl
data_ syn = do (doc, acc, dataOpts) <- try (do
doc <- option "" (docComment '|')
pushIndent
acc <- optional accessibility
elim <- dataOpts []
co <- dataI
let dataOpts = combineDataOpts(elim ++ co)
return (doc, acc, dataOpts))
fc <- getFC
tyn_in <- fnName
(do try (lchar ':')
popIndent
ty <- typeExpr (allowImp syn)
let tyn = expandNS syn tyn_in
option (PData doc syn fc dataOpts (PLaterdecl tyn ty)) (do
reserved "where"
cons <- indentedBlock (constructor syn)
accData acc tyn (map (\ (_, n, _, _, _) -> n) cons)
return $ PData doc syn fc dataOpts (PDatadecl tyn ty cons))) <|> (do
args <- many name
let ty = bindArgs (map (const PType) args) PType
let tyn = expandNS syn tyn_in
option (PData doc syn fc dataOpts (PLaterdecl tyn ty)) (do
try (lchar '=') <|> do reserved "where"
let kw = (if DefaultEliminator `elem` dataOpts then "" else "%noelim ") ++ (if Codata `elem` dataOpts then "co" else "") ++ "data "
let n = show tyn_in ++ " "
let s = kw ++ n
let as = concat (intersperse " " $ map show args) ++ " "
let ns = concat (intersperse " -> " $ map ((\x -> "(" ++ x ++ " : Type)") . show) args)
let ss = concat (intersperse " -> " $ map (const "Type") args)
let fix1 = s ++ as ++ " = ..."
let fix2 = s ++ ": " ++ ns ++ " -> Type where\n ..."
let fix3 = s ++ ": " ++ ss ++ " -> Type where\n ..."
fail $ fixErrorMsg "unexpected \"where\"" [fix1, fix2, fix3]
cons <- sepBy1 (simpleConstructor syn) (lchar '|')
terminator
let conty = mkPApp fc (PRef fc tyn) (map (PRef fc) args)
cons' <- mapM (\ (doc, x, cargs, cfc, fs) ->
do let cty = bindArgs cargs conty
return (doc, x, cty, cfc, fs)) cons
accData acc tyn (map (\ (_, n, _, _, _) -> n) cons')
return $ PData doc syn fc dataOpts (PDatadecl tyn ty cons')))
<?> "data type declaration"
where
mkPApp :: FC -> PTerm -> [PTerm] -> PTerm
mkPApp fc t [] = t
mkPApp fc t xs = PApp fc t (map pexp xs)
bindArgs :: [PTerm] -> PTerm -> PTerm
bindArgs xs t = foldr (PPi expl (sMN 0 "_t")) t xs
combineDataOpts :: DataOpts -> DataOpts
combineDataOpts opts = if Codata `elem` opts
then delete DefaultEliminator opts
else opts
{- | Parses a type constructor declaration
Constructor ::= DocComment? FnName TypeSig;
-} | 3,406 | data_ syn = do (doc, acc, dataOpts) <- try (do
doc <- option "" (docComment '|')
pushIndent
acc <- optional accessibility
elim <- dataOpts []
co <- dataI
let dataOpts = combineDataOpts(elim ++ co)
return (doc, acc, dataOpts))
fc <- getFC
tyn_in <- fnName
(do try (lchar ':')
popIndent
ty <- typeExpr (allowImp syn)
let tyn = expandNS syn tyn_in
option (PData doc syn fc dataOpts (PLaterdecl tyn ty)) (do
reserved "where"
cons <- indentedBlock (constructor syn)
accData acc tyn (map (\ (_, n, _, _, _) -> n) cons)
return $ PData doc syn fc dataOpts (PDatadecl tyn ty cons))) <|> (do
args <- many name
let ty = bindArgs (map (const PType) args) PType
let tyn = expandNS syn tyn_in
option (PData doc syn fc dataOpts (PLaterdecl tyn ty)) (do
try (lchar '=') <|> do reserved "where"
let kw = (if DefaultEliminator `elem` dataOpts then "" else "%noelim ") ++ (if Codata `elem` dataOpts then "co" else "") ++ "data "
let n = show tyn_in ++ " "
let s = kw ++ n
let as = concat (intersperse " " $ map show args) ++ " "
let ns = concat (intersperse " -> " $ map ((\x -> "(" ++ x ++ " : Type)") . show) args)
let ss = concat (intersperse " -> " $ map (const "Type") args)
let fix1 = s ++ as ++ " = ..."
let fix2 = s ++ ": " ++ ns ++ " -> Type where\n ..."
let fix3 = s ++ ": " ++ ss ++ " -> Type where\n ..."
fail $ fixErrorMsg "unexpected \"where\"" [fix1, fix2, fix3]
cons <- sepBy1 (simpleConstructor syn) (lchar '|')
terminator
let conty = mkPApp fc (PRef fc tyn) (map (PRef fc) args)
cons' <- mapM (\ (doc, x, cargs, cfc, fs) ->
do let cty = bindArgs cargs conty
return (doc, x, cty, cfc, fs)) cons
accData acc tyn (map (\ (_, n, _, _, _) -> n) cons')
return $ PData doc syn fc dataOpts (PDatadecl tyn ty cons')))
<?> "data type declaration"
where
mkPApp :: FC -> PTerm -> [PTerm] -> PTerm
mkPApp fc t [] = t
mkPApp fc t xs = PApp fc t (map pexp xs)
bindArgs :: [PTerm] -> PTerm -> PTerm
bindArgs xs t = foldr (PPi expl (sMN 0 "_t")) t xs
combineDataOpts :: DataOpts -> DataOpts
combineDataOpts opts = if Codata `elem` opts
then delete DefaultEliminator opts
else opts
{- | Parses a type constructor declaration
Constructor ::= DocComment? FnName TypeSig;
-} | 3,365 | true | true | 12 | 21 | 1,741 | 1,043 | 519 | 524 | null | null |
google/cabal2bazel | src/Google/Google3/Tools/Cabal2Build/Plan.hs | apache-2.0 | -- | Looks up the version of the given package in the Stackage snapshot.
resolvePackageId :: Snapshot -> Cabal.PackageName -> Cabal.PackageId
resolvePackageId snapshot n = Map.findWithDefault err n
$ Cabal.PackageIdentifier n
. snapshotPackageVersion
<$> snapshotPackages snapshot
where err = error $ "The Stackage snapshot doesn't contain the package "
++ Cabal.display n
++ "; consider fetching it with an explicit version, "
++ "e.g., cabal2build --fetch foo-X.Y.Z" | 631 | resolvePackageId :: Snapshot -> Cabal.PackageName -> Cabal.PackageId
resolvePackageId snapshot n = Map.findWithDefault err n
$ Cabal.PackageIdentifier n
. snapshotPackageVersion
<$> snapshotPackages snapshot
where err = error $ "The Stackage snapshot doesn't contain the package "
++ Cabal.display n
++ "; consider fetching it with an explicit version, "
++ "e.g., cabal2build --fetch foo-X.Y.Z" | 558 | resolvePackageId snapshot n = Map.findWithDefault err n
$ Cabal.PackageIdentifier n
. snapshotPackageVersion
<$> snapshotPackages snapshot
where err = error $ "The Stackage snapshot doesn't contain the package "
++ Cabal.display n
++ "; consider fetching it with an explicit version, "
++ "e.g., cabal2build --fetch foo-X.Y.Z" | 489 | true | true | 0 | 9 | 229 | 85 | 41 | 44 | null | null |
naoto-ogawa/h-xproto-mysql | src/DataBase/MySQLX/NodeSession.hs | mit | writeExpectClose NodeSession{..} = do
liftIO $ sendAll _socket (BL.toStrict $ (putMessageLengthLE (len + 1)) `BL.append` ty `BL.append` bytes)
where
bytes = PBW.messagePut mkClose
len = fromIntegral 0
ty = putMessageType $ fromIntegral 25
-- | write a message. | 284 | writeExpectClose NodeSession{..} = do
liftIO $ sendAll _socket (BL.toStrict $ (putMessageLengthLE (len + 1)) `BL.append` ty `BL.append` bytes)
where
bytes = PBW.messagePut mkClose
len = fromIntegral 0
ty = putMessageType $ fromIntegral 25
-- | write a message. | 284 | writeExpectClose NodeSession{..} = do
liftIO $ sendAll _socket (BL.toStrict $ (putMessageLengthLE (len + 1)) `BL.append` ty `BL.append` bytes)
where
bytes = PBW.messagePut mkClose
len = fromIntegral 0
ty = putMessageType $ fromIntegral 25
-- | write a message. | 284 | false | false | 6 | 17 | 61 | 115 | 52 | 63 | null | null |
pshendry/project-euler-solutions | 0026/solution.hs | mit | -- Computes the multiplicative order of a number. It just so happens that the
-- multiplicative order of n and 10 is equal to the length of the decimal period of
-- m/n :)
multOrder :: Int -> Int -> Int
multOrder n a = f n a 1 1
where
f n a a' c = if a'' == 1 then c else f n a a'' (c+1)
where a'' = a*a' `mod` n | 324 | multOrder :: Int -> Int -> Int
multOrder n a = f n a 1 1
where
f n a a' c = if a'' == 1 then c else f n a a'' (c+1)
where a'' = a*a' `mod` n | 152 | multOrder n a = f n a 1 1
where
f n a a' c = if a'' == 1 then c else f n a a'' (c+1)
where a'' = a*a' `mod` n | 121 | true | true | 0 | 8 | 86 | 100 | 52 | 48 | null | null |
rjwright/js-typeomatic | LabelJSAST.hs | apache-2.0 | abelJSAST (AWSF (WSIfElse ex bodyT bodyF) sourceFragment) n =
((LabIfElse field1 field2 field3), (childWSGetLabel field3) + 1, sourceFragment)
where
field1 = labelExpression ex n
field2 = labelJSAST bodyT (childWSGetLabel field1)
field3 = labelJSAST bodyF (childWSGetLabel field2)
| 313 | labelJSAST (AWSF (WSIfElse ex bodyT bodyF) sourceFragment) n =
((LabIfElse field1 field2 field3), (childWSGetLabel field3) + 1, sourceFragment)
where
field1 = labelExpression ex n
field2 = labelJSAST bodyT (childWSGetLabel field1)
field3 = labelJSAST bodyF (childWSGetLabel field2) | 313 | labelJSAST (AWSF (WSIfElse ex bodyT bodyF) sourceFragment) n =
((LabIfElse field1 field2 field3), (childWSGetLabel field3) + 1, sourceFragment)
where
field1 = labelExpression ex n
field2 = labelJSAST bodyT (childWSGetLabel field1)
field3 = labelJSAST bodyF (childWSGetLabel field2) | 313 | false | false | 2 | 9 | 68 | 103 | 52 | 51 | null | null |
ianthehenry/basilica | Database/Posts.hs | mit | toResolvedPost :: (Entity PostRow, Value Int, Entity UserRow) -> ResolvedPost
toResolvedPost (postEntity, childCount, userEntity) = ResolvedPost post user
where
postRow = entityVal postEntity
userRow = entityVal userEntity
post = Post { postID = getID postEntity
, postUserID = asInt (postRowUserId postRow)
, postContent = postRowContent postRow
, postAt = postRowAt postRow
, postParentID = asInt <$> postRowParentId postRow
, postCount = unValue childCount
}
user = User { userID = getID userEntity
, userName = userRowName userRow
, userEmail = userRowEmail userRow
} | 733 | toResolvedPost :: (Entity PostRow, Value Int, Entity UserRow) -> ResolvedPost
toResolvedPost (postEntity, childCount, userEntity) = ResolvedPost post user
where
postRow = entityVal postEntity
userRow = entityVal userEntity
post = Post { postID = getID postEntity
, postUserID = asInt (postRowUserId postRow)
, postContent = postRowContent postRow
, postAt = postRowAt postRow
, postParentID = asInt <$> postRowParentId postRow
, postCount = unValue childCount
}
user = User { userID = getID userEntity
, userName = userRowName userRow
, userEmail = userRowEmail userRow
} | 733 | toResolvedPost (postEntity, childCount, userEntity) = ResolvedPost post user
where
postRow = entityVal postEntity
userRow = entityVal userEntity
post = Post { postID = getID postEntity
, postUserID = asInt (postRowUserId postRow)
, postContent = postRowContent postRow
, postAt = postRowAt postRow
, postParentID = asInt <$> postRowParentId postRow
, postCount = unValue childCount
}
user = User { userID = getID userEntity
, userName = userRowName userRow
, userEmail = userRowEmail userRow
} | 655 | false | true | 6 | 9 | 244 | 195 | 95 | 100 | null | null |
HJvT/hdirect | src/Parser.hs | bsd-3-clause | action_402 (185#) = happyShift action_539 | 41 | action_402 (185#) = happyShift action_539 | 41 | action_402 (185#) = happyShift action_539 | 41 | false | false | 0 | 6 | 4 | 15 | 7 | 8 | null | null |
nicball/playground | visgo/src/Model.hs | mit | sideFromInt 1 = White | 21 | sideFromInt 1 = White | 21 | sideFromInt 1 = White | 21 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
FranklinChen/Idris-dev | src/Idris/AbsSyntaxTree.hs | bsd-3-clause | -- | Colourise annotations according to an Idris state. It ignores the
-- names in the annotation, as there's no good way to show extended
-- information on a terminal. Note that strings produced this way will
-- not be coloured on Windows, so the use of the colour rendering
-- functions in Idris.Output is to be preferred.
consoleDecorate :: IState -> OutputAnnotation -> String -> String
consoleDecorate ist ann = maybe id colourise (annotationColour ist ann) | 462 | consoleDecorate :: IState -> OutputAnnotation -> String -> String
consoleDecorate ist ann = maybe id colourise (annotationColour ist ann) | 137 | consoleDecorate ist ann = maybe id colourise (annotationColour ist ann) | 71 | true | true | 0 | 7 | 76 | 48 | 26 | 22 | null | null |
brendanhay/gogol | gogol-container/gen/Network/Google/Resource/Container/Projects/Locations/Clusters/NodePools/List.hs | mpl-2.0 | -- | Legacy upload protocol for media (e.g. \"media\", \"multipart\").
plcnplUploadType :: Lens' ProjectsLocationsClustersNodePoolsList (Maybe Text)
plcnplUploadType
= lens _plcnplUploadType
(\ s a -> s{_plcnplUploadType = a}) | 234 | plcnplUploadType :: Lens' ProjectsLocationsClustersNodePoolsList (Maybe Text)
plcnplUploadType
= lens _plcnplUploadType
(\ s a -> s{_plcnplUploadType = a}) | 163 | plcnplUploadType
= lens _plcnplUploadType
(\ s a -> s{_plcnplUploadType = a}) | 85 | true | true | 1 | 9 | 34 | 51 | 25 | 26 | null | null |
hjwylde/werewolf | app/Werewolf/Options.hs | bsd-3-clause | vote :: Parser Command
vote = Vote . Vote.Options <$> playerArgument | 68 | vote :: Parser Command
vote = Vote . Vote.Options <$> playerArgument | 68 | vote = Vote . Vote.Options <$> playerArgument | 45 | false | true | 0 | 7 | 10 | 24 | 12 | 12 | null | null |
spechub/Hets | OWL2/AS.hs | gpl-2.0 | symsOfAnnotation :: Annotation -> Set.Set Entity
symsOfAnnotation (Annotation as p _) = Set.insert
(mkEntity AnnotationProperty p) $ Set.unions (map symsOfAnnotation as) | 172 | symsOfAnnotation :: Annotation -> Set.Set Entity
symsOfAnnotation (Annotation as p _) = Set.insert
(mkEntity AnnotationProperty p) $ Set.unions (map symsOfAnnotation as) | 172 | symsOfAnnotation (Annotation as p _) = Set.insert
(mkEntity AnnotationProperty p) $ Set.unions (map symsOfAnnotation as) | 123 | false | true | 0 | 8 | 23 | 63 | 30 | 33 | null | null |
spechub/Hets | HasCASL/InteractiveTests.hs | gpl-2.0 | etReal :: EvalTerm -> RealType
etReal (ETreal p) = p | 52 | etReal :: EvalTerm -> RealType
etReal (ETreal p) = p | 52 | etReal (ETreal p) = p | 21 | false | true | 0 | 7 | 9 | 24 | 12 | 12 | null | null |
leroux/testsuite | tests/typecheck/should_fail/TcCoercibleFailSafe.hs | gpl-3.0 | foo1 :: (Down Age -> Down Int)
foo1 = coerce | 44 | foo1 :: (Down Age -> Down Int)
foo1 = coerce | 44 | foo1 = coerce | 13 | false | true | 0 | 9 | 9 | 31 | 13 | 18 | null | null |
robdockins/edison | edison-core/src/Data/Edison/Assoc/TernaryTrie.hs | mit | minViewFMB (I i k (Just v) E m r) f = return (v, f (I i k Nothing E m r)) | 80 | minViewFMB (I i k (Just v) E m r) f = return (v, f (I i k Nothing E m r)) | 80 | minViewFMB (I i k (Just v) E m r) f = return (v, f (I i k Nothing E m r)) | 80 | false | false | 0 | 9 | 27 | 61 | 30 | 31 | null | null |
vincenthz/hs-foundation | foundation/Foundation/Array/Bitmap.hs | bsd-3-clause | -- return the index in word32 quantity and mask to a bit in a bitmap
{-
bitmapAddr :: Int -> (# Int , Word #)
bitmapAddr !i = (# idx, mask #)
where (!idx, !bitIdx) = bitmapIndex i
!mask = case bitIdx of
0 -> 0x1
1 -> 0x2
2 -> 0x4
3 -> 0x8
4 -> 0x10
5 -> 0x20
6 -> 0x40
7 -> 0x80
8 -> 0x100
9 -> 0x200
10 -> 0x400
11 -> 0x800
12 -> 0x1000
13 -> 0x2000
14 -> 0x4000
15 -> 0x8000
16 -> 0x10000
17 -> 0x20000
18 -> 0x40000
19 -> 0x80000
20 -> 0x100000
21 -> 0x200000
22 -> 0x400000
23 -> 0x800000
24 -> 0x1000000
25 -> 0x2000000
26 -> 0x4000000
27 -> 0x8000000
28 -> 0x10000000
29 -> 0x20000000
30 -> 0x40000000
_ -> 0x80000000
-}
thaw :: PrimMonad prim => Bitmap -> prim (MutableBitmap (PrimState prim))
thaw (Bitmap len ba) = MutableBitmap len `fmap` C.thaw ba | 1,420 | thaw :: PrimMonad prim => Bitmap -> prim (MutableBitmap (PrimState prim))
thaw (Bitmap len ba) = MutableBitmap len `fmap` C.thaw ba | 131 | thaw (Bitmap len ba) = MutableBitmap len `fmap` C.thaw ba | 57 | true | true | 0 | 11 | 822 | 64 | 32 | 32 | null | null |
jacendfeng/OpenJDK-7U-Research | src/macosx/native/jobjc/src/core/PrimitiveCoder.hs | gpl-2.0 | ffitype _ Nuchar = UINT8 | 25 | ffitype _ Nuchar = UINT8 | 25 | ffitype _ Nuchar = UINT8 | 25 | false | false | 0 | 5 | 5 | 11 | 5 | 6 | null | null |
OpenXT/manager | xenmgr/XenMgr/Host.hs | gpl-2.0 | getHostPlaybackDevices = filter pcmPlayback <$> getHostPcmDevices | 65 | getHostPlaybackDevices = filter pcmPlayback <$> getHostPcmDevices | 65 | getHostPlaybackDevices = filter pcmPlayback <$> getHostPcmDevices | 65 | false | false | 0 | 6 | 5 | 13 | 6 | 7 | null | null |
facebookincubator/duckling | Duckling/Rules/BN.hs | bsd-3-clause | langRules (Seal Time) = [] | 26 | langRules (Seal Time) = [] | 26 | langRules (Seal Time) = [] | 26 | false | false | 0 | 6 | 4 | 18 | 8 | 10 | null | null |
freebsd-haskell/hsporter | src-hsupdater/Main.hs | bsd-3-clause | [getPlatformConf,getGhcConf,getCategoriesConf] =
#ifdef STANDALONE
[ getDataFileName "platform.conf"
, getDataFileName "ghc.conf"
, getDataFileName "categories.conf"
] | 175 | [getPlatformConf,getGhcConf,getCategoriesConf] =
#ifdef STANDALONE
[ getDataFileName "platform.conf"
, getDataFileName "ghc.conf"
, getDataFileName "categories.conf"
] | 175 | [getPlatformConf,getGhcConf,getCategoriesConf] =
#ifdef STANDALONE
[ getDataFileName "platform.conf"
, getDataFileName "ghc.conf"
, getDataFileName "categories.conf"
] | 175 | false | false | 0 | 6 | 21 | 35 | 19 | 16 | null | null |
walck/cyclotomic | test/Properties.hs | gpl-3.0 | qc_square_sqrtRat :: T.Test
qc_square_sqrtRat
= T.plusTestOptions (T.TestOptions
{T.topt_seed = Nothing
,T.topt_maximum_generated_tests = Just 15
,T.topt_maximum_unsuitable_generated_tests = Nothing
,T.topt_maximum_test_size = Just 15
,T.topt_maximum_test_depth = Nothing
,T.topt_timeout = Nothing
})
$ testProperty "QuickCheck prop_square_sqrtRat" prop_square_sqrtRat | 654 | qc_square_sqrtRat :: T.Test
qc_square_sqrtRat
= T.plusTestOptions (T.TestOptions
{T.topt_seed = Nothing
,T.topt_maximum_generated_tests = Just 15
,T.topt_maximum_unsuitable_generated_tests = Nothing
,T.topt_maximum_test_size = Just 15
,T.topt_maximum_test_depth = Nothing
,T.topt_timeout = Nothing
})
$ testProperty "QuickCheck prop_square_sqrtRat" prop_square_sqrtRat | 654 | qc_square_sqrtRat
= T.plusTestOptions (T.TestOptions
{T.topt_seed = Nothing
,T.topt_maximum_generated_tests = Just 15
,T.topt_maximum_unsuitable_generated_tests = Nothing
,T.topt_maximum_test_size = Just 15
,T.topt_maximum_test_depth = Nothing
,T.topt_timeout = Nothing
})
$ testProperty "QuickCheck prop_square_sqrtRat" prop_square_sqrtRat | 626 | false | true | 0 | 10 | 318 | 91 | 49 | 42 | null | null |
ardfard/dagang | src/Handler/Home.hs | mit | -- This is a handler function for the GET request method on the HomeR
-- resource pattern. All of your resource patterns are defined in
-- config/routes
--
-- The majority of the code you will write in Yesod lives in these handler
-- functions. You can spread them across multiple files if you are so
-- inclined, or create a single monolithic file.
getHomeR :: Handler Html
getHomeR = do
(formWidget, formEnctype) <- generateFormPost sampleForm
let submission = Nothing :: Maybe FileForm
handlerName = "getHomeR" :: Text
allComments <- runDB getAllComments
-- productEntityList <- runDB getAllProducts
-- let productList' = fmap entityVal productEntityList
-- let createProductsWidget productList = $(widgetFile "productdetail")
defaultLayout $ do
let (commentFormId, commentTextareaId, commentListId) = commentIds
aDomId <- newIdent
setTitle "Perangkat Komputer Untukmu!"
-- let productsWidget = createProductsWidget productList'
--
$(widgetFile "homepage")
-- productsWidget | 1,071 | getHomeR :: Handler Html
getHomeR = do
(formWidget, formEnctype) <- generateFormPost sampleForm
let submission = Nothing :: Maybe FileForm
handlerName = "getHomeR" :: Text
allComments <- runDB getAllComments
-- productEntityList <- runDB getAllProducts
-- let productList' = fmap entityVal productEntityList
-- let createProductsWidget productList = $(widgetFile "productdetail")
defaultLayout $ do
let (commentFormId, commentTextareaId, commentListId) = commentIds
aDomId <- newIdent
setTitle "Perangkat Komputer Untukmu!"
-- let productsWidget = createProductsWidget productList'
--
$(widgetFile "homepage")
-- productsWidget | 721 | getHomeR = do
(formWidget, formEnctype) <- generateFormPost sampleForm
let submission = Nothing :: Maybe FileForm
handlerName = "getHomeR" :: Text
allComments <- runDB getAllComments
-- productEntityList <- runDB getAllProducts
-- let productList' = fmap entityVal productEntityList
-- let createProductsWidget productList = $(widgetFile "productdetail")
defaultLayout $ do
let (commentFormId, commentTextareaId, commentListId) = commentIds
aDomId <- newIdent
setTitle "Perangkat Komputer Untukmu!"
-- let productsWidget = createProductsWidget productList'
--
$(widgetFile "homepage")
-- productsWidget | 696 | true | true | 0 | 13 | 231 | 125 | 66 | 59 | null | null |
dmjio/aeson | benchmarks/bench/Issue673.hs | bsd-3-clause | valInteger :: Integer -> Int -> [Integer] -> Integer
valInteger = go
where
go :: Integer -> Int -> [Integer] -> Integer
go _ _ [] = 0
go _ _ [d] = d
go b l ds
| l > 40 = b' `seq` go b' l' (combine b ds')
| otherwise = valSimple b ds
where
-- ensure that we have an even number of digits
-- before we call combine:
ds' = if even l then ds else 0 : ds
b' = b * b
l' = (l + 1) `quot` 2
combine b (d1 : d2 : ds) = d `seq` (d : combine b ds)
where
d = d1 * b + d2
combine _ [] = []
combine _ [_] = errorWithoutStackTrace "this should not happen"
-- The following algorithm is only linear for types whose Num operations
-- are in constant time. | 748 | valInteger :: Integer -> Int -> [Integer] -> Integer
valInteger = go
where
go :: Integer -> Int -> [Integer] -> Integer
go _ _ [] = 0
go _ _ [d] = d
go b l ds
| l > 40 = b' `seq` go b' l' (combine b ds')
| otherwise = valSimple b ds
where
-- ensure that we have an even number of digits
-- before we call combine:
ds' = if even l then ds else 0 : ds
b' = b * b
l' = (l + 1) `quot` 2
combine b (d1 : d2 : ds) = d `seq` (d : combine b ds)
where
d = d1 * b + d2
combine _ [] = []
combine _ [_] = errorWithoutStackTrace "this should not happen"
-- The following algorithm is only linear for types whose Num operations
-- are in constant time. | 748 | valInteger = go
where
go :: Integer -> Int -> [Integer] -> Integer
go _ _ [] = 0
go _ _ [d] = d
go b l ds
| l > 40 = b' `seq` go b' l' (combine b ds')
| otherwise = valSimple b ds
where
-- ensure that we have an even number of digits
-- before we call combine:
ds' = if even l then ds else 0 : ds
b' = b * b
l' = (l + 1) `quot` 2
combine b (d1 : d2 : ds) = d `seq` (d : combine b ds)
where
d = d1 * b + d2
combine _ [] = []
combine _ [_] = errorWithoutStackTrace "this should not happen"
-- The following algorithm is only linear for types whose Num operations
-- are in constant time. | 695 | false | true | 10 | 10 | 259 | 317 | 149 | 168 | null | null |
GaloisInc/saw-script | src/SAWScript/Crucible/LLVM/MethodSpecIR.hs | bsd-3-clause | -- | Load an LLVM module from the given bitcode file, then parse and
-- translate to Crucible.
loadLLVMModule ::
(?transOpts :: CL.TranslationOptions) =>
FilePath ->
Crucible.HandleAllocator ->
IO (Either LLVM.Error (Some LLVMModule))
loadLLVMModule file halloc =
do parseResult <- LLVM.parseBitCodeFromFile file
case parseResult of
Left err -> return (Left err)
Right llvm_mod ->
do memVar <- CL.mkMemVar (Text.pack "saw:llvm_memory") halloc
-- FIXME: do something with the translation warnings
(Some mtrans, _warnings) <- CL.translateModule halloc memVar llvm_mod
return (Right (Some (LLVMModule file llvm_mod mtrans))) | 695 | loadLLVMModule ::
(?transOpts :: CL.TranslationOptions) =>
FilePath ->
Crucible.HandleAllocator ->
IO (Either LLVM.Error (Some LLVMModule))
loadLLVMModule file halloc =
do parseResult <- LLVM.parseBitCodeFromFile file
case parseResult of
Left err -> return (Left err)
Right llvm_mod ->
do memVar <- CL.mkMemVar (Text.pack "saw:llvm_memory") halloc
-- FIXME: do something with the translation warnings
(Some mtrans, _warnings) <- CL.translateModule halloc memVar llvm_mod
return (Right (Some (LLVMModule file llvm_mod mtrans))) | 600 | loadLLVMModule file halloc =
do parseResult <- LLVM.parseBitCodeFromFile file
case parseResult of
Left err -> return (Left err)
Right llvm_mod ->
do memVar <- CL.mkMemVar (Text.pack "saw:llvm_memory") halloc
-- FIXME: do something with the translation warnings
(Some mtrans, _warnings) <- CL.translateModule halloc memVar llvm_mod
return (Right (Some (LLVMModule file llvm_mod mtrans))) | 452 | true | true | 0 | 18 | 157 | 180 | 87 | 93 | null | null |
david-caro/shellcheck | ShellCheck/Analytics.hs | gpl-3.0 | checkForInCat _ _ = return () | 29 | checkForInCat _ _ = return () | 29 | checkForInCat _ _ = return () | 29 | false | false | 0 | 6 | 5 | 16 | 7 | 9 | null | null |
urbanslug/ghc | compiler/nativeGen/SPARC/Cond.hs | bsd-3-clause | condToUnsigned GE = GEU | 24 | condToUnsigned GE = GEU | 24 | condToUnsigned GE = GEU | 24 | false | false | 0 | 5 | 4 | 9 | 4 | 5 | null | null |
gcampax/ghc | utils/genprimopcode/Main.hs | bsd-3-clause | ppType (TyApp (TyCon "MutableByteArray#") [x]) = "mkMutableByteArrayPrimTy "
++ ppType x | 141 | ppType (TyApp (TyCon "MutableByteArray#") [x]) = "mkMutableByteArrayPrimTy "
++ ppType x | 141 | ppType (TyApp (TyCon "MutableByteArray#") [x]) = "mkMutableByteArrayPrimTy "
++ ppType x | 141 | false | false | 0 | 8 | 63 | 34 | 16 | 18 | null | null |
michaelficarra/purescript | psc-docs/Main.hs | mit | parseDocgen :: [String] -> Either String DocgenOutput
parseDocgen [] = Right EverythingToStdOut | 95 | parseDocgen :: [String] -> Either String DocgenOutput
parseDocgen [] = Right EverythingToStdOut | 95 | parseDocgen [] = Right EverythingToStdOut | 41 | false | true | 0 | 8 | 11 | 36 | 16 | 20 | null | null |
janrain/snap-server | src/Snap/Http/Server/Config.hs | bsd-3-clause | ------------------------------------------------------------------------------
getLocale :: MonadSnap m => Config m a -> Maybe String
getLocale = locale | 152 | getLocale :: MonadSnap m => Config m a -> Maybe String
getLocale = locale | 73 | getLocale = locale | 18 | true | true | 0 | 7 | 14 | 31 | 15 | 16 | null | null |
geekingfrog/advent-of-code | src/Y2018/Day20.hs | bsd-3-clause | stepSym start (R rs) =
let withDup = concatMap (stepRegex start) rs
f m (p, cells) = M.insertWith M.union p cells m
deduped = foldl' f mempty withDup
in M.toList deduped | 186 | stepSym start (R rs) =
let withDup = concatMap (stepRegex start) rs
f m (p, cells) = M.insertWith M.union p cells m
deduped = foldl' f mempty withDup
in M.toList deduped | 186 | stepSym start (R rs) =
let withDup = concatMap (stepRegex start) rs
f m (p, cells) = M.insertWith M.union p cells m
deduped = foldl' f mempty withDup
in M.toList deduped | 186 | false | false | 0 | 11 | 47 | 85 | 41 | 44 | null | null |
HairyDude/heal | Settings.hs | bsd-2-clause | -- Static setting below. Changing these requires a recompile
-- | The location of static files on your system. This is a file system
-- path. The default value works properly with your scaffolded site.
staticDir :: FilePath
staticDir = "static" | 245 | staticDir :: FilePath
staticDir = "static" | 42 | staticDir = "static" | 20 | true | true | 0 | 4 | 41 | 14 | 9 | 5 | null | null |
lamdu/lamdu | src/Lamdu/Sugar/Names/Clash.hs | gpl-3.0 | groupNameContextOf (Just d) uuid = d ~~> Single uuid & Disambiguated | 68 | groupNameContextOf (Just d) uuid = d ~~> Single uuid & Disambiguated | 68 | groupNameContextOf (Just d) uuid = d ~~> Single uuid & Disambiguated | 68 | false | false | 0 | 7 | 10 | 28 | 13 | 15 | null | null |
beni55/haste-compiler | libraries/ghc-7.8/base/GHC/IO/Handle.hs | bsd-3-clause | hIsOpen :: Handle -> IO Bool
hIsOpen handle =
withHandle_ "hIsOpen" handle $ \ handle_ -> do
case haType handle_ of
ClosedHandle -> return False
SemiClosedHandle -> return False
_ -> return True | 252 | hIsOpen :: Handle -> IO Bool
hIsOpen handle =
withHandle_ "hIsOpen" handle $ \ handle_ -> do
case haType handle_ of
ClosedHandle -> return False
SemiClosedHandle -> return False
_ -> return True | 252 | hIsOpen handle =
withHandle_ "hIsOpen" handle $ \ handle_ -> do
case haType handle_ of
ClosedHandle -> return False
SemiClosedHandle -> return False
_ -> return True | 223 | false | true | 0 | 13 | 90 | 78 | 34 | 44 | null | null |
avieth/diplomacy | Diplomacy/OrderValidation.hs | bsd-3-clause | convoyPaths :: Occupation -> Province -> [(Province, [Province])]
convoyPaths occupation pr =
filter ((/=) pr . fst) . fmap (\(x, y, z) -> (x, y : z)) . paths occupiedByFleet pickCoastal . pure $ pr
where
occupiedByFleet pr = case provinceOccupier pr occupation of
Just aunit -> alignedThing aunit == Fleet
_ -> False
pickCoastal pr = if isCoastal pr then Just pr else Nothing | 406 | convoyPaths :: Occupation -> Province -> [(Province, [Province])]
convoyPaths occupation pr =
filter ((/=) pr . fst) . fmap (\(x, y, z) -> (x, y : z)) . paths occupiedByFleet pickCoastal . pure $ pr
where
occupiedByFleet pr = case provinceOccupier pr occupation of
Just aunit -> alignedThing aunit == Fleet
_ -> False
pickCoastal pr = if isCoastal pr then Just pr else Nothing | 406 | convoyPaths occupation pr =
filter ((/=) pr . fst) . fmap (\(x, y, z) -> (x, y : z)) . paths occupiedByFleet pickCoastal . pure $ pr
where
occupiedByFleet pr = case provinceOccupier pr occupation of
Just aunit -> alignedThing aunit == Fleet
_ -> False
pickCoastal pr = if isCoastal pr then Just pr else Nothing | 340 | false | true | 0 | 13 | 94 | 171 | 87 | 84 | null | null |
Kheldar/hw-koans | test/Check/Either.hs | bsd-3-clause | prop_applyEitherRight :: Property
prop_applyEitherRight = property $ do
eab <- forAll $ genEither (Gen.int Range.constantBounded) (Gen.int Range.constantBounded)
frK (applyEither (K.Right (*2)) (toK eab)) === (pure (*2) <*> eab) | 232 | prop_applyEitherRight :: Property
prop_applyEitherRight = property $ do
eab <- forAll $ genEither (Gen.int Range.constantBounded) (Gen.int Range.constantBounded)
frK (applyEither (K.Right (*2)) (toK eab)) === (pure (*2) <*> eab) | 232 | prop_applyEitherRight = property $ do
eab <- forAll $ genEither (Gen.int Range.constantBounded) (Gen.int Range.constantBounded)
frK (applyEither (K.Right (*2)) (toK eab)) === (pure (*2) <*> eab) | 198 | false | true | 0 | 14 | 31 | 101 | 51 | 50 | null | null |
nh2/proctest | examples/netcat-test.hs | mit | label :: String -> EqualAssertion a -> LabeledAssertion a
label = LabeledAssertion | 82 | label :: String -> EqualAssertion a -> LabeledAssertion a
label = LabeledAssertion | 82 | label = LabeledAssertion | 24 | false | true | 0 | 8 | 11 | 31 | 13 | 18 | null | null |
brendanhay/gogol | gogol-games/gen/Network/Google/Games/Types/Product.hs | mpl-2.0 | -- | The score submissions.
psslScores :: Lens' PlayerScoreSubmissionList [ScoreSubmission]
psslScores
= lens _psslScores (\ s a -> s{_psslScores = a}) .
_Default
. _Coerce | 186 | psslScores :: Lens' PlayerScoreSubmissionList [ScoreSubmission]
psslScores
= lens _psslScores (\ s a -> s{_psslScores = a}) .
_Default
. _Coerce | 158 | psslScores
= lens _psslScores (\ s a -> s{_psslScores = a}) .
_Default
. _Coerce | 94 | true | true | 0 | 11 | 38 | 53 | 28 | 25 | null | null |
spechub/Hets | CASL/Freeness.hs | gpl-2.0 | free_pred_sym :: PRED_SYMB -> PRED_SYMB
free_pred_sym (Pred_name pn) = Pred_name $ mkFreeName pn | 96 | free_pred_sym :: PRED_SYMB -> PRED_SYMB
free_pred_sym (Pred_name pn) = Pred_name $ mkFreeName pn | 96 | free_pred_sym (Pred_name pn) = Pred_name $ mkFreeName pn | 56 | false | true | 0 | 7 | 12 | 31 | 15 | 16 | null | null |
fcostantini/PlEb | src/Parsing.hs | gpl-3.0 | addD :: Parser Cmd
addD = do string "add_dir "
f <- stuff
return $ AddD (M.rstrip f) | 104 | addD :: Parser Cmd
addD = do string "add_dir "
f <- stuff
return $ AddD (M.rstrip f) | 104 | addD = do string "add_dir "
f <- stuff
return $ AddD (M.rstrip f) | 85 | false | true | 1 | 12 | 37 | 49 | 20 | 29 | null | null |
tulcod/megaparsec | Text/Megaparsec/Prim.hs | bsd-2-clause | manyErr :: a
manyErr = error
"Text.Megaparsec.Prim.many: combinator 'many' is applied to a parser \
\that accepts an empty string." | 139 | manyErr :: a
manyErr = error
"Text.Megaparsec.Prim.many: combinator 'many' is applied to a parser \
\that accepts an empty string." | 139 | manyErr = error
"Text.Megaparsec.Prim.many: combinator 'many' is applied to a parser \
\that accepts an empty string." | 126 | false | true | 0 | 6 | 27 | 21 | 8 | 13 | null | null |
rueshyna/gogol | gogol-kgsearch/gen/Network/Google/Resource/Kgsearch/Entities/Search.hs | mpl-2.0 | -- | OAuth access token.
esAccessToken :: Lens' EntitiesSearch (Maybe Text)
esAccessToken
= lens _esAccessToken
(\ s a -> s{_esAccessToken = a}) | 152 | esAccessToken :: Lens' EntitiesSearch (Maybe Text)
esAccessToken
= lens _esAccessToken
(\ s a -> s{_esAccessToken = a}) | 127 | esAccessToken
= lens _esAccessToken
(\ s a -> s{_esAccessToken = a}) | 76 | true | true | 0 | 9 | 29 | 48 | 25 | 23 | null | null |
vizietto/kalkulu | src/Kalkulu/Builtin/Control.hs | gpl-3.0 | pureIf (Cmp _ [SymbolB B.False, _, a, _]) = a | 45 | pureIf (Cmp _ [SymbolB B.False, _, a, _]) = a | 45 | pureIf (Cmp _ [SymbolB B.False, _, a, _]) = a | 45 | false | false | 0 | 10 | 9 | 34 | 18 | 16 | null | null |
urbanslug/ghc | testsuite/tests/perf/compiler/T783.hs | bsd-3-clause | foo x | x == 230 = 230 | 22 | foo x | x == 230 = 230 | 22 | foo x | x == 230 = 230 | 22 | false | false | 0 | 8 | 7 | 23 | 9 | 14 | null | null |
awagner83/identifiers | src/Data/Identifiers/Hashable.hs | bsd-3-clause | -- | Combine two identifier sets into one.
-- Because the ids will change while combining two sets, a map is also
-- returned that identifies the new location of old ids for the second
-- set passed in.
combine
:: (Integral i, Hashable a, Eq a)
=> Identifiers i a -> Identifiers i a -> (Identifiers i a, Map i i)
combine a b = let c = (insertMany a) xs
xs = toList b
m = M.fromList $ map (unsafeLookupId b &&& unsafeLookupId c) xs
in (c, m) | 506 | combine
:: (Integral i, Hashable a, Eq a)
=> Identifiers i a -> Identifiers i a -> (Identifiers i a, Map i i)
combine a b = let c = (insertMany a) xs
xs = toList b
m = M.fromList $ map (unsafeLookupId b &&& unsafeLookupId c) xs
in (c, m) | 297 | combine a b = let c = (insertMany a) xs
xs = toList b
m = M.fromList $ map (unsafeLookupId b &&& unsafeLookupId c) xs
in (c, m) | 179 | true | true | 0 | 13 | 155 | 144 | 71 | 73 | null | null |
aaronc/Idris-dev | src/Idris/Core/TT.hs | bsd-3-clause | discard :: Monad m => m a -> m ()
discard f = f >> return () | 60 | discard :: Monad m => m a -> m ()
discard f = f >> return () | 60 | discard f = f >> return () | 26 | false | true | 2 | 9 | 16 | 48 | 20 | 28 | null | null |
saep/nvim-hs | library/Neovim/API/Parser.hs | apache-2.0 | extractFunctions :: Map String Object -> Either (Doc AnsiStyle) [NeovimFunction]
extractFunctions objAPI = mapM extractFunction =<< oLookup "functions" objAPI | 158 | extractFunctions :: Map String Object -> Either (Doc AnsiStyle) [NeovimFunction]
extractFunctions objAPI = mapM extractFunction =<< oLookup "functions" objAPI | 158 | extractFunctions objAPI = mapM extractFunction =<< oLookup "functions" objAPI | 77 | false | true | 0 | 8 | 18 | 49 | 23 | 26 | null | null |
ShellShoccar-jpn/Open-usp-Tukubai | COMMANDS.HS/mdate.hs | mit | prevDay :: UTCTime -> UTCTime
prevDay d = addUTCTime (-24*3600) d | 65 | prevDay :: UTCTime -> UTCTime
prevDay d = addUTCTime (-24*3600) d | 65 | prevDay d = addUTCTime (-24*3600) d | 35 | false | true | 0 | 8 | 10 | 37 | 17 | 20 | null | null |
ssaavedra/liquidhaskell | benchmarks/containers-0.5.0.0/tests/intset-properties.hs | bsd-3-clause | prop_ord :: IntSet -> IntSet -> Bool
prop_ord s1 s2 = s1 `compare` s2 == toList s1 `compare` toList s2 | 102 | prop_ord :: IntSet -> IntSet -> Bool
prop_ord s1 s2 = s1 `compare` s2 == toList s1 `compare` toList s2 | 102 | prop_ord s1 s2 = s1 `compare` s2 == toList s1 `compare` toList s2 | 65 | false | true | 1 | 8 | 19 | 56 | 27 | 29 | null | null |
corngood/cabal | Cabal/Distribution/Simple/Utils.hs | bsd-3-clause | -- | Reads a UTF8 encoded text file as a Unicode String
--
-- Same behaviour as 'withFileContents'.
--
withUTF8FileContents :: FilePath -> (String -> IO a) -> IO a
withUTF8FileContents name action =
Exception.bracket
(openBinaryFile name ReadMode)
hClose
(\hnd -> hGetContents hnd >>= action . ignoreBOM . fromUTF8) | 329 | withUTF8FileContents :: FilePath -> (String -> IO a) -> IO a
withUTF8FileContents name action =
Exception.bracket
(openBinaryFile name ReadMode)
hClose
(\hnd -> hGetContents hnd >>= action . ignoreBOM . fromUTF8) | 226 | withUTF8FileContents name action =
Exception.bracket
(openBinaryFile name ReadMode)
hClose
(\hnd -> hGetContents hnd >>= action . ignoreBOM . fromUTF8) | 165 | true | true | 0 | 11 | 62 | 81 | 42 | 39 | null | null |
ellis/OnTopOfThings | old-20150308/src/Args.hs | gpl-3.0 | modHasName :: String -> Mod -> Bool
modHasName name (ModAdd n _) = n == name | 76 | modHasName :: String -> Mod -> Bool
modHasName name (ModAdd n _) = n == name | 76 | modHasName name (ModAdd n _) = n == name | 40 | false | true | 0 | 6 | 15 | 41 | 19 | 22 | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.