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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
bos/statistics | tests/Tests/Serialization.hs | bsd-2-clause | p_aeson :: (Eq a, ToJSON a, FromJSON a) => T a -> a -> Bool
p_aeson _ a = Data.Aeson.Success a == (fromJSON . toJSON) a | 119 | p_aeson :: (Eq a, ToJSON a, FromJSON a) => T a -> a -> Bool
p_aeson _ a = Data.Aeson.Success a == (fromJSON . toJSON) a | 119 | p_aeson _ a = Data.Aeson.Success a == (fromJSON . toJSON) a | 59 | false | true | 0 | 8 | 25 | 68 | 34 | 34 | null | null |
gsdlab/claferIG | src/Language/Clafer/IG/AlloyIGInterface.hs | mit | getScope :: MonadIO m => String -> AlloyIGT m Integer
getScope sig =
do
rscopes <- fetches scopes
case Map.lookup sig rscopes of
Just scope -> return scope
Nothing -> getGlobalScope | 228 | getScope :: MonadIO m => String -> AlloyIGT m Integer
getScope sig =
do
rscopes <- fetches scopes
case Map.lookup sig rscopes of
Just scope -> return scope
Nothing -> getGlobalScope | 228 | getScope sig =
do
rscopes <- fetches scopes
case Map.lookup sig rscopes of
Just scope -> return scope
Nothing -> getGlobalScope | 174 | false | true | 0 | 10 | 77 | 72 | 32 | 40 | null | null |
dorchard/camfort | src/Camfort/Output.hs | apache-2.0 | refactorBlocks v inp b@(F.BlStatement _ _ _ u@F.StUse{}) = do
cursor <- get
case refactored $ F.getAnnotation u of
Just (FU.Position _ rCol _) -> do
let (FU.SrcSpan lb _) = FU.getSpan u
let (p0, _) = takeBounds (cursor, lb) inp
let out = B.pack $ PP.pprintAndRender v b (Just (rCol -1))
added <- lift get
when (newNode $ F.getAnnotation u)
(lift $ put $ added + countLines out)
put $ toCol0 lb
return (p0 `B.append` out, True)
Nothing -> return (B.empty, False)
-- Common blocks, equivalence statements, and declarations can all
-- be refactored by the default refactoring | 729 | refactorBlocks v inp b@(F.BlStatement _ _ _ u@F.StUse{}) = do
cursor <- get
case refactored $ F.getAnnotation u of
Just (FU.Position _ rCol _) -> do
let (FU.SrcSpan lb _) = FU.getSpan u
let (p0, _) = takeBounds (cursor, lb) inp
let out = B.pack $ PP.pprintAndRender v b (Just (rCol -1))
added <- lift get
when (newNode $ F.getAnnotation u)
(lift $ put $ added + countLines out)
put $ toCol0 lb
return (p0 `B.append` out, True)
Nothing -> return (B.empty, False)
-- Common blocks, equivalence statements, and declarations can all
-- be refactored by the default refactoring | 729 | refactorBlocks v inp b@(F.BlStatement _ _ _ u@F.StUse{}) = do
cursor <- get
case refactored $ F.getAnnotation u of
Just (FU.Position _ rCol _) -> do
let (FU.SrcSpan lb _) = FU.getSpan u
let (p0, _) = takeBounds (cursor, lb) inp
let out = B.pack $ PP.pprintAndRender v b (Just (rCol -1))
added <- lift get
when (newNode $ F.getAnnotation u)
(lift $ put $ added + countLines out)
put $ toCol0 lb
return (p0 `B.append` out, True)
Nothing -> return (B.empty, False)
-- Common blocks, equivalence statements, and declarations can all
-- be refactored by the default refactoring | 729 | false | false | 0 | 20 | 255 | 269 | 131 | 138 | null | null |
abbradar/netwire | Control/Wire/Interval.hs | bsd-3-clause | holdFor :: (HasTime t s, Monoid e, EventLike ev) => t -> Wire s e m (ev a) a
holdFor int | int <= 0 = error "holdFor: Non-positive interval." | 141 | holdFor :: (HasTime t s, Monoid e, EventLike ev) => t -> Wire s e m (ev a) a
holdFor int | int <= 0 = error "holdFor: Non-positive interval." | 141 | holdFor int | int <= 0 = error "holdFor: Non-positive interval." | 64 | false | true | 0 | 9 | 29 | 71 | 34 | 37 | null | null |
ambiata/highlighting-kate | Text/Highlighting/Kate/Syntax/Fortran.hs | gpl-2.0 | regex_'5cbmodule'5cs'2bprocedure'5cb = compileRegex False "\\bmodule\\s+procedure\\b" | 85 | regex_'5cbmodule'5cs'2bprocedure'5cb = compileRegex False "\\bmodule\\s+procedure\\b" | 85 | regex_'5cbmodule'5cs'2bprocedure'5cb = compileRegex False "\\bmodule\\s+procedure\\b" | 85 | false | false | 0 | 5 | 4 | 11 | 5 | 6 | null | null |
andorp/hs-bluesnap | src/Bluesnap/API/Request.hs | gpl-3.0 | elementToXMLCart :: Cart -> [Content ()]
elementToXMLCart = schemaTypeToXML "cart" | 82 | elementToXMLCart :: Cart -> [Content ()]
elementToXMLCart = schemaTypeToXML "cart" | 82 | elementToXMLCart = schemaTypeToXML "cart" | 41 | false | true | 0 | 8 | 9 | 26 | 13 | 13 | null | null |
brendanhay/gogol | gogol-plus-domains/gen/Network/Google/PlusDomains/Types/Product.hs | mpl-2.0 | -- | ETag of this response for caching purposes.
actEtag :: Lens' Activity (Maybe Text)
actEtag = lens _actEtag (\ s a -> s{_actEtag = a}) | 138 | actEtag :: Lens' Activity (Maybe Text)
actEtag = lens _actEtag (\ s a -> s{_actEtag = a}) | 89 | actEtag = lens _actEtag (\ s a -> s{_actEtag = a}) | 50 | true | true | 0 | 9 | 25 | 46 | 25 | 21 | null | null |
mcmaniac/ghc | compiler/nativeGen/X86/Regs.hs | bsd-3-clause | freeReg REG_D2 = fastBool False | 31 | freeReg REG_D2 = fastBool False | 31 | freeReg REG_D2 = fastBool False | 31 | false | false | 1 | 5 | 4 | 16 | 5 | 11 | null | null |
brendanhay/gogol | gogol-firestore/gen/Network/Google/Resource/FireStore/Projects/Databases/Documents/Write.hs | mpl-2.0 | -- | Creates a value of 'ProjectsDatabasesDocumentsWrite' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'pddwXgafv'
--
-- * 'pddwUploadProtocol'
--
-- * 'pddwDatabase'
--
-- * 'pddwAccessToken'
--
-- * 'pddwUploadType'
--
-- * 'pddwPayload'
--
-- * 'pddwCallback'
projectsDatabasesDocumentsWrite
:: Text -- ^ 'pddwDatabase'
-> WriteRequest -- ^ 'pddwPayload'
-> ProjectsDatabasesDocumentsWrite
projectsDatabasesDocumentsWrite pPddwDatabase_ pPddwPayload_ =
ProjectsDatabasesDocumentsWrite'
{ _pddwXgafv = Nothing
, _pddwUploadProtocol = Nothing
, _pddwDatabase = pPddwDatabase_
, _pddwAccessToken = Nothing
, _pddwUploadType = Nothing
, _pddwPayload = pPddwPayload_
, _pddwCallback = Nothing
} | 826 | projectsDatabasesDocumentsWrite
:: Text -- ^ 'pddwDatabase'
-> WriteRequest -- ^ 'pddwPayload'
-> ProjectsDatabasesDocumentsWrite
projectsDatabasesDocumentsWrite pPddwDatabase_ pPddwPayload_ =
ProjectsDatabasesDocumentsWrite'
{ _pddwXgafv = Nothing
, _pddwUploadProtocol = Nothing
, _pddwDatabase = pPddwDatabase_
, _pddwAccessToken = Nothing
, _pddwUploadType = Nothing
, _pddwPayload = pPddwPayload_
, _pddwCallback = Nothing
} | 475 | projectsDatabasesDocumentsWrite pPddwDatabase_ pPddwPayload_ =
ProjectsDatabasesDocumentsWrite'
{ _pddwXgafv = Nothing
, _pddwUploadProtocol = Nothing
, _pddwDatabase = pPddwDatabase_
, _pddwAccessToken = Nothing
, _pddwUploadType = Nothing
, _pddwPayload = pPddwPayload_
, _pddwCallback = Nothing
} | 333 | true | true | 0 | 6 | 150 | 87 | 60 | 27 | null | null |
jamessanders/twine | test/test.hs | bsd-2-clause | template1 = loadTemplateFromString "Hello {{name}}" | 51 | template1 = loadTemplateFromString "Hello {{name}}" | 51 | template1 = loadTemplateFromString "Hello {{name}}" | 51 | false | false | 0 | 5 | 4 | 9 | 4 | 5 | null | null |
toothbrush/dotfs | System/DotFS/Test/Tests.hs | bsd-3-clause | prop_parseExpr :: DFSExpr -> Bool
prop_parseExpr xs = xs == testExprP (show xs) | 79 | prop_parseExpr :: DFSExpr -> Bool
prop_parseExpr xs = xs == testExprP (show xs) | 79 | prop_parseExpr xs = xs == testExprP (show xs) | 45 | false | true | 0 | 8 | 12 | 31 | 15 | 16 | null | null |
yoo-e/weixin-mp-sdk | WeiXin/PublicPlatform/Types.hs | mit | wxppParseOAuthScopesList :: Stream s m Char => ParsecT s u m [OAuthScope]
wxppParseOAuthScopesList = simpleParser `sepBy1` (spaces *> char ',' <* spaces) | 153 | wxppParseOAuthScopesList :: Stream s m Char => ParsecT s u m [OAuthScope]
wxppParseOAuthScopesList = simpleParser `sepBy1` (spaces *> char ',' <* spaces) | 153 | wxppParseOAuthScopesList = simpleParser `sepBy1` (spaces *> char ',' <* spaces) | 79 | false | true | 0 | 10 | 21 | 63 | 30 | 33 | null | null |
jkoppel/compstrat | Data/Comp/Multi/Strategy/Derive.hs | bsd-3-clause | abstractConType (ForallC _ _ constr) = abstractConType constr | 61 | abstractConType (ForallC _ _ constr) = abstractConType constr | 61 | abstractConType (ForallC _ _ constr) = abstractConType constr | 61 | false | false | 0 | 7 | 7 | 22 | 10 | 12 | null | null |
DaMSL/K3 | src/Language/K3/Utils/Pretty/Common.hs | apache-2.0 | prettyMap :: (Pretty k, Pretty v)
=> [String] -- ^The pretty map's prefix.
-> [String] -- ^The pretty map's postfix.
-> String -- ^The separator between elements.
-> String -- ^The separator between keys and values.
-> Map k v
-> [String]
prettyMap pre post elsep innersep =
explicitPrettyMap pre post elsep innersep prettyLines prettyLines | 402 | prettyMap :: (Pretty k, Pretty v)
=> [String] -- ^The pretty map's prefix.
-> [String] -- ^The pretty map's postfix.
-> String -- ^The separator between elements.
-> String -- ^The separator between keys and values.
-> Map k v
-> [String]
prettyMap pre post elsep innersep =
explicitPrettyMap pre post elsep innersep prettyLines prettyLines | 402 | prettyMap pre post elsep innersep =
explicitPrettyMap pre post elsep innersep prettyLines prettyLines | 103 | false | true | 0 | 11 | 116 | 86 | 46 | 40 | null | null |
brendanhay/gogol | gogol-genomics/gen/Network/Google/Genomics/Types/Product.hs | mpl-2.0 | -- | An SOS report for an unexpected VM failure.
cirSosReport :: Lens' CheckInRequest (Maybe ByteString)
cirSosReport
= lens _cirSosReport (\ s a -> s{_cirSosReport = a})
. mapping _Bytes | 195 | cirSosReport :: Lens' CheckInRequest (Maybe ByteString)
cirSosReport
= lens _cirSosReport (\ s a -> s{_cirSosReport = a})
. mapping _Bytes | 146 | cirSosReport
= lens _cirSosReport (\ s a -> s{_cirSosReport = a})
. mapping _Bytes | 90 | true | true | 0 | 10 | 37 | 55 | 28 | 27 | null | null |
lucasdicioccio/probecraft-hs | Network/Probecraft/Packet/Icmp.hs | bsd-3-clause | unparseKind TimeExceeded = 11 | 29 | unparseKind TimeExceeded = 11 | 29 | unparseKind TimeExceeded = 11 | 29 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
Soostone/hadron | src/Hadron/Run/Local.hs | bsd-3-clause | -------------------------------------------------------------------------------
-- | Helper to work with relative paths using Haskell functions like
-- 'readFile' and 'writeFile'.
withLocalFile
:: MonadIO m
=> LocalRunSettings
-> LocalFile
-- ^ A relative path in our working folder
-> (FilePath -> m b)
-- ^ What to do with the absolute path.
-> m b
withLocalFile settings fp f = f =<< runLocal settings (path fp) | 442 | withLocalFile
:: MonadIO m
=> LocalRunSettings
-> LocalFile
-- ^ A relative path in our working folder
-> (FilePath -> m b)
-- ^ What to do with the absolute path.
-> m b
withLocalFile settings fp f = f =<< runLocal settings (path fp) | 262 | withLocalFile settings fp f = f =<< runLocal settings (path fp) | 63 | true | true | 1 | 12 | 89 | 69 | 35 | 34 | null | null |
Fuuzetsu/cabal2nix | src/Distribution/Nixpkgs/Haskell/FromCabal/PostProcess.hs | bsd-3-clause | darcsInstallPostInstall :: String
darcsInstallPostInstall = unlines
[ "postInstall = ''"
, " mkdir -p $out/etc/bash_completion.d"
, " mv contrib/darcs_completion $out/etc/bash_completion.d/darcs"
, "'';"
] | 217 | darcsInstallPostInstall :: String
darcsInstallPostInstall = unlines
[ "postInstall = ''"
, " mkdir -p $out/etc/bash_completion.d"
, " mv contrib/darcs_completion $out/etc/bash_completion.d/darcs"
, "'';"
] | 217 | darcsInstallPostInstall = unlines
[ "postInstall = ''"
, " mkdir -p $out/etc/bash_completion.d"
, " mv contrib/darcs_completion $out/etc/bash_completion.d/darcs"
, "'';"
] | 183 | false | true | 0 | 5 | 34 | 26 | 15 | 11 | null | null |
ags/hs-moz | src/Moz/Linkscape/URLMetrics.hs | mit | toBitFlag ExternalLinksToRootDomain = 2251799813685248 | 60 | toBitFlag ExternalLinksToRootDomain = 2251799813685248 | 60 | toBitFlag ExternalLinksToRootDomain = 2251799813685248 | 60 | false | false | 0 | 5 | 9 | 9 | 4 | 5 | null | null |
roldugin/LiveFusion | Data/LiveFusion/Loop/Stmt.hs | bsd-3-clause | gotoStmt = Goto | 19 | gotoStmt = Goto | 19 | gotoStmt = Goto | 19 | false | false | 0 | 4 | 6 | 6 | 3 | 3 | null | null |
bixuanzju/SCore | src/Language.hs | gpl-3.0 | pExpr5c :: Parser PartialExpr
pExpr5c =
(do op <- pLit "*"
expr <- pExpr5
return (FoundOp op expr)) `pAlt`
(return NoOp) | 136 | pExpr5c :: Parser PartialExpr
pExpr5c =
(do op <- pLit "*"
expr <- pExpr5
return (FoundOp op expr)) `pAlt`
(return NoOp) | 136 | pExpr5c =
(do op <- pLit "*"
expr <- pExpr5
return (FoundOp op expr)) `pAlt`
(return NoOp) | 106 | false | true | 0 | 11 | 36 | 60 | 29 | 31 | null | null |
sol/aeson | benchmarks/CompareWithJSON.hs | bsd-3-clause | decode :: BL.ByteString -> A.Value
decode s = fromMaybe (error "fail to parse via Aeson") $ A.decode s | 102 | decode :: BL.ByteString -> A.Value
decode s = fromMaybe (error "fail to parse via Aeson") $ A.decode s | 102 | decode s = fromMaybe (error "fail to parse via Aeson") $ A.decode s | 67 | false | true | 0 | 8 | 17 | 40 | 19 | 21 | null | null |
mfpi/OpenGLRaw | src/Graphics/Rendering/OpenGL/Raw/ARB/ES3Compatibility.hs | bsd-3-clause | gl_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2 :: GLenum
gl_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2 = 0x9277 | 108 | gl_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2 :: GLenum
gl_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2 = 0x9277 | 108 | gl_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2 = 0x9277 | 53 | false | true | 0 | 4 | 5 | 11 | 6 | 5 | null | null |
truls/language-vhdl-quote | src/Language/VHDL/Quote/Internal.hs | mpl-2.0 | qqSubtyIndE _ = Nothing | 40 | qqSubtyIndE _ = Nothing | 40 | qqSubtyIndE _ = Nothing | 40 | false | false | 0 | 4 | 20 | 10 | 4 | 6 | null | null |
evanrinehart/lowgl | Graphics/GL/Low/Common.hs | bsd-2-clause | cubeSideCodes :: Cube GLenum
cubeSideCodes = Cube
{ cubeLeft = GL_TEXTURE_CUBE_MAP_NEGATIVE_X
, cubeRight = GL_TEXTURE_CUBE_MAP_POSITIVE_X
, cubeTop = GL_TEXTURE_CUBE_MAP_POSITIVE_Y
, cubeBottom = GL_TEXTURE_CUBE_MAP_NEGATIVE_Y
, cubeFront = GL_TEXTURE_CUBE_MAP_POSITIVE_Z
, cubeBack = GL_TEXTURE_CUBE_MAP_NEGATIVE_Z } | 339 | cubeSideCodes :: Cube GLenum
cubeSideCodes = Cube
{ cubeLeft = GL_TEXTURE_CUBE_MAP_NEGATIVE_X
, cubeRight = GL_TEXTURE_CUBE_MAP_POSITIVE_X
, cubeTop = GL_TEXTURE_CUBE_MAP_POSITIVE_Y
, cubeBottom = GL_TEXTURE_CUBE_MAP_NEGATIVE_Y
, cubeFront = GL_TEXTURE_CUBE_MAP_POSITIVE_Z
, cubeBack = GL_TEXTURE_CUBE_MAP_NEGATIVE_Z } | 339 | cubeSideCodes = Cube
{ cubeLeft = GL_TEXTURE_CUBE_MAP_NEGATIVE_X
, cubeRight = GL_TEXTURE_CUBE_MAP_POSITIVE_X
, cubeTop = GL_TEXTURE_CUBE_MAP_POSITIVE_Y
, cubeBottom = GL_TEXTURE_CUBE_MAP_NEGATIVE_Y
, cubeFront = GL_TEXTURE_CUBE_MAP_POSITIVE_Z
, cubeBack = GL_TEXTURE_CUBE_MAP_NEGATIVE_Z } | 310 | false | true | 0 | 7 | 52 | 56 | 33 | 23 | null | null |
dmbarbour/awelon | hsrc/AO/Compile.hs | bsd-3-clause | odeToABC _ [] = id
| 19 | codeToABC _ [] = id | 19 | codeToABC _ [] = id | 19 | false | false | 0 | 6 | 5 | 16 | 7 | 9 | null | null |
sdiehl/ghc | compiler/typecheck/TcType.hs | bsd-3-clause | tcSplitNestedSigmaTys :: Type -> ([TyVar], ThetaType, Type)
-- NB: This is basically a pure version of deeplyInstantiate (from Inst) that
-- doesn't compute an HsWrapper.
tcSplitNestedSigmaTys ty
-- If there's a forall, split it apart and try splitting the rho type
-- underneath it.
| Just (arg_tys, tvs1, theta1, rho1) <- tcDeepSplitSigmaTy_maybe ty
= let (tvs2, theta2, rho2) = tcSplitNestedSigmaTys rho1
in (tvs1 ++ tvs2, theta1 ++ theta2, mkVisFunTys arg_tys rho2)
-- If there's no forall, we're done.
| otherwise = ([], [], ty) | 555 | tcSplitNestedSigmaTys :: Type -> ([TyVar], ThetaType, Type)
tcSplitNestedSigmaTys ty
-- If there's a forall, split it apart and try splitting the rho type
-- underneath it.
| Just (arg_tys, tvs1, theta1, rho1) <- tcDeepSplitSigmaTy_maybe ty
= let (tvs2, theta2, rho2) = tcSplitNestedSigmaTys rho1
in (tvs1 ++ tvs2, theta1 ++ theta2, mkVisFunTys arg_tys rho2)
-- If there's no forall, we're done.
| otherwise = ([], [], ty) | 444 | tcSplitNestedSigmaTys ty
-- If there's a forall, split it apart and try splitting the rho type
-- underneath it.
| Just (arg_tys, tvs1, theta1, rho1) <- tcDeepSplitSigmaTy_maybe ty
= let (tvs2, theta2, rho2) = tcSplitNestedSigmaTys rho1
in (tvs1 ++ tvs2, theta1 ++ theta2, mkVisFunTys arg_tys rho2)
-- If there's no forall, we're done.
| otherwise = ([], [], ty) | 384 | true | true | 1 | 10 | 105 | 130 | 72 | 58 | null | null |
headprogrammingczar/cabal | cabal-install/Distribution/Client/Dependency/TopDown.hs | bsd-3-clause | showFailure (TopLevelVersionConstraintUnsatisfiable name ver) =
"There is no available version of " ++ display name
++ " that satisfies " ++ displayVer ver | 166 | showFailure (TopLevelVersionConstraintUnsatisfiable name ver) =
"There is no available version of " ++ display name
++ " that satisfies " ++ displayVer ver | 166 | showFailure (TopLevelVersionConstraintUnsatisfiable name ver) =
"There is no available version of " ++ display name
++ " that satisfies " ++ displayVer ver | 166 | false | false | 2 | 6 | 33 | 37 | 16 | 21 | null | null |
mbakke/ganeti | src/Ganeti/Query/Filter.hs | bsd-2-clause | tryGetter cfg rt item (FieldConfigRuntime getter) =
maybe Nothing (\rt' -> Just $ getter cfg rt' item) rt | 107 | tryGetter cfg rt item (FieldConfigRuntime getter) =
maybe Nothing (\rt' -> Just $ getter cfg rt' item) rt | 107 | tryGetter cfg rt item (FieldConfigRuntime getter) =
maybe Nothing (\rt' -> Just $ getter cfg rt' item) rt | 107 | false | false | 0 | 9 | 19 | 48 | 23 | 25 | null | null |
ggreif/clash-compiler | clash-lib/src/CLaSH/Core/Pretty.hs | bsd-2-clause | ppr_type p (AppTy ty1 ty2) = maybeParen p TyConPrec <$> ((<+>) <$> pprType ty1 <*> ppr_type TyConPrec ty2) | 106 | ppr_type p (AppTy ty1 ty2) = maybeParen p TyConPrec <$> ((<+>) <$> pprType ty1 <*> ppr_type TyConPrec ty2) | 106 | ppr_type p (AppTy ty1 ty2) = maybeParen p TyConPrec <$> ((<+>) <$> pprType ty1 <*> ppr_type TyConPrec ty2) | 106 | false | false | 0 | 9 | 17 | 51 | 24 | 27 | null | null |
MasseR/xmonadcontrib | XMonad/Layout/Gaps.hs | bsd-3-clause | -- | Add togglable manual gaps to a layout.
gaps :: GapSpec -- ^ The gaps to allow, paired with their initial sizes.
-> l a -- ^ The layout to modify.
-> ModifiedLayout Gaps l a
gaps g = ModifiedLayout (Gaps g (map fst g)) | 240 | gaps :: GapSpec -- ^ The gaps to allow, paired with their initial sizes.
-> l a -- ^ The layout to modify.
-> ModifiedLayout Gaps l a
gaps g = ModifiedLayout (Gaps g (map fst g)) | 196 | gaps g = ModifiedLayout (Gaps g (map fst g)) | 44 | true | true | 0 | 9 | 63 | 59 | 28 | 31 | null | null |
jtojnar/hulk | src/Hulk/Client.hs | bsd-3-clause | newClientMsg :: Client -> RegUser -> RPL -> [Text]
-> Hulk Message
newClientMsg Client{..} RegUser{..} cmd ps = do
return (Message (Just (User (encodeUtf8 (nickText regUserNick))
(encodeUtf8 (userText regUserUser))
(encodeUtf8 clientHostname)))
(makeCommand cmd ps))
--------------------------------------------------------------------------------
-- * Server replies
-- | Send the welcome message. | 493 | newClientMsg :: Client -> RegUser -> RPL -> [Text]
-> Hulk Message
newClientMsg Client{..} RegUser{..} cmd ps = do
return (Message (Just (User (encodeUtf8 (nickText regUserNick))
(encodeUtf8 (userText regUserUser))
(encodeUtf8 clientHostname)))
(makeCommand cmd ps))
--------------------------------------------------------------------------------
-- * Server replies
-- | Send the welcome message. | 493 | newClientMsg Client{..} RegUser{..} cmd ps = do
return (Message (Just (User (encodeUtf8 (nickText regUserNick))
(encodeUtf8 (userText regUserUser))
(encodeUtf8 clientHostname)))
(makeCommand cmd ps))
--------------------------------------------------------------------------------
-- * Server replies
-- | Send the welcome message. | 413 | false | true | 4 | 15 | 139 | 118 | 64 | 54 | null | null |
pseudonom/persistent | persistent/Database/Persist/Sql/Class.hs | mit | from5 :: (a,b,c,d,e) -> ((a,b),(c,d),e)
from5 (a,b,c,d,e) = ((a,b),(c,d),e) | 75 | from5 :: (a,b,c,d,e) -> ((a,b),(c,d),e)
from5 (a,b,c,d,e) = ((a,b),(c,d),e) | 75 | from5 (a,b,c,d,e) = ((a,b),(c,d),e) | 35 | false | true | 0 | 7 | 8 | 90 | 57 | 33 | null | null |
nevrenato/HetsAlloy | Propositional/Sublogic.hs | gpl-2.0 | prSymM :: PropSL -> AS_BASIC.SYMB_ITEMS -> Maybe AS_BASIC.SYMB_ITEMS
prSymM _ = Just | 84 | prSymM :: PropSL -> AS_BASIC.SYMB_ITEMS -> Maybe AS_BASIC.SYMB_ITEMS
prSymM _ = Just | 84 | prSymM _ = Just | 15 | false | true | 0 | 9 | 11 | 34 | 15 | 19 | null | null |
michalkonecny/aern2 | aern2-mfun/src/AERN2/BoxFunMinMax/Expressions/Translators/DReal.hs | bsd-3-clause | expressionToSMT (Float32 _ _) = error "dReal translator does not support Floats" | 80 | expressionToSMT (Float32 _ _) = error "dReal translator does not support Floats" | 80 | expressionToSMT (Float32 _ _) = error "dReal translator does not support Floats" | 80 | false | false | 0 | 6 | 11 | 21 | 9 | 12 | null | null |
lslah/nvim-hs | library/Neovim/API/Parser.hs | apache-2.0 | extractErrorTypes :: Map String Object -> Either Doc [(String, Int64)]
extractErrorTypes objAPI = extractTypeNameAndID =<< oLookup "error_types" objAPI | 151 | extractErrorTypes :: Map String Object -> Either Doc [(String, Int64)]
extractErrorTypes objAPI = extractTypeNameAndID =<< oLookup "error_types" objAPI | 151 | extractErrorTypes objAPI = extractTypeNameAndID =<< oLookup "error_types" objAPI | 80 | false | true | 0 | 8 | 17 | 46 | 23 | 23 | null | null |
Kiandr/CrackingCodingInterview | Haskell/src/chapter-2/remove-node.hs | mit | removeNode :: Eq a => a -> [a] -> [a]
removeNode _ [] = [] | 58 | removeNode :: Eq a => a -> [a] -> [a]
removeNode _ [] = [] | 58 | removeNode _ [] = [] | 20 | false | true | 0 | 8 | 14 | 41 | 21 | 20 | null | null |
mgsloan/slogger | deadcode/Slogger.hs | bsd-3-clause | logInternal :: (MonadLogger m, MonadIO m, ToLogStr msg) => Loc -> LogSource -> LogLevel -> Maybe LogId -> msg -> T.Text -> SloggerT m LogId
logInternal loc source level mid msg typ = do
i <- maybe getFreshId return mid
ss <- getSloggerState
logInternal' loc source level msg typ (LogData i (headMay (idParents ss)) 0)
return i | 342 | logInternal :: (MonadLogger m, MonadIO m, ToLogStr msg) => Loc -> LogSource -> LogLevel -> Maybe LogId -> msg -> T.Text -> SloggerT m LogId
logInternal loc source level mid msg typ = do
i <- maybe getFreshId return mid
ss <- getSloggerState
logInternal' loc source level msg typ (LogData i (headMay (idParents ss)) 0)
return i | 342 | logInternal loc source level mid msg typ = do
i <- maybe getFreshId return mid
ss <- getSloggerState
logInternal' loc source level msg typ (LogData i (headMay (idParents ss)) 0)
return i | 202 | false | true | 0 | 13 | 72 | 144 | 68 | 76 | null | null |
seni/copilot-libraries | src/Copilot/Library/RegExp.hs | bsd-3-clause | hasEpsilon ( RStar _ ) = True | 36 | hasEpsilon ( RStar _ ) = True | 36 | hasEpsilon ( RStar _ ) = True | 36 | false | false | 0 | 7 | 13 | 15 | 7 | 8 | null | null |
wavewave/madgraph-auto-dataset | src/HEP/Automation/MadGraph/Dataset/Set20110413set2.hs | gpl-3.0 | processTTBar :: [Char]
processTTBar =
"\ngenerate P P > t t~ QED=99\n" | 74 | processTTBar :: [Char]
processTTBar =
"\ngenerate P P > t t~ QED=99\n" | 74 | processTTBar =
"\ngenerate P P > t t~ QED=99\n" | 51 | false | true | 0 | 5 | 15 | 14 | 8 | 6 | null | null |
text-utf8/text | Data/Text/Lazy/Builder/RealFloat.hs | bsd-2-clause | formatRealFloat fmt decs x
| isNaN x = "NaN"
| isInfinite x = if x < 0 then "-Infinity" else "Infinity"
| x < 0 || isNegativeZero x = singleton '-' <> doFmt fmt (floatToDigits (-x))
| otherwise = doFmt fmt (floatToDigits x)
where
doFmt format (is, e) =
let ds = map i2d is in
case format of
Generic ->
doFmt (if e < 0 || e > 7 then Exponent else Fixed)
(is,e)
Exponent ->
case decs of
Nothing ->
let show_e' = decimal (e-1) in
case ds of
"0" -> "0.0e0"
[d] -> singleton d <> ".0e" <> show_e'
(d:ds') -> singleton d <> singleton '.' <> fromString ds' <> singleton 'e' <> show_e'
[] -> error "formatRealFloat/doFmt/Exponent: []"
Just dec ->
let dec' = max dec 1 in
case is of
[0] -> "0." <> fromText (T.replicate dec' "0") <> "e0"
_ ->
let
(ei,is') = roundTo (dec'+1) is
(d:ds') = map i2d (if ei > 0 then init is' else is')
in
singleton d <> singleton '.' <> fromString ds' <> singleton 'e' <> decimal (e-1+ei)
Fixed ->
let
mk0 ls = case ls of { "" -> "0" ; _ -> fromString ls}
in
case decs of
Nothing
| e <= 0 -> "0." <> fromText (T.replicate (-e) "0") <> fromString ds
| otherwise ->
let
f 0 s rs = mk0 (reverse s) <> singleton '.' <> mk0 rs
f n s "" = f (n-1) ('0':s) ""
f n s (r:rs) = f (n-1) (r:s) rs
in
f e "" ds
Just dec ->
let dec' = max dec 0 in
if e >= 0 then
let
(ei,is') = roundTo (dec' + e) is
(ls,rs) = splitAt (e+ei) (map i2d is')
in
mk0 ls <> (if null rs then "" else singleton '.' <> fromString rs)
else
let
(ei,is') = roundTo dec' (replicate (-e) 0 ++ is)
d:ds' = map i2d (if ei > 0 then is' else 0:is')
in
singleton d <> (if null ds' then "" else singleton '.' <> fromString ds')
-- Based on "Printing Floating-Point Numbers Quickly and Accurately"
-- by R.G. Burger and R.K. Dybvig in PLDI 96.
-- This version uses a much slower logarithm estimator. It should be improved.
-- | 'floatToDigits' takes a base and a non-negative 'RealFloat' number,
-- and returns a list of digits and an exponent.
-- In particular, if @x>=0@, and
--
-- > floatToDigits base x = ([d1,d2,...,dn], e)
--
-- then
--
-- (1) @n >= 1@
--
-- (2) @x = 0.d1d2...dn * (base**e)@
--
-- (3) @0 <= di <= base-1@ | 2,671 | formatRealFloat fmt decs x
| isNaN x = "NaN"
| isInfinite x = if x < 0 then "-Infinity" else "Infinity"
| x < 0 || isNegativeZero x = singleton '-' <> doFmt fmt (floatToDigits (-x))
| otherwise = doFmt fmt (floatToDigits x)
where
doFmt format (is, e) =
let ds = map i2d is in
case format of
Generic ->
doFmt (if e < 0 || e > 7 then Exponent else Fixed)
(is,e)
Exponent ->
case decs of
Nothing ->
let show_e' = decimal (e-1) in
case ds of
"0" -> "0.0e0"
[d] -> singleton d <> ".0e" <> show_e'
(d:ds') -> singleton d <> singleton '.' <> fromString ds' <> singleton 'e' <> show_e'
[] -> error "formatRealFloat/doFmt/Exponent: []"
Just dec ->
let dec' = max dec 1 in
case is of
[0] -> "0." <> fromText (T.replicate dec' "0") <> "e0"
_ ->
let
(ei,is') = roundTo (dec'+1) is
(d:ds') = map i2d (if ei > 0 then init is' else is')
in
singleton d <> singleton '.' <> fromString ds' <> singleton 'e' <> decimal (e-1+ei)
Fixed ->
let
mk0 ls = case ls of { "" -> "0" ; _ -> fromString ls}
in
case decs of
Nothing
| e <= 0 -> "0." <> fromText (T.replicate (-e) "0") <> fromString ds
| otherwise ->
let
f 0 s rs = mk0 (reverse s) <> singleton '.' <> mk0 rs
f n s "" = f (n-1) ('0':s) ""
f n s (r:rs) = f (n-1) (r:s) rs
in
f e "" ds
Just dec ->
let dec' = max dec 0 in
if e >= 0 then
let
(ei,is') = roundTo (dec' + e) is
(ls,rs) = splitAt (e+ei) (map i2d is')
in
mk0 ls <> (if null rs then "" else singleton '.' <> fromString rs)
else
let
(ei,is') = roundTo dec' (replicate (-e) 0 ++ is)
d:ds' = map i2d (if ei > 0 then is' else 0:is')
in
singleton d <> (if null ds' then "" else singleton '.' <> fromString ds')
-- Based on "Printing Floating-Point Numbers Quickly and Accurately"
-- by R.G. Burger and R.K. Dybvig in PLDI 96.
-- This version uses a much slower logarithm estimator. It should be improved.
-- | 'floatToDigits' takes a base and a non-negative 'RealFloat' number,
-- and returns a list of digits and an exponent.
-- In particular, if @x>=0@, and
--
-- > floatToDigits base x = ([d1,d2,...,dn], e)
--
-- then
--
-- (1) @n >= 1@
--
-- (2) @x = 0.d1d2...dn * (base**e)@
--
-- (3) @0 <= di <= base-1@ | 2,671 | formatRealFloat fmt decs x
| isNaN x = "NaN"
| isInfinite x = if x < 0 then "-Infinity" else "Infinity"
| x < 0 || isNegativeZero x = singleton '-' <> doFmt fmt (floatToDigits (-x))
| otherwise = doFmt fmt (floatToDigits x)
where
doFmt format (is, e) =
let ds = map i2d is in
case format of
Generic ->
doFmt (if e < 0 || e > 7 then Exponent else Fixed)
(is,e)
Exponent ->
case decs of
Nothing ->
let show_e' = decimal (e-1) in
case ds of
"0" -> "0.0e0"
[d] -> singleton d <> ".0e" <> show_e'
(d:ds') -> singleton d <> singleton '.' <> fromString ds' <> singleton 'e' <> show_e'
[] -> error "formatRealFloat/doFmt/Exponent: []"
Just dec ->
let dec' = max dec 1 in
case is of
[0] -> "0." <> fromText (T.replicate dec' "0") <> "e0"
_ ->
let
(ei,is') = roundTo (dec'+1) is
(d:ds') = map i2d (if ei > 0 then init is' else is')
in
singleton d <> singleton '.' <> fromString ds' <> singleton 'e' <> decimal (e-1+ei)
Fixed ->
let
mk0 ls = case ls of { "" -> "0" ; _ -> fromString ls}
in
case decs of
Nothing
| e <= 0 -> "0." <> fromText (T.replicate (-e) "0") <> fromString ds
| otherwise ->
let
f 0 s rs = mk0 (reverse s) <> singleton '.' <> mk0 rs
f n s "" = f (n-1) ('0':s) ""
f n s (r:rs) = f (n-1) (r:s) rs
in
f e "" ds
Just dec ->
let dec' = max dec 0 in
if e >= 0 then
let
(ei,is') = roundTo (dec' + e) is
(ls,rs) = splitAt (e+ei) (map i2d is')
in
mk0 ls <> (if null rs then "" else singleton '.' <> fromString rs)
else
let
(ei,is') = roundTo dec' (replicate (-e) 0 ++ is)
d:ds' = map i2d (if ei > 0 then is' else 0:is')
in
singleton d <> (if null ds' then "" else singleton '.' <> fromString ds')
-- Based on "Printing Floating-Point Numbers Quickly and Accurately"
-- by R.G. Burger and R.K. Dybvig in PLDI 96.
-- This version uses a much slower logarithm estimator. It should be improved.
-- | 'floatToDigits' takes a base and a non-negative 'RealFloat' number,
-- and returns a list of digits and an exponent.
-- In particular, if @x>=0@, and
--
-- > floatToDigits base x = ([d1,d2,...,dn], e)
--
-- then
--
-- (1) @n >= 1@
--
-- (2) @x = 0.d1d2...dn * (base**e)@
--
-- (3) @0 <= di <= base-1@ | 2,671 | false | false | 2 | 34 | 1,009 | 948 | 472 | 476 | null | null |
ggreif/clash-compiler | clash-lib/src/CLaSH/Netlist/BlackBox/Util.hs | bsd-2-clause | lineToType b [(TypElem t)] = case lineToType b [t] of
Vector _ elTy -> elTy
_ -> error $ $(curLoc) ++ "Element type selection of a non-vector type" | 218 | lineToType b [(TypElem t)] = case lineToType b [t] of
Vector _ elTy -> elTy
_ -> error $ $(curLoc) ++ "Element type selection of a non-vector type" | 218 | lineToType b [(TypElem t)] = case lineToType b [t] of
Vector _ elTy -> elTy
_ -> error $ $(curLoc) ++ "Element type selection of a non-vector type" | 218 | false | false | 0 | 11 | 98 | 63 | 30 | 33 | null | null |
badp/ganeti | src/Ganeti/Query/Common.hs | gpl-2.0 | -- | Hvparams optimised lookup map.
hvParamTypes :: Map.Map String FieldType
hvParamTypes = Map.map vTypeToQFT C.hvsParameterTypes | 130 | hvParamTypes :: Map.Map String FieldType
hvParamTypes = Map.map vTypeToQFT C.hvsParameterTypes | 94 | hvParamTypes = Map.map vTypeToQFT C.hvsParameterTypes | 53 | true | true | 0 | 6 | 15 | 28 | 14 | 14 | null | null |
NightRa/Idris-dev | src/Idris/AbsSyntaxTree.hs | bsd-3-clause | defined (PNamespace _ _ ds) = concatMap defined ds | 50 | defined (PNamespace _ _ ds) = concatMap defined ds | 50 | defined (PNamespace _ _ ds) = concatMap defined ds | 50 | false | false | 0 | 7 | 8 | 24 | 11 | 13 | null | null |
fmapfmapfmap/amazonka | amazonka-redshift/gen/Network/AWS/Redshift/DescribeReservedNodeOfferings.hs | mpl-2.0 | -- | The maximum number of response records to return in each call. If the
-- number of remaining response records exceeds the specified 'MaxRecords'
-- value, a value is returned in a 'marker' field of the response. You can
-- retrieve the next set of records by retrying the command with the
-- returned marker value.
--
-- Default: '100'
--
-- Constraints: minimum 20, maximum 100.
drnoMaxRecords :: Lens' DescribeReservedNodeOfferings (Maybe Int)
drnoMaxRecords = lens _drnoMaxRecords (\ s a -> s{_drnoMaxRecords = a}) | 522 | drnoMaxRecords :: Lens' DescribeReservedNodeOfferings (Maybe Int)
drnoMaxRecords = lens _drnoMaxRecords (\ s a -> s{_drnoMaxRecords = a}) | 137 | drnoMaxRecords = lens _drnoMaxRecords (\ s a -> s{_drnoMaxRecords = a}) | 71 | true | true | 0 | 9 | 84 | 54 | 33 | 21 | null | null |
ezyang/ghc | compiler/hsSyn/HsPat.hs | bsd-3-clause | pprPat (ViewPat expr pat _) = hcat [pprLExpr expr, text " -> ", ppr pat] | 74 | pprPat (ViewPat expr pat _) = hcat [pprLExpr expr, text " -> ", ppr pat] | 74 | pprPat (ViewPat expr pat _) = hcat [pprLExpr expr, text " -> ", ppr pat] | 74 | false | false | 0 | 7 | 16 | 40 | 19 | 21 | null | null |
dysinger/amazonka | amazonka-kinesis/gen/Network/AWS/Kinesis/SplitShard.hs | mpl-2.0 | -- | The name of the stream for the shard split.
ssStreamName :: Lens' SplitShard Text
ssStreamName = lens _ssStreamName (\s a -> s { _ssStreamName = a }) | 154 | ssStreamName :: Lens' SplitShard Text
ssStreamName = lens _ssStreamName (\s a -> s { _ssStreamName = a }) | 105 | ssStreamName = lens _ssStreamName (\s a -> s { _ssStreamName = a }) | 67 | true | true | 0 | 9 | 28 | 40 | 22 | 18 | null | null |
wavewave/madgraph-auto-dataset | src/HEP/Automation/MadGraph/Dataset/Set20110314set1.hs | gpl-3.0 | ucut :: UserCut
ucut = UserCut {
uc_metcut = 15.0
, uc_etacutlep = 1.2
, uc_etcutlep = 18.0
, uc_etacutjet = 2.5
, uc_etcutjet = 15.0
} | 156 | ucut :: UserCut
ucut = UserCut {
uc_metcut = 15.0
, uc_etacutlep = 1.2
, uc_etcutlep = 18.0
, uc_etacutjet = 2.5
, uc_etcutjet = 15.0
} | 156 | ucut = UserCut {
uc_metcut = 15.0
, uc_etacutlep = 1.2
, uc_etcutlep = 18.0
, uc_etacutjet = 2.5
, uc_etcutjet = 15.0
} | 140 | false | true | 0 | 6 | 47 | 43 | 27 | 16 | null | null |
urbanslug/ghc | compiler/typecheck/TcType.hs | bsd-3-clause | tcSplitTyConApp_maybe (TyConApp tc tys) = Just (tc, tys) | 56 | tcSplitTyConApp_maybe (TyConApp tc tys) = Just (tc, tys) | 56 | tcSplitTyConApp_maybe (TyConApp tc tys) = Just (tc, tys) | 56 | false | false | 0 | 6 | 7 | 27 | 13 | 14 | null | null |
ajnsit/custom-prelude | test-is-a-prelude.hs | gpl-3.0 | replicate = P.replicate | 23 | replicate = P.replicate | 23 | replicate = P.replicate | 23 | false | false | 0 | 5 | 2 | 8 | 4 | 4 | null | null |
zenhack/haskell-capnp | tests/Module/Capnp/Rpc.hs | mit | withTransportPair ::
( ( WordCount -> Transport
, WordCount -> Transport
) -> IO a
) -> IO a
withTransportPair f =
withSocketPair $ \(x, y) -> f (socketTransport x, socketTransport y) | 207 | withTransportPair ::
( ( WordCount -> Transport
, WordCount -> Transport
) -> IO a
) -> IO a
withTransportPair f =
withSocketPair $ \(x, y) -> f (socketTransport x, socketTransport y) | 207 | withTransportPair f =
withSocketPair $ \(x, y) -> f (socketTransport x, socketTransport y) | 94 | false | true | 0 | 10 | 55 | 76 | 39 | 37 | null | null |
bredelings/BAli-Phy | haskell/Probability/Random.hs | gpl-2.0 | -- It seems like we could return raw_x in most cases, except the case of a tree.
-- But in the tree case, we could return triggered_x.
-- Note on unsafeInterleaveIO:
-- Simply using run_lazy does not guarantee that the result of run_lazy
-- will not be demanded. (It guarantees that f >>= g that are INSIDE run_lazy
-- won't demand the result of the f).
-- We need to guard any IO operations with unsafeInterleaveIO if we
-- want to prevent their results from being demanded.
--
-- QUESTION: So, do we need to guard the execution of Distributions with unsafeInterleaveIO?
-- ANSWER: No. If its not the last entry in a sequence, it will get unsafeInterleaveIO from
-- run_lazy' _ (IOAndPass _ _).
-- If it is run from run_strict' directly, then it is run with
-- unsafeInterleaveIO $ run_lazy', so we get an unsafeInterleaveIO from there.
--
run_lazy' rate (LiftIO a) = a | 927 | run_lazy' rate (LiftIO a) = a | 29 | run_lazy' rate (LiftIO a) = a | 29 | true | false | 0 | 6 | 212 | 34 | 23 | 11 | null | null |
co-dan/NPNTool | tests/Main.hs | bsd-3-clause | bind2' "Y" = Right np2E3 | 24 | bind2' "Y" = Right np2E3 | 24 | bind2' "Y" = Right np2E3 | 24 | false | false | 0 | 5 | 4 | 12 | 5 | 7 | null | null |
shlevy/ghc | testsuite/tests/th/T5597.hs | bsd-3-clause | g = $(f [t| (Int, Int) |]) | 26 | g = $(f [t| (Int, Int) |]) | 26 | g = $(f [t| (Int, Int) |]) | 26 | false | false | 0 | 8 | 6 | 21 | 11 | 10 | null | null |
kapilash/dc | src/ccs2c/ccs2cs-lib/src/Language/CCS/Printer.hs | bsd-3-clause | cCode :: HS.HashSet NativeTxt -> [CInclude] -> Doc
cCode set hdrs = vcat [headersToC . appendHdrs $ hdrs, mainBegin, printStmts set, mainClose] | 143 | cCode :: HS.HashSet NativeTxt -> [CInclude] -> Doc
cCode set hdrs = vcat [headersToC . appendHdrs $ hdrs, mainBegin, printStmts set, mainClose] | 143 | cCode set hdrs = vcat [headersToC . appendHdrs $ hdrs, mainBegin, printStmts set, mainClose] | 92 | false | true | 0 | 8 | 21 | 63 | 31 | 32 | null | null |
zenhack/dedup-backup | tests/TestMain.hs | gpl-3.0 | main :: IO ()
main = defaultMain [ testProperty
"syncMetadata path status; lstat path == status"
syncMetadataEq
, testProperty
("Writing a file tree to disk then reading it " ++
"back in yields equal trees")
writeThenReadEq
, testProperty
"Doing a backup of a clean tree makes an equal copy."
copyEq
, testProperty
("Doing an incremental backup with a prev backup " ++
"makes a correct copy.")
cTimeCopyEq
, testProperty
("The file size cutoff for deduplication vs not is " ++
"respected.")
sizeCutOffActions
] | 921 | main :: IO ()
main = defaultMain [ testProperty
"syncMetadata path status; lstat path == status"
syncMetadataEq
, testProperty
("Writing a file tree to disk then reading it " ++
"back in yields equal trees")
writeThenReadEq
, testProperty
"Doing a backup of a clean tree makes an equal copy."
copyEq
, testProperty
("Doing an incremental backup with a prev backup " ++
"makes a correct copy.")
cTimeCopyEq
, testProperty
("The file size cutoff for deduplication vs not is " ++
"respected.")
sizeCutOffActions
] | 921 | main = defaultMain [ testProperty
"syncMetadata path status; lstat path == status"
syncMetadataEq
, testProperty
("Writing a file tree to disk then reading it " ++
"back in yields equal trees")
writeThenReadEq
, testProperty
"Doing a backup of a clean tree makes an equal copy."
copyEq
, testProperty
("Doing an incremental backup with a prev backup " ++
"makes a correct copy.")
cTimeCopyEq
, testProperty
("The file size cutoff for deduplication vs not is " ++
"respected.")
sizeCutOffActions
] | 907 | false | true | 0 | 9 | 493 | 86 | 42 | 44 | null | null |
tolysz/prepare-ghcjs | spec-lts8/base/GHC/IO/Handle/Internals.hs | bsd-3-clause | checkWritableHandle :: (Handle__ -> IO a) -> Handle__ -> IO a
checkWritableHandle act h_@Handle__{..}
= case haType of
ClosedHandle -> ioe_closedHandle
SemiClosedHandle -> ioe_semiclosedHandle
ReadHandle -> ioe_notWritable
ReadWriteHandle -> do
buf <- readIORef haCharBuffer
when (not (isWriteBuffer buf)) $ do
flushCharReadBuffer h_
flushByteReadBuffer h_
buf <- readIORef haCharBuffer
writeIORef haCharBuffer buf{ bufState = WriteBuffer }
buf <- readIORef haByteBuffer
buf' <- Buffered.emptyWriteBuffer haDevice buf
writeIORef haByteBuffer buf'
act h_
_other -> act h_
-- ---------------------------------------------------------------------------
-- Wrapper for read operations. | 856 | checkWritableHandle :: (Handle__ -> IO a) -> Handle__ -> IO a
checkWritableHandle act h_@Handle__{..}
= case haType of
ClosedHandle -> ioe_closedHandle
SemiClosedHandle -> ioe_semiclosedHandle
ReadHandle -> ioe_notWritable
ReadWriteHandle -> do
buf <- readIORef haCharBuffer
when (not (isWriteBuffer buf)) $ do
flushCharReadBuffer h_
flushByteReadBuffer h_
buf <- readIORef haCharBuffer
writeIORef haCharBuffer buf{ bufState = WriteBuffer }
buf <- readIORef haByteBuffer
buf' <- Buffered.emptyWriteBuffer haDevice buf
writeIORef haByteBuffer buf'
act h_
_other -> act h_
-- ---------------------------------------------------------------------------
-- Wrapper for read operations. | 856 | checkWritableHandle act h_@Handle__{..}
= case haType of
ClosedHandle -> ioe_closedHandle
SemiClosedHandle -> ioe_semiclosedHandle
ReadHandle -> ioe_notWritable
ReadWriteHandle -> do
buf <- readIORef haCharBuffer
when (not (isWriteBuffer buf)) $ do
flushCharReadBuffer h_
flushByteReadBuffer h_
buf <- readIORef haCharBuffer
writeIORef haCharBuffer buf{ bufState = WriteBuffer }
buf <- readIORef haByteBuffer
buf' <- Buffered.emptyWriteBuffer haDevice buf
writeIORef haByteBuffer buf'
act h_
_other -> act h_
-- ---------------------------------------------------------------------------
-- Wrapper for read operations. | 794 | false | true | 0 | 15 | 254 | 193 | 88 | 105 | null | null |
raventid/coursera_learning | haskell/will_kurt/capstone_time_series.hs | mit | maxTS :: (Ord a) => TS a -> Maybe (Int, Maybe a)
maxTS = compareTS max | 70 | maxTS :: (Ord a) => TS a -> Maybe (Int, Maybe a)
maxTS = compareTS max | 70 | maxTS = compareTS max | 21 | false | true | 0 | 9 | 15 | 42 | 21 | 21 | null | null |
sashabu/libcspm | src/Util/PrettyPrint.hs | bsd-3-clause | punctuateFront :: Doc -> [Doc] -> [Doc]
punctuateFront _ [] = [] | 64 | punctuateFront :: Doc -> [Doc] -> [Doc]
punctuateFront _ [] = [] | 64 | punctuateFront _ [] = [] | 24 | false | true | 0 | 7 | 11 | 34 | 18 | 16 | null | null |
jaanos/TPJ-2015-16 | homework2/examples_llmh.hs | mit | ieve l =
case l of
[] -> [] ;
x : xs -> x : (sieve (fltr (\n -> neg (divides x n)) xs)) ;
| 100 | sieve l =
case l of
[] -> [] ;
x : xs -> x : (sieve (fltr (\n -> neg (divides x n)) xs)) ; | 100 | sieve l =
case l of
[] -> [] ;
x : xs -> x : (sieve (fltr (\n -> neg (divides x n)) xs)) ; | 100 | false | false | 0 | 17 | 36 | 72 | 37 | 35 | null | null |
semaj/ants | src/Main.hs | bsd-3-clause | spaceAnts ants = cycleAnts ants ants spaceAnt | 45 | spaceAnts ants = cycleAnts ants ants spaceAnt | 45 | spaceAnts ants = cycleAnts ants ants spaceAnt | 45 | false | false | 0 | 5 | 6 | 16 | 7 | 9 | null | null |
forked-upstream-packages-for-ghcjs/ghc | compiler/prelude/PrelNames.hs | bsd-3-clause | -- See Note [WildCard binders]
absentErrorIdKey = mkPreludeMiscIdUnique 1 | 87 | absentErrorIdKey = mkPreludeMiscIdUnique 1 | 56 | absentErrorIdKey = mkPreludeMiscIdUnique 1 | 56 | true | false | 0 | 5 | 22 | 10 | 5 | 5 | null | null |
wat-aro/scheme | app/Main.hs | bsd-3-clause | main :: IO ()
main = do args <- getArgs
if null args
then runRepl
else runOne args | 116 | main :: IO ()
main = do args <- getArgs
if null args
then runRepl
else runOne args | 116 | main = do args <- getArgs
if null args
then runRepl
else runOne args | 102 | false | true | 0 | 9 | 51 | 46 | 20 | 26 | null | null |
jmct/IterativeCompiler | frontend/GMachine.hs | mit | --When preparing the stack to be printed
showStack :: GMState -> Iseq
showStack state
= iConcat [IStr " Stack:["
,IIndent (iInterleave INewline
(map (showStackItem state)
(reverse (getStack state))))
,IStr "]"] | 319 | showStack :: GMState -> Iseq
showStack state
= iConcat [IStr " Stack:["
,IIndent (iInterleave INewline
(map (showStackItem state)
(reverse (getStack state))))
,IStr "]"] | 278 | showStack state
= iConcat [IStr " Stack:["
,IIndent (iInterleave INewline
(map (showStackItem state)
(reverse (getStack state))))
,IStr "]"] | 249 | true | true | 0 | 15 | 138 | 74 | 37 | 37 | null | null |
spacekitteh/smcghc | libraries/base/GHC/IO/Handle/Text.hs | bsd-3-clause | -- | 'hGetBufNonBlocking' @hdl buf count@ reads data from the handle @hdl@
-- into the buffer @buf@ until either EOF is reached, or
-- @count@ 8-bit bytes have been read, or there is no more data available
-- to read immediately.
--
-- 'hGetBufNonBlocking' is identical to 'hGetBuf', except that it will
-- never block waiting for data to become available, instead it returns
-- only whatever data is available. To wait for data to arrive before
-- calling 'hGetBufNonBlocking', use 'hWaitForInput'.
--
-- If the handle is a pipe or socket, and the writing end
-- is closed, 'hGetBufNonBlocking' will behave as if EOF was reached.
--
-- 'hGetBufNonBlocking' ignores the prevailing 'TextEncoding' and
-- 'NewlineMode' on the 'Handle', and reads bytes directly.
--
-- NOTE: on Windows, this function does not work correctly; it
-- behaves identically to 'hGetBuf'.
hGetBufNonBlocking :: Handle -> Ptr a -> Int -> IO Int
hGetBufNonBlocking h ptr count
| count == 0 = return 0
| count < 0 = illegalBufferSize h "hGetBufNonBlocking" count
| otherwise =
wantReadableHandle_ "hGetBufNonBlocking" h $ \ h_@Handle__{..} -> do
flushCharReadBuffer h_
buf@Buffer{ bufRaw=raw, bufR=w, bufL=r, bufSize=sz }
<- readIORef haByteBuffer
if isEmptyBuffer buf
then bufReadNBEmpty h_ buf (castPtr ptr) 0 count
else bufReadNBNonEmpty h_ buf (castPtr ptr) 0 count | 1,422 | hGetBufNonBlocking :: Handle -> Ptr a -> Int -> IO Int
hGetBufNonBlocking h ptr count
| count == 0 = return 0
| count < 0 = illegalBufferSize h "hGetBufNonBlocking" count
| otherwise =
wantReadableHandle_ "hGetBufNonBlocking" h $ \ h_@Handle__{..} -> do
flushCharReadBuffer h_
buf@Buffer{ bufRaw=raw, bufR=w, bufL=r, bufSize=sz }
<- readIORef haByteBuffer
if isEmptyBuffer buf
then bufReadNBEmpty h_ buf (castPtr ptr) 0 count
else bufReadNBNonEmpty h_ buf (castPtr ptr) 0 count | 557 | hGetBufNonBlocking h ptr count
| count == 0 = return 0
| count < 0 = illegalBufferSize h "hGetBufNonBlocking" count
| otherwise =
wantReadableHandle_ "hGetBufNonBlocking" h $ \ h_@Handle__{..} -> do
flushCharReadBuffer h_
buf@Buffer{ bufRaw=raw, bufR=w, bufL=r, bufSize=sz }
<- readIORef haByteBuffer
if isEmptyBuffer buf
then bufReadNBEmpty h_ buf (castPtr ptr) 0 count
else bufReadNBNonEmpty h_ buf (castPtr ptr) 0 count | 502 | true | true | 2 | 14 | 294 | 212 | 113 | 99 | null | null |
ihc/futhark | src/Futhark/Representation/Primitive.hs | isc | allPrimTypes :: [PrimType]
allPrimTypes = map IntType allIntTypes ++
map FloatType allFloatTypes ++
[Bool, Cert] | 142 | allPrimTypes :: [PrimType]
allPrimTypes = map IntType allIntTypes ++
map FloatType allFloatTypes ++
[Bool, Cert] | 142 | allPrimTypes = map IntType allIntTypes ++
map FloatType allFloatTypes ++
[Bool, Cert] | 115 | false | true | 0 | 7 | 44 | 38 | 20 | 18 | null | null |
bch29/streaming-png | src/Codec/Picture/Png/Streaming/MainData.hs | lgpl-3.0 | -- | Given a stream of filtered scanlines, reconstruct each of them.
reconstructScanlines
:: (MonadThrow m)
=> Int
-> Stream (ByteString m) m r
-> Stream (Of UnfilteredScanline) m r
reconstructScanlines prevByteDistance
= mapWithMemory (reconstructScanline prevByteDistance)
. S.mapped Q.toStrict | 317 | reconstructScanlines
:: (MonadThrow m)
=> Int
-> Stream (ByteString m) m r
-> Stream (Of UnfilteredScanline) m r
reconstructScanlines prevByteDistance
= mapWithMemory (reconstructScanline prevByteDistance)
. S.mapped Q.toStrict | 248 | reconstructScanlines prevByteDistance
= mapWithMemory (reconstructScanline prevByteDistance)
. S.mapped Q.toStrict | 118 | true | true | 1 | 11 | 59 | 84 | 39 | 45 | null | null |
reiddraper/async | Control/Concurrent/Async.hs | bsd-3-clause | -- | Like 'waitEither', but also 'cancel's both @Async@s before
-- returning.
--
waitEitherCancel :: Async a -> Async b -> IO (Either a b)
waitEitherCancel left right =
waitEither left right `finally` (cancel left >> cancel right) | 232 | waitEitherCancel :: Async a -> Async b -> IO (Either a b)
waitEitherCancel left right =
waitEither left right `finally` (cancel left >> cancel right) | 151 | waitEitherCancel left right =
waitEither left right `finally` (cancel left >> cancel right) | 93 | true | true | 0 | 9 | 39 | 74 | 35 | 39 | null | null |
dawedawe/kripkeweb | src/KripkeTypes.hs | bsd-3-clause | -- |Drop the reflexive relations in the model.
toUnreflModel :: Model -> Model
toUnreflModel (Model (Frame w r) l) =
let r' = S.fromList (dropReflRels (S.toList r))
in Model (Frame w r') l | 197 | toUnreflModel :: Model -> Model
toUnreflModel (Model (Frame w r) l) =
let r' = S.fromList (dropReflRels (S.toList r))
in Model (Frame w r') l | 150 | toUnreflModel (Model (Frame w r) l) =
let r' = S.fromList (dropReflRels (S.toList r))
in Model (Frame w r') l | 118 | true | true | 0 | 14 | 41 | 78 | 38 | 40 | null | null |
keera-studios/hsQt | Qtc/Gui/QTextFrame.hs | bsd-2-clause | childFrames :: QTextFrame a -> (()) -> IO ([QTextFrame ()])
childFrames x0 ()
= withQListQTextFrameResult $ \arr ->
withObjectPtr x0 $ \cobj_x0 ->
qtc_QTextFrame_childFrames cobj_x0 arr | 195 | childFrames :: QTextFrame a -> (()) -> IO ([QTextFrame ()])
childFrames x0 ()
= withQListQTextFrameResult $ \arr ->
withObjectPtr x0 $ \cobj_x0 ->
qtc_QTextFrame_childFrames cobj_x0 arr | 195 | childFrames x0 ()
= withQListQTextFrameResult $ \arr ->
withObjectPtr x0 $ \cobj_x0 ->
qtc_QTextFrame_childFrames cobj_x0 arr | 135 | false | true | 0 | 11 | 35 | 74 | 37 | 37 | null | null |
dmbarbour/awelon | hsrc_util/ABCGraph.hs | bsd-3-clause | runOp (Tok tok) = opTok tok | 27 | runOp (Tok tok) = opTok tok | 27 | runOp (Tok tok) = opTok tok | 27 | false | false | 0 | 6 | 5 | 19 | 8 | 11 | null | null |
da-x/free | src/Control/Monad/Trans/Iter.hs | bsd-3-clause | -- | Lift a monad homomorphism from @m@ to @n@ into a Monad homomorphism from @'IterT' m@ to @'IterT' n@.
hoistIterT :: Monad n => (forall a. m a -> n a) -> IterT m b -> IterT n b
hoistIterT f (IterT as) = IterT (fmap (hoistIterT f) `liftM` f as) | 246 | hoistIterT :: Monad n => (forall a. m a -> n a) -> IterT m b -> IterT n b
hoistIterT f (IterT as) = IterT (fmap (hoistIterT f) `liftM` f as) | 140 | hoistIterT f (IterT as) = IterT (fmap (hoistIterT f) `liftM` f as) | 66 | true | true | 0 | 10 | 51 | 90 | 44 | 46 | null | null |
sherwoodwang/wxHaskell | wxdirect/src/CompileClasses.hs | lgpl-2.1 | {-----------------------------------------------------------------------------------------
Compile
-----------------------------------------------------------------------------------------}
compileClasses :: Bool -> String -> String -> String -> FilePath -> [FilePath] -> IO ()
compileClasses showIgnore moduleRoot moduleClassTypesName moduleName outputFile inputFiles
= do declss <- mapM parseC inputFiles
time <- getCurrentTime
let splitter = 'M'
(decls1,decls2) = let isLower decl = (haskellDeclName (declName decl) < [toLower splitter])
in span isLower (deriveTypes showIgnore (sortBy cmpDecl (concat declss)))
postfix1 = "A" ++ [toEnum (fromEnum splitter -1)]
postfix2 = [splitter] ++ "Z"
module1 = moduleRoot ++ moduleName ++ postfix1
module2 = moduleRoot ++ moduleName ++ postfix2
export = concat [ ["module " ++ moduleRoot ++ moduleName
, " ( -- * Re-export"
, " module " ++ module1
, " , module " ++ module2
, " , module " ++ moduleRoot ++ moduleClassTypesName
, " ) where"
, ""
, "import " ++ module1
, "import " ++ module2
, "import " ++ moduleRoot ++ moduleClassTypesName
, ""
]
]
(m1,c1) <- compileClassesFile showIgnore moduleRoot moduleClassTypesName
(moduleName ++ postfix1) (outputFile ++ postfix1) inputFiles decls1 time
(m2,c2) <- compileClassesFile showIgnore moduleRoot moduleClassTypesName
(moduleName ++ postfix2) (outputFile ++ postfix2) inputFiles decls2 time
let methodCount = m1 + m2
classCount = c1 + c2
prologue = getPrologue moduleName "class"
(show methodCount ++ " methods for " ++ show classCount ++ " classes.")
inputFiles
let output = unlines (prologue ++ export)
putStrLn ("generating: " ++ outputFile ++ ".hs")
writeFileLazy (outputFile ++ ".hs") output
putStrLn ("generated " ++ show methodCount ++ " total methods for " ++ show classCount ++ " total classes.")
putStrLn ("ok.") | 2,596 | compileClasses :: Bool -> String -> String -> String -> FilePath -> [FilePath] -> IO ()
compileClasses showIgnore moduleRoot moduleClassTypesName moduleName outputFile inputFiles
= do declss <- mapM parseC inputFiles
time <- getCurrentTime
let splitter = 'M'
(decls1,decls2) = let isLower decl = (haskellDeclName (declName decl) < [toLower splitter])
in span isLower (deriveTypes showIgnore (sortBy cmpDecl (concat declss)))
postfix1 = "A" ++ [toEnum (fromEnum splitter -1)]
postfix2 = [splitter] ++ "Z"
module1 = moduleRoot ++ moduleName ++ postfix1
module2 = moduleRoot ++ moduleName ++ postfix2
export = concat [ ["module " ++ moduleRoot ++ moduleName
, " ( -- * Re-export"
, " module " ++ module1
, " , module " ++ module2
, " , module " ++ moduleRoot ++ moduleClassTypesName
, " ) where"
, ""
, "import " ++ module1
, "import " ++ module2
, "import " ++ moduleRoot ++ moduleClassTypesName
, ""
]
]
(m1,c1) <- compileClassesFile showIgnore moduleRoot moduleClassTypesName
(moduleName ++ postfix1) (outputFile ++ postfix1) inputFiles decls1 time
(m2,c2) <- compileClassesFile showIgnore moduleRoot moduleClassTypesName
(moduleName ++ postfix2) (outputFile ++ postfix2) inputFiles decls2 time
let methodCount = m1 + m2
classCount = c1 + c2
prologue = getPrologue moduleName "class"
(show methodCount ++ " methods for " ++ show classCount ++ " classes.")
inputFiles
let output = unlines (prologue ++ export)
putStrLn ("generating: " ++ outputFile ++ ".hs")
writeFileLazy (outputFile ++ ".hs") output
putStrLn ("generated " ++ show methodCount ++ " total methods for " ++ show classCount ++ " total classes.")
putStrLn ("ok.") | 2,404 | compileClasses showIgnore moduleRoot moduleClassTypesName moduleName outputFile inputFiles
= do declss <- mapM parseC inputFiles
time <- getCurrentTime
let splitter = 'M'
(decls1,decls2) = let isLower decl = (haskellDeclName (declName decl) < [toLower splitter])
in span isLower (deriveTypes showIgnore (sortBy cmpDecl (concat declss)))
postfix1 = "A" ++ [toEnum (fromEnum splitter -1)]
postfix2 = [splitter] ++ "Z"
module1 = moduleRoot ++ moduleName ++ postfix1
module2 = moduleRoot ++ moduleName ++ postfix2
export = concat [ ["module " ++ moduleRoot ++ moduleName
, " ( -- * Re-export"
, " module " ++ module1
, " , module " ++ module2
, " , module " ++ moduleRoot ++ moduleClassTypesName
, " ) where"
, ""
, "import " ++ module1
, "import " ++ module2
, "import " ++ moduleRoot ++ moduleClassTypesName
, ""
]
]
(m1,c1) <- compileClassesFile showIgnore moduleRoot moduleClassTypesName
(moduleName ++ postfix1) (outputFile ++ postfix1) inputFiles decls1 time
(m2,c2) <- compileClassesFile showIgnore moduleRoot moduleClassTypesName
(moduleName ++ postfix2) (outputFile ++ postfix2) inputFiles decls2 time
let methodCount = m1 + m2
classCount = c1 + c2
prologue = getPrologue moduleName "class"
(show methodCount ++ " methods for " ++ show classCount ++ " classes.")
inputFiles
let output = unlines (prologue ++ export)
putStrLn ("generating: " ++ outputFile ++ ".hs")
writeFileLazy (outputFile ++ ".hs") output
putStrLn ("generated " ++ show methodCount ++ " total methods for " ++ show classCount ++ " total classes.")
putStrLn ("ok.") | 2,316 | true | true | 0 | 18 | 1,032 | 543 | 276 | 267 | null | null |
benmos/HLevy | src/UUParsingLibFixes.hs | bsd-3-clause | runParser :: String -> P (Str Char String LineColPos) a -> String -> a
runParser inputName p s | (a,b) <- execParser p s =
if null b
then a
else error (printf "Failed parsing '%s' :\n%s\n" inputName (pruneError s b))
-- We do 'pruneError' above because otherwise you can end
-- up reporting huge correction streams, and that's
-- generally not helpful... but the pruning does discard info...
where -- | Produce a single simple, user-friendly error message
pruneError :: String -> [Error LineColPos] -> String
pruneError _ [] = ""
pruneError _ (DeletedAtEnd x : _) = printf "Unexpected '%s' at end." x
pruneError s (Inserted _ pos exp : _) = prettyError s exp pos
pruneError s (Deleted _ pos exp : _) = prettyError s exp pos
prettyError :: String -> [String] -> LineColPos -> String
prettyError s exp p@(LineColPos line c abs) = printf "Expected %s at %s :\n%s\n%s\n%s\n"
(show_expecting p exp)
(show p)
aboveString
inputFrag
belowString
where
s' = map (\c -> if c=='\n' || c=='\r' || c=='\t' then ' ' else c) s
aboveString = replicate 30 ' ' ++ "v"
belowString = replicate 30 ' ' ++ "^"
inputFrag = replicate (30 - c) ' ' ++ (take 71 $ drop (c - 30) s') | 1,725 | runParser :: String -> P (Str Char String LineColPos) a -> String -> a
runParser inputName p s | (a,b) <- execParser p s =
if null b
then a
else error (printf "Failed parsing '%s' :\n%s\n" inputName (pruneError s b))
-- We do 'pruneError' above because otherwise you can end
-- up reporting huge correction streams, and that's
-- generally not helpful... but the pruning does discard info...
where -- | Produce a single simple, user-friendly error message
pruneError :: String -> [Error LineColPos] -> String
pruneError _ [] = ""
pruneError _ (DeletedAtEnd x : _) = printf "Unexpected '%s' at end." x
pruneError s (Inserted _ pos exp : _) = prettyError s exp pos
pruneError s (Deleted _ pos exp : _) = prettyError s exp pos
prettyError :: String -> [String] -> LineColPos -> String
prettyError s exp p@(LineColPos line c abs) = printf "Expected %s at %s :\n%s\n%s\n%s\n"
(show_expecting p exp)
(show p)
aboveString
inputFrag
belowString
where
s' = map (\c -> if c=='\n' || c=='\r' || c=='\t' then ' ' else c) s
aboveString = replicate 30 ' ' ++ "v"
belowString = replicate 30 ' ' ++ "^"
inputFrag = replicate (30 - c) ' ' ++ (take 71 $ drop (c - 30) s') | 1,725 | runParser inputName p s | (a,b) <- execParser p s =
if null b
then a
else error (printf "Failed parsing '%s' :\n%s\n" inputName (pruneError s b))
-- We do 'pruneError' above because otherwise you can end
-- up reporting huge correction streams, and that's
-- generally not helpful... but the pruning does discard info...
where -- | Produce a single simple, user-friendly error message
pruneError :: String -> [Error LineColPos] -> String
pruneError _ [] = ""
pruneError _ (DeletedAtEnd x : _) = printf "Unexpected '%s' at end." x
pruneError s (Inserted _ pos exp : _) = prettyError s exp pos
pruneError s (Deleted _ pos exp : _) = prettyError s exp pos
prettyError :: String -> [String] -> LineColPos -> String
prettyError s exp p@(LineColPos line c abs) = printf "Expected %s at %s :\n%s\n%s\n%s\n"
(show_expecting p exp)
(show p)
aboveString
inputFrag
belowString
where
s' = map (\c -> if c=='\n' || c=='\r' || c=='\t' then ' ' else c) s
aboveString = replicate 30 ' ' ++ "v"
belowString = replicate 30 ' ' ++ "^"
inputFrag = replicate (30 - c) ' ' ++ (take 71 $ drop (c - 30) s') | 1,654 | false | true | 20 | 12 | 784 | 416 | 210 | 206 | null | null |
databrary/databrary | src/Static/Fillin.hs | agpl-3.0 | staticSendInvestigator :: Party -> ActionContext -> IO ()
staticSendInvestigator p ActionContext{ contextTimestamp = t, contextService = rc@Service{ serviceStatic = Static{ staticAuthorizeAddr = a, staticInvestigator = Just req, staticKey = key } } } = void $ forkIO $
handle
(\(e :: HC.HttpException) -> logMsg t ("staticSendInvestigator: " ++ show e) (serviceLogs rc))
$ void $ HC.httpNoBody req
{ HC.requestBody = HC.RequestBodyBS $ renderSimpleQuery False fields
} (serviceHTTPClient rc)
where
fields =
[ ("auth", convertToBase Base16 $ key $ foldMap snd $ tail fields)
, ("id", BSC.pack $ show $ partyId $ partyRow p)
, ("name", TE.encodeUtf8 $ partyName $ partyRow p)
, ("date", BSC.pack $ formatTime defaultTimeLocale "%B %e, %Y" t)
, ("mail", a)
] | 805 | staticSendInvestigator :: Party -> ActionContext -> IO ()
staticSendInvestigator p ActionContext{ contextTimestamp = t, contextService = rc@Service{ serviceStatic = Static{ staticAuthorizeAddr = a, staticInvestigator = Just req, staticKey = key } } } = void $ forkIO $
handle
(\(e :: HC.HttpException) -> logMsg t ("staticSendInvestigator: " ++ show e) (serviceLogs rc))
$ void $ HC.httpNoBody req
{ HC.requestBody = HC.RequestBodyBS $ renderSimpleQuery False fields
} (serviceHTTPClient rc)
where
fields =
[ ("auth", convertToBase Base16 $ key $ foldMap snd $ tail fields)
, ("id", BSC.pack $ show $ partyId $ partyRow p)
, ("name", TE.encodeUtf8 $ partyName $ partyRow p)
, ("date", BSC.pack $ formatTime defaultTimeLocale "%B %e, %Y" t)
, ("mail", a)
] | 805 | staticSendInvestigator p ActionContext{ contextTimestamp = t, contextService = rc@Service{ serviceStatic = Static{ staticAuthorizeAddr = a, staticInvestigator = Just req, staticKey = key } } } = void $ forkIO $
handle
(\(e :: HC.HttpException) -> logMsg t ("staticSendInvestigator: " ++ show e) (serviceLogs rc))
$ void $ HC.httpNoBody req
{ HC.requestBody = HC.RequestBodyBS $ renderSimpleQuery False fields
} (serviceHTTPClient rc)
where
fields =
[ ("auth", convertToBase Base16 $ key $ foldMap snd $ tail fields)
, ("id", BSC.pack $ show $ partyId $ partyRow p)
, ("name", TE.encodeUtf8 $ partyName $ partyRow p)
, ("date", BSC.pack $ formatTime defaultTimeLocale "%B %e, %Y" t)
, ("mail", a)
] | 747 | false | true | 2 | 16 | 164 | 292 | 154 | 138 | null | null |
leshchevds/ganeti | src/Ganeti/HTools/Node.hs | bsd-2-clause | -- | Adds a secondary instance (extended version).
addSecEx :: Bool -> Node -> Instance.Instance -> T.Ndx -> T.OpResult Node
addSecEx = addSecExEx False | 152 | addSecEx :: Bool -> Node -> Instance.Instance -> T.Ndx -> T.OpResult Node
addSecEx = addSecExEx False | 101 | addSecEx = addSecExEx False | 27 | true | true | 0 | 10 | 23 | 40 | 20 | 20 | null | null |
epsilonhalbe/VocabuLambda | Main.hs | bsd-3-clause | control db test "print db" = do frqKnowList <- query db ViewAllVocabulary
print frqKnowList
command db test | 186 | control db test "print db" = do frqKnowList <- query db ViewAllVocabulary
print frqKnowList
command db test | 186 | control db test "print db" = do frqKnowList <- query db ViewAllVocabulary
print frqKnowList
command db test | 186 | false | false | 0 | 8 | 95 | 40 | 16 | 24 | null | null |
shayan-najd/HsParser | Language/Haskell/Utility/Bag.hs | gpl-3.0 | anyBag :: (a -> Bool) -> Bag a -> Bool
anyBag _ EmptyBag = False | 71 | anyBag :: (a -> Bool) -> Bag a -> Bool
anyBag _ EmptyBag = False | 71 | anyBag _ EmptyBag = False | 32 | false | true | 0 | 8 | 21 | 40 | 18 | 22 | null | null |
Gabriel439/Haskell-Dhall-Library | dhall-lsp-server/src/Dhall/LSP/Backend/Parsing.hs | bsd-3-clause | -- | Parse the outermost binding in a Src descriptor of a let-block and return
-- the rest. Ex. on input `let a = 0 let b = a in b` parses `let a = 0 ` and
-- returns the Src descriptor containing `let b = a in b`.
getLetInner :: Src -> Maybe Src
getLetInner (Src left _ text) = Megaparsec.parseMaybe (unParser parseLetInnerOffset) text
where parseLetInnerOffset = do
setSourcePos left
_let
nonemptyWhitespace
_ <- label
whitespace
_ <- optional (do
_ <- _colon
nonemptyWhitespace
_ <- expr
whitespace)
_equal
whitespace
_ <- expr
whitespace
_ <- optional _in
whitespace
begin <- Megaparsec.getSourcePos
tokens <- Megaparsec.takeRest
end <- Megaparsec.getSourcePos
return (Src begin end tokens)
-- | Given an Src of a let expression return the Src containing the type
-- annotation. If the let expression does not have a type annotation return
-- a 0-length Src where we can insert one. | 1,104 | getLetInner :: Src -> Maybe Src
getLetInner (Src left _ text) = Megaparsec.parseMaybe (unParser parseLetInnerOffset) text
where parseLetInnerOffset = do
setSourcePos left
_let
nonemptyWhitespace
_ <- label
whitespace
_ <- optional (do
_ <- _colon
nonemptyWhitespace
_ <- expr
whitespace)
_equal
whitespace
_ <- expr
whitespace
_ <- optional _in
whitespace
begin <- Megaparsec.getSourcePos
tokens <- Megaparsec.takeRest
end <- Megaparsec.getSourcePos
return (Src begin end tokens)
-- | Given an Src of a let expression return the Src containing the type
-- annotation. If the let expression does not have a type annotation return
-- a 0-length Src where we can insert one. | 885 | getLetInner (Src left _ text) = Megaparsec.parseMaybe (unParser parseLetInnerOffset) text
where parseLetInnerOffset = do
setSourcePos left
_let
nonemptyWhitespace
_ <- label
whitespace
_ <- optional (do
_ <- _colon
nonemptyWhitespace
_ <- expr
whitespace)
_equal
whitespace
_ <- expr
whitespace
_ <- optional _in
whitespace
begin <- Megaparsec.getSourcePos
tokens <- Megaparsec.takeRest
end <- Megaparsec.getSourcePos
return (Src begin end tokens)
-- | Given an Src of a let expression return the Src containing the type
-- annotation. If the let expression does not have a type annotation return
-- a 0-length Src where we can insert one. | 853 | true | true | 0 | 13 | 369 | 190 | 84 | 106 | null | null |
atsukotakahashi/wi | src/library/Yi/Syntax/Latex.hs | gpl-2.0 | isNoise :: Token -> Bool
isNoise Text = True | 44 | isNoise :: Token -> Bool
isNoise Text = True | 44 | isNoise Text = True | 19 | false | true | 0 | 7 | 8 | 24 | 10 | 14 | null | null |
energyflowanalysis/efa-2.1 | test/EFA/Test/Sequence.hs | bsd-3-clause | prop_chopProjectiveApprox ::
PowerRecord Node [] Double -> Bool
prop_chopProjectiveApprox prec =
let secs :: Sequ.List (PowerRecord Node [] Double)
secs = Chop.chopAtZeroCrossingsPowerRecord False prec
in Chop.approxSequPwrRecord (1e-8)
secs
(Chop.chopAtZeroCrossingsPowerRecord False $
Chop.concatPowerRecords secs) | 364 | prop_chopProjectiveApprox ::
PowerRecord Node [] Double -> Bool
prop_chopProjectiveApprox prec =
let secs :: Sequ.List (PowerRecord Node [] Double)
secs = Chop.chopAtZeroCrossingsPowerRecord False prec
in Chop.approxSequPwrRecord (1e-8)
secs
(Chop.chopAtZeroCrossingsPowerRecord False $
Chop.concatPowerRecords secs) | 364 | prop_chopProjectiveApprox prec =
let secs :: Sequ.List (PowerRecord Node [] Double)
secs = Chop.chopAtZeroCrossingsPowerRecord False prec
in Chop.approxSequPwrRecord (1e-8)
secs
(Chop.chopAtZeroCrossingsPowerRecord False $
Chop.concatPowerRecords secs) | 297 | false | true | 0 | 12 | 80 | 96 | 46 | 50 | null | null |
chadbrewbaker/shellcheck | ShellCheck/Parser.hs | gpl-3.0 | prop_readBackTicked8 = isOk readSimpleCommand "echo `#comment` \\\nbar baz" | 75 | prop_readBackTicked8 = isOk readSimpleCommand "echo `#comment` \\\nbar baz" | 75 | prop_readBackTicked8 = isOk readSimpleCommand "echo `#comment` \\\nbar baz" | 75 | false | false | 1 | 5 | 7 | 14 | 5 | 9 | null | null |
josiah14/lambdaline | LambdaLine/XTerm/Colors.hs | gpl-3.0 | indianRed2 :: Color
indianRed2 = "204" | 38 | indianRed2 :: Color
indianRed2 = "204" | 38 | indianRed2 = "204" | 18 | false | true | 0 | 6 | 5 | 18 | 7 | 11 | null | null |
nevrenato/Hets_Fork | SoftFOL/ParseTPTP.hs | gpl-2.0 | lexeme :: Parser a -> Parser a
lexeme = (<< skipAll) | 52 | lexeme :: Parser a -> Parser a
lexeme = (<< skipAll) | 52 | lexeme = (<< skipAll) | 21 | false | true | 0 | 7 | 10 | 31 | 14 | 17 | null | null |
mettekou/ghc | compiler/typecheck/TcRnTypes.hs | bsd-3-clause | isCFunEqCan _ = False | 21 | isCFunEqCan _ = False | 21 | isCFunEqCan _ = False | 21 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
castaway/pandoc | src/Text/Pandoc/Readers/RST.hs | gpl-2.0 | indentedLine :: String -> GenParser Char st [Char]
indentedLine indents = try $ do
string indents
manyTill anyChar newline
-- one or more indented lines, possibly separated by blank lines.
-- any amount of indentation will work. | 233 | indentedLine :: String -> GenParser Char st [Char]
indentedLine indents = try $ do
string indents
manyTill anyChar newline
-- one or more indented lines, possibly separated by blank lines.
-- any amount of indentation will work. | 233 | indentedLine indents = try $ do
string indents
manyTill anyChar newline
-- one or more indented lines, possibly separated by blank lines.
-- any amount of indentation will work. | 182 | false | true | 2 | 8 | 41 | 54 | 24 | 30 | null | null |
haskell/filepath | System/FilePath/Windows.hs | bsd-3-clause | ---------------------------------------------------------------------
-- Drive methods
-- | Is the given character a valid drive letter?
-- only a-z and A-Z are letters, not isAlpha which is more unicodey
isLetter :: Char -> Bool
isLetter x = isAsciiLower x || isAsciiUpper x | 276 | isLetter :: Char -> Bool
isLetter x = isAsciiLower x || isAsciiUpper x | 70 | isLetter x = isAsciiLower x || isAsciiUpper x | 45 | true | true | 0 | 6 | 40 | 32 | 17 | 15 | null | null |
lally/org-issue-sync | tests/Sync/RetrieveSpec.hs | apache-2.0 | spec :: Spec
spec = do
describe "gets new issues" $ do
it "returns new issues fetched" $ do
nrItems <- countNew Nothing [] simpleNewItems
nrItems `shouldBe` 3
it "only loads them once" $ do
let repeats = map FetchedIssue $ take 1 $ sIssues simpleNewItems
nrItems <- countNew Nothing repeats simpleNewItems
nrItems `shouldBe` 3
describe "merges issues" $ do
it "marks merges" $ do
let markLoaded iss = LoadedIssue True simpleIssueFile iss
loaded = map markLoaded $ take 1 $ sIssues simpleNewItems
nrItems <- countMerge Nothing loaded simpleNewItems True
nrItems `shouldBe` 1
it "ignores stub or archived issues" $ do
let markLoaded iss = LoadedIssue False simpleIssueFile iss
loaded = map markLoaded $ take 1 $ sIssues simpleNewItems
nrItems <- countLoaded Nothing loaded simpleNewItems
nrUpdatedItems <- countMerge Nothing loaded simpleNewItems True
nrItems `shouldBe` 1
nrUpdatedItems `shouldBe` 0
-- TODO(lally): not sure if I still need this.
--describe "updates orphans" $ do
-- it "updates orphans" $ undefined
-- it "ignores stub or archived orphans" $ undefined | 1,194 | spec :: Spec
spec = do
describe "gets new issues" $ do
it "returns new issues fetched" $ do
nrItems <- countNew Nothing [] simpleNewItems
nrItems `shouldBe` 3
it "only loads them once" $ do
let repeats = map FetchedIssue $ take 1 $ sIssues simpleNewItems
nrItems <- countNew Nothing repeats simpleNewItems
nrItems `shouldBe` 3
describe "merges issues" $ do
it "marks merges" $ do
let markLoaded iss = LoadedIssue True simpleIssueFile iss
loaded = map markLoaded $ take 1 $ sIssues simpleNewItems
nrItems <- countMerge Nothing loaded simpleNewItems True
nrItems `shouldBe` 1
it "ignores stub or archived issues" $ do
let markLoaded iss = LoadedIssue False simpleIssueFile iss
loaded = map markLoaded $ take 1 $ sIssues simpleNewItems
nrItems <- countLoaded Nothing loaded simpleNewItems
nrUpdatedItems <- countMerge Nothing loaded simpleNewItems True
nrItems `shouldBe` 1
nrUpdatedItems `shouldBe` 0
-- TODO(lally): not sure if I still need this.
--describe "updates orphans" $ do
-- it "updates orphans" $ undefined
-- it "ignores stub or archived orphans" $ undefined | 1,194 | spec = do
describe "gets new issues" $ do
it "returns new issues fetched" $ do
nrItems <- countNew Nothing [] simpleNewItems
nrItems `shouldBe` 3
it "only loads them once" $ do
let repeats = map FetchedIssue $ take 1 $ sIssues simpleNewItems
nrItems <- countNew Nothing repeats simpleNewItems
nrItems `shouldBe` 3
describe "merges issues" $ do
it "marks merges" $ do
let markLoaded iss = LoadedIssue True simpleIssueFile iss
loaded = map markLoaded $ take 1 $ sIssues simpleNewItems
nrItems <- countMerge Nothing loaded simpleNewItems True
nrItems `shouldBe` 1
it "ignores stub or archived issues" $ do
let markLoaded iss = LoadedIssue False simpleIssueFile iss
loaded = map markLoaded $ take 1 $ sIssues simpleNewItems
nrItems <- countLoaded Nothing loaded simpleNewItems
nrUpdatedItems <- countMerge Nothing loaded simpleNewItems True
nrItems `shouldBe` 1
nrUpdatedItems `shouldBe` 0
-- TODO(lally): not sure if I still need this.
--describe "updates orphans" $ do
-- it "updates orphans" $ undefined
-- it "ignores stub or archived orphans" $ undefined | 1,181 | false | true | 0 | 18 | 292 | 304 | 139 | 165 | null | null |
SwiftsNamesake/Southpaw | lib/Southpaw/Picasso/Palette.hs | mit | azure = (0.94117600, 1.00000000, 1.00000000, 1.0) | 64 | azure = (0.94117600, 1.00000000, 1.00000000, 1.0) | 64 | azure = (0.94117600, 1.00000000, 1.00000000, 1.0) | 64 | false | false | 0 | 5 | 20 | 18 | 11 | 7 | null | null |
green-haskell/ghc | compiler/cmm/CLabel.hs | bsd-3-clause | hasHaskellName _ = Nothing | 40 | hasHaskellName _ = Nothing | 40 | hasHaskellName _ = Nothing | 40 | false | false | 0 | 5 | 17 | 9 | 4 | 5 | null | null |
charlesrosenbauer/Bzo-Compiler | src/BzoParserRules.hs | gpl-3.0 | parserIter fname tokens (i@(BzS_Import p1 imp impas)
:(BzS_File p0 mname _ incs imps []):stk) = Left [ParseErr p1 $ pack "Import call found outside of file header."] | 196 | parserIter fname tokens (i@(BzS_Import p1 imp impas)
:(BzS_File p0 mname _ incs imps []):stk) = Left [ParseErr p1 $ pack "Import call found outside of file header."] | 196 | parserIter fname tokens (i@(BzS_Import p1 imp impas)
:(BzS_File p0 mname _ incs imps []):stk) = Left [ParseErr p1 $ pack "Import call found outside of file header."] | 196 | false | false | 0 | 11 | 57 | 71 | 35 | 36 | null | null |
keithodulaigh/Hets | Proofs/HideTheoremShift.hs | gpl-2.0 | hideThmShiftRule :: EdgeId -> DGRule
hideThmShiftRule = DGRuleWithEdge "HideTheoremShift" | 89 | hideThmShiftRule :: EdgeId -> DGRule
hideThmShiftRule = DGRuleWithEdge "HideTheoremShift" | 89 | hideThmShiftRule = DGRuleWithEdge "HideTheoremShift" | 52 | false | true | 0 | 5 | 8 | 18 | 9 | 9 | null | null |
GaloisInc/halvm-ghc | compiler/hsSyn/HsUtils.hs | bsd-3-clause | collectStmtBinders (TransStmt { trS_stmts = stmts }) = collectLStmtsBinders stmts | 81 | collectStmtBinders (TransStmt { trS_stmts = stmts }) = collectLStmtsBinders stmts | 81 | collectStmtBinders (TransStmt { trS_stmts = stmts }) = collectLStmtsBinders stmts | 81 | false | false | 0 | 8 | 9 | 25 | 12 | 13 | null | null |
DaMSL/K3 | src/Language/K3/Interpreter/Utils.hs | apache-2.0 | showIResultTagM :: String -> IResult Value -> EngineM Value [String]
showIResultTagM str r = prettyIResultM r >>= return . showTag str | 134 | showIResultTagM :: String -> IResult Value -> EngineM Value [String]
showIResultTagM str r = prettyIResultM r >>= return . showTag str | 134 | showIResultTagM str r = prettyIResultM r >>= return . showTag str | 65 | false | true | 0 | 9 | 20 | 53 | 24 | 29 | null | null |
maoe/ghc-time-alloc-prof | tests/Regression.hs | bsd-3-clause | generateProfiles :: IO [FilePath]
generateProfiles = do
withFile "hello.hs" WriteMode $ \h ->
hPutStrLn h $ unlines
[ "import Control.Exception"
, "main = evaluate $ fib 100000"
, "fib n = fibs !! n"
, "fibs = 0:1:zipWith (+) fibs (tail fibs)"
]
ghc <- findGhc
void $ readProcess ghc ["-prof", "-rtsopts", "-fforce-recomp", "hello.hs"] ""
for profilingFlags $ \(name, flag) -> do
void $ readProcess "./hello" ["+RTS", flag, "-RTS"] ""
let profName = "hello" <.> name <.> "prof"
renameFile "hello.prof" profName
return profName | 584 | generateProfiles :: IO [FilePath]
generateProfiles = do
withFile "hello.hs" WriteMode $ \h ->
hPutStrLn h $ unlines
[ "import Control.Exception"
, "main = evaluate $ fib 100000"
, "fib n = fibs !! n"
, "fibs = 0:1:zipWith (+) fibs (tail fibs)"
]
ghc <- findGhc
void $ readProcess ghc ["-prof", "-rtsopts", "-fforce-recomp", "hello.hs"] ""
for profilingFlags $ \(name, flag) -> do
void $ readProcess "./hello" ["+RTS", flag, "-RTS"] ""
let profName = "hello" <.> name <.> "prof"
renameFile "hello.prof" profName
return profName | 584 | generateProfiles = do
withFile "hello.hs" WriteMode $ \h ->
hPutStrLn h $ unlines
[ "import Control.Exception"
, "main = evaluate $ fib 100000"
, "fib n = fibs !! n"
, "fibs = 0:1:zipWith (+) fibs (tail fibs)"
]
ghc <- findGhc
void $ readProcess ghc ["-prof", "-rtsopts", "-fforce-recomp", "hello.hs"] ""
for profilingFlags $ \(name, flag) -> do
void $ readProcess "./hello" ["+RTS", flag, "-RTS"] ""
let profName = "hello" <.> name <.> "prof"
renameFile "hello.prof" profName
return profName | 550 | false | true | 0 | 15 | 140 | 164 | 82 | 82 | null | null |
sgillespie/ghc | compiler/codeGen/StgCmmPrim.hs | bsd-3-clause | emitPrimOp dflags res ReadByteArrayOp_Addr args = doIndexByteArrayOp Nothing (bWord dflags) res args | 114 | emitPrimOp dflags res ReadByteArrayOp_Addr args = doIndexByteArrayOp Nothing (bWord dflags) res args | 114 | emitPrimOp dflags res ReadByteArrayOp_Addr args = doIndexByteArrayOp Nothing (bWord dflags) res args | 114 | false | false | 0 | 7 | 25 | 30 | 14 | 16 | null | null |
lefant/kurt | src/Kurt/MainLoop.hs | gpl-3.0 | cmd_kurt_heuristic_total :: CommandHandler
cmd_kurt_heuristic_total [] state =
make_cmd_kurt_heuristic (const (getConfig state)) [] state | 139 | cmd_kurt_heuristic_total :: CommandHandler
cmd_kurt_heuristic_total [] state =
make_cmd_kurt_heuristic (const (getConfig state)) [] state | 139 | cmd_kurt_heuristic_total [] state =
make_cmd_kurt_heuristic (const (getConfig state)) [] state | 96 | false | true | 0 | 9 | 14 | 39 | 19 | 20 | null | null |
mapinguari/SC_HS_Proxy | src/Proxy/Query/Unit.hs | mit | isBuilding ResourceVespeneGeyser = False | 40 | isBuilding ResourceVespeneGeyser = False | 40 | isBuilding ResourceVespeneGeyser = False | 40 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
atsukotakahashi/wi | src/library/Yi/Keymap/Vim/Tag.hs | gpl-2.0 | completeVimTag :: T.Text -> YiM [T.Text]
completeVimTag s =
fmap maybeToList . visitTagTable $ return . flip completeTag s | 124 | completeVimTag :: T.Text -> YiM [T.Text]
completeVimTag s =
fmap maybeToList . visitTagTable $ return . flip completeTag s | 124 | completeVimTag s =
fmap maybeToList . visitTagTable $ return . flip completeTag s | 83 | false | true | 0 | 8 | 20 | 48 | 23 | 25 | null | null |
jaiyalas/creepy-waffle | LeHavre/src/LeHavre.hs | mit | --
wB :: (Int, Int) -> Map (Int, Int) Cat -> Map (Int, Int) Cat
wB xy m = update (const (Just B)) xy m | 102 | wB :: (Int, Int) -> Map (Int, Int) Cat -> Map (Int, Int) Cat
wB xy m = update (const (Just B)) xy m | 99 | wB xy m = update (const (Just B)) xy m | 38 | true | true | 0 | 9 | 24 | 72 | 38 | 34 | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.