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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
derkyjadex/aegg-bomb | src/Game.hs | mit | simulateEgg :: Egg -> State Game (Maybe GameObject)
simulateEgg egg =
do players <- map snd <$> gamePlayers
walls <- gameWalls
let pos = eggPos egg
vel = eggVel egg
bounds = eggBounds egg
playerBoxes =
map (boxAt <$> playerBounds <*> playerPos) players
boxes = playerBoxes ++ walls
Trace pos' frac = trace pos bounds vel boxes
vVel' = eggVVel egg - eggGravity
height' = eggHeight egg + vVel'
if frac < 1 || height' <= 0
then do startExplosion pos' (eggPlayer egg)
return Nothing
else return $ Just (EggObj egg {eggPos = pos'
,eggVVel = vVel'
,eggHeight = height'}) | 765 | simulateEgg :: Egg -> State Game (Maybe GameObject)
simulateEgg egg =
do players <- map snd <$> gamePlayers
walls <- gameWalls
let pos = eggPos egg
vel = eggVel egg
bounds = eggBounds egg
playerBoxes =
map (boxAt <$> playerBounds <*> playerPos) players
boxes = playerBoxes ++ walls
Trace pos' frac = trace pos bounds vel boxes
vVel' = eggVVel egg - eggGravity
height' = eggHeight egg + vVel'
if frac < 1 || height' <= 0
then do startExplosion pos' (eggPlayer egg)
return Nothing
else return $ Just (EggObj egg {eggPos = pos'
,eggVVel = vVel'
,eggHeight = height'}) | 765 | simulateEgg egg =
do players <- map snd <$> gamePlayers
walls <- gameWalls
let pos = eggPos egg
vel = eggVel egg
bounds = eggBounds egg
playerBoxes =
map (boxAt <$> playerBounds <*> playerPos) players
boxes = playerBoxes ++ walls
Trace pos' frac = trace pos bounds vel boxes
vVel' = eggVVel egg - eggGravity
height' = eggHeight egg + vVel'
if frac < 1 || height' <= 0
then do startExplosion pos' (eggPlayer egg)
return Nothing
else return $ Just (EggObj egg {eggPos = pos'
,eggVVel = vVel'
,eggHeight = height'}) | 713 | false | true | 0 | 13 | 300 | 228 | 112 | 116 | null | null |
vedgar/mlr | 2016 Kolokvij/Z3.hs | unlicense | table (Conn n f) = [b | start <- [False, True],
b <- table (Conn (n-1) (\ rest -> f([start] ++ rest)))] | 108 | table (Conn n f) = [b | start <- [False, True],
b <- table (Conn (n-1) (\ rest -> f([start] ++ rest)))] | 108 | table (Conn n f) = [b | start <- [False, True],
b <- table (Conn (n-1) (\ rest -> f([start] ++ rest)))] | 108 | false | false | 0 | 16 | 26 | 81 | 43 | 38 | null | null |
siddhanathan/ghc | compiler/coreSyn/CoreFVs.hs | bsd-3-clause | bndrRuleAndUnfoldingVars ::Var -> VarSet
-- A 'let' can bind a type variable, and idRuleVars assumes
-- it's seeing an Id. This function tests first.
bndrRuleAndUnfoldingVars v | isTyVar v = emptyVarSet
| otherwise = idRuleAndUnfoldingVars v | 268 | bndrRuleAndUnfoldingVars ::Var -> VarSet
bndrRuleAndUnfoldingVars v | isTyVar v = emptyVarSet
| otherwise = idRuleAndUnfoldingVars v | 159 | bndrRuleAndUnfoldingVars v | isTyVar v = emptyVarSet
| otherwise = idRuleAndUnfoldingVars v | 118 | true | true | 0 | 8 | 62 | 48 | 21 | 27 | null | null |
jmct/IterativeCompiler | frontend/frontend.hs | mit | splitFiles :: [Option] -> ([String], [Option])
splitFiles xs = ([s | File s <- ys], zs)
where
(ys, zs) = partition isFile xs | 130 | splitFiles :: [Option] -> ([String], [Option])
splitFiles xs = ([s | File s <- ys], zs)
where
(ys, zs) = partition isFile xs | 130 | splitFiles xs = ([s | File s <- ys], zs)
where
(ys, zs) = partition isFile xs | 83 | false | true | 0 | 9 | 28 | 73 | 40 | 33 | null | null |
OpenXT/manager | rpc-proxy/Settings.hs | gpl-2.0 | defaultSettings :: Settings
defaultSettings = Settings { incomingChannel = FromArgo 5555
, incomingForcedDomID = Nothing
, agentServiceName = Nothing
, outgoingChannel = ToUnixSocket "/var/run/dbus/system_bus_socket"
, verbose = False
, useFirewall = True
, runDbusServer = False
, authDomainUuid = False
, rulesPath = "/etc/rpc-proxy.rules"
, jsonIn = False
, jsonOut = False
, websocketsIn = False
, autoAuth = False
, interceptGetOwnerName = False
, interceptAnonymousDestinations = False } | 871 | defaultSettings :: Settings
defaultSettings = Settings { incomingChannel = FromArgo 5555
, incomingForcedDomID = Nothing
, agentServiceName = Nothing
, outgoingChannel = ToUnixSocket "/var/run/dbus/system_bus_socket"
, verbose = False
, useFirewall = True
, runDbusServer = False
, authDomainUuid = False
, rulesPath = "/etc/rpc-proxy.rules"
, jsonIn = False
, jsonOut = False
, websocketsIn = False
, autoAuth = False
, interceptGetOwnerName = False
, interceptAnonymousDestinations = False } | 871 | defaultSettings = Settings { incomingChannel = FromArgo 5555
, incomingForcedDomID = Nothing
, agentServiceName = Nothing
, outgoingChannel = ToUnixSocket "/var/run/dbus/system_bus_socket"
, verbose = False
, useFirewall = True
, runDbusServer = False
, authDomainUuid = False
, rulesPath = "/etc/rpc-proxy.rules"
, jsonIn = False
, jsonOut = False
, websocketsIn = False
, autoAuth = False
, interceptGetOwnerName = False
, interceptAnonymousDestinations = False } | 843 | false | true | 0 | 7 | 446 | 109 | 69 | 40 | null | null |
olsner/ghc | compiler/utils/FastStringEnv.hs | bsd-3-clause | mapFsEnv :: (elt1 -> elt2) -> FastStringEnv elt1 -> FastStringEnv elt2
emptyFsEnv = emptyUFM | 118 | mapFsEnv :: (elt1 -> elt2) -> FastStringEnv elt1 -> FastStringEnv elt2
emptyFsEnv = emptyUFM | 117 | emptyFsEnv = emptyUFM | 36 | false | true | 0 | 7 | 39 | 36 | 17 | 19 | null | null |
spacekitteh/smcghc | compiler/nativeGen/X86/CodeGen.hs | bsd-3-clause | isVecExpr (CmmMachOp (MO_VF_Add {}) _) = True | 49 | isVecExpr (CmmMachOp (MO_VF_Add {}) _) = True | 49 | isVecExpr (CmmMachOp (MO_VF_Add {}) _) = True | 49 | false | false | 0 | 9 | 10 | 24 | 12 | 12 | null | null |
gabesoft/kapi | test/ElasticSearchSetup.hs | bsd-3-clause | subIds :: [Text]
subIds =
[ "56e60f7d1432afe539337b7e"
, "56e5c9cb1432afe53933789e"
, "56d7e167c788cb1d6eb935f3"
, "56e5cc021432afe539337994"
, "56d7de19c788cb1d6eb91b22"
, "56d7e1b2c788cb1d6eb9396a"
, "56d7e064c788cb1d6eb92ea2"
, "5792e720ed521f1f1704877f"
] | 277 | subIds :: [Text]
subIds =
[ "56e60f7d1432afe539337b7e"
, "56e5c9cb1432afe53933789e"
, "56d7e167c788cb1d6eb935f3"
, "56e5cc021432afe539337994"
, "56d7de19c788cb1d6eb91b22"
, "56d7e1b2c788cb1d6eb9396a"
, "56d7e064c788cb1d6eb92ea2"
, "5792e720ed521f1f1704877f"
] | 277 | subIds =
[ "56e60f7d1432afe539337b7e"
, "56e5c9cb1432afe53933789e"
, "56d7e167c788cb1d6eb935f3"
, "56e5cc021432afe539337994"
, "56d7de19c788cb1d6eb91b22"
, "56d7e1b2c788cb1d6eb9396a"
, "56d7e064c788cb1d6eb92ea2"
, "5792e720ed521f1f1704877f"
] | 260 | false | true | 0 | 5 | 39 | 38 | 24 | 14 | null | null |
JustinUnger/haskell-book | ch14/ch14-ex-3.hs | mit | sortIdempotence :: String -> Bool
sortIdempotence x = (sort x == twice sort x) && (sort x == fourTimes sort x) | 110 | sortIdempotence :: String -> Bool
sortIdempotence x = (sort x == twice sort x) && (sort x == fourTimes sort x) | 110 | sortIdempotence x = (sort x == twice sort x) && (sort x == fourTimes sort x) | 76 | false | true | 0 | 9 | 20 | 58 | 26 | 32 | null | null |
Muzietto/transformerz | haskell/grabmuller/grabmuller_01.hs | mit | runEval1 :: Eval1 a -> a
runEval1 = runIdentity | 49 | runEval1 :: Eval1 a -> a
runEval1 = runIdentity | 47 | runEval1 = runIdentity | 22 | false | true | 0 | 7 | 10 | 25 | 10 | 15 | null | null |
alphalambda/k12math | lib/Drawing.hs | mit | drawLabel p text = translate_ (p +| (0.25,0)) $ P.scale textscale textscale $ P.text text | 89 | drawLabel p text = translate_ (p +| (0.25,0)) $ P.scale textscale textscale $ P.text text | 89 | drawLabel p text = translate_ (p +| (0.25,0)) $ P.scale textscale textscale $ P.text text | 89 | false | false | 0 | 10 | 14 | 47 | 23 | 24 | null | null |
comonoidial/ALFIN | Simulate/DEvalTypes.hs | mit | stats :: Lens' ProcState Stats
stats = lens _stats (\s x -> s {_stats = x}) | 75 | stats :: Lens' ProcState Stats
stats = lens _stats (\s x -> s {_stats = x}) | 75 | stats = lens _stats (\s x -> s {_stats = x}) | 44 | false | true | 0 | 9 | 15 | 46 | 22 | 24 | null | null |
liamoc/sprig-hs | Graphics/UI/SDL/Sprig/Primitives.hs | bsd-3-clause | pixelBlend a a1 a2 a3 a4 = withSurface a $ \a' -> withInteger a1 $ \a1' -> withInteger a2 $ \a2' -> withPixelVl a3 $ \a3' -> withWordVal a4 $ \a4' -> spgPixelBlend a' a1' a2' a3' a4' | 192 | pixelBlend a a1 a2 a3 a4 = withSurface a $ \a' -> withInteger a1 $ \a1' -> withInteger a2 $ \a2' -> withPixelVl a3 $ \a3' -> withWordVal a4 $ \a4' -> spgPixelBlend a' a1' a2' a3' a4' | 192 | pixelBlend a a1 a2 a3 a4 = withSurface a $ \a' -> withInteger a1 $ \a1' -> withInteger a2 $ \a2' -> withPixelVl a3 $ \a3' -> withWordVal a4 $ \a4' -> spgPixelBlend a' a1' a2' a3' a4' | 192 | false | false | 0 | 15 | 47 | 88 | 43 | 45 | null | null |
edofic/scotty | Web/Scotty.hs | bsd-3-clause | -- | Catch an exception thrown by 'raise'.
--
-- > raise "just kidding" `rescue` (\msg -> text msg)
rescue :: ActionM a -> (Text -> ActionM a) -> ActionM a
rescue = Trans.rescue | 177 | rescue :: ActionM a -> (Text -> ActionM a) -> ActionM a
rescue = Trans.rescue | 77 | rescue = Trans.rescue | 21 | true | true | 0 | 9 | 33 | 40 | 21 | 19 | null | null |
sdiehl/ghc | compiler/utils/Outputable.hs | bsd-3-clause | qualPackage (PprDump q) m = queryQualifyPackage q m | 56 | qualPackage (PprDump q) m = queryQualifyPackage q m | 56 | qualPackage (PprDump q) m = queryQualifyPackage q m | 56 | false | false | 0 | 7 | 12 | 22 | 10 | 12 | null | null |
erikd/hs-tls | core/Network/TLS/Credentials.hs | bsd-3-clause | credentialMatchesHashSignatures :: [TLS.HashAndSignatureAlgorithm] -> Credential -> Bool
credentialMatchesHashSignatures hashSigs (chain, _) =
case chain of
CertificateChain [] -> True
CertificateChain (leaf:_) -> isSelfSigned leaf || matchHashSig leaf
where
matchHashSig signed = case getHashSignature signed of
Nothing -> False
Just hs -> hs `elem` hashSigs
isSelfSigned signed =
let cert = signedObject $ getSigned signed
in certSubjectDN cert == certIssuerDN cert | 581 | credentialMatchesHashSignatures :: [TLS.HashAndSignatureAlgorithm] -> Credential -> Bool
credentialMatchesHashSignatures hashSigs (chain, _) =
case chain of
CertificateChain [] -> True
CertificateChain (leaf:_) -> isSelfSigned leaf || matchHashSig leaf
where
matchHashSig signed = case getHashSignature signed of
Nothing -> False
Just hs -> hs `elem` hashSigs
isSelfSigned signed =
let cert = signedObject $ getSigned signed
in certSubjectDN cert == certIssuerDN cert | 581 | credentialMatchesHashSignatures hashSigs (chain, _) =
case chain of
CertificateChain [] -> True
CertificateChain (leaf:_) -> isSelfSigned leaf || matchHashSig leaf
where
matchHashSig signed = case getHashSignature signed of
Nothing -> False
Just hs -> hs `elem` hashSigs
isSelfSigned signed =
let cert = signedObject $ getSigned signed
in certSubjectDN cert == certIssuerDN cert | 492 | false | true | 0 | 10 | 173 | 151 | 73 | 78 | null | null |
svenkeidel/hsynth | src/Data/MidiFile.hs | bsd-3-clause | getTrack :: Int -> Get Track
getTrack trackNumber = do
skip (length "MTrk")
trackLength <- getWord32be
Track <$> isolate (fromIntegral trackLength) (getTrackEvents trackNumber) | 182 | getTrack :: Int -> Get Track
getTrack trackNumber = do
skip (length "MTrk")
trackLength <- getWord32be
Track <$> isolate (fromIntegral trackLength) (getTrackEvents trackNumber) | 182 | getTrack trackNumber = do
skip (length "MTrk")
trackLength <- getWord32be
Track <$> isolate (fromIntegral trackLength) (getTrackEvents trackNumber) | 153 | false | true | 0 | 11 | 28 | 69 | 30 | 39 | null | null |
brianshourd/haskell-Calypso | Calypso/Core.hs | bsd-3-clause | {- |
An updater using a constant inertia weight factor, as can be found in
Shi, Yuhui, and Russell Eberhart. \"Parameter selection in particle swarm
optimization.\" Evolutionary Programming VII. Springer Berlin/Heidelberg,
1998.
-}
upInertiaWeight :: (PsoVect a, Grade b)
=> Double -- ^ Inertia weight (omega)
-> Double -- ^ Tendancy toward private guide (c1)
-> Double -- ^ Tendancy toward local guide (c2)
-> Updater a b
upInertiaWeight omega c1 c2 = (upAddLocal c2) <> (upAddPrivate c1) <> (upScale omega) | 529 | upInertiaWeight :: (PsoVect a, Grade b)
=> Double -- ^ Inertia weight (omega)
-> Double -- ^ Tendancy toward private guide (c1)
-> Double -- ^ Tendancy toward local guide (c2)
-> Updater a b
upInertiaWeight omega c1 c2 = (upAddLocal c2) <> (upAddPrivate c1) <> (upScale omega) | 295 | upInertiaWeight omega c1 c2 = (upAddLocal c2) <> (upAddPrivate c1) <> (upScale omega) | 85 | true | true | 0 | 10 | 101 | 81 | 42 | 39 | null | null |
prasmussen/glot-www | Yesod/Auth/Simple.hs | mit | redirectTemplate :: YesodAuthSimple master => (Route Auth -> Route master) -> WidgetFor master ()
redirectTemplate toParent =
[whamlet|$newline never
<script>window.location = "@{toParent loginR}";
<p>Content has moved, click
<a href="@{toParent loginR}">here
|] | 290 | redirectTemplate :: YesodAuthSimple master => (Route Auth -> Route master) -> WidgetFor master ()
redirectTemplate toParent =
[whamlet|$newline never
<script>window.location = "@{toParent loginR}";
<p>Content has moved, click
<a href="@{toParent loginR}">here
|] | 290 | redirectTemplate toParent =
[whamlet|$newline never
<script>window.location = "@{toParent loginR}";
<p>Content has moved, click
<a href="@{toParent loginR}">here
|] | 192 | false | true | 0 | 9 | 58 | 49 | 25 | 24 | null | null |
nlim/portfolio-quote | src/TransactionLoading.hs | mit | readTransactionsFromStdin :: IO [(String, (Float, Float))]
readTransactionsFromStdin = readTransactions stdin | 111 | readTransactionsFromStdin :: IO [(String, (Float, Float))]
readTransactionsFromStdin = readTransactions stdin | 109 | readTransactionsFromStdin = readTransactions stdin | 50 | false | true | 0 | 8 | 11 | 32 | 18 | 14 | null | null |
oldmanmike/ghc | compiler/hsSyn/HsUtils.hs | bsd-3-clause | collectLStmtBinders :: LStmtLR idL idR body -> [idL]
collectLStmtBinders = collectStmtBinders . unLoc | 101 | collectLStmtBinders :: LStmtLR idL idR body -> [idL]
collectLStmtBinders = collectStmtBinders . unLoc | 101 | collectLStmtBinders = collectStmtBinders . unLoc | 48 | false | true | 0 | 6 | 12 | 29 | 15 | 14 | null | null |
grnet/snf-ganeti | src/Ganeti/Constants.hs | bsd-2-clause | diskDtParameters :: FrozenSet String
diskDtParameters = ConstantUtils.mkSet (Map.keys diskDtTypes) | 98 | diskDtParameters :: FrozenSet String
diskDtParameters = ConstantUtils.mkSet (Map.keys diskDtTypes) | 98 | diskDtParameters = ConstantUtils.mkSet (Map.keys diskDtTypes) | 61 | false | true | 1 | 8 | 8 | 30 | 13 | 17 | null | null |
xuwei-k/kan-extensions | src/Data/Functor/Contravariant/Day.hs | bsd-3-clause | -- | Diagonalize the Day convolution:
--
-- @
-- 'day1' '.' 'diag' = 'id'
-- 'day2' '.' 'diag' = 'id'
-- 'runDay' '.' 'diag' = \a -> (a,a)
-- 'contramap' f . 'diag' = 'diag' . 'contramap' f
-- @
diag :: f a -> Day f f a
diag fa = Day fa fa $ \a -> (a,a) | 254 | diag :: f a -> Day f f a
diag fa = Day fa fa $ \a -> (a,a) | 58 | diag fa = Day fa fa $ \a -> (a,a) | 33 | true | true | 2 | 7 | 60 | 63 | 33 | 30 | null | null |
amir/hmscrobbler | src/LastFM.hs | unlicense | getSessionFile :: IO FilePath
getSessionFile = do
c <- getXdgDirectory XdgConfig "hmscrobbler"
createDirectoryIfMissing False c
return $ c ++ "/lastfm_session" | 165 | getSessionFile :: IO FilePath
getSessionFile = do
c <- getXdgDirectory XdgConfig "hmscrobbler"
createDirectoryIfMissing False c
return $ c ++ "/lastfm_session" | 165 | getSessionFile = do
c <- getXdgDirectory XdgConfig "hmscrobbler"
createDirectoryIfMissing False c
return $ c ++ "/lastfm_session" | 135 | false | true | 0 | 8 | 25 | 51 | 21 | 30 | null | null |
phylake/avm3 | swf/Data/Swf/Util.hs | mit | readS24LE :: Parser Int32
readS24LE = CB.take 3 >>= toStrict >>= return . fromS24LE . B.unpack | 94 | readS24LE :: Parser Int32
readS24LE = CB.take 3 >>= toStrict >>= return . fromS24LE . B.unpack | 94 | readS24LE = CB.take 3 >>= toStrict >>= return . fromS24LE . B.unpack | 68 | false | true | 0 | 10 | 15 | 37 | 18 | 19 | null | null |
elieux/ghc | compiler/utils/Outputable.hs | bsd-3-clause | neverQualify = QueryQualify neverQualifyNames
neverQualifyModules
neverQualifyPackages | 145 | neverQualify = QueryQualify neverQualifyNames
neverQualifyModules
neverQualifyPackages | 145 | neverQualify = QueryQualify neverQualifyNames
neverQualifyModules
neverQualifyPackages | 145 | false | false | 0 | 5 | 64 | 13 | 6 | 7 | null | null |
prowdsponsor/country-codes | src/Data/CountryCodes/ISO31661.hs | bsd-3-clause | toName GU = "Guam" | 18 | toName GU = "Guam" | 18 | toName GU = "Guam" | 18 | false | false | 0 | 4 | 3 | 10 | 4 | 6 | null | null |
arkon/courseography | hs/Scripts.hs | gpl-3.0 | postScripts :: H.Html
postScripts = concatHtml (map makeScript ["https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js",
"https://ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/jquery-ui.min.js",
"static/js/post/change_div.js",
"static/js/common/cookie_handler.js",
"static/js/post/update_post.js",
"static/js/graph/create_data.js",
"static/js/graph/objects/node.js",
"static/js/post/fill_textboxes.js",
"static/js/graph/create_data.js",
"static/js/post/update_categories.js"]) | 866 | postScripts :: H.Html
postScripts = concatHtml (map makeScript ["https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js",
"https://ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/jquery-ui.min.js",
"static/js/post/change_div.js",
"static/js/common/cookie_handler.js",
"static/js/post/update_post.js",
"static/js/graph/create_data.js",
"static/js/graph/objects/node.js",
"static/js/post/fill_textboxes.js",
"static/js/graph/create_data.js",
"static/js/post/update_categories.js"]) | 866 | postScripts = concatHtml (map makeScript ["https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js",
"https://ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/jquery-ui.min.js",
"static/js/post/change_div.js",
"static/js/common/cookie_handler.js",
"static/js/post/update_post.js",
"static/js/graph/create_data.js",
"static/js/graph/objects/node.js",
"static/js/post/fill_textboxes.js",
"static/js/graph/create_data.js",
"static/js/post/update_categories.js"]) | 844 | false | true | 0 | 8 | 395 | 54 | 32 | 22 | null | null |
nickspinale/bencode | src/Data/Bencode.hs | mit | parseBDict :: Parser (BDict B.ByteString)
parseBDict = char 'd' *> inner <* char 'e'
where
inner = do
pairs <- many' $ (,) <$> parseBString <*> parseBValue
if sorted pairs
then return (M.fromAscList pairs)
else empty
sorted x@(_:y) = all (== LT) $ zipWith (compare `on` fst) x y
sorted _ = True
----------------------------------------
-- BUILDERS
---------------------------------------- | 437 | parseBDict :: Parser (BDict B.ByteString)
parseBDict = char 'd' *> inner <* char 'e'
where
inner = do
pairs <- many' $ (,) <$> parseBString <*> parseBValue
if sorted pairs
then return (M.fromAscList pairs)
else empty
sorted x@(_:y) = all (== LT) $ zipWith (compare `on` fst) x y
sorted _ = True
----------------------------------------
-- BUILDERS
---------------------------------------- | 437 | parseBDict = char 'd' *> inner <* char 'e'
where
inner = do
pairs <- many' $ (,) <$> parseBString <*> parseBValue
if sorted pairs
then return (M.fromAscList pairs)
else empty
sorted x@(_:y) = all (== LT) $ zipWith (compare `on` fst) x y
sorted _ = True
----------------------------------------
-- BUILDERS
---------------------------------------- | 395 | false | true | 0 | 11 | 105 | 147 | 76 | 71 | null | null |
akru/haste-compiler | src/Data/JSTarget/PP.hs | bsd-3-clause | ind :: PP ()
ind = PP $ \opts indentlvl ns b ->
(ns, foldl' (<>) b (replicate indentlvl (indentStr opts)), ()) | 112 | ind :: PP ()
ind = PP $ \opts indentlvl ns b ->
(ns, foldl' (<>) b (replicate indentlvl (indentStr opts)), ()) | 112 | ind = PP $ \opts indentlvl ns b ->
(ns, foldl' (<>) b (replicate indentlvl (indentStr opts)), ()) | 99 | false | true | 2 | 12 | 23 | 72 | 36 | 36 | null | null |
rimmington/eclogues | eclogues/src/Eclogues/Job.hs | bsd-3-clause | -- | All 'Name's are valid file names.
nameFile :: Name -> Path Rel Path.File
nameFile = either (error . displayException) id . parseRelFile . T.unpack . nameText | 162 | nameFile :: Name -> Path Rel Path.File
nameFile = either (error . displayException) id . parseRelFile . T.unpack . nameText | 123 | nameFile = either (error . displayException) id . parseRelFile . T.unpack . nameText | 84 | true | true | 0 | 10 | 27 | 56 | 26 | 30 | null | null |
mbg/monadic-state-hierarchies | Language/MSH/CodeGen/Class.hs | mit | splitMethodType :: Type -> ([Type], Type)
splitMethodType (ForallT tvs cxt t) = splitMethodType t | 106 | splitMethodType :: Type -> ([Type], Type)
splitMethodType (ForallT tvs cxt t) = splitMethodType t | 106 | splitMethodType (ForallT tvs cxt t) = splitMethodType t | 64 | false | true | 0 | 7 | 22 | 40 | 21 | 19 | null | null |
UCSD-PL/nano-js | Language/Nano/Typecheck/Types.hs | bsd-3-clause | mapCode :: (a -> b) -> Nano a t -> Nano b t
mapCode f n = n { code = fmap f (code n) } | 86 | mapCode :: (a -> b) -> Nano a t -> Nano b t
mapCode f n = n { code = fmap f (code n) } | 86 | mapCode f n = n { code = fmap f (code n) } | 42 | false | true | 0 | 9 | 25 | 60 | 30 | 30 | null | null |
sighingnow/Functional-99-Problems | Haskell/27.hs | mit | {--
- Problem 27
Group the elements of a set into disjoint subsets.
a) In how many ways can a group of 9 people work in 3 disjoint subgroups of 2, 3 and 4 persons? Write
a function that generates all the possibilities and returns them in a list.
Example:
* (group3 '(aldo beat carla david evi flip gary hugo ida))
( ( (ALDO BEAT) (CARLA DAVID EVI) (FLIP GARY HUGO IDA) )
... )
b) Generalize the above predicate in a way that we can specify a list of group sizes and the predicate will
return a list of groups.
Example:
* (group '(aldo beat carla david evi flip gary hugo ida) '(2 2 5))
( ( (ALDO BEAT) (CARLA DAVID) (EVI FLIP GARY HUGO IDA) )
... )
Note that we do not want permutations of the group members; i.e. ((ALDO BEAT) ...) is the same
solution as ((BEAT ALDO) ...). However, we make a difference between ((ALDO BEAT) (CARLA
DAVID) ...) and ((CARLA DAVID) (ALDO BEAT) ...).
You may find more about this combinatorial problem in a good book on discrete mathematics under the
term "multinomial coefficients".
Example in Haskell:
P27> groups [2,3,4] ["aldo","beat","carla","david","evi","flip","gary","hugo","ida"]
[[["aldo","beat"],["carla","david","evi"],["flip","gary","hugo","ida"]],...]
(altogether 1260 solutions)
P27> groups [2,2,5] ["aldo","beat","carla","david","evi","flip","gary","hugo","ida"]
[[["aldo","beat"],["carla","david"],["evi","flip","gary","hugo","ida"]],...]
(altogether 756 solutions)
--}
combination :: Int -> [a] -> [([a], [a])]
combination 0 xs = [([], xs)] | 1,594 | combination :: Int -> [a] -> [([a], [a])]
combination 0 xs = [([], xs)] | 71 | combination 0 xs = [([], xs)] | 29 | true | true | 0 | 9 | 328 | 54 | 32 | 22 | null | null |
oprdyn/technique | tests/MockData.hs | mit | testSetFakeData =
it "store mock data" $ do
storeResource "254" "{\"president\": \"Kennedy\"}\n"
storeResource "42:config" "[null]"
assertPass | 156 | testSetFakeData =
it "store mock data" $ do
storeResource "254" "{\"president\": \"Kennedy\"}\n"
storeResource "42:config" "[null]"
assertPass | 156 | testSetFakeData =
it "store mock data" $ do
storeResource "254" "{\"president\": \"Kennedy\"}\n"
storeResource "42:config" "[null]"
assertPass | 156 | false | false | 1 | 8 | 29 | 36 | 13 | 23 | null | null |
s9gf4ult/yesod | yesod-form/Yesod/Form/I18n/Dutch.hs | mit | dutchFormMessage MsgBoolNo = "Nee" | 46 | dutchFormMessage MsgBoolNo = "Nee" | 46 | dutchFormMessage MsgBoolNo = "Nee" | 46 | false | false | 0 | 5 | 15 | 9 | 4 | 5 | null | null |
zachsully/hakaru | haskell/Language/Hakaru/CodeGen/Flatten.hs | bsd-3-clause | flattenTerm
:: ABT Term abt
=> Term abt a
-> (CExpr -> CodeGen ())
-- SCon can contain mochastic terms
flattenTerm (x :$ ys) = flattenSCon x ys | 157 | flattenTerm
:: ABT Term abt
=> Term abt a
-> (CExpr -> CodeGen ())
flattenTerm (x :$ ys) = flattenSCon x ys | 121 | flattenTerm (x :$ ys) = flattenSCon x ys | 48 | true | true | 0 | 12 | 41 | 62 | 29 | 33 | null | null |
mainland/nikola | examples/common/GUI/Commands.hs | bsd-3-clause | glutKeyToKey (GLUT.MouseButton GLUT.WheelDown) = MouseButton WheelDown | 81 | glutKeyToKey (GLUT.MouseButton GLUT.WheelDown) = MouseButton WheelDown | 81 | glutKeyToKey (GLUT.MouseButton GLUT.WheelDown) = MouseButton WheelDown | 81 | false | false | 0 | 8 | 16 | 22 | 10 | 12 | null | null |
markflorisson/hpack | src/ExtractIFace/ExtractIface.hs | bsd-3-clause | loadIface :: String -> IO ()
loadIface modName = do
msg <- runIfaceM $ do
modIface <- compileAndLoadIface "." modName
-- iface <- lift $ extract modIface
showModIface modIface
putStrLn msg | 220 | loadIface :: String -> IO ()
loadIface modName = do
msg <- runIfaceM $ do
modIface <- compileAndLoadIface "." modName
-- iface <- lift $ extract modIface
showModIface modIface
putStrLn msg | 220 | loadIface modName = do
msg <- runIfaceM $ do
modIface <- compileAndLoadIface "." modName
-- iface <- lift $ extract modIface
showModIface modIface
putStrLn msg | 191 | false | true | 0 | 12 | 62 | 59 | 26 | 33 | null | null |
glutamate/probably-baysig | src/Math/Probably/PDF.hs | bsd-3-clause | dNormSd_wrt_sd m s x = ((m-x)^2-s*s)/(s*s*s) | 44 | dNormSd_wrt_sd m s x = ((m-x)^2-s*s)/(s*s*s) | 44 | dNormSd_wrt_sd m s x = ((m-x)^2-s*s)/(s*s*s) | 44 | false | false | 1 | 11 | 5 | 56 | 26 | 30 | null | null |
shimazing/haskell-study-fall2016 | HW01/HW01.hs | bsd-3-clause | hanoi n a b c = (hanoi (n-1) a c b) ++ (hanoi 1 a b c) ++ (hanoi (n-1) c b a) | 77 | hanoi n a b c = (hanoi (n-1) a c b) ++ (hanoi 1 a b c) ++ (hanoi (n-1) c b a) | 77 | hanoi n a b c = (hanoi (n-1) a c b) ++ (hanoi 1 a b c) ++ (hanoi (n-1) c b a) | 77 | false | false | 0 | 10 | 22 | 73 | 37 | 36 | null | null |
Solonarv/OctoTactics | OctoTactics/Data/Direction.hs | mit | move :: Num a => Direction -> (a, a) -> (a, a)
move North (x, y) = (x , y - 1) | 85 | move :: Num a => Direction -> (a, a) -> (a, a)
move North (x, y) = (x , y - 1) | 85 | move North (x, y) = (x , y - 1) | 38 | false | true | 0 | 10 | 28 | 65 | 34 | 31 | null | null |
alexgadea/fun-gui | GUI/EvalConsole/Parser.hs | gpl-3.0 | parseStep :: ParserCmd EvalComm
parseStep = string "step" >> spaces >> eof >>
return Step | 101 | parseStep :: ParserCmd EvalComm
parseStep = string "step" >> spaces >> eof >>
return Step | 101 | parseStep = string "step" >> spaces >> eof >>
return Step | 69 | false | true | 2 | 6 | 26 | 39 | 16 | 23 | null | null |
siddhanathan/ghc | compiler/deSugar/DsBinds.hs | bsd-3-clause | dsEvTerm (EvTypeable ev) = dsEvTypeable ev | 42 | dsEvTerm (EvTypeable ev) = dsEvTypeable ev | 42 | dsEvTerm (EvTypeable ev) = dsEvTypeable ev | 42 | false | false | 0 | 6 | 5 | 19 | 8 | 11 | null | null |
R-Morgan/NGramCrackers | testsuite/NGramCrackers/Utilities/Tuple.hs | agpl-3.0 | doubleToCSV :: (T.Text, Int) -> T.Text
doubleToCSV x = lexeme <#> commaChar <#> (T.pack . show . snd) x
where lexeme = fst x
commaChar = T.singleton ',' | 192 | doubleToCSV :: (T.Text, Int) -> T.Text
doubleToCSV x = lexeme <#> commaChar <#> (T.pack . show . snd) x
where lexeme = fst x
commaChar = T.singleton ',' | 192 | doubleToCSV x = lexeme <#> commaChar <#> (T.pack . show . snd) x
where lexeme = fst x
commaChar = T.singleton ',' | 153 | false | true | 0 | 10 | 67 | 72 | 37 | 35 | null | null |
binesiyu/ifl | examples/ch07/return3.hs | mit | {-- snippet all --}
returnTest :: IO ()
returnTest =
do one <- return 1
let two = 2
putStrLn $ show (one + two)
{-- /snippet all --} | 150 | returnTest :: IO ()
returnTest =
do one <- return 1
let two = 2
putStrLn $ show (one + two)
{-- /snippet all --} | 130 | returnTest =
do one <- return 1
let two = 2
putStrLn $ show (one + two)
{-- /snippet all --} | 110 | true | true | 0 | 11 | 46 | 60 | 27 | 33 | null | null |
michaelficarra/purescript | src/Language/PureScript/Constants.hs | mit | returnEscaped :: String
returnEscaped = "$return" | 49 | returnEscaped :: String
returnEscaped = "$return" | 49 | returnEscaped = "$return" | 25 | false | true | 0 | 4 | 5 | 11 | 6 | 5 | null | null |
mitchellwrosen/haskell-erlang-bridge | src/Network/TCP/Receive.hs | lgpl-3.0 | receivePacket2 :: Receive ByteString
receivePacket2 = receiveSomeWord16be >>= receive . fromIntegral | 100 | receivePacket2 :: Receive ByteString
receivePacket2 = receiveSomeWord16be >>= receive . fromIntegral | 100 | receivePacket2 = receiveSomeWord16be >>= receive . fromIntegral | 63 | false | true | 0 | 6 | 10 | 22 | 11 | 11 | null | null |
wuzzeb/yesod | yesod-core/Yesod/Core/Handler.hs | mit | lookupGetParams :: MonadHandler m => Text -> m [Text]
lookupGetParams pn = do
rr <- getRequest
return $ lookup' pn $ reqGetParams rr
-- | Lookup for GET parameters. | 173 | lookupGetParams :: MonadHandler m => Text -> m [Text]
lookupGetParams pn = do
rr <- getRequest
return $ lookup' pn $ reqGetParams rr
-- | Lookup for GET parameters. | 173 | lookupGetParams pn = do
rr <- getRequest
return $ lookup' pn $ reqGetParams rr
-- | Lookup for GET parameters. | 119 | false | true | 0 | 9 | 37 | 56 | 26 | 30 | null | null |
brendanhay/gogol | gogol-datafusion/gen/Network/Google/Resource/DataFusion/Projects/Locations/Versions/List.hs | mpl-2.0 | -- | OAuth access token.
plvlAccessToken :: Lens' ProjectsLocationsVersionsList (Maybe Text)
plvlAccessToken
= lens _plvlAccessToken
(\ s a -> s{_plvlAccessToken = a}) | 175 | plvlAccessToken :: Lens' ProjectsLocationsVersionsList (Maybe Text)
plvlAccessToken
= lens _plvlAccessToken
(\ s a -> s{_plvlAccessToken = a}) | 150 | plvlAccessToken
= lens _plvlAccessToken
(\ s a -> s{_plvlAccessToken = a}) | 82 | true | true | 0 | 8 | 29 | 49 | 25 | 24 | null | null |
ezyang/ghc | compiler/types/OptCoercion.hs | bsd-3-clause | opt_trans1 :: InScopeSet -> NormalNonIdCo -> NormalCo -> NormalCo
-- First arg is not the identity
opt_trans1 is co1 co2
| isReflCo co2 = co1
| otherwise = opt_trans2 is co1 co2 | 184 | opt_trans1 :: InScopeSet -> NormalNonIdCo -> NormalCo -> NormalCo
opt_trans1 is co1 co2
| isReflCo co2 = co1
| otherwise = opt_trans2 is co1 co2 | 151 | opt_trans1 is co1 co2
| isReflCo co2 = co1
| otherwise = opt_trans2 is co1 co2 | 85 | true | true | 1 | 8 | 38 | 54 | 26 | 28 | null | null |
dancingrobot84/toydb | src/Database/Toy/Internal/Pager/Trans.hs | mit | getExternalState :: Monad m => (PagerState -> a) -> PagerT m a
getExternalState fn = PagerT $ gets (fn . snd) | 109 | getExternalState :: Monad m => (PagerState -> a) -> PagerT m a
getExternalState fn = PagerT $ gets (fn . snd) | 109 | getExternalState fn = PagerT $ gets (fn . snd) | 46 | false | true | 0 | 8 | 20 | 51 | 25 | 26 | null | null |
R-Morgan/NGramCrackers | testsuite/NGramCrackers/DataTypes.hs | agpl-3.0 | {- Date related data declarations -}
toMedium :: T.Text -> Medium
toMedium text | text == "book" = Book
| text == "journal" = Journal
| text == "newsp" = Newspaper
| otherwise = OtherMed text | 239 | toMedium :: T.Text -> Medium
toMedium text | text == "book" = Book
| text == "journal" = Journal
| text == "newsp" = Newspaper
| otherwise = OtherMed text | 201 | toMedium text | text == "book" = Book
| text == "journal" = Journal
| text == "newsp" = Newspaper
| otherwise = OtherMed text | 172 | true | true | 3 | 8 | 83 | 72 | 33 | 39 | null | null |
shayan-najd/QHaskell | Examples/VHDL/Interpreter.hs | gpl-3.0 | lift2 :: (Lift a , Lift b , Lift c) =>
(a -> b -> c) -> Signal -> Signal -> Signal
lift2 f s s' i = toRes (f (frmRes (s i)) (frmRes (s' i))) | 149 | lift2 :: (Lift a , Lift b , Lift c) =>
(a -> b -> c) -> Signal -> Signal -> Signal
lift2 f s s' i = toRes (f (frmRes (s i)) (frmRes (s' i))) | 149 | lift2 f s s' i = toRes (f (frmRes (s i)) (frmRes (s' i))) | 57 | false | true | 0 | 11 | 44 | 105 | 51 | 54 | null | null |
olorin/amazonka | amazonka-iam/gen/Network/AWS/IAM/ListVirtualMFADevices.hs | mpl-2.0 | -- | When 'IsTruncated' is 'true', this element is present and contains the
-- value to use for the 'Marker' parameter in a subsequent pagination
-- request.
lvmdrsMarker :: Lens' ListVirtualMFADevicesResponse (Maybe Text)
lvmdrsMarker = lens _lvmdrsMarker (\ s a -> s{_lvmdrsMarker = a}) | 288 | lvmdrsMarker :: Lens' ListVirtualMFADevicesResponse (Maybe Text)
lvmdrsMarker = lens _lvmdrsMarker (\ s a -> s{_lvmdrsMarker = a}) | 130 | lvmdrsMarker = lens _lvmdrsMarker (\ s a -> s{_lvmdrsMarker = a}) | 65 | true | true | 0 | 9 | 43 | 48 | 27 | 21 | null | null |
momomimachli/Hedsql-tests | src/Database/Hedsql/Examples/Select.hs | gpl-3.0 | groupByAlias :: Query [String] dbVendor
groupByAlias = do
select name
from "People"
groupBy name
where
name = col "lastName" (varchar 256) `as_` "name"
{-|
@
SELECT
"personId",
"P"."lastName" AS "name",
SUM("C"."size") * "P"."age" AS "weirdFigure"
FROM "People" AS "P" LEFT JOIN "Countries" AS "C" USING ("personId")
GROUP BY "personId", "name"
@
-} | 386 | groupByAlias :: Query [String] dbVendor
groupByAlias = do
select name
from "People"
groupBy name
where
name = col "lastName" (varchar 256) `as_` "name"
{-|
@
SELECT
"personId",
"P"."lastName" AS "name",
SUM("C"."size") * "P"."age" AS "weirdFigure"
FROM "People" AS "P" LEFT JOIN "Countries" AS "C" USING ("personId")
GROUP BY "personId", "name"
@
-} | 386 | groupByAlias = do
select name
from "People"
groupBy name
where
name = col "lastName" (varchar 256) `as_` "name"
{-|
@
SELECT
"personId",
"P"."lastName" AS "name",
SUM("C"."size") * "P"."age" AS "weirdFigure"
FROM "People" AS "P" LEFT JOIN "Countries" AS "C" USING ("personId")
GROUP BY "personId", "name"
@
-} | 346 | false | true | 0 | 8 | 88 | 63 | 30 | 33 | null | null |
douglas-larocca/contracts | Coq/Extraction/HOAS.hs | mit | fromHoas :: Contr -> C.Contr
fromHoas t = unCDB t 0 | 51 | fromHoas :: Contr -> C.Contr
fromHoas t = unCDB t 0 | 51 | fromHoas t = unCDB t 0 | 22 | false | true | 0 | 8 | 10 | 32 | 13 | 19 | null | null |
kim/amazonka | amazonka-rds/gen/Network/AWS/RDS/Types.hs | mpl-2.0 | -- | The offering identifier.
rdbioReservedDBInstancesOfferingId :: Lens' ReservedDBInstancesOffering (Maybe Text)
rdbioReservedDBInstancesOfferingId =
lens _rdbioReservedDBInstancesOfferingId
(\s a -> s { _rdbioReservedDBInstancesOfferingId = a }) | 260 | rdbioReservedDBInstancesOfferingId :: Lens' ReservedDBInstancesOffering (Maybe Text)
rdbioReservedDBInstancesOfferingId =
lens _rdbioReservedDBInstancesOfferingId
(\s a -> s { _rdbioReservedDBInstancesOfferingId = a }) | 230 | rdbioReservedDBInstancesOfferingId =
lens _rdbioReservedDBInstancesOfferingId
(\s a -> s { _rdbioReservedDBInstancesOfferingId = a }) | 145 | true | true | 0 | 8 | 35 | 47 | 25 | 22 | null | null |
alexander-at-github/eta | compiler/ETA/Core/CoreUnfold.hs | bsd-3-clause | litSize :: Literal -> Int
-- Used by CoreUnfold.sizeExpr
litSize (LitInteger {}) = 100 | 86 | litSize :: Literal -> Int
litSize (LitInteger {}) = 100 | 55 | litSize (LitInteger {}) = 100 | 29 | true | true | 1 | 8 | 13 | 31 | 15 | 16 | null | null |
sdiehl/ghc | compiler/main/SysTools/Info.hs | bsd-3-clause | neededLinkArgs (GnuGold o) = o | 32 | neededLinkArgs (GnuGold o) = o | 32 | neededLinkArgs (GnuGold o) = o | 32 | false | false | 0 | 7 | 6 | 15 | 7 | 8 | null | null |
AlainODea-haskell/tenable-securitycenter | app/ApiClient.hs | apache-2.0 | endSession :: ApiClient
-> IO (Maybe (ApiResponse Value), CookieJar)
endSession apiClient = do
let req = DeleteTokenRequest
runApiRequest apiClient req | 166 | endSession :: ApiClient
-> IO (Maybe (ApiResponse Value), CookieJar)
endSession apiClient = do
let req = DeleteTokenRequest
runApiRequest apiClient req | 166 | endSession apiClient = do
let req = DeleteTokenRequest
runApiRequest apiClient req | 86 | false | true | 0 | 11 | 34 | 58 | 26 | 32 | null | null |
ejconlon/dxedrine | src/Dxedrine/Blocks.hs | bsd-3-clause | getEntries (D2PC m) = getEntries' (_d2pcModel m) (_d2pcAddr m) | 62 | getEntries (D2PC m) = getEntries' (_d2pcModel m) (_d2pcAddr m) | 62 | getEntries (D2PC m) = getEntries' (_d2pcModel m) (_d2pcAddr m) | 62 | false | false | 0 | 7 | 8 | 32 | 15 | 17 | null | null |
palas/detparaminf | src/DetParamInf/TKPMap.hs | bsd-2-clause | lookup2 :: (Hashable kb, Ord kb) => kb -> TKPMap ka kb kc a -> S.HashSet a
lookup2 kb (TKPMap (m1, m2, m3, f1, f2, f3)) = mFindWithDefault S.empty kb m2 | 152 | lookup2 :: (Hashable kb, Ord kb) => kb -> TKPMap ka kb kc a -> S.HashSet a
lookup2 kb (TKPMap (m1, m2, m3, f1, f2, f3)) = mFindWithDefault S.empty kb m2 | 152 | lookup2 kb (TKPMap (m1, m2, m3, f1, f2, f3)) = mFindWithDefault S.empty kb m2 | 77 | false | true | 0 | 9 | 30 | 86 | 45 | 41 | null | null |
rahulmutt/ghcvm | compiler/Eta/Main/HscTypes.hs | bsd-3-clause | tyThingId (AConLike (RealDataCon dc)) = dataConWrapId dc | 56 | tyThingId (AConLike (RealDataCon dc)) = dataConWrapId dc | 56 | tyThingId (AConLike (RealDataCon dc)) = dataConWrapId dc | 56 | false | false | 0 | 9 | 6 | 24 | 11 | 13 | null | null |
three/codeworld | codeworld-api/src/CodeWorld/Color.hs | apache-2.0 | green = fromHSL (2/3 * pi) 0.75 0.5 | 40 | green = fromHSL (2/3 * pi) 0.75 0.5 | 40 | green = fromHSL (2/3 * pi) 0.75 0.5 | 40 | false | false | 0 | 8 | 12 | 24 | 12 | 12 | null | null |
headprogrammingczar/cabal | cabal-install/Distribution/Solver/Types/PackageIndex.hs | bsd-3-clause | mergeBuckets xs [] = xs | 31 | mergeBuckets xs [] = xs | 31 | mergeBuckets xs [] = xs | 31 | false | false | 0 | 6 | 12 | 13 | 6 | 7 | null | null |
dasuxullebt/inflate.hs | inflate.runST.hs | gpl-3.0 | dynamicBlockLenMap :: Int -> DeflateParse (CodeTree Int)
dynamicBlockLenMap hclen = do
!raw <- dynamicBlockLenListRaw hclen
let
lM = weaveCodeTree $ toBoolCodeMapWithoutZeroes $ dynamicBlockLenListToActualLens raw
in
case lM of Right lm -> do return lm
Left lm -> throwUp ("Did not receive Length Map in dynamicBlockLenMap: " ++ lm) | 364 | dynamicBlockLenMap :: Int -> DeflateParse (CodeTree Int)
dynamicBlockLenMap hclen = do
!raw <- dynamicBlockLenListRaw hclen
let
lM = weaveCodeTree $ toBoolCodeMapWithoutZeroes $ dynamicBlockLenListToActualLens raw
in
case lM of Right lm -> do return lm
Left lm -> throwUp ("Did not receive Length Map in dynamicBlockLenMap: " ++ lm) | 364 | dynamicBlockLenMap hclen = do
!raw <- dynamicBlockLenListRaw hclen
let
lM = weaveCodeTree $ toBoolCodeMapWithoutZeroes $ dynamicBlockLenListToActualLens raw
in
case lM of Right lm -> do return lm
Left lm -> throwUp ("Did not receive Length Map in dynamicBlockLenMap: " ++ lm) | 307 | false | true | 0 | 15 | 79 | 106 | 46 | 60 | null | null |
brendanhay/gogol | gogol-file/gen/Network/Google/File/Types/Product.hs | mpl-2.0 | -- | Optional. The MaintenanceSettings associated with instance.
gcsmpviMaintenanceSettings :: Lens' GoogleCloudSaasacceleratorManagementProvidersV1Instance (Maybe GoogleCloudSaasacceleratorManagementProvidersV1MaintenanceSettings)
gcsmpviMaintenanceSettings
= lens _gcsmpviMaintenanceSettings
(\ s a -> s{_gcsmpviMaintenanceSettings = a}) | 347 | gcsmpviMaintenanceSettings :: Lens' GoogleCloudSaasacceleratorManagementProvidersV1Instance (Maybe GoogleCloudSaasacceleratorManagementProvidersV1MaintenanceSettings)
gcsmpviMaintenanceSettings
= lens _gcsmpviMaintenanceSettings
(\ s a -> s{_gcsmpviMaintenanceSettings = a}) | 282 | gcsmpviMaintenanceSettings
= lens _gcsmpviMaintenanceSettings
(\ s a -> s{_gcsmpviMaintenanceSettings = a}) | 115 | true | true | 0 | 9 | 32 | 48 | 25 | 23 | null | null |
robdockins/orlin | src/Orlin/PureTypeSys.hs | bsd-2-clause | simplifyConstraint env (CCheck pn ctx exp ty) = checkExpr pn env ctx exp ty | 75 | simplifyConstraint env (CCheck pn ctx exp ty) = checkExpr pn env ctx exp ty | 75 | simplifyConstraint env (CCheck pn ctx exp ty) = checkExpr pn env ctx exp ty | 75 | false | false | 0 | 7 | 13 | 34 | 16 | 18 | null | null |
stla/jsonxlsx | src/ReadXLSX/SheetToDataframe.hs | bsd-3-clause | test = sheetToDataframe cellmapExample cellToCellValue True | 59 | test = sheetToDataframe cellmapExample cellToCellValue True | 59 | test = sheetToDataframe cellmapExample cellToCellValue True | 59 | false | false | 1 | 5 | 5 | 16 | 6 | 10 | null | null |
mightymoose/liquidhaskell | benchmarks/vector-0.10.0.1/Data/Vector/Storable.hs | bsd-3-clause | foldr' = G.foldr' | 17 | foldr' = G.foldr' | 17 | foldr' = G.foldr' | 17 | false | false | 1 | 6 | 2 | 12 | 4 | 8 | null | null |
phaul/chess | Data/Square.hs | bsd-3-clause | -------------
-- Parsers --
-------------
------------------------------------------------------------------------------
-- | Parses a file notation to a File
fileParser :: Parser File
fileParser = do
f <- oneOf ['a' .. 'h']
return $ toEnum $ ord f - ord 'a'
------------------------------------------------------------------------------
-- | Parses a rank notation to a Rank | 446 | fileParser :: Parser File
fileParser = do
f <- oneOf ['a' .. 'h']
return $ toEnum $ ord f - ord 'a'
------------------------------------------------------------------------------
-- | Parses a rank notation to a Rank | 222 | fileParser = do
f <- oneOf ['a' .. 'h']
return $ toEnum $ ord f - ord 'a'
------------------------------------------------------------------------------
-- | Parses a rank notation to a Rank | 196 | true | true | 0 | 9 | 117 | 58 | 31 | 27 | null | null |
prl-tokyo/bigul-configuration-adaptation | Transformations/src/Generics/BiGUL/Interpreter.hs | mit | put Skip s v = return s | 23 | put Skip s v = return s | 23 | put Skip s v = return s | 23 | false | false | 0 | 5 | 6 | 16 | 7 | 9 | null | null |
dpieroux/euler | 0/0088.hs | mit | uniqueNumbers upto = toList $ fromList [minimumNumber k | k<-[2..upto]] | 71 | uniqueNumbers upto = toList $ fromList [minimumNumber k | k<-[2..upto]] | 71 | uniqueNumbers upto = toList $ fromList [minimumNumber k | k<-[2..upto]] | 71 | false | false | 1 | 10 | 9 | 38 | 17 | 21 | null | null |
ganeti/ganeti | src/Ganeti/Constants.hs | bsd-2-clause | ssNodeVmCapable :: String
ssNodeVmCapable = "node_vm_capable" | 61 | ssNodeVmCapable :: String
ssNodeVmCapable = "node_vm_capable" | 61 | ssNodeVmCapable = "node_vm_capable" | 35 | false | true | 0 | 4 | 5 | 11 | 6 | 5 | null | null |
fpco/statistics | Statistics/Matrix/Mutable.hs | bsd-2-clause | -- | Given row and column numbers, calculate the offset into the flat
-- row-major vector.
bounds :: MMatrix s -> Int -> Int -> (MVector s -> Int -> r) -> r
bounds (MMatrix rs cs _ mv) r c k
| r < 0 || r >= rs = error "row out of bounds"
| c < 0 || c >= cs = error "column out of bounds"
| otherwise = k mv $! r * cs + c | 333 | bounds :: MMatrix s -> Int -> Int -> (MVector s -> Int -> r) -> r
bounds (MMatrix rs cs _ mv) r c k
| r < 0 || r >= rs = error "row out of bounds"
| c < 0 || c >= cs = error "column out of bounds"
| otherwise = k mv $! r * cs + c | 242 | bounds (MMatrix rs cs _ mv) r c k
| r < 0 || r >= rs = error "row out of bounds"
| c < 0 || c >= cs = error "column out of bounds"
| otherwise = k mv $! r * cs + c | 176 | true | true | 3 | 12 | 93 | 147 | 68 | 79 | null | null |
svenssonjoel/EmbArBB | Intel/ArBB/Language.hs | bsd-3-clause | -- | reduce along a specified level
addReduce :: Num a => Exp USize -> Exp (DVector (t:.Int) a) -> Exp (DVector t a)
addReduce (E lev) (E vec) =
E $ Op AddReduce [vec,lev] | 176 | addReduce :: Num a => Exp USize -> Exp (DVector (t:.Int) a) -> Exp (DVector t a)
addReduce (E lev) (E vec) =
E $ Op AddReduce [vec,lev] | 138 | addReduce (E lev) (E vec) =
E $ Op AddReduce [vec,lev] | 57 | true | true | 0 | 12 | 39 | 91 | 45 | 46 | null | null |
fffej/HS-Poker | LookupPatternMatch.hs | bsd-3-clause | getValueFromProduct 153065 = 2180 | 33 | getValueFromProduct 153065 = 2180 | 33 | getValueFromProduct 153065 = 2180 | 33 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
beni55/libmpd-haskell | tests/TestUtil.hs | mit | withPassword :: Eq a => Password
-> [(Expect, Response String)]
-> Command a
-> Response a
withPassword pwd ps m = testMPDWithPassword ps pwd (runCommand m) | 195 | withPassword :: Eq a => Password
-> [(Expect, Response String)]
-> Command a
-> Response a
withPassword pwd ps m = testMPDWithPassword ps pwd (runCommand m) | 195 | withPassword pwd ps m = testMPDWithPassword ps pwd (runCommand m) | 65 | false | true | 0 | 11 | 64 | 72 | 34 | 38 | null | null |
jakubfijalkowski/hlibsass | tests/Main.hs | mit | main :: IO ()
main = hspec $
describe "Libsass" $ do
it "should correctly compile simple expression" $
simpleCompile sampleInput `shouldReturn` sampleOutput
#ifndef EXTERNAL_LIBSASS
it "should report correct version" $ do
str <- peekCString libsass_version
str `shouldBe` "3.6.4"
#endif
it "should support quoted strings" $ withCString "sample" $ \cstr -> do
str <- sass_make_qstring cstr
sass_string_is_quoted str `shouldReturn` True
it "should correctly combine two SassValues" $ withCString "" $ \unit -> do
val1 <- sass_make_number 1.0 unit
val2 <- sass_make_number 2.0 unit
val3 <- sass_value_op (fromIntegral $ fromEnum SassAdd) val1 val2
result <- sass_number_get_value val3
sass_delete_value val1
sass_delete_value val2
sass_delete_value val3
result `shouldBe` 3.0 | 897 | main :: IO ()
main = hspec $
describe "Libsass" $ do
it "should correctly compile simple expression" $
simpleCompile sampleInput `shouldReturn` sampleOutput
#ifndef EXTERNAL_LIBSASS
it "should report correct version" $ do
str <- peekCString libsass_version
str `shouldBe` "3.6.4"
#endif
it "should support quoted strings" $ withCString "sample" $ \cstr -> do
str <- sass_make_qstring cstr
sass_string_is_quoted str `shouldReturn` True
it "should correctly combine two SassValues" $ withCString "" $ \unit -> do
val1 <- sass_make_number 1.0 unit
val2 <- sass_make_number 2.0 unit
val3 <- sass_value_op (fromIntegral $ fromEnum SassAdd) val1 val2
result <- sass_number_get_value val3
sass_delete_value val1
sass_delete_value val2
sass_delete_value val3
result `shouldBe` 3.0 | 897 | main = hspec $
describe "Libsass" $ do
it "should correctly compile simple expression" $
simpleCompile sampleInput `shouldReturn` sampleOutput
#ifndef EXTERNAL_LIBSASS
it "should report correct version" $ do
str <- peekCString libsass_version
str `shouldBe` "3.6.4"
#endif
it "should support quoted strings" $ withCString "sample" $ \cstr -> do
str <- sass_make_qstring cstr
sass_string_is_quoted str `shouldReturn` True
it "should correctly combine two SassValues" $ withCString "" $ \unit -> do
val1 <- sass_make_number 1.0 unit
val2 <- sass_make_number 2.0 unit
val3 <- sass_value_op (fromIntegral $ fromEnum SassAdd) val1 val2
result <- sass_number_get_value val3
sass_delete_value val1
sass_delete_value val2
sass_delete_value val3
result `shouldBe` 3.0 | 883 | false | true | 0 | 16 | 229 | 228 | 103 | 125 | null | null |
psibi/yesod | yesod-core/Yesod/Core/Content.hs | mit | typePng :: ContentType
typePng = "image/png" | 44 | typePng :: ContentType
typePng = "image/png" | 44 | typePng = "image/png" | 21 | false | true | 0 | 4 | 5 | 11 | 6 | 5 | null | null |
itsuart/fdc_archivist | src/HttpUtils.hs | mit | lookupHeader :: Wai.Request -> T.Text -> Maybe S.ByteString
lookupHeader request headerName = lookup (CI.mk $ E.encodeUtf8 headerName) (Wai.requestHeaders request) | 163 | lookupHeader :: Wai.Request -> T.Text -> Maybe S.ByteString
lookupHeader request headerName = lookup (CI.mk $ E.encodeUtf8 headerName) (Wai.requestHeaders request) | 163 | lookupHeader request headerName = lookup (CI.mk $ E.encodeUtf8 headerName) (Wai.requestHeaders request) | 103 | false | true | 0 | 9 | 18 | 64 | 30 | 34 | null | null |
conal/ghc-mod | ErrMsg.hs | bsd-3-clause | ppMsg (RealSrcSpan src) msg
#else
ppMsg src msg
#endif
= file ++ ":" ++ line ++ ":" ++ col ++ ":" ++ cts ++ "\0"
where
file = takeFileName $ unpackFS (srcSpanFile src)
line = show (srcSpanStartLine src)
col = show (srcSpanStartCol src)
cts = showMsg msg
---------------------------------------------------------------- | 343 | ppMsg (RealSrcSpan src) msg
#else
ppMsg src msg
#endif
= file ++ ":" ++ line ++ ":" ++ col ++ ":" ++ cts ++ "\0"
where
file = takeFileName $ unpackFS (srcSpanFile src)
line = show (srcSpanStartLine src)
col = show (srcSpanStartCol src)
cts = showMsg msg
---------------------------------------------------------------- | 343 | ppMsg (RealSrcSpan src) msg
#else
ppMsg src msg
#endif
= file ++ ":" ++ line ++ ":" ++ col ++ ":" ++ cts ++ "\0"
where
file = takeFileName $ unpackFS (srcSpanFile src)
line = show (srcSpanStartLine src)
col = show (srcSpanStartCol src)
cts = showMsg msg
---------------------------------------------------------------- | 343 | false | false | 0 | 11 | 72 | 105 | 53 | 52 | null | null |
mavenraven/github | Github/GitData/References.hs | bsd-3-clause | -- | Limited references by a namespace.
--
-- > namespacedReferences "thoughtbot" "paperclip" "tags"
namespacedReferences :: String -> String -> String -> IO (Either Error [GitReference])
namespacedReferences user reqRepoName namespace =
githubGet ["repos", user, reqRepoName, "git", "refs", namespace] | 304 | namespacedReferences :: String -> String -> String -> IO (Either Error [GitReference])
namespacedReferences user reqRepoName namespace =
githubGet ["repos", user, reqRepoName, "git", "refs", namespace] | 203 | namespacedReferences user reqRepoName namespace =
githubGet ["repos", user, reqRepoName, "git", "refs", namespace] | 116 | true | true | 0 | 11 | 39 | 72 | 39 | 33 | null | null |
lambdageek/insomnia | src/Insomnia/ToF/Type.hs | bsd-3-clause | betaWhnf :: U.LFresh m => F.Type -> m F.Type
betaWhnf t_ =
case t_ of
F.TApp t1 t2 -> do
t1' <- betaWhnf t1
case t1' of
F.TLam bnd ->
U.lunbind bnd $ \((tv,_k), tB) ->
betaWhnf (U.subst tv t2 tB)
_ -> return $ F.TApp t1' t2
_ -> return $ t_ | 287 | betaWhnf :: U.LFresh m => F.Type -> m F.Type
betaWhnf t_ =
case t_ of
F.TApp t1 t2 -> do
t1' <- betaWhnf t1
case t1' of
F.TLam bnd ->
U.lunbind bnd $ \((tv,_k), tB) ->
betaWhnf (U.subst tv t2 tB)
_ -> return $ F.TApp t1' t2
_ -> return $ t_ | 287 | betaWhnf t_ =
case t_ of
F.TApp t1 t2 -> do
t1' <- betaWhnf t1
case t1' of
F.TLam bnd ->
U.lunbind bnd $ \((tv,_k), tB) ->
betaWhnf (U.subst tv t2 tB)
_ -> return $ F.TApp t1' t2
_ -> return $ t_ | 242 | false | true | 0 | 18 | 99 | 147 | 71 | 76 | null | null |
haskell-distributed/distributed-process-client-server | tests/TestManagedProcess.hs | bsd-3-clause | testCallReturnTypeMismatchHandling :: TestResult Bool -> Process ()
testCallReturnTypeMismatchHandling result =
let procDef = statelessProcess {
apiHandlers = [
handleCall (\s (m :: String) -> reply m s)
]
, unhandledMessagePolicy = Terminate
} in do
pid <- spawnLocal $ serve () (statelessInit Infinity) procDef
res <- safeCall pid "hello buddy" :: Process (Either ExitReason ())
case res of
Left (ExitOther _) -> stash result True
_ -> stash result False | 603 | testCallReturnTypeMismatchHandling :: TestResult Bool -> Process ()
testCallReturnTypeMismatchHandling result =
let procDef = statelessProcess {
apiHandlers = [
handleCall (\s (m :: String) -> reply m s)
]
, unhandledMessagePolicy = Terminate
} in do
pid <- spawnLocal $ serve () (statelessInit Infinity) procDef
res <- safeCall pid "hello buddy" :: Process (Either ExitReason ())
case res of
Left (ExitOther _) -> stash result True
_ -> stash result False | 603 | testCallReturnTypeMismatchHandling result =
let procDef = statelessProcess {
apiHandlers = [
handleCall (\s (m :: String) -> reply m s)
]
, unhandledMessagePolicy = Terminate
} in do
pid <- spawnLocal $ serve () (statelessInit Infinity) procDef
res <- safeCall pid "hello buddy" :: Process (Either ExitReason ())
case res of
Left (ExitOther _) -> stash result True
_ -> stash result False | 535 | false | true | 0 | 16 | 216 | 171 | 83 | 88 | null | null |
black0range/Smutt | src/Smutt/HTTP/Util/Common.hs | mit | parseMethod "PUT" = Just PUT | 36 | parseMethod "PUT" = Just PUT | 36 | parseMethod "PUT" = Just PUT | 36 | false | false | 0 | 5 | 12 | 12 | 5 | 7 | null | null |
seereason/ghcjs-jquery | JavaScript/JQuery.hs | mit | -- This just isn't cool[' Can']'t we all just use map?
-- each :: (Double -> Element -> Fay Bool) -> JQuery -> Fay JQuery
-- each = ffi "%2['each'](%1)"
end :: JQuery -> IO JQuery
end = jq_end | 193 | end :: JQuery -> IO JQuery
end = jq_end | 39 | end = jq_end | 12 | true | true | 0 | 7 | 39 | 27 | 13 | 14 | null | null |
dashhalpern/cs2-adts-logging | Test.hs | bsd-3-clause | main = defaultMain testes | 25 | main = defaultMain testes | 25 | main = defaultMain testes | 25 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
alexvong1995/pandoc | src/Text/Pandoc/Readers/Org.hs | gpl-2.0 | popInlineCharStack :: OrgParser ()
popInlineCharStack = updateState $ \s ->
s{ orgStateEmphasisCharStack = drop 1 . orgStateEmphasisCharStack $ s } | 149 | popInlineCharStack :: OrgParser ()
popInlineCharStack = updateState $ \s ->
s{ orgStateEmphasisCharStack = drop 1 . orgStateEmphasisCharStack $ s } | 149 | popInlineCharStack = updateState $ \s ->
s{ orgStateEmphasisCharStack = drop 1 . orgStateEmphasisCharStack $ s } | 114 | false | true | 0 | 10 | 21 | 49 | 24 | 25 | null | null |
lpeterse/HiggsSet | src/Data/HiggsSet.hs | bsd-3-clause | unMargin (Closed a) = a | 25 | unMargin (Closed a) = a | 25 | unMargin (Closed a) = a | 25 | false | false | 0 | 6 | 6 | 16 | 7 | 9 | null | null |
naerbnic/capsir | src/Capsir/Check.hs | bsd-3-clause | freeValueVarsFromList :: [Value] -> Set String
freeValueVarsFromList = freeVarsFromList freeValueVars | 101 | freeValueVarsFromList :: [Value] -> Set String
freeValueVarsFromList = freeVarsFromList freeValueVars | 101 | freeValueVarsFromList = freeVarsFromList freeValueVars | 54 | false | true | 0 | 6 | 9 | 24 | 12 | 12 | null | null |
snoyberg/ghc | libraries/base/Data/Data.hs | bsd-3-clause | -- | Gets the fixity of a constructor
constrFixity :: Constr -> Fixity
constrFixity = confixity | 95 | constrFixity :: Constr -> Fixity
constrFixity = confixity | 57 | constrFixity = confixity | 24 | true | true | 0 | 7 | 15 | 23 | 10 | 13 | null | null |
psibi/cabal2nix | src/Distribution/Nixpkgs/Haskell/FromCabal/Name.hs | bsd-3-clause | libNixName "Qt5Gui" = return "qt5" | 62 | libNixName "Qt5Gui" = return "qt5" | 62 | libNixName "Qt5Gui" = return "qt5" | 62 | false | false | 0 | 5 | 32 | 12 | 5 | 7 | null | null |
snoyberg/ghc | compiler/prelude/TysWiredIn.hs | bsd-3-clause | promotedTupleDataCon :: Boxity -> Arity -> TyCon
promotedTupleDataCon boxity i = promoteDataCon (tupleDataCon boxity i) | 119 | promotedTupleDataCon :: Boxity -> Arity -> TyCon
promotedTupleDataCon boxity i = promoteDataCon (tupleDataCon boxity i) | 119 | promotedTupleDataCon boxity i = promoteDataCon (tupleDataCon boxity i) | 70 | false | true | 0 | 7 | 14 | 35 | 17 | 18 | null | null |
ksaveljev/hake-2 | src/Client/Menu.hs | bsd-3-clause | fieldKey :: Ref MenuFieldS -> Int -> Quake Bool
fieldKey fieldRef key = do
let k = if | key == KeyConstants.kKpSlash -> '/'
| key == KeyConstants.kKpMinus -> '-'
| key == KeyConstants.kKpPlus -> '+'
| key == KeyConstants.kKpHome -> '7'
| key == KeyConstants.kKpUpArrow -> '8'
| key == KeyConstants.kKpPgUp -> '9'
| key == KeyConstants.kKpLeftArrow -> '4'
| key == KeyConstants.kKp5 -> '5'
| key == KeyConstants.kKpRightArrow -> '6'
| key == KeyConstants.kKpEnd -> '1'
| key == KeyConstants.kKpDownArrow -> '2'
| key == KeyConstants.kKpPgDn -> '3'
| key == KeyConstants.kKpIns -> '0'
| key == KeyConstants.kKpDel -> '.'
| otherwise -> chr key
if ord k > 127
then
return False
else do
-- support pasting from the clipboard
io (putStrLn "Menu.fieldKey") >> undefined -- TODO | 1,039 | fieldKey :: Ref MenuFieldS -> Int -> Quake Bool
fieldKey fieldRef key = do
let k = if | key == KeyConstants.kKpSlash -> '/'
| key == KeyConstants.kKpMinus -> '-'
| key == KeyConstants.kKpPlus -> '+'
| key == KeyConstants.kKpHome -> '7'
| key == KeyConstants.kKpUpArrow -> '8'
| key == KeyConstants.kKpPgUp -> '9'
| key == KeyConstants.kKpLeftArrow -> '4'
| key == KeyConstants.kKp5 -> '5'
| key == KeyConstants.kKpRightArrow -> '6'
| key == KeyConstants.kKpEnd -> '1'
| key == KeyConstants.kKpDownArrow -> '2'
| key == KeyConstants.kKpPgDn -> '3'
| key == KeyConstants.kKpIns -> '0'
| key == KeyConstants.kKpDel -> '.'
| otherwise -> chr key
if ord k > 127
then
return False
else do
-- support pasting from the clipboard
io (putStrLn "Menu.fieldKey") >> undefined -- TODO | 1,039 | fieldKey fieldRef key = do
let k = if | key == KeyConstants.kKpSlash -> '/'
| key == KeyConstants.kKpMinus -> '-'
| key == KeyConstants.kKpPlus -> '+'
| key == KeyConstants.kKpHome -> '7'
| key == KeyConstants.kKpUpArrow -> '8'
| key == KeyConstants.kKpPgUp -> '9'
| key == KeyConstants.kKpLeftArrow -> '4'
| key == KeyConstants.kKp5 -> '5'
| key == KeyConstants.kKpRightArrow -> '6'
| key == KeyConstants.kKpEnd -> '1'
| key == KeyConstants.kKpDownArrow -> '2'
| key == KeyConstants.kKpPgDn -> '3'
| key == KeyConstants.kKpIns -> '0'
| key == KeyConstants.kKpDel -> '.'
| otherwise -> chr key
if ord k > 127
then
return False
else do
-- support pasting from the clipboard
io (putStrLn "Menu.fieldKey") >> undefined -- TODO | 991 | false | true | 0 | 15 | 397 | 305 | 141 | 164 | null | null |
ksaveljev/hNES | NES/Instruction.hs | mit | operandLength Relative = 1 | 33 | operandLength Relative = 1 | 33 | operandLength Relative = 1 | 33 | false | false | 0 | 5 | 10 | 9 | 4 | 5 | null | null |
bch29/streaming-png | src/Codec/Picture/Png/Streaming/Core.hs | lgpl-3.0 | encodeChunk
:: (MonadThrow m)
=> PNGChunk m r -- ^ The data segment to write.
-> ByteString m r -- ^ The resulting data encoded as a PNG chunk.
encodeChunk PNGChunk{..} =
do let lenBS = C.runPut . C.putWord32be $ chunkLength
-- write the
Q.fromStrict lenBS
let -- restrict the length of the input to the given data length as above
restrictedLen = checkLength (fromIntegral chunkLength) chunkData
-- tack the chunk type bytes to the front
-- it is important to do this BEFORE calculating the CRC, because the
-- CRC applies to the chunk type too (but not to the length)
withChunkType = Q.fromStrict chunkType >> restrictedLen
-- calculate the CRC and write that to the end
appendCRC32 withChunkType
--------------------------------------------------------------------------------
-- Extra helper functions
-- | Check the length of a ByteString against an expected length. Running the
-- resulting 'ByteString' to the end will throw an error if it is not exactly the
-- right length. | 1,073 | encodeChunk
:: (MonadThrow m)
=> PNGChunk m r -- ^ The data segment to write.
-> ByteString m r
encodeChunk PNGChunk{..} =
do let lenBS = C.runPut . C.putWord32be $ chunkLength
-- write the
Q.fromStrict lenBS
let -- restrict the length of the input to the given data length as above
restrictedLen = checkLength (fromIntegral chunkLength) chunkData
-- tack the chunk type bytes to the front
-- it is important to do this BEFORE calculating the CRC, because the
-- CRC applies to the chunk type too (but not to the length)
withChunkType = Q.fromStrict chunkType >> restrictedLen
-- calculate the CRC and write that to the end
appendCRC32 withChunkType
--------------------------------------------------------------------------------
-- Extra helper functions
-- | Check the length of a ByteString against an expected length. Running the
-- resulting 'ByteString' to the end will throw an error if it is not exactly the
-- right length. | 1,025 | encodeChunk PNGChunk{..} =
do let lenBS = C.runPut . C.putWord32be $ chunkLength
-- write the
Q.fromStrict lenBS
let -- restrict the length of the input to the given data length as above
restrictedLen = checkLength (fromIntegral chunkLength) chunkData
-- tack the chunk type bytes to the front
-- it is important to do this BEFORE calculating the CRC, because the
-- CRC applies to the chunk type too (but not to the length)
withChunkType = Q.fromStrict chunkType >> restrictedLen
-- calculate the CRC and write that to the end
appendCRC32 withChunkType
--------------------------------------------------------------------------------
-- Extra helper functions
-- | Check the length of a ByteString against an expected length. Running the
-- resulting 'ByteString' to the end will throw an error if it is not exactly the
-- right length. | 915 | true | true | 0 | 13 | 249 | 129 | 66 | 63 | null | null |
ml9951/ghc | compiler/typecheck/TcGenDeriv.hs | bsd-3-clause | geChar_RDR = varQual_RDR gHC_PRIM (fsLit "geChar#") | 56 | geChar_RDR = varQual_RDR gHC_PRIM (fsLit "geChar#") | 56 | geChar_RDR = varQual_RDR gHC_PRIM (fsLit "geChar#") | 56 | false | false | 0 | 7 | 10 | 17 | 8 | 9 | null | null |
pparkkin/eta | compiler/ETA/Main/DynFlags.hs | bsd-3-clause | isOneShot :: GhcMode -> Bool
isOneShot OneShot = True | 53 | isOneShot :: GhcMode -> Bool
isOneShot OneShot = True | 53 | isOneShot OneShot = True | 24 | false | true | 0 | 5 | 8 | 18 | 9 | 9 | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.