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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
rvion/ride | jetpack/src/Network/Wai/Handler/Warp/AsWai.hs | bsd-3-clause | -- wai_runHTTP2Env :: Port -> HTTP2Application -> Application -> IO ()
wai_runHTTP2Env = I.runHTTP2Env | 102 | wai_runHTTP2Env = I.runHTTP2Env | 31 | wai_runHTTP2Env = I.runHTTP2Env | 31 | true | false | 0 | 5 | 13 | 9 | 5 | 4 | null | null |
Hodapp87/ivory | ivory/src/Ivory/Language/Syntax/Concrete/Lexeme.hs | bsd-3-clause | readBitLit :: String -> Token
readBitLit s =
let (width, val) = break (== 'b') s in
let w = case reads width of
[(i,"")] -> i
_ -> error $ "Lex error on bitWidth " ++ width
in
TokBitLit (w, readBin (tail val)) | 248 | readBitLit :: String -> Token
readBitLit s =
let (width, val) = break (== 'b') s in
let w = case reads width of
[(i,"")] -> i
_ -> error $ "Lex error on bitWidth " ++ width
in
TokBitLit (w, readBin (tail val)) | 248 | readBitLit s =
let (width, val) = break (== 'b') s in
let w = case reads width of
[(i,"")] -> i
_ -> error $ "Lex error on bitWidth " ++ width
in
TokBitLit (w, readBin (tail val)) | 218 | false | true | 0 | 15 | 82 | 110 | 56 | 54 | null | null |
Fizzixnerd/xmonad-config | Battery.hs | gpl-3.0 | -- | A helper to read the variant contents of a dict with a default
-- value.
readDict :: (IsVariant a) => Map Text Variant -> Text -> a -> a
readDict dict key dflt = fromMaybe dflt $ do
variant <- M.lookup key dict
fromVariant variant
-- | Read the variant contents of a dict which is of an unknown integral type. | 319 | readDict :: (IsVariant a) => Map Text Variant -> Text -> a -> a
readDict dict key dflt = fromMaybe dflt $ do
variant <- M.lookup key dict
fromVariant variant
-- | Read the variant contents of a dict which is of an unknown integral type. | 241 | readDict dict key dflt = fromMaybe dflt $ do
variant <- M.lookup key dict
fromVariant variant
-- | Read the variant contents of a dict which is of an unknown integral type. | 177 | true | true | 0 | 10 | 67 | 74 | 36 | 38 | null | null |
sboosali/commands-spiros | config/Commands/Plugins/Spiros/Macros.hs | gpl-2.0 | renderManaCostForReddit :: ManaCost ->String
renderManaCostForReddit (ManaCost n s)
= ((n <&> (show > renderSymbolForReddit)) & maybe "" id )
++ ((sort s <&> (renderMagicSymbol > renderSymbolForReddit)) & foldr (++) "" ) | 244 | renderManaCostForReddit :: ManaCost ->String
renderManaCostForReddit (ManaCost n s)
= ((n <&> (show > renderSymbolForReddit)) & maybe "" id )
++ ((sort s <&> (renderMagicSymbol > renderSymbolForReddit)) & foldr (++) "" ) | 244 | renderManaCostForReddit (ManaCost n s)
= ((n <&> (show > renderSymbolForReddit)) & maybe "" id )
++ ((sort s <&> (renderMagicSymbol > renderSymbolForReddit)) & foldr (++) "" ) | 199 | false | true | 2 | 11 | 54 | 89 | 46 | 43 | null | null |
osa1/Idris-dev | src/IRTS/Compiler.hs | bsd-3-clause | irTerm vs env (Bind n (Lam _) sc) = LLam [n'] <$> irTerm vs (n':env) sc
where
n' = uniqueName n env | 105 | irTerm vs env (Bind n (Lam _) sc) = LLam [n'] <$> irTerm vs (n':env) sc
where
n' = uniqueName n env | 105 | irTerm vs env (Bind n (Lam _) sc) = LLam [n'] <$> irTerm vs (n':env) sc
where
n' = uniqueName n env | 105 | false | false | 1 | 8 | 27 | 74 | 32 | 42 | null | null |
zepto-lang/zepto | src/Zepto/Types/Export.hs | gpl-2.0 | concatBVec = B.concat | 21 | concatBVec = B.concat | 21 | concatBVec = B.concat | 21 | false | false | 0 | 5 | 2 | 8 | 4 | 4 | null | null |
c00w/BitToll | haskell/NewBlock.hs | mit | removeUserQueue :: PersistentConns -> B.ByteString -> IO ()
removeUserQueue conn share = do
username <- getMaybe (RedisException "no share Username") =<< getShareUsername conn share
_ <- remShareUserQueue conn username share
return () | 246 | removeUserQueue :: PersistentConns -> B.ByteString -> IO ()
removeUserQueue conn share = do
username <- getMaybe (RedisException "no share Username") =<< getShareUsername conn share
_ <- remShareUserQueue conn username share
return () | 246 | removeUserQueue conn share = do
username <- getMaybe (RedisException "no share Username") =<< getShareUsername conn share
_ <- remShareUserQueue conn username share
return () | 186 | false | true | 0 | 12 | 43 | 83 | 36 | 47 | null | null |
capn-freako/lambda-ccc | src/LambdaCCC/Unused/CoreEncode.hs | bsd-3-clause | onScrutineeR :: Unop ReExpr
onScrutineeR r = caseAllR r id id (const id) | 72 | onScrutineeR :: Unop ReExpr
onScrutineeR r = caseAllR r id id (const id) | 72 | onScrutineeR r = caseAllR r id id (const id) | 44 | false | true | 0 | 7 | 12 | 32 | 15 | 17 | null | null |
juhp/network-uri | tests/uri001.hs | bsd-3-clause | -- URI with IPv(future) address
testURIRef121 = testURIRef AbsId "http://[v9.123.abc;456.def]/" | 95 | testURIRef121 = testURIRef AbsId "http://[v9.123.abc;456.def]/" | 63 | testURIRef121 = testURIRef AbsId "http://[v9.123.abc;456.def]/" | 63 | true | false | 0 | 5 | 9 | 12 | 6 | 6 | null | null |
a143753/AOJ | 0500.hs | apache-2.0 | play (n:ns) =
let i = take (n!!0) ns
o = acm $ map turn $ map (\(x0:x1:xs) -> (x0,x1)) i
os= play $ drop (n!!0) ns
in
(o:os) | 156 | play (n:ns) =
let i = take (n!!0) ns
o = acm $ map turn $ map (\(x0:x1:xs) -> (x0,x1)) i
os= play $ drop (n!!0) ns
in
(o:os) | 156 | play (n:ns) =
let i = take (n!!0) ns
o = acm $ map turn $ map (\(x0:x1:xs) -> (x0,x1)) i
os= play $ drop (n!!0) ns
in
(o:os) | 156 | false | false | 0 | 15 | 60 | 113 | 59 | 54 | null | null |
Dobiasd/HackerRank-solutions | Artificial_Intelligence/Digital_Image_Analysis/Digital_Camera_Autodetect_Day_or_Night/Main.hs | mit | solve :: String -> String
solve =
readImage
>>> imageRows 0 2
>>> averageColor
>>> rgbToGray
>>> toValue
>>> toDayTime
where
toDayTime val = if val >= 96 then "day" else "night" | 213 | solve :: String -> String
solve =
readImage
>>> imageRows 0 2
>>> averageColor
>>> rgbToGray
>>> toValue
>>> toDayTime
where
toDayTime val = if val >= 96 then "day" else "night" | 213 | solve =
readImage
>>> imageRows 0 2
>>> averageColor
>>> rgbToGray
>>> toValue
>>> toDayTime
where
toDayTime val = if val >= 96 then "day" else "night" | 187 | false | true | 10 | 6 | 67 | 68 | 32 | 36 | null | null |
forked-upstream-packages-for-ghcjs/ghc | compiler/rename/RnBinds.hs | bsd-3-clause | rnBindLHS _ _ b = pprPanic "rnBindHS" (ppr b) | 45 | rnBindLHS _ _ b = pprPanic "rnBindHS" (ppr b) | 45 | rnBindLHS _ _ b = pprPanic "rnBindHS" (ppr b) | 45 | false | false | 0 | 7 | 8 | 24 | 11 | 13 | null | null |
kim/amazonka | amazonka-s3/gen/Network/AWS/S3/Types.hs | mpl-2.0 | -- | Protocol to use (http, https) when redirecting requests. The default is the
-- protocol that is used in the original request.
rProtocol :: Lens' Redirect (Maybe Protocol)
rProtocol = lens _rProtocol (\s a -> s { _rProtocol = a }) | 234 | rProtocol :: Lens' Redirect (Maybe Protocol)
rProtocol = lens _rProtocol (\s a -> s { _rProtocol = a }) | 103 | rProtocol = lens _rProtocol (\s a -> s { _rProtocol = a }) | 58 | true | true | 0 | 9 | 41 | 47 | 26 | 21 | null | null |
lfairy/sparkle | Sparkle/Types.hs | agpl-3.0 | -- Debugging -----------------------------------------------------------
testProject :: Project
testProject = emptyProject
& projTitle .~ "Test Project"
& projTasks .~ testTasks | 186 | testProject :: Project
testProject = emptyProject
& projTitle .~ "Test Project"
& projTasks .~ testTasks | 112 | testProject = emptyProject
& projTitle .~ "Test Project"
& projTasks .~ testTasks | 89 | true | true | 0 | 8 | 26 | 28 | 15 | 13 | null | null |
Warbo/quickcheck | examples/Simple.hs | bsd-3-clause | --------------------------------------------------------------------------
-- example 1
allEqual x y z = x == y && y == z | 123 | allEqual x y z = x == y && y == z | 34 | allEqual x y z = x == y && y == z | 34 | true | false | 3 | 5 | 17 | 35 | 15 | 20 | null | null |
kowey/GenI | src/NLP/GenI/Morphology.hs | gpl-2.0 | setMorphAnchor :: GNode GeniVal -> Tree (GNode GeniVal) -> Tree (GNode GeniVal)
setMorphAnchor n t =
fromMaybe (error oops) $ repNode fn filt t
where
filt (Node a _) = gtype a == Lex && ganchor a
fn (Node _ l) = Node n l
oops = "NLP.GenI.Morphology.setMorphAnchor did not anticipate failure was possible"
-- ----------------------------------------------------------------------
-- Morphological realisation
-- ----------------------------------------------------------------------
-- | Extracts the lemmas from a list of uninflected sentences. This is used
-- when the morphological generator is unavailable, doesn't work, etc. | 653 | setMorphAnchor :: GNode GeniVal -> Tree (GNode GeniVal) -> Tree (GNode GeniVal)
setMorphAnchor n t =
fromMaybe (error oops) $ repNode fn filt t
where
filt (Node a _) = gtype a == Lex && ganchor a
fn (Node _ l) = Node n l
oops = "NLP.GenI.Morphology.setMorphAnchor did not anticipate failure was possible"
-- ----------------------------------------------------------------------
-- Morphological realisation
-- ----------------------------------------------------------------------
-- | Extracts the lemmas from a list of uninflected sentences. This is used
-- when the morphological generator is unavailable, doesn't work, etc. | 653 | setMorphAnchor n t =
fromMaybe (error oops) $ repNode fn filt t
where
filt (Node a _) = gtype a == Lex && ganchor a
fn (Node _ l) = Node n l
oops = "NLP.GenI.Morphology.setMorphAnchor did not anticipate failure was possible"
-- ----------------------------------------------------------------------
-- Morphological realisation
-- ----------------------------------------------------------------------
-- | Extracts the lemmas from a list of uninflected sentences. This is used
-- when the morphological generator is unavailable, doesn't work, etc. | 573 | false | true | 1 | 10 | 109 | 139 | 64 | 75 | null | null |
spacekitteh/smcghc | compiler/cmm/CLabel.hs | bsd-3-clause | pprCLbl (PlainModuleInitLabel mod)
= ptext (sLit "__stginit_") <> ppr mod | 76 | pprCLbl (PlainModuleInitLabel mod)
= ptext (sLit "__stginit_") <> ppr mod | 76 | pprCLbl (PlainModuleInitLabel mod)
= ptext (sLit "__stginit_") <> ppr mod | 76 | false | false | 0 | 7 | 12 | 32 | 14 | 18 | null | null |
winterland1989/mysql-haskell | Database/MySQL/Protocol/MySQLValue.hs | bsd-3-clause | putBinaryField (MySQLDate d) = do putWord8 4
putBinaryDay d | 105 | putBinaryField (MySQLDate d) = do putWord8 4
putBinaryDay d | 105 | putBinaryField (MySQLDate d) = do putWord8 4
putBinaryDay d | 105 | false | false | 0 | 7 | 54 | 27 | 11 | 16 | null | null |
vlastachu/milan | src/Compiler.hs | mit | binaryOpToVMCommand Add = ADD | 31 | binaryOpToVMCommand Add = ADD | 31 | binaryOpToVMCommand Add = ADD | 31 | false | false | 0 | 5 | 5 | 9 | 4 | 5 | null | null |
brendanhay/gogol | gogol-firestore/gen/Network/Google/Resource/FireStore/Projects/Databases/Documents/Get.hs | mpl-2.0 | -- | Upload protocol for media (e.g. \"raw\", \"multipart\").
pddgUploadProtocol :: Lens' ProjectsDatabasesDocumentsGet (Maybe Text)
pddgUploadProtocol
= lens _pddgUploadProtocol
(\ s a -> s{_pddgUploadProtocol = a}) | 224 | pddgUploadProtocol :: Lens' ProjectsDatabasesDocumentsGet (Maybe Text)
pddgUploadProtocol
= lens _pddgUploadProtocol
(\ s a -> s{_pddgUploadProtocol = a}) | 162 | pddgUploadProtocol
= lens _pddgUploadProtocol
(\ s a -> s{_pddgUploadProtocol = a}) | 91 | true | true | 0 | 9 | 33 | 48 | 25 | 23 | null | null |
taojang/haskell-programming-book-exercise | src/ch10/LiveCoding.hs | bsd-3-clause | squish :: [[a]] -> [a]
squish = foldr (++) [] | 45 | squish :: [[a]] -> [a]
squish = foldr (++) [] | 45 | squish = foldr (++) [] | 22 | false | true | 0 | 8 | 9 | 40 | 20 | 20 | null | null |
snoyberg/ghc | compiler/basicTypes/Unique.hs | bsd-3-clause | showUnique :: Unique -> String
showUnique uniq
= case unpkUnique uniq of
(tag, u) -> finish_show tag u (iToBase62 u) | 124 | showUnique :: Unique -> String
showUnique uniq
= case unpkUnique uniq of
(tag, u) -> finish_show tag u (iToBase62 u) | 124 | showUnique uniq
= case unpkUnique uniq of
(tag, u) -> finish_show tag u (iToBase62 u) | 93 | false | true | 0 | 10 | 27 | 55 | 26 | 29 | null | null |
patrickboe/wheel | src/lib/hs/Config.hs | gpl-3.0 | loadConfig :: Worth FilePath -> IO AuthConfig
loadConfig path = do
cfg <- load [path]
s <- require cfg "auth0_secret"
i <- require cfg "auth0_issuer"
a <- require cfg "auth0_audience"
return $ AuthConfig { privatekey = s
, audience = a
, issuer = i} | 303 | loadConfig :: Worth FilePath -> IO AuthConfig
loadConfig path = do
cfg <- load [path]
s <- require cfg "auth0_secret"
i <- require cfg "auth0_issuer"
a <- require cfg "auth0_audience"
return $ AuthConfig { privatekey = s
, audience = a
, issuer = i} | 303 | loadConfig path = do
cfg <- load [path]
s <- require cfg "auth0_secret"
i <- require cfg "auth0_issuer"
a <- require cfg "auth0_audience"
return $ AuthConfig { privatekey = s
, audience = a
, issuer = i} | 257 | false | true | 0 | 9 | 98 | 100 | 48 | 52 | null | null |
phischu/fragnix | tests/packages/scotty/Data.Vector.Mutable.hs | bsd-3-clause | unsafeCopy = G.unsafeCopy | 25 | unsafeCopy = G.unsafeCopy | 25 | unsafeCopy = G.unsafeCopy | 25 | false | false | 1 | 6 | 2 | 12 | 4 | 8 | null | null |
ghc-android/ghc | testsuite/tests/ghci/should_run/ghcirun004.hs | bsd-3-clause | 2426 = 2425 | 11 | 2426 = 2425 | 11 | 2426 = 2425 | 11 | false | false | 1 | 5 | 2 | 10 | 3 | 7 | null | null |
gcampax/ghc | compiler/deSugar/Check.hs | bsd-3-clause | mb_neg negate (Just _) v = negate v | 35 | mb_neg negate (Just _) v = negate v | 35 | mb_neg negate (Just _) v = negate v | 35 | false | false | 0 | 7 | 7 | 22 | 10 | 12 | null | null |
input-output-hk/cardano-sl-explorer | src/Pos/Explorer/Web/Server.hs | mit | getMainBlock :: ExplorerMode ctx m => HeaderHash -> m (MainBlock SscGodTossing)
getMainBlock = fmap fst . getMainBlund | 118 | getMainBlock :: ExplorerMode ctx m => HeaderHash -> m (MainBlock SscGodTossing)
getMainBlock = fmap fst . getMainBlund | 118 | getMainBlock = fmap fst . getMainBlund | 38 | false | true | 0 | 10 | 16 | 45 | 20 | 25 | null | null |
kawu/tag-vanilla | src/NLP/TAG/Vanilla/Earley/Pred.hs | bsd-2-clause | -- | Make an initial `EarSt` from a set of states.
mkEarSt
:: (Ord n, Ord t)
=> S.Set (Rule n t) -- ^ The set of rules
-> S.Set n -- ^ Starting symbols
-> (EarSt n t)
mkEarSt ruleSet startSet = EarSt
{ gramMap = theGram
, doneExpEnd = M.empty
, doneProSpan = M.empty
, waiting = Q.fromList
[ p :-> prio p
| p <- S.toList sts0 ] }
where
theGram = mkGram ruleSet
sts0 = S.fromList
[ State
{ root = headR
, left = []
, right = bodyR
, beg = 0
, end = 0
, gap = Nothing }
-- TODO: we can speed it up by using the
-- constructed grammar.
| Rule{..} <- S.toList ruleSet
-- make sure it's a regular rule
, isNonT headR
-- and that it's a top-level rule
, isNothing (labID headR)
-- it must also contain a start symbol
, nonTerm headR `S.member` startSet ]
isNonT NonT{} = True
isNonT _ = False
-- | Earley parser monad. Contains the input sentence (reader)
-- and the state of the computation `EarSt'. | 1,145 | mkEarSt
:: (Ord n, Ord t)
=> S.Set (Rule n t) -- ^ The set of rules
-> S.Set n -- ^ Starting symbols
-> (EarSt n t)
mkEarSt ruleSet startSet = EarSt
{ gramMap = theGram
, doneExpEnd = M.empty
, doneProSpan = M.empty
, waiting = Q.fromList
[ p :-> prio p
| p <- S.toList sts0 ] }
where
theGram = mkGram ruleSet
sts0 = S.fromList
[ State
{ root = headR
, left = []
, right = bodyR
, beg = 0
, end = 0
, gap = Nothing }
-- TODO: we can speed it up by using the
-- constructed grammar.
| Rule{..} <- S.toList ruleSet
-- make sure it's a regular rule
, isNonT headR
-- and that it's a top-level rule
, isNothing (labID headR)
-- it must also contain a start symbol
, nonTerm headR `S.member` startSet ]
isNonT NonT{} = True
isNonT _ = False
-- | Earley parser monad. Contains the input sentence (reader)
-- and the state of the computation `EarSt'. | 1,094 | mkEarSt ruleSet startSet = EarSt
{ gramMap = theGram
, doneExpEnd = M.empty
, doneProSpan = M.empty
, waiting = Q.fromList
[ p :-> prio p
| p <- S.toList sts0 ] }
where
theGram = mkGram ruleSet
sts0 = S.fromList
[ State
{ root = headR
, left = []
, right = bodyR
, beg = 0
, end = 0
, gap = Nothing }
-- TODO: we can speed it up by using the
-- constructed grammar.
| Rule{..} <- S.toList ruleSet
-- make sure it's a regular rule
, isNonT headR
-- and that it's a top-level rule
, isNothing (labID headR)
-- it must also contain a start symbol
, nonTerm headR `S.member` startSet ]
isNonT NonT{} = True
isNonT _ = False
-- | Earley parser monad. Contains the input sentence (reader)
-- and the state of the computation `EarSt'. | 945 | true | true | 3 | 12 | 436 | 289 | 150 | 139 | null | null |
yousufmsoliman/music | Source (Haskell)/GeneralSpecies.hs | gpl-3.0 | -- skipping hard rule 1
-- hard rule 2
noAugDimCPIntervals = makeHardRule op "General CP - no augmented or diminished intervals in CP."
where
op bb = let cp = goToTime (counterPoint bb) (timeToTestAt bb)
notes = getBackN 2 =<< cp
interval = liftM2 (#) (liftM (!!0) notes) (liftM (!!1) notes)
isDim = toBool . liftM ((<Minor) . quality) $ interval
isAug = toBool . liftM ((>Major) . quality) $ interval
in (if isDim || isAug then failTest else passTest) bb | 526 | noAugDimCPIntervals = makeHardRule op "General CP - no augmented or diminished intervals in CP."
where
op bb = let cp = goToTime (counterPoint bb) (timeToTestAt bb)
notes = getBackN 2 =<< cp
interval = liftM2 (#) (liftM (!!0) notes) (liftM (!!1) notes)
isDim = toBool . liftM ((<Minor) . quality) $ interval
isAug = toBool . liftM ((>Major) . quality) $ interval
in (if isDim || isAug then failTest else passTest) bb | 486 | noAugDimCPIntervals = makeHardRule op "General CP - no augmented or diminished intervals in CP."
where
op bb = let cp = goToTime (counterPoint bb) (timeToTestAt bb)
notes = getBackN 2 =<< cp
interval = liftM2 (#) (liftM (!!0) notes) (liftM (!!1) notes)
isDim = toBool . liftM ((<Minor) . quality) $ interval
isAug = toBool . liftM ((>Major) . quality) $ interval
in (if isDim || isAug then failTest else passTest) bb | 486 | true | false | 1 | 14 | 151 | 177 | 93 | 84 | null | null |
tensorflow/haskell | tensorflow/src/TensorFlow/Output.hs | apache-2.0 | opInputs :: Lens' OpDef [Output]
opInputs = lens _opInputs (\o x -> o {_opInputs = x}) | 86 | opInputs :: Lens' OpDef [Output]
opInputs = lens _opInputs (\o x -> o {_opInputs = x}) | 86 | opInputs = lens _opInputs (\o x -> o {_opInputs = x}) | 53 | false | true | 0 | 9 | 15 | 42 | 23 | 19 | null | null |
thielema/accelerate-fft | Data/Array/Accelerate/Math/FFT.hs | bsd-3-clause | fft1D' :: forall e. (Elt e, IsFloating e)
=> Mode
-> Int
-> Acc (Vector (Complex e))
-> Acc (Vector (Complex e))
fft1D' mode len vec
= let sign = signOfMode mode :: e
scale = P.fromIntegral len
#ifdef ACCELERATE_CUDA_BACKEND
sh = (Z:.len)
vec' = cudaFFT mode sh fft' vec
#else
vec' = fft' vec
#endif
fft' a = fft sign Z len a
in
if P.not (isPow2 len)
then error $ unlines
[ "Data.Array.Accelerate.FFT: fft1D"
, " Array dimensions must be powers of two, but are: " P.++ showShape (Z:.len) ]
else case mode of
Inverse -> A.map (/scale) vec'
_ -> vec'
-- Matrix Transform
-- ----------------
--
-- Discrete Fourier Transform of a matrix. Array dimensions must be powers of
-- two else error.
-- | 872 | fft1D' :: forall e. (Elt e, IsFloating e)
=> Mode
-> Int
-> Acc (Vector (Complex e))
-> Acc (Vector (Complex e))
fft1D' mode len vec
= let sign = signOfMode mode :: e
scale = P.fromIntegral len
#ifdef ACCELERATE_CUDA_BACKEND
sh = (Z:.len)
vec' = cudaFFT mode sh fft' vec
#else
vec' = fft' vec
#endif
fft' a = fft sign Z len a
in
if P.not (isPow2 len)
then error $ unlines
[ "Data.Array.Accelerate.FFT: fft1D"
, " Array dimensions must be powers of two, but are: " P.++ showShape (Z:.len) ]
else case mode of
Inverse -> A.map (/scale) vec'
_ -> vec'
-- Matrix Transform
-- ----------------
--
-- Discrete Fourier Transform of a matrix. Array dimensions must be powers of
-- two else error.
-- | 872 | fft1D' mode len vec
= let sign = signOfMode mode :: e
scale = P.fromIntegral len
#ifdef ACCELERATE_CUDA_BACKEND
sh = (Z:.len)
vec' = cudaFFT mode sh fft' vec
#else
vec' = fft' vec
#endif
fft' a = fft sign Z len a
in
if P.not (isPow2 len)
then error $ unlines
[ "Data.Array.Accelerate.FFT: fft1D"
, " Array dimensions must be powers of two, but are: " P.++ showShape (Z:.len) ]
else case mode of
Inverse -> A.map (/scale) vec'
_ -> vec'
-- Matrix Transform
-- ----------------
--
-- Discrete Fourier Transform of a matrix. Array dimensions must be powers of
-- two else error.
-- | 731 | false | true | 0 | 15 | 308 | 239 | 124 | 115 | null | null |
lzlarryli/advent_of_code_2016 | day10/part2.hs | mit | give bot val (Output j) (state, outputs) = (state, outputs')
where
outputs' = M.alter (\ _ -> Just $ val : M.findWithDefault [] j outputs) j outputs | 154 | give bot val (Output j) (state, outputs) = (state, outputs')
where
outputs' = M.alter (\ _ -> Just $ val : M.findWithDefault [] j outputs) j outputs | 154 | give bot val (Output j) (state, outputs) = (state, outputs')
where
outputs' = M.alter (\ _ -> Just $ val : M.findWithDefault [] j outputs) j outputs | 154 | false | false | 1 | 10 | 32 | 85 | 40 | 45 | null | null |
bredelings/BAli-Phy | tests/optimizer/11/test.hs | gpl-2.0 | q y x = fst (if x then (1,y) else (y,3)) | 40 | q y x = fst (if x then (1,y) else (y,3)) | 40 | q y x = fst (if x then (1,y) else (y,3)) | 40 | false | false | 0 | 8 | 10 | 38 | 21 | 17 | null | null |
wouwouwou/2017_module_8 | src/haskell/PP-project-2016/CodeGen.hs | apache-2.0 | codeGen (ASTWhile astExpr astStat
checkType@(functions, globals, variables)) threads
= exprGen ++
[ Pop regE
, ComputeI Xor regE 1 regE
, Branch regE (Rel (2 + (lengthNoDebug bodyGen)))] ++
bodyGen ++
[ Jump (Rel (-((lengthNoDebug (bodyGen ++ exprGen)) + 3)))]
where
exprGen = codeGen astExpr threads
bodyGen = codeGen astStat threads
-- Fork works like a normal call, except that it will be executed on a different
-- sprockell. Therefore its local arguments are passed on call-by-value. Any global
-- variables that are passed as arguments are referenced, but will only be visible
-- after the procedure behind the fork call finishes. This can be ensured with the
-- join keyword. | 856 | codeGen (ASTWhile astExpr astStat
checkType@(functions, globals, variables)) threads
= exprGen ++
[ Pop regE
, ComputeI Xor regE 1 regE
, Branch regE (Rel (2 + (lengthNoDebug bodyGen)))] ++
bodyGen ++
[ Jump (Rel (-((lengthNoDebug (bodyGen ++ exprGen)) + 3)))]
where
exprGen = codeGen astExpr threads
bodyGen = codeGen astStat threads
-- Fork works like a normal call, except that it will be executed on a different
-- sprockell. Therefore its local arguments are passed on call-by-value. Any global
-- variables that are passed as arguments are referenced, but will only be visible
-- after the procedure behind the fork call finishes. This can be ensured with the
-- join keyword. | 856 | codeGen (ASTWhile astExpr astStat
checkType@(functions, globals, variables)) threads
= exprGen ++
[ Pop regE
, ComputeI Xor regE 1 regE
, Branch regE (Rel (2 + (lengthNoDebug bodyGen)))] ++
bodyGen ++
[ Jump (Rel (-((lengthNoDebug (bodyGen ++ exprGen)) + 3)))]
where
exprGen = codeGen astExpr threads
bodyGen = codeGen astStat threads
-- Fork works like a normal call, except that it will be executed on a different
-- sprockell. Therefore its local arguments are passed on call-by-value. Any global
-- variables that are passed as arguments are referenced, but will only be visible
-- after the procedure behind the fork call finishes. This can be ensured with the
-- join keyword. | 856 | false | false | 0 | 17 | 284 | 154 | 83 | 71 | null | null |
pparkkin/eta | compiler/ETA/BasicTypes/OccName.hs | bsd-3-clause | nameSpacesRelated :: NameSpace -> NameSpace -> Bool
nameSpacesRelated ns1 ns2 = ns1 == ns2 || otherNameSpace ns1 == ns2 | 119 | nameSpacesRelated :: NameSpace -> NameSpace -> Bool
nameSpacesRelated ns1 ns2 = ns1 == ns2 || otherNameSpace ns1 == ns2 | 119 | nameSpacesRelated ns1 ns2 = ns1 == ns2 || otherNameSpace ns1 == ns2 | 67 | false | true | 0 | 7 | 18 | 39 | 19 | 20 | null | null |
shlevy/ghc | compiler/utils/Util.hs | bsd-3-clause | looksLikeModuleName (c:cs) = isUpper c && go cs
where go [] = True
go ('.':cs) = looksLikeModuleName cs
go (c:cs) = (isAlphaNum c || c == '_' || c == '\'') && go cs
-- Similar to 'parse' for Distribution.Package.PackageName,
-- but we don't want to depend on Cabal. | 286 | looksLikeModuleName (c:cs) = isUpper c && go cs
where go [] = True
go ('.':cs) = looksLikeModuleName cs
go (c:cs) = (isAlphaNum c || c == '_' || c == '\'') && go cs
-- Similar to 'parse' for Distribution.Package.PackageName,
-- but we don't want to depend on Cabal. | 286 | looksLikeModuleName (c:cs) = isUpper c && go cs
where go [] = True
go ('.':cs) = looksLikeModuleName cs
go (c:cs) = (isAlphaNum c || c == '_' || c == '\'') && go cs
-- Similar to 'parse' for Distribution.Package.PackageName,
-- but we don't want to depend on Cabal. | 286 | false | false | 0 | 11 | 69 | 103 | 51 | 52 | null | null |
beni55/hermit | src/HERMIT/Kure.hs | bsd-2-clause | -- | Transform an expression of the form: @Let@ 'CoreBind' 'CoreExpr'
letT :: (ExtendPath c Crumb, ReadPath c Crumb, AddBindings c, Monad m) => Transform c m CoreBind a1 -> Transform c m CoreExpr a2 -> (a1 -> a2 -> b) -> Transform c m CoreExpr b
letT t1 t2 f = transform $ \ c -> \case
Let bds e -> -- Note we use the *original* context for the binding group.
-- If the bindings are recursive, they will be added to the context by recT.
f <$> applyT t1 (c @@ Let_Bind) bds <*> applyT t2 (addBindingGroup bds c @@ Let_Body) e
_ -> fail "not a let node."
| 619 | letT :: (ExtendPath c Crumb, ReadPath c Crumb, AddBindings c, Monad m) => Transform c m CoreBind a1 -> Transform c m CoreExpr a2 -> (a1 -> a2 -> b) -> Transform c m CoreExpr b
letT t1 t2 f = transform $ \ c -> \case
Let bds e -> -- Note we use the *original* context for the binding group.
-- If the bindings are recursive, they will be added to the context by recT.
f <$> applyT t1 (c @@ Let_Bind) bds <*> applyT t2 (addBindingGroup bds c @@ Let_Body) e
_ -> fail "not a let node."
| 549 | letT t1 t2 f = transform $ \ c -> \case
Let bds e -> -- Note we use the *original* context for the binding group.
-- If the bindings are recursive, they will be added to the context by recT.
f <$> applyT t1 (c @@ Let_Bind) bds <*> applyT t2 (addBindingGroup bds c @@ Let_Body) e
_ -> fail "not a let node."
| 373 | true | true | 0 | 14 | 178 | 174 | 87 | 87 | null | null |
palf/free-driver | packages/drive-terminal/lib/Drive/Terminal/Handlers.hs | bsd-3-clause | execTerminal (PrintMessage s x) = liftIO (print s) >> pure x | 60 | execTerminal (PrintMessage s x) = liftIO (print s) >> pure x | 60 | execTerminal (PrintMessage s x) = liftIO (print s) >> pure x | 60 | false | false | 0 | 8 | 10 | 33 | 15 | 18 | null | null |
thoughtpolice/binary-serialise-cbor | bench/Real/PkgAesonGeneric.hs | bsd-3-clause | serialise :: [GenericPackageDescription] -> BS.ByteString
serialise pkgs = Aeson.encode pkgs | 92 | serialise :: [GenericPackageDescription] -> BS.ByteString
serialise pkgs = Aeson.encode pkgs | 92 | serialise pkgs = Aeson.encode pkgs | 34 | false | true | 0 | 6 | 9 | 28 | 14 | 14 | null | null |
sjakobi/heist | src/Heist/Compiled/Internal.hs | bsd-3-clause | renderFragment :: Markup -> [X.Node] -> Builder
renderFragment markup ns =
case markup of
Html -> X.renderHtmlFragment X.UTF8 ns
Xml -> X.renderXmlFragment X.UTF8 ns
------------------------------------------------------------------------------
-- | Yields pure text known at load time. | 305 | renderFragment :: Markup -> [X.Node] -> Builder
renderFragment markup ns =
case markup of
Html -> X.renderHtmlFragment X.UTF8 ns
Xml -> X.renderXmlFragment X.UTF8 ns
------------------------------------------------------------------------------
-- | Yields pure text known at load time. | 305 | renderFragment markup ns =
case markup of
Html -> X.renderHtmlFragment X.UTF8 ns
Xml -> X.renderXmlFragment X.UTF8 ns
------------------------------------------------------------------------------
-- | Yields pure text known at load time. | 257 | false | true | 0 | 9 | 52 | 70 | 34 | 36 | null | null |
shlevy/ghc | compiler/nativeGen/SPARC/CodeGen/Gen32.hs | bsd-3-clause | trivialFCode
:: Width
-> (Format -> Reg -> Reg -> Reg -> Instr)
-> CmmExpr
-> CmmExpr
-> NatM Register
trivialFCode pk instr x y = do
dflags <- getDynFlags
(src1, code1) <- getSomeReg x
(src2, code2) <- getSomeReg y
tmp <- getNewRegNat FF64
let
promote x = FxTOy FF32 FF64 x tmp
pk1 = cmmExprType dflags x
pk2 = cmmExprType dflags y
code__2 dst =
if pk1 `cmmEqType` pk2 then
code1 `appOL` code2 `snocOL`
instr (floatFormat pk) src1 src2 dst
else if typeWidth pk1 == W32 then
code1 `snocOL` promote src1 `appOL` code2 `snocOL`
instr FF64 tmp src2 dst
else
code1 `appOL` code2 `snocOL` promote src2 `snocOL`
instr FF64 src1 tmp dst
return (Any (cmmTypeFormat $ if pk1 `cmmEqType` pk2 then pk1 else cmmFloat W64)
code__2) | 1,005 | trivialFCode
:: Width
-> (Format -> Reg -> Reg -> Reg -> Instr)
-> CmmExpr
-> CmmExpr
-> NatM Register
trivialFCode pk instr x y = do
dflags <- getDynFlags
(src1, code1) <- getSomeReg x
(src2, code2) <- getSomeReg y
tmp <- getNewRegNat FF64
let
promote x = FxTOy FF32 FF64 x tmp
pk1 = cmmExprType dflags x
pk2 = cmmExprType dflags y
code__2 dst =
if pk1 `cmmEqType` pk2 then
code1 `appOL` code2 `snocOL`
instr (floatFormat pk) src1 src2 dst
else if typeWidth pk1 == W32 then
code1 `snocOL` promote src1 `appOL` code2 `snocOL`
instr FF64 tmp src2 dst
else
code1 `appOL` code2 `snocOL` promote src2 `snocOL`
instr FF64 src1 tmp dst
return (Any (cmmTypeFormat $ if pk1 `cmmEqType` pk2 then pk1 else cmmFloat W64)
code__2) | 1,004 | trivialFCode pk instr x y = do
dflags <- getDynFlags
(src1, code1) <- getSomeReg x
(src2, code2) <- getSomeReg y
tmp <- getNewRegNat FF64
let
promote x = FxTOy FF32 FF64 x tmp
pk1 = cmmExprType dflags x
pk2 = cmmExprType dflags y
code__2 dst =
if pk1 `cmmEqType` pk2 then
code1 `appOL` code2 `snocOL`
instr (floatFormat pk) src1 src2 dst
else if typeWidth pk1 == W32 then
code1 `snocOL` promote src1 `appOL` code2 `snocOL`
instr FF64 tmp src2 dst
else
code1 `appOL` code2 `snocOL` promote src2 `snocOL`
instr FF64 src1 tmp dst
return (Any (cmmTypeFormat $ if pk1 `cmmEqType` pk2 then pk1 else cmmFloat W64)
code__2) | 861 | false | true | 0 | 16 | 413 | 315 | 162 | 153 | null | null |
GaloisInc/halvm-ghc | compiler/basicTypes/SrcLoc.hs | bsd-3-clause | realSrcLocSpan :: RealSrcLoc -> RealSrcSpan
realSrcLocSpan (SrcLoc file line col) = RealSrcSpan' file line col line col | 119 | realSrcLocSpan :: RealSrcLoc -> RealSrcSpan
realSrcLocSpan (SrcLoc file line col) = RealSrcSpan' file line col line col | 119 | realSrcLocSpan (SrcLoc file line col) = RealSrcSpan' file line col line col | 75 | false | true | 0 | 7 | 16 | 39 | 19 | 20 | null | null |
forked-upstream-packages-for-ghcjs/ghc | utils/genprimopcode/Main.hs | bsd-3-clause | mkPOItext :: Entry -> String
mkPOItext i = mkPOI_LHS_text i ++ mkPOI_RHS_text i | 79 | mkPOItext :: Entry -> String
mkPOItext i = mkPOI_LHS_text i ++ mkPOI_RHS_text i | 79 | mkPOItext i = mkPOI_LHS_text i ++ mkPOI_RHS_text i | 50 | false | true | 0 | 7 | 12 | 33 | 14 | 19 | null | null |
tkasu/haskellbook-adventure | app/Main.hs | bsd-3-clause | main :: IO ()
main = someFunc | 29 | main :: IO ()
main = someFunc | 29 | main = someFunc | 15 | false | true | 0 | 7 | 6 | 22 | 9 | 13 | null | null |
mindriot101/pandoc | src/Text/Pandoc/Pretty.hs | gpl-2.0 | renderList (BeforeNonBlank d : xs) =
case xs of
(x:_) | isBlank x -> renderList xs
| otherwise -> renderDoc d >> renderList xs
[] -> renderList xs | 181 | renderList (BeforeNonBlank d : xs) =
case xs of
(x:_) | isBlank x -> renderList xs
| otherwise -> renderDoc d >> renderList xs
[] -> renderList xs | 181 | renderList (BeforeNonBlank d : xs) =
case xs of
(x:_) | isBlank x -> renderList xs
| otherwise -> renderDoc d >> renderList xs
[] -> renderList xs | 181 | false | false | 0 | 11 | 62 | 78 | 35 | 43 | null | null |
iquiw/wai | warp-tls/Network/Wai/Handler/WarpTLS.hs | mit | getTLSinfo :: TLS.Context -> IO Transport
getTLSinfo ctx = do
proto <- TLS.getNegotiatedProtocol ctx
minfo <- TLS.contextGetInformation ctx
case minfo of
Nothing -> return TCP
Just TLS.Information{..} -> do
let (major, minor) = case infoVersion of
TLS.SSL2 -> (2,0)
TLS.SSL3 -> (3,0)
TLS.TLS10 -> (3,1)
TLS.TLS11 -> (3,2)
TLS.TLS12 -> (3,3)
return TLS {
tlsMajorVersion = major
, tlsMinorVersion = minor
, tlsNegotiatedProtocol = proto
, tlsChiperID = TLS.cipherID infoCipher
} | 705 | getTLSinfo :: TLS.Context -> IO Transport
getTLSinfo ctx = do
proto <- TLS.getNegotiatedProtocol ctx
minfo <- TLS.contextGetInformation ctx
case minfo of
Nothing -> return TCP
Just TLS.Information{..} -> do
let (major, minor) = case infoVersion of
TLS.SSL2 -> (2,0)
TLS.SSL3 -> (3,0)
TLS.TLS10 -> (3,1)
TLS.TLS11 -> (3,2)
TLS.TLS12 -> (3,3)
return TLS {
tlsMajorVersion = major
, tlsMinorVersion = minor
, tlsNegotiatedProtocol = proto
, tlsChiperID = TLS.cipherID infoCipher
} | 705 | getTLSinfo ctx = do
proto <- TLS.getNegotiatedProtocol ctx
minfo <- TLS.contextGetInformation ctx
case minfo of
Nothing -> return TCP
Just TLS.Information{..} -> do
let (major, minor) = case infoVersion of
TLS.SSL2 -> (2,0)
TLS.SSL3 -> (3,0)
TLS.TLS10 -> (3,1)
TLS.TLS11 -> (3,2)
TLS.TLS12 -> (3,3)
return TLS {
tlsMajorVersion = major
, tlsMinorVersion = minor
, tlsNegotiatedProtocol = proto
, tlsChiperID = TLS.cipherID infoCipher
} | 663 | false | true | 0 | 18 | 298 | 207 | 107 | 100 | null | null |
tolysz/prepare-ghcjs | spec-lts8/base/GHC/Float/RealFracMethods.hs | bsd-3-clause | ceilingFloatInteger :: Float -> Integer
ceilingFloatInteger (F# x) =
negateInteger (floorFloatInteger (F# (negateFloat# x))) | 128 | ceilingFloatInteger :: Float -> Integer
ceilingFloatInteger (F# x) =
negateInteger (floorFloatInteger (F# (negateFloat# x))) | 128 | ceilingFloatInteger (F# x) =
negateInteger (floorFloatInteger (F# (negateFloat# x))) | 88 | false | true | 0 | 11 | 17 | 45 | 22 | 23 | null | null |
philopon/pylon | Graphics/Pylon/Binding/Pango/Font.hs | mit | fontDescriptionGetStretch :: FontDescription -> IO Stretch
fontDescriptionGetStretch (FontDescription f'fd) =
withForeignPtr f'fd $ \fd ->
pango_font_description_get_stretch fd | 184 | fontDescriptionGetStretch :: FontDescription -> IO Stretch
fontDescriptionGetStretch (FontDescription f'fd) =
withForeignPtr f'fd $ \fd ->
pango_font_description_get_stretch fd | 184 | fontDescriptionGetStretch (FontDescription f'fd) =
withForeignPtr f'fd $ \fd ->
pango_font_description_get_stretch fd | 125 | false | true | 0 | 7 | 24 | 42 | 20 | 22 | null | null |
rhovland/hackerrank-30days2016 | day0.hs | bsd-3-clause | main = putStrLn "Hello World.\nWelcome to 30 Days of Code.\n" | 61 | main = putStrLn "Hello World.\nWelcome to 30 Days of Code.\n" | 61 | main = putStrLn "Hello World.\nWelcome to 30 Days of Code.\n" | 61 | false | false | 0 | 5 | 9 | 9 | 4 | 5 | null | null |
jyp/lp-diagrams | Graphics/Diagrams/Graphviz.hs | agpl-3.0 | pt :: G.Point -> Point' Expr
pt = fmap constant . pt' | 53 | pt :: G.Point -> Point' Expr
pt = fmap constant . pt' | 53 | pt = fmap constant . pt' | 24 | false | true | 0 | 7 | 11 | 33 | 14 | 19 | null | null |
TOSPIO/yi | src/library/Yi/Keymap/Vim.hs | gpl-2.0 | convertEvent :: VimMode -> (Char -> Char) -> Event -> Event
convertEvent (Insert _) f (Event (KASCII c) mods)
| MCtrl `elem` mods || MMeta `elem` mods = Event (KASCII (f c)) mods | 182 | convertEvent :: VimMode -> (Char -> Char) -> Event -> Event
convertEvent (Insert _) f (Event (KASCII c) mods)
| MCtrl `elem` mods || MMeta `elem` mods = Event (KASCII (f c)) mods | 182 | convertEvent (Insert _) f (Event (KASCII c) mods)
| MCtrl `elem` mods || MMeta `elem` mods = Event (KASCII (f c)) mods | 122 | false | true | 0 | 10 | 36 | 96 | 49 | 47 | null | null |
bstamour/weather | src/Net/Weather.hs | bsd-3-clause | conditionsQuery :: String -> String -> String -> String
conditionsQuery key city state =
"http://api.wunderground.com/api/" ++ key
++ "/conditions/q/" ++ state
++ "/" ++ city ++ ".json" | 191 | conditionsQuery :: String -> String -> String -> String
conditionsQuery key city state =
"http://api.wunderground.com/api/" ++ key
++ "/conditions/q/" ++ state
++ "/" ++ city ++ ".json" | 191 | conditionsQuery key city state =
"http://api.wunderground.com/api/" ++ key
++ "/conditions/q/" ++ state
++ "/" ++ city ++ ".json" | 135 | false | true | 4 | 7 | 32 | 57 | 27 | 30 | null | null |
rockdragon/julia-programming | code/haskell/Prettify.hs | mit | astral :: Int -> Doc
astral n = smallHex (a + 0xd800) <> smallHex (b + 0xdc00)
where
a = (n `shiftR` 10) .&. 0x3ff
b = n .&. 0x3ff | 140 | astral :: Int -> Doc
astral n = smallHex (a + 0xd800) <> smallHex (b + 0xdc00)
where
a = (n `shiftR` 10) .&. 0x3ff
b = n .&. 0x3ff | 140 | astral n = smallHex (a + 0xd800) <> smallHex (b + 0xdc00)
where
a = (n `shiftR` 10) .&. 0x3ff
b = n .&. 0x3ff | 119 | false | true | 1 | 8 | 39 | 74 | 38 | 36 | null | null |
PeterCxy/peterbot-haskell | src/Commands.hs | mit | -- Titlebot: title-changing actions
cmdPush :: Command
cmdPush _ msg ["push", newItem] =
cmdChangeTitle msg $ doCmdPush (chat_id $ chat msg) (chat_title $ chat msg) newItem | 174 | cmdPush :: Command
cmdPush _ msg ["push", newItem] =
cmdChangeTitle msg $ doCmdPush (chat_id $ chat msg) (chat_title $ chat msg) newItem | 138 | cmdPush _ msg ["push", newItem] =
cmdChangeTitle msg $ doCmdPush (chat_id $ chat msg) (chat_title $ chat msg) newItem | 119 | true | true | 0 | 9 | 27 | 59 | 30 | 29 | null | null |
DweebsUnited/CodeMonkey | haskell/terrainShow/src/GLMatrix.hs | bsd-3-clause | -- | Scales a vector by a scalar.
scaleVec :: GLfloat -> [GLfloat] -> [GLfloat]
scaleVec s = map (s*) | 101 | scaleVec :: GLfloat -> [GLfloat] -> [GLfloat]
scaleVec s = map (s*) | 67 | scaleVec s = map (s*) | 21 | true | true | 0 | 7 | 19 | 36 | 20 | 16 | null | null |
nilnullzip/lambda-untyped | src/Parse.hs | mit | -- predecessor/subtraction
parseTerm (x:r) | x == '*' = (parse("Lx.Ly.Lz.x(yz)"), r) | 84 | parseTerm (x:r) | x == '*' = (parse("Lx.Ly.Lz.x(yz)"), r) | 57 | parseTerm (x:r) | x == '*' = (parse("Lx.Ly.Lz.x(yz)"), r) | 57 | true | false | 0 | 8 | 10 | 39 | 20 | 19 | null | null |
cmahon/interactive-brokers | library/API/IB/Util.hs | bsd-3-clause | stringToEnum :: (Read a) => String -> Maybe a
stringToEnum s = case reads s of
[(s',"")] -> Just s'
_ -> Nothing | 116 | stringToEnum :: (Read a) => String -> Maybe a
stringToEnum s = case reads s of
[(s',"")] -> Just s'
_ -> Nothing | 116 | stringToEnum s = case reads s of
[(s',"")] -> Just s'
_ -> Nothing | 70 | false | true | 0 | 9 | 26 | 61 | 31 | 30 | null | null |
mariefarrell/Hets | OWL2/Parse.hs | gpl-2.0 | individualOrConstant :: CharParser st (Either Individual Literal)
individualOrConstant = fmap Right literal <|> fmap Left individual | 132 | individualOrConstant :: CharParser st (Either Individual Literal)
individualOrConstant = fmap Right literal <|> fmap Left individual | 132 | individualOrConstant = fmap Right literal <|> fmap Left individual | 66 | false | true | 0 | 7 | 15 | 38 | 18 | 20 | null | null |
mhuesch/scheme_compiler | src/L3ToL2/Compile.hs | bsd-3-clause | addReturn False = id | 20 | addReturn False = id | 20 | addReturn False = id | 20 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
nevrenato/Hets_Fork | LF/Sign.hs | gpl-2.0 | genSig :: Set.Set Symbol -> Sign -> Result Sign
genSig syms sig = do
let syms' = inclSyms syms sig
let defs' = filter (\ d -> Set.member (getSym d) syms') $ getDefs sig
return $ Sign gen_base gen_module defs' | 214 | genSig :: Set.Set Symbol -> Sign -> Result Sign
genSig syms sig = do
let syms' = inclSyms syms sig
let defs' = filter (\ d -> Set.member (getSym d) syms') $ getDefs sig
return $ Sign gen_base gen_module defs' | 214 | genSig syms sig = do
let syms' = inclSyms syms sig
let defs' = filter (\ d -> Set.member (getSym d) syms') $ getDefs sig
return $ Sign gen_base gen_module defs' | 166 | false | true | 0 | 16 | 45 | 100 | 46 | 54 | null | null |
pjones/xmonad-test | vendor/xmonad-contrib/XMonad/Layout/WindowNavigation.hs | bsd-2-clause | sortby D = sortBy (\(_,Rectangle _ y _ _) (_,Rectangle _ y' _ _) -> compare y y') | 81 | sortby D = sortBy (\(_,Rectangle _ y _ _) (_,Rectangle _ y' _ _) -> compare y y') | 81 | sortby D = sortBy (\(_,Rectangle _ y _ _) (_,Rectangle _ y' _ _) -> compare y y') | 81 | false | false | 0 | 9 | 17 | 57 | 29 | 28 | null | null |
sapek/pandoc | src/Text/Pandoc/Writers/Custom.hs | gpl-2.0 | inlineToCustom lua (Note contents) = callfunc lua "Note" contents | 65 | inlineToCustom lua (Note contents) = callfunc lua "Note" contents | 65 | inlineToCustom lua (Note contents) = callfunc lua "Note" contents | 65 | false | false | 0 | 6 | 8 | 26 | 11 | 15 | null | null |
peteg/ADHOC | Apps/Cache/Tests/000_arbitrated_bus.hs | gpl-2.0 | processes :: [Integer]
processes = [1 .. numProcesses] | 54 | processes :: [Integer]
processes = [1 .. numProcesses] | 54 | processes = [1 .. numProcesses] | 31 | false | true | 0 | 5 | 7 | 20 | 12 | 8 | null | null |
lambdageek/use-c | main/Main.hs | mit | outputMethodOptions :: Parser Centrinel.Report.OutputMethod
outputMethodOptions = Centrinel.Report.OutputMethod <$> outputDestinationOption <*> outputFormatOption
where
outputDestinationOption :: Parser Centrinel.Report.OutputDestination
outputDestinationOption =
(Centrinel.Report.FilePathOutputDestination <$> strOption (long "output" <> help "destination file for the output"
<> metavar "FILE" ))
<|> pure Centrinel.Report.StdOutOutputDestination
outputFormatOption :: Parser Centrinel.Report.OutputFormat
outputFormatOption =
(option outputFormatReader (long "format" <> help "output format: text or json (default is text)"
<> metavar "FMT"))
<|> pure Centrinel.Report.PlainTextOutputFormat
outputFormatReader :: ReadM Centrinel.Report.OutputFormat
outputFormatReader = maybeReader $ \s ->
case s of
"text" -> pure Centrinel.Report.PlainTextOutputFormat
"json" -> pure Centrinel.Report.JSONOutputFormat
_ -> empty | 1,097 | outputMethodOptions :: Parser Centrinel.Report.OutputMethod
outputMethodOptions = Centrinel.Report.OutputMethod <$> outputDestinationOption <*> outputFormatOption
where
outputDestinationOption :: Parser Centrinel.Report.OutputDestination
outputDestinationOption =
(Centrinel.Report.FilePathOutputDestination <$> strOption (long "output" <> help "destination file for the output"
<> metavar "FILE" ))
<|> pure Centrinel.Report.StdOutOutputDestination
outputFormatOption :: Parser Centrinel.Report.OutputFormat
outputFormatOption =
(option outputFormatReader (long "format" <> help "output format: text or json (default is text)"
<> metavar "FMT"))
<|> pure Centrinel.Report.PlainTextOutputFormat
outputFormatReader :: ReadM Centrinel.Report.OutputFormat
outputFormatReader = maybeReader $ \s ->
case s of
"text" -> pure Centrinel.Report.PlainTextOutputFormat
"json" -> pure Centrinel.Report.JSONOutputFormat
_ -> empty | 1,097 | outputMethodOptions = Centrinel.Report.OutputMethod <$> outputDestinationOption <*> outputFormatOption
where
outputDestinationOption :: Parser Centrinel.Report.OutputDestination
outputDestinationOption =
(Centrinel.Report.FilePathOutputDestination <$> strOption (long "output" <> help "destination file for the output"
<> metavar "FILE" ))
<|> pure Centrinel.Report.StdOutOutputDestination
outputFormatOption :: Parser Centrinel.Report.OutputFormat
outputFormatOption =
(option outputFormatReader (long "format" <> help "output format: text or json (default is text)"
<> metavar "FMT"))
<|> pure Centrinel.Report.PlainTextOutputFormat
outputFormatReader :: ReadM Centrinel.Report.OutputFormat
outputFormatReader = maybeReader $ \s ->
case s of
"text" -> pure Centrinel.Report.PlainTextOutputFormat
"json" -> pure Centrinel.Report.JSONOutputFormat
_ -> empty | 1,037 | false | true | 0 | 12 | 266 | 203 | 104 | 99 | null | null |
unisonweb/platform | parser-typechecker/src/Unison/Result.hs | mit | tell1 :: Monad f => note -> ResultT (Seq note) f ()
tell1 = tell . pure | 71 | tell1 :: Monad f => note -> ResultT (Seq note) f ()
tell1 = tell . pure | 71 | tell1 = tell . pure | 19 | false | true | 0 | 9 | 16 | 41 | 20 | 21 | null | null |
rueshyna/gogol | gogol-admin-directory/gen/Network/Google/Resource/Directory/Resources/Calendars/Insert.hs | mpl-2.0 | -- | The unique ID for the customer\'s Google account. As an account
-- administrator, you can also use the my_customer alias to represent your
-- account\'s customer ID.
rciCustomer :: Lens' ResourcesCalendarsInsert Text
rciCustomer
= lens _rciCustomer (\ s a -> s{_rciCustomer = a}) | 286 | rciCustomer :: Lens' ResourcesCalendarsInsert Text
rciCustomer
= lens _rciCustomer (\ s a -> s{_rciCustomer = a}) | 115 | rciCustomer
= lens _rciCustomer (\ s a -> s{_rciCustomer = a}) | 64 | true | true | 1 | 9 | 46 | 48 | 24 | 24 | null | null |
rblaze/haskell-dbus | tests/DBusTests/Transport.hs | apache-2.0 | test_ListenUnix_InvalidBind :: TestTree
test_ListenUnix_InvalidBind = testCase "invalid-bind" $ do
fdcountBefore <- countFileDescriptors
let Just addr = address "unix" (Map.fromList
[ ("path", "/")
])
assertThrows
(\err -> and
[ "Permission denied" `isInfixOf` transportErrorMessage err
, transportErrorAddress err == Just addr
])
(transportListen socketTransportOptions addr)
fdcountAfter <- countFileDescriptors
fdcountBefore @=? fdcountAfter | 542 | test_ListenUnix_InvalidBind :: TestTree
test_ListenUnix_InvalidBind = testCase "invalid-bind" $ do
fdcountBefore <- countFileDescriptors
let Just addr = address "unix" (Map.fromList
[ ("path", "/")
])
assertThrows
(\err -> and
[ "Permission denied" `isInfixOf` transportErrorMessage err
, transportErrorAddress err == Just addr
])
(transportListen socketTransportOptions addr)
fdcountAfter <- countFileDescriptors
fdcountBefore @=? fdcountAfter | 542 | test_ListenUnix_InvalidBind = testCase "invalid-bind" $ do
fdcountBefore <- countFileDescriptors
let Just addr = address "unix" (Map.fromList
[ ("path", "/")
])
assertThrows
(\err -> and
[ "Permission denied" `isInfixOf` transportErrorMessage err
, transportErrorAddress err == Just addr
])
(transportListen socketTransportOptions addr)
fdcountAfter <- countFileDescriptors
fdcountBefore @=? fdcountAfter | 502 | false | true | 0 | 15 | 146 | 126 | 61 | 65 | null | null |
acowley/ghc | compiler/basicTypes/BasicTypes.hs | bsd-3-clause | isActive :: CompilerPhase -> Activation -> Bool
isActive InitialPhase AlwaysActive = True | 94 | isActive :: CompilerPhase -> Activation -> Bool
isActive InitialPhase AlwaysActive = True | 94 | isActive InitialPhase AlwaysActive = True | 46 | false | true | 0 | 6 | 16 | 29 | 13 | 16 | null | null |
tmielcza/demiurge | src/Parse.hs | apache-2.0 | -- | Consume the line until its end '\n' and an optional comments befor
endOfLine :: ReadP ()
endOfLine = do {spaces; optional comment ; char '\n'; return ()} | 158 | endOfLine :: ReadP ()
endOfLine = do {spaces; optional comment ; char '\n'; return ()} | 86 | endOfLine = do {spaces; optional comment ; char '\n'; return ()} | 64 | true | true | 0 | 8 | 28 | 45 | 22 | 23 | null | null |
expipiplus1/vulkan | openxr/src/OpenXR/Core10/Input.hs | bsd-3-clause | -- | xrEnumerateBoundSourcesForAction - Queries the bound input sources for
-- an action
--
-- == Parameter Descriptions
--
-- - @session@ is the 'OpenXR.Core10.Handles.Session' being queried.
--
-- - @enumerateInfo@ is an 'BoundSourcesForActionEnumerateInfo' providing
-- the query information.
--
-- - @sourceCapacityInput@ is the capacity of the array, or 0 to indicate
-- a request to retrieve the required capacity.
--
-- - @sourceCountOutput@ is a pointer to the count of sources, or a
-- pointer to the required capacity in the case that
-- @sourceCapacityInput@ is 0.
--
-- - @sources@ is a pointer to an application-allocated array that will
-- be filled with the
-- <https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#XrPath >
-- values for all sources. It /can/ be @NULL@ if @sourceCapacityInput@
-- is 0.
--
-- - See
-- <https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#buffer-size-parameters Buffer Size Parameters>
-- chapter for a detailed description of retrieving the required
-- @sources@ size.
--
-- = Description
--
-- If an action is unbound, 'enumerateBoundSourcesForAction' /must/ assign
-- @0@ to the value pointed-to by @sourceCountOutput@ and not modify the
-- array.
--
-- 'enumerateBoundSourcesForAction' /must/ return
-- 'OpenXR.Core10.Enums.Result.ERROR_ACTIONSET_NOT_ATTACHED' if passed an
-- action in an action set never attached to the session with
-- 'attachSessionActionSets'.
--
-- == Valid Usage (Implicit)
--
-- - #VUID-xrEnumerateBoundSourcesForAction-session-parameter# @session@
-- /must/ be a valid 'OpenXR.Core10.Handles.Session' handle
--
-- - #VUID-xrEnumerateBoundSourcesForAction-enumerateInfo-parameter#
-- @enumerateInfo@ /must/ be a pointer to a valid
-- 'BoundSourcesForActionEnumerateInfo' structure
--
-- - #VUID-xrEnumerateBoundSourcesForAction-sourceCountOutput-parameter#
-- @sourceCountOutput@ /must/ be a pointer to a @uint32_t@ value
--
-- - #VUID-xrEnumerateBoundSourcesForAction-sources-parameter# If
-- @sourceCapacityInput@ is not @0@, @sources@ /must/ be a pointer to
-- an array of @sourceCapacityInput@
-- <https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#XrPath >
-- values
--
-- == Return Codes
--
-- [<https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#fundamentals-successcodes Success>]
--
-- - 'OpenXR.Core10.Enums.Result.SUCCESS'
--
-- - 'OpenXR.Core10.Enums.Result.SESSION_LOSS_PENDING'
--
-- [<https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#fundamentals-errorcodes Failure>]
--
-- - 'OpenXR.Core10.Enums.Result.ERROR_INSTANCE_LOST'
--
-- - 'OpenXR.Core10.Enums.Result.ERROR_SESSION_LOST'
--
-- - 'OpenXR.Core10.Enums.Result.ERROR_RUNTIME_FAILURE'
--
-- - 'OpenXR.Core10.Enums.Result.ERROR_HANDLE_INVALID'
--
-- - 'OpenXR.Core10.Enums.Result.ERROR_ACTIONSET_NOT_ATTACHED'
--
-- - 'OpenXR.Core10.Enums.Result.ERROR_SIZE_INSUFFICIENT'
--
-- - 'OpenXR.Core10.Enums.Result.ERROR_VALIDATION_FAILURE'
--
-- - 'OpenXR.Core10.Enums.Result.ERROR_PATH_INVALID'
--
-- = See Also
--
-- 'OpenXR.Core10.Handles.Action', 'BoundSourcesForActionEnumerateInfo',
-- <https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#XrPath >,
-- 'OpenXR.Core10.Handles.Session'
enumerateBoundSourcesForAction :: forall io
. (MonadIO io)
=> -- No documentation found for Nested "xrEnumerateBoundSourcesForAction" "session"
Session
-> -- No documentation found for Nested "xrEnumerateBoundSourcesForAction" "enumerateInfo"
BoundSourcesForActionEnumerateInfo
-> io (Result, ("sources" ::: Vector Path))
enumerateBoundSourcesForAction session enumerateInfo = liftIO . evalContT $ do
let xrEnumerateBoundSourcesForActionPtr = pXrEnumerateBoundSourcesForAction (case session of Session{instanceCmds} -> instanceCmds)
lift $ unless (xrEnumerateBoundSourcesForActionPtr /= nullFunPtr) $
throwIO $ IOError Nothing InvalidArgument "" "The function pointer for xrEnumerateBoundSourcesForAction is null" Nothing Nothing
let xrEnumerateBoundSourcesForAction' = mkXrEnumerateBoundSourcesForAction xrEnumerateBoundSourcesForActionPtr
let session' = sessionHandle (session)
enumerateInfo' <- ContT $ withCStruct (enumerateInfo)
pSourceCountOutput <- ContT $ bracket (callocBytes @Word32 4) free
r <- lift $ traceAroundEvent "xrEnumerateBoundSourcesForAction" (xrEnumerateBoundSourcesForAction' session' enumerateInfo' (0) (pSourceCountOutput) (nullPtr))
lift $ when (r < SUCCESS) (throwIO (OpenXrException r))
sourceCountOutput <- lift $ peek @Word32 pSourceCountOutput
pSources <- ContT $ bracket (callocBytes @Path ((fromIntegral (sourceCountOutput)) * 8)) free
r' <- lift $ traceAroundEvent "xrEnumerateBoundSourcesForAction" (xrEnumerateBoundSourcesForAction' session' enumerateInfo' ((sourceCountOutput)) (pSourceCountOutput) (pSources))
lift $ when (r' < SUCCESS) (throwIO (OpenXrException r'))
sourceCountOutput' <- lift $ peek @Word32 pSourceCountOutput
sources' <- lift $ generateM (fromIntegral (sourceCountOutput')) (\i -> peek @Path ((pSources `advancePtrBytes` (8 * (i)) :: Ptr Path)))
pure $ ((r'), sources') | 5,434 | enumerateBoundSourcesForAction :: forall io
. (MonadIO io)
=> -- No documentation found for Nested "xrEnumerateBoundSourcesForAction" "session"
Session
-> -- No documentation found for Nested "xrEnumerateBoundSourcesForAction" "enumerateInfo"
BoundSourcesForActionEnumerateInfo
-> io (Result, ("sources" ::: Vector Path))
enumerateBoundSourcesForAction session enumerateInfo = liftIO . evalContT $ do
let xrEnumerateBoundSourcesForActionPtr = pXrEnumerateBoundSourcesForAction (case session of Session{instanceCmds} -> instanceCmds)
lift $ unless (xrEnumerateBoundSourcesForActionPtr /= nullFunPtr) $
throwIO $ IOError Nothing InvalidArgument "" "The function pointer for xrEnumerateBoundSourcesForAction is null" Nothing Nothing
let xrEnumerateBoundSourcesForAction' = mkXrEnumerateBoundSourcesForAction xrEnumerateBoundSourcesForActionPtr
let session' = sessionHandle (session)
enumerateInfo' <- ContT $ withCStruct (enumerateInfo)
pSourceCountOutput <- ContT $ bracket (callocBytes @Word32 4) free
r <- lift $ traceAroundEvent "xrEnumerateBoundSourcesForAction" (xrEnumerateBoundSourcesForAction' session' enumerateInfo' (0) (pSourceCountOutput) (nullPtr))
lift $ when (r < SUCCESS) (throwIO (OpenXrException r))
sourceCountOutput <- lift $ peek @Word32 pSourceCountOutput
pSources <- ContT $ bracket (callocBytes @Path ((fromIntegral (sourceCountOutput)) * 8)) free
r' <- lift $ traceAroundEvent "xrEnumerateBoundSourcesForAction" (xrEnumerateBoundSourcesForAction' session' enumerateInfo' ((sourceCountOutput)) (pSourceCountOutput) (pSources))
lift $ when (r' < SUCCESS) (throwIO (OpenXrException r'))
sourceCountOutput' <- lift $ peek @Word32 pSourceCountOutput
sources' <- lift $ generateM (fromIntegral (sourceCountOutput')) (\i -> peek @Path ((pSources `advancePtrBytes` (8 * (i)) :: Ptr Path)))
pure $ ((r'), sources') | 2,055 | enumerateBoundSourcesForAction session enumerateInfo = liftIO . evalContT $ do
let xrEnumerateBoundSourcesForActionPtr = pXrEnumerateBoundSourcesForAction (case session of Session{instanceCmds} -> instanceCmds)
lift $ unless (xrEnumerateBoundSourcesForActionPtr /= nullFunPtr) $
throwIO $ IOError Nothing InvalidArgument "" "The function pointer for xrEnumerateBoundSourcesForAction is null" Nothing Nothing
let xrEnumerateBoundSourcesForAction' = mkXrEnumerateBoundSourcesForAction xrEnumerateBoundSourcesForActionPtr
let session' = sessionHandle (session)
enumerateInfo' <- ContT $ withCStruct (enumerateInfo)
pSourceCountOutput <- ContT $ bracket (callocBytes @Word32 4) free
r <- lift $ traceAroundEvent "xrEnumerateBoundSourcesForAction" (xrEnumerateBoundSourcesForAction' session' enumerateInfo' (0) (pSourceCountOutput) (nullPtr))
lift $ when (r < SUCCESS) (throwIO (OpenXrException r))
sourceCountOutput <- lift $ peek @Word32 pSourceCountOutput
pSources <- ContT $ bracket (callocBytes @Path ((fromIntegral (sourceCountOutput)) * 8)) free
r' <- lift $ traceAroundEvent "xrEnumerateBoundSourcesForAction" (xrEnumerateBoundSourcesForAction' session' enumerateInfo' ((sourceCountOutput)) (pSourceCountOutput) (pSources))
lift $ when (r' < SUCCESS) (throwIO (OpenXrException r'))
sourceCountOutput' <- lift $ peek @Word32 pSourceCountOutput
sources' <- lift $ generateM (fromIntegral (sourceCountOutput')) (\i -> peek @Path ((pSources `advancePtrBytes` (8 * (i)) :: Ptr Path)))
pure $ ((r'), sources') | 1,540 | true | true | 0 | 19 | 912 | 599 | 344 | 255 | null | null |
spechub/Hets | CSL/Parse_AS_Basic.hs | gpl-2.0 | -- | parser for Axiom_item
parseAxItems :: AnnoState.AParser st BASIC_ITEM
parseAxItems = do
AnnoState.dotT
cmd <- AnnoState.allAnnoParser command
return $ Axiom_item cmd
-- ---------------------------------------------------------------------------
-- * parser for symbol maps etc.
-- ---------------------------------------------------------------------------
-- | parsing a prop symbol | 399 | parseAxItems :: AnnoState.AParser st BASIC_ITEM
parseAxItems = do
AnnoState.dotT
cmd <- AnnoState.allAnnoParser command
return $ Axiom_item cmd
-- ---------------------------------------------------------------------------
-- * parser for symbol maps etc.
-- ---------------------------------------------------------------------------
-- | parsing a prop symbol | 372 | parseAxItems = do
AnnoState.dotT
cmd <- AnnoState.allAnnoParser command
return $ Axiom_item cmd
-- ---------------------------------------------------------------------------
-- * parser for symbol maps etc.
-- ---------------------------------------------------------------------------
-- | parsing a prop symbol | 324 | true | true | 0 | 9 | 49 | 50 | 25 | 25 | null | null |
vTurbine/w3dhs | src/Game/Agent.hs | mit | statusDrawPic :: Point -> GraphicNums -> StateT GameState IO ()
statusDrawPic (Point x y) = vwbDrawPic (Point (x * 8) (y + 200 - statusLines)) | 142 | statusDrawPic :: Point -> GraphicNums -> StateT GameState IO ()
statusDrawPic (Point x y) = vwbDrawPic (Point (x * 8) (y + 200 - statusLines)) | 142 | statusDrawPic (Point x y) = vwbDrawPic (Point (x * 8) (y + 200 - statusLines)) | 78 | false | true | 0 | 10 | 24 | 72 | 35 | 37 | null | null |
silky/react-haskell | src/React/Interpret.hs | mit | attrsToJson :: [Attr] -> JSON
attrsToJson = Aeson.toJSON . H.fromList . map unAttr where
unAttr (Attr name json) = (name, json) | 131 | attrsToJson :: [Attr] -> JSON
attrsToJson = Aeson.toJSON . H.fromList . map unAttr where
unAttr (Attr name json) = (name, json) | 131 | attrsToJson = Aeson.toJSON . H.fromList . map unAttr where
unAttr (Attr name json) = (name, json) | 101 | false | true | 0 | 9 | 24 | 57 | 30 | 27 | null | null |
meiersi/bytestring | Data/ByteString.hs | bsd-3-clause | -- | /O(n)/ The 'elemIndices' function extends 'elemIndex', by returning
-- the indices of all elements equal to the query element, in ascending order.
-- This implementation uses memchr(3).
elemIndices :: Word8 -> ByteString -> [Int]
elemIndices w (PS x s l) = loop 0
where
STRICT1(loop)
loop n = let q = inlinePerformIO $ withForeignPtr x $ \p ->
memchr (p `plusPtr` (n+s))
w (fromIntegral (l - n))
in if q == nullPtr
then []
else let i = inlinePerformIO $ withForeignPtr x $ \p ->
return (q `minusPtr` (p `plusPtr` s))
in i : loop (i+1)
| 768 | elemIndices :: Word8 -> ByteString -> [Int]
elemIndices w (PS x s l) = loop 0
where
STRICT1(loop)
loop n = let q = inlinePerformIO $ withForeignPtr x $ \p ->
memchr (p `plusPtr` (n+s))
w (fromIntegral (l - n))
in if q == nullPtr
then []
else let i = inlinePerformIO $ withForeignPtr x $ \p ->
return (q `minusPtr` (p `plusPtr` s))
in i : loop (i+1)
| 577 | elemIndices w (PS x s l) = loop 0
where
STRICT1(loop)
loop n = let q = inlinePerformIO $ withForeignPtr x $ \p ->
memchr (p `plusPtr` (n+s))
w (fromIntegral (l - n))
in if q == nullPtr
then []
else let i = inlinePerformIO $ withForeignPtr x $ \p ->
return (q `minusPtr` (p `plusPtr` s))
in i : loop (i+1)
| 533 | true | true | 1 | 18 | 326 | 210 | 107 | 103 | null | null |
Rizary/hackage-matrix-builder | src-exe/Controller/Util.hs | gpl-3.0 | brotliCompression :: MonadSnap m => m ()
brotliCompression = modifyResponse f
where
f rs = setHeader "Content-Encoding" "br" $
setHeader "Vary" "Accept-Encoding" $
clearContentLength $
modifyResponseBody go rs
go :: (OutputStream BB.Builder -> IO (OutputStream BB.Builder))
-> OutputStream BB.Builder -> IO (OutputStream BB.Builder)
go body stream = go2 stream >>= body
go2 :: OutputStream BB.Builder -> IO (OutputStream BB.Builder)
go2 = unbuilderStream >=> BrotliStr.compressWith cparms >=> Streams.builderStream
cparms = BrotliStr.defaultCompressParams { BrotliStr.compressLevel = BrotliStr.CompressionLevel7 } | 700 | brotliCompression :: MonadSnap m => m ()
brotliCompression = modifyResponse f
where
f rs = setHeader "Content-Encoding" "br" $
setHeader "Vary" "Accept-Encoding" $
clearContentLength $
modifyResponseBody go rs
go :: (OutputStream BB.Builder -> IO (OutputStream BB.Builder))
-> OutputStream BB.Builder -> IO (OutputStream BB.Builder)
go body stream = go2 stream >>= body
go2 :: OutputStream BB.Builder -> IO (OutputStream BB.Builder)
go2 = unbuilderStream >=> BrotliStr.compressWith cparms >=> Streams.builderStream
cparms = BrotliStr.defaultCompressParams { BrotliStr.compressLevel = BrotliStr.CompressionLevel7 } | 700 | brotliCompression = modifyResponse f
where
f rs = setHeader "Content-Encoding" "br" $
setHeader "Vary" "Accept-Encoding" $
clearContentLength $
modifyResponseBody go rs
go :: (OutputStream BB.Builder -> IO (OutputStream BB.Builder))
-> OutputStream BB.Builder -> IO (OutputStream BB.Builder)
go body stream = go2 stream >>= body
go2 :: OutputStream BB.Builder -> IO (OutputStream BB.Builder)
go2 = unbuilderStream >=> BrotliStr.compressWith cparms >=> Streams.builderStream
cparms = BrotliStr.defaultCompressParams { BrotliStr.compressLevel = BrotliStr.CompressionLevel7 } | 659 | false | true | 2 | 12 | 161 | 220 | 98 | 122 | null | null |
haskell-distributed/distributed-process-platform | tests/TestRegistry.hs | bsd-3-clause | testUnmonitor :: TestResult Bool -> Process ()
testUnmonitor result = do
let k = "chickens"
let name = "poultry"
reg <- counterReg
(sp, rp) <- newChan
pid <- spawnLocal $ do
void $ addProperty reg k (42 :: Int)
addName reg name
sendChan sp ()
expect >>= return
() <- receiveChan rp
mRef <- Registry.monitorProp reg k pid
void $ receiveWait [
matchIf (\(RegistryKeyMonitorNotification k' ref ev _) ->
k' == k && ref == mRef && ev == (KeyRegistered pid))
return
]
Registry.unmonitor reg mRef
kill pid "goodbye!"
awaitExit pid
Nothing <- lookupName reg name
t <- receiveTimeout (after 1 Seconds) [
matchIf (\(RegistryKeyMonitorNotification k' ref ev _) ->
k' == k && ref == mRef && ev == (KeyRegistered pid))
return
]
t `shouldBe` (equalTo Nothing)
stash result True | 914 | testUnmonitor :: TestResult Bool -> Process ()
testUnmonitor result = do
let k = "chickens"
let name = "poultry"
reg <- counterReg
(sp, rp) <- newChan
pid <- spawnLocal $ do
void $ addProperty reg k (42 :: Int)
addName reg name
sendChan sp ()
expect >>= return
() <- receiveChan rp
mRef <- Registry.monitorProp reg k pid
void $ receiveWait [
matchIf (\(RegistryKeyMonitorNotification k' ref ev _) ->
k' == k && ref == mRef && ev == (KeyRegistered pid))
return
]
Registry.unmonitor reg mRef
kill pid "goodbye!"
awaitExit pid
Nothing <- lookupName reg name
t <- receiveTimeout (after 1 Seconds) [
matchIf (\(RegistryKeyMonitorNotification k' ref ev _) ->
k' == k && ref == mRef && ev == (KeyRegistered pid))
return
]
t `shouldBe` (equalTo Nothing)
stash result True | 914 | testUnmonitor result = do
let k = "chickens"
let name = "poultry"
reg <- counterReg
(sp, rp) <- newChan
pid <- spawnLocal $ do
void $ addProperty reg k (42 :: Int)
addName reg name
sendChan sp ()
expect >>= return
() <- receiveChan rp
mRef <- Registry.monitorProp reg k pid
void $ receiveWait [
matchIf (\(RegistryKeyMonitorNotification k' ref ev _) ->
k' == k && ref == mRef && ev == (KeyRegistered pid))
return
]
Registry.unmonitor reg mRef
kill pid "goodbye!"
awaitExit pid
Nothing <- lookupName reg name
t <- receiveTimeout (after 1 Seconds) [
matchIf (\(RegistryKeyMonitorNotification k' ref ev _) ->
k' == k && ref == mRef && ev == (KeyRegistered pid))
return
]
t `shouldBe` (equalTo Nothing)
stash result True | 867 | false | true | 0 | 17 | 281 | 345 | 161 | 184 | null | null |
agrafix/typed-wire | src/TW/Parser.hs | mit | parseQualTypeName :: Parser QualTypeName
parseQualTypeName =
do md <- unModuleName <$> parseModuleName
case reverse md of
[] -> fail "This should never happen"
(x:xs) ->
return $ QualTypeName (ModuleName $ reverse xs) (TypeName x) | 272 | parseQualTypeName :: Parser QualTypeName
parseQualTypeName =
do md <- unModuleName <$> parseModuleName
case reverse md of
[] -> fail "This should never happen"
(x:xs) ->
return $ QualTypeName (ModuleName $ reverse xs) (TypeName x) | 272 | parseQualTypeName =
do md <- unModuleName <$> parseModuleName
case reverse md of
[] -> fail "This should never happen"
(x:xs) ->
return $ QualTypeName (ModuleName $ reverse xs) (TypeName x) | 231 | false | true | 0 | 14 | 75 | 84 | 40 | 44 | null | null |
vkomenda/CoALP | lib/CoALP/Subst.hs | lgpl-3.0 | -- | The singleton substitution.
singleton :: (Eq a, Hashable a, Hashable b) => a -> m b -> Subst m a b
singleton i t = Subst $ HashMap.singleton i t | 149 | singleton :: (Eq a, Hashable a, Hashable b) => a -> m b -> Subst m a b
singleton i t = Subst $ HashMap.singleton i t | 116 | singleton i t = Subst $ HashMap.singleton i t | 45 | true | true | 2 | 9 | 31 | 72 | 34 | 38 | null | null |
martin-kolinek/stack | src/Stack/Types/Package.hs | bsd-3-clause | installedPackageIdentifier :: Installed -> PackageIdentifier
installedPackageIdentifier (Library pid _) = pid | 109 | installedPackageIdentifier :: Installed -> PackageIdentifier
installedPackageIdentifier (Library pid _) = pid | 109 | installedPackageIdentifier (Library pid _) = pid | 48 | false | true | 0 | 7 | 10 | 26 | 13 | 13 | null | null |
jasdennison/scrabble-solver | src/Parsers.hs | bsd-3-clause | boardCell :: Parser BoardCell
boardCell = Empty <$ char '.'
<|> Full . MarkedT <$> lower
<|> Full . BlankT . toLower <$> upper
<?> "board character" | 172 | boardCell :: Parser BoardCell
boardCell = Empty <$ char '.'
<|> Full . MarkedT <$> lower
<|> Full . BlankT . toLower <$> upper
<?> "board character" | 172 | boardCell = Empty <$ char '.'
<|> Full . MarkedT <$> lower
<|> Full . BlankT . toLower <$> upper
<?> "board character" | 142 | false | true | 0 | 14 | 50 | 53 | 26 | 27 | null | null |
spl/digits | src/Digits/Count.hs | bsd-3-clause | int :: (Integral a, Bounded a) => a -> a -> Word
int !base !number
| number < 0 =
if number == minBound then
1 + intNonNeg base (negate (quot number base))
else
intNonNeg base (negate number)
| otherwise =
intNonNeg base number | 256 | int :: (Integral a, Bounded a) => a -> a -> Word
int !base !number
| number < 0 =
if number == minBound then
1 + intNonNeg base (negate (quot number base))
else
intNonNeg base (negate number)
| otherwise =
intNonNeg base number | 256 | int !base !number
| number < 0 =
if number == minBound then
1 + intNonNeg base (negate (quot number base))
else
intNonNeg base (negate number)
| otherwise =
intNonNeg base number | 207 | false | true | 1 | 12 | 72 | 115 | 55 | 60 | null | null |
vTurbine/ghc | compiler/prelude/PrelNames.hs | bsd-3-clause | fmap_RDR, pure_RDR, ap_RDR, foldable_foldr_RDR, foldMap_RDR,
traverse_RDR, mempty_RDR, mappend_RDR :: RdrName
fmap_RDR = varQual_RDR gHC_BASE (fsLit "fmap") | 175 | fmap_RDR, pure_RDR, ap_RDR, foldable_foldr_RDR, foldMap_RDR,
traverse_RDR, mempty_RDR, mappend_RDR :: RdrName
fmap_RDR = varQual_RDR gHC_BASE (fsLit "fmap") | 175 | fmap_RDR = varQual_RDR gHC_BASE (fsLit "fmap") | 61 | false | true | 0 | 7 | 34 | 36 | 25 | 11 | null | null |
phischu/fragnix | tests/packages/scotty/Data.ByteString.Builder.Prim.hs | bsd-3-clause | primMapListFixed :: FixedPrim a -> ([a] -> Builder)
primMapListFixed = primMapListBounded . toB | 95 | primMapListFixed :: FixedPrim a -> ([a] -> Builder)
primMapListFixed = primMapListBounded . toB | 95 | primMapListFixed = primMapListBounded . toB | 43 | false | true | 0 | 8 | 12 | 32 | 17 | 15 | null | null |
caiorss/Functional-Programming | haskell/src/OldState.hs | unlicense | {- Returns the final state of computation -}
execState :: State s a -> s -> s
execState act = snd . runState act | 112 | execState :: State s a -> s -> s
execState act = snd . runState act | 67 | execState act = snd . runState act | 34 | true | true | 1 | 8 | 23 | 41 | 18 | 23 | null | null |
beni55/fay | src/haskell-names/Language/Haskell/Names/ScopeUtils.hs | bsd-3-clause | sv_parent (SymMethod { sv_className = n }) = Just n | 51 | sv_parent (SymMethod { sv_className = n }) = Just n | 51 | sv_parent (SymMethod { sv_className = n }) = Just n | 51 | false | false | 0 | 9 | 9 | 24 | 12 | 12 | null | null |
jimenezrick/cook.hs | src/Cook/Recipe/FsTree.hs | mit | mkdir :: FilePath -> IO ()
mkdir = createDirectoryIfMissing True | 64 | mkdir :: FilePath -> IO ()
mkdir = createDirectoryIfMissing True | 64 | mkdir = createDirectoryIfMissing True | 37 | false | true | 0 | 8 | 9 | 28 | 12 | 16 | null | null |
cartazio/omega | util/BuildDistr.hs | bsd-3-clause | move1file time distrDir (dir, name, typ) =
prepend time license
(dir ++ name ++ typ) (distrDir ++ "/" ++ name ++ typ) | 134 | move1file time distrDir (dir, name, typ) =
prepend time license
(dir ++ name ++ typ) (distrDir ++ "/" ++ name ++ typ) | 134 | move1file time distrDir (dir, name, typ) =
prepend time license
(dir ++ name ++ typ) (distrDir ++ "/" ++ name ++ typ) | 134 | false | false | 0 | 9 | 38 | 63 | 30 | 33 | null | null |
phischu/fragnix | tests/packages/scotty/Data.Aeson.Types.FromJSON.hs | bsd-3-clause | -- | Function variant of '.:?'.
parseFieldMaybe :: (FromJSON a) => Object -> Text -> Parser (Maybe a)
parseFieldMaybe = (.:?) | 125 | parseFieldMaybe :: (FromJSON a) => Object -> Text -> Parser (Maybe a)
parseFieldMaybe = (.:?) | 93 | parseFieldMaybe = (.:?) | 23 | true | true | 0 | 10 | 20 | 40 | 22 | 18 | null | null |
lspitzner/brittany | data/Test513.hs | agpl-3.0 | readMergePersConfig path shouldCreate conf = do
exists <- liftIO $ System.Directory.doesFileExist path
if
| exists -> do
contents <- liftIO $ ByteString.readFile path -- no lazy IO, tyvm.
fileConf <- case Data.Yaml.decodeEither contents of
Left e -> do
liftIO
$ putStrErrLn
$ "error reading in brittany config from "
++ path
++ ":"
liftIO $ putStrErrLn e
mzero
Right x -> return x
return $ fileConf Semigroup.<> conf
| shouldCreate -> do
liftIO $ ByteString.writeFile path $ Data.Yaml.encode $ cMap
(Option . Just . runIdentity)
staticDefaultConfig
return $ conf
| otherwise -> do
return conf | 754 | readMergePersConfig path shouldCreate conf = do
exists <- liftIO $ System.Directory.doesFileExist path
if
| exists -> do
contents <- liftIO $ ByteString.readFile path -- no lazy IO, tyvm.
fileConf <- case Data.Yaml.decodeEither contents of
Left e -> do
liftIO
$ putStrErrLn
$ "error reading in brittany config from "
++ path
++ ":"
liftIO $ putStrErrLn e
mzero
Right x -> return x
return $ fileConf Semigroup.<> conf
| shouldCreate -> do
liftIO $ ByteString.writeFile path $ Data.Yaml.encode $ cMap
(Option . Just . runIdentity)
staticDefaultConfig
return $ conf
| otherwise -> do
return conf | 754 | readMergePersConfig path shouldCreate conf = do
exists <- liftIO $ System.Directory.doesFileExist path
if
| exists -> do
contents <- liftIO $ ByteString.readFile path -- no lazy IO, tyvm.
fileConf <- case Data.Yaml.decodeEither contents of
Left e -> do
liftIO
$ putStrErrLn
$ "error reading in brittany config from "
++ path
++ ":"
liftIO $ putStrErrLn e
mzero
Right x -> return x
return $ fileConf Semigroup.<> conf
| shouldCreate -> do
liftIO $ ByteString.writeFile path $ Data.Yaml.encode $ cMap
(Option . Just . runIdentity)
staticDefaultConfig
return $ conf
| otherwise -> do
return conf | 754 | false | false | 0 | 20 | 256 | 212 | 96 | 116 | null | null |
chemist/agentx | src/Network/Protocol/Snmp/AgentX/MIBTree/Types.hs | bsd-3-clause | fillOid (ObjectType o i p n v u : xs)
| o == [] = ObjectType [i] i p n v u : mkOid' [(p, []), (n, [i])] xs
| otherwise = ObjectType o i p n v u : mkOid' [(p, []), (n, o)] xs
where
mkOid' :: [(Parent, OID)] -> [MIB ] -> [MIB ]
mkOid' _ [] = []
mkOid' base (y:ys) =
let Just prev = lookup (parent y) base
newbase = (name y, prev <> [int y]) : base
in addOid prev y : mkOid' newbase ys
addOid :: OID -> MIB -> MIB
addOid o' (Object _ i' p' n' u') = Object (o' <> [i']) i' p' n' u'
addOid o' (ObjectType _ i' p' n' v' u') = ObjectType (o' <> [i']) i' p' n' v' u' | 618 | fillOid (ObjectType o i p n v u : xs)
| o == [] = ObjectType [i] i p n v u : mkOid' [(p, []), (n, [i])] xs
| otherwise = ObjectType o i p n v u : mkOid' [(p, []), (n, o)] xs
where
mkOid' :: [(Parent, OID)] -> [MIB ] -> [MIB ]
mkOid' _ [] = []
mkOid' base (y:ys) =
let Just prev = lookup (parent y) base
newbase = (name y, prev <> [int y]) : base
in addOid prev y : mkOid' newbase ys
addOid :: OID -> MIB -> MIB
addOid o' (Object _ i' p' n' u') = Object (o' <> [i']) i' p' n' u'
addOid o' (ObjectType _ i' p' n' v' u') = ObjectType (o' <> [i']) i' p' n' v' u' | 618 | fillOid (ObjectType o i p n v u : xs)
| o == [] = ObjectType [i] i p n v u : mkOid' [(p, []), (n, [i])] xs
| otherwise = ObjectType o i p n v u : mkOid' [(p, []), (n, o)] xs
where
mkOid' :: [(Parent, OID)] -> [MIB ] -> [MIB ]
mkOid' _ [] = []
mkOid' base (y:ys) =
let Just prev = lookup (parent y) base
newbase = (name y, prev <> [int y]) : base
in addOid prev y : mkOid' newbase ys
addOid :: OID -> MIB -> MIB
addOid o' (Object _ i' p' n' u') = Object (o' <> [i']) i' p' n' u'
addOid o' (ObjectType _ i' p' n' v' u') = ObjectType (o' <> [i']) i' p' n' v' u' | 618 | false | false | 8 | 14 | 194 | 375 | 194 | 181 | null | null |
alfpark/bond | compiler/tests/Tests/Syntax.hs | mit | compareAST :: FilePath -> Assertion
compareAST file = do
bond <- parseBondFile [] $ "tests" </> "schema" </> file <.> "bond"
json <- parseASTFile $ "tests" </> "schema" </> file <.> "json"
assertEqual "" bond json | 225 | compareAST :: FilePath -> Assertion
compareAST file = do
bond <- parseBondFile [] $ "tests" </> "schema" </> file <.> "bond"
json <- parseASTFile $ "tests" </> "schema" </> file <.> "json"
assertEqual "" bond json | 225 | compareAST file = do
bond <- parseBondFile [] $ "tests" </> "schema" </> file <.> "bond"
json <- parseASTFile $ "tests" </> "schema" </> file <.> "json"
assertEqual "" bond json | 189 | false | true | 0 | 14 | 47 | 85 | 38 | 47 | null | null |
ratsam/hs-carbon-aggregator | src/library/Carbon/Stats.hs | apache-2.0 | collectSelfStatsIO :: StatsConfig -> StatsMap -> BuffersManager -> Timestamp -> IO [MetricTuple]
collectSelfStatsIO statsConf statsMap bufmanager now = do
let metricName = fullMetricPath statsConf
let getAndReset = getAndResetStat statsMap
let aggregatorMetric name value = metricTuple (metricName name) now $ realToFrac value
-- Aggregator specific metrics:
allocatedBuffersCount <- atomically $ bufferManagerLength bufmanager
bufferedDatapointsCount <- countBufferedDataPoints bufmanager
aggregatedDataPointsCount <- getAndReset AggregatedDataPoints
-- Common metrics:
dataPointsReceivedCount <- getAndReset DataPointsReceived
-- TODO:
-- cpuUsage
-- memUsage
return [
aggregatorMetric "allocatedBuffers" allocatedBuffersCount,
aggregatorMetric "bufferedDatapoints" bufferedDatapointsCount,
aggregatorMetric "aggregateDatapointsSent" aggregatedDataPointsCount,
aggregatorMetric "metricsReceived" dataPointsReceivedCount
] | 1,018 | collectSelfStatsIO :: StatsConfig -> StatsMap -> BuffersManager -> Timestamp -> IO [MetricTuple]
collectSelfStatsIO statsConf statsMap bufmanager now = do
let metricName = fullMetricPath statsConf
let getAndReset = getAndResetStat statsMap
let aggregatorMetric name value = metricTuple (metricName name) now $ realToFrac value
-- Aggregator specific metrics:
allocatedBuffersCount <- atomically $ bufferManagerLength bufmanager
bufferedDatapointsCount <- countBufferedDataPoints bufmanager
aggregatedDataPointsCount <- getAndReset AggregatedDataPoints
-- Common metrics:
dataPointsReceivedCount <- getAndReset DataPointsReceived
-- TODO:
-- cpuUsage
-- memUsage
return [
aggregatorMetric "allocatedBuffers" allocatedBuffersCount,
aggregatorMetric "bufferedDatapoints" bufferedDatapointsCount,
aggregatorMetric "aggregateDatapointsSent" aggregatedDataPointsCount,
aggregatorMetric "metricsReceived" dataPointsReceivedCount
] | 1,018 | collectSelfStatsIO statsConf statsMap bufmanager now = do
let metricName = fullMetricPath statsConf
let getAndReset = getAndResetStat statsMap
let aggregatorMetric name value = metricTuple (metricName name) now $ realToFrac value
-- Aggregator specific metrics:
allocatedBuffersCount <- atomically $ bufferManagerLength bufmanager
bufferedDatapointsCount <- countBufferedDataPoints bufmanager
aggregatedDataPointsCount <- getAndReset AggregatedDataPoints
-- Common metrics:
dataPointsReceivedCount <- getAndReset DataPointsReceived
-- TODO:
-- cpuUsage
-- memUsage
return [
aggregatorMetric "allocatedBuffers" allocatedBuffersCount,
aggregatorMetric "bufferedDatapoints" bufferedDatapointsCount,
aggregatorMetric "aggregateDatapointsSent" aggregatedDataPointsCount,
aggregatorMetric "metricsReceived" dataPointsReceivedCount
] | 921 | false | true | 0 | 13 | 181 | 185 | 86 | 99 | null | null |
adk9/pbbs-haskell | PBBS/FileReader.hs | bsd-3-clause | -- | A simple front-end to 'parReadNats'. This @mmap@s the file as a byte string and
-- parses it in parallel. It returns a list of chunks of arbitrary size that may be
-- concattenated for a final result.
readNumFile :: forall nty . (U.Unbox nty, Integral nty, Eq nty, Show nty, Read nty) =>
FilePath -> IO [U.Vector nty]
readNumFile path = do
bs <- unsafeMMapFile path
ncpus <- getNumCapabilities
ls <- runParIO $ parReadNats (ncpus * overPartition) bs
return (sewEnds ls) | 506 | readNumFile :: forall nty . (U.Unbox nty, Integral nty, Eq nty, Show nty, Read nty) =>
FilePath -> IO [U.Vector nty]
readNumFile path = do
bs <- unsafeMMapFile path
ncpus <- getNumCapabilities
ls <- runParIO $ parReadNats (ncpus * overPartition) bs
return (sewEnds ls) | 298 | readNumFile path = do
bs <- unsafeMMapFile path
ncpus <- getNumCapabilities
ls <- runParIO $ parReadNats (ncpus * overPartition) bs
return (sewEnds ls) | 166 | true | true | 0 | 11 | 114 | 124 | 61 | 63 | null | null |
inq/agitpunkt | spec/Misc/StringUtilSpec.hs | agpl-3.0 | main :: IO ()
main = hspec spec | 31 | main :: IO ()
main = hspec spec | 31 | main = hspec spec | 17 | false | true | 0 | 7 | 7 | 25 | 10 | 15 | null | null |
forsyde/forsyde-shallow | src/ForSyDe/Shallow/Core/Vector.hs | bsd-3-clause | unzipV :: Vector (a, b) -- ^ /length/ = @la@
-> (Vector a, Vector b) -- ^ /length/ = @la@
unzipV NullV = (NullV, NullV) | 143 | unzipV :: Vector (a, b) -- ^ /length/ = @la@
-> (Vector a, Vector b)
unzipV NullV = (NullV, NullV) | 122 | unzipV NullV = (NullV, NullV) | 39 | true | true | 0 | 9 | 48 | 53 | 27 | 26 | null | null |
DanielWaterworth/Idris-dev | src/Idris/Unlit.hs | bsd-3-clause | chkAdj :: FilePath -> Int -> LineType -> LineType -> TC ()
chkAdj f l Prog Comm = tfail $ At (FC f (l, 0) (l, 0)) ProgramLineComment | 132 | chkAdj :: FilePath -> Int -> LineType -> LineType -> TC ()
chkAdj f l Prog Comm = tfail $ At (FC f (l, 0) (l, 0)) ProgramLineComment | 132 | chkAdj f l Prog Comm = tfail $ At (FC f (l, 0) (l, 0)) ProgramLineComment | 73 | false | true | 0 | 10 | 27 | 79 | 38 | 41 | null | null |
frms-/aws | Aws/DynamoDb/Core.hs | bsd-3-clause | -- | Type witness for 'Text'. See 'attrAs'.
text :: Proxy T.Text
text = Proxy | 77 | text :: Proxy T.Text
text = Proxy | 33 | text = Proxy | 12 | true | true | 1 | 6 | 14 | 21 | 9 | 12 | null | null |
ozgurakgun/Idris-dev | src/Idris/CaseSplit.hs | bsd-3-clause | mergePat' ist orig@(PRef fc _ n) new@(PRef _ _ n') t
| isDConName n' (tt_ctxt ist) = do addUpdate n new
return new
| otherwise
= do ms <- get
case lookup n' (namemap ms) of
Just x -> do addUpdate n (PRef fc [] x)
return (PRef fc [] x)
Nothing -> do put (ms { namemap = ((n', n) : namemap ms) })
return (PRef fc [] n) | 453 | mergePat' ist orig@(PRef fc _ n) new@(PRef _ _ n') t
| isDConName n' (tt_ctxt ist) = do addUpdate n new
return new
| otherwise
= do ms <- get
case lookup n' (namemap ms) of
Just x -> do addUpdate n (PRef fc [] x)
return (PRef fc [] x)
Nothing -> do put (ms { namemap = ((n', n) : namemap ms) })
return (PRef fc [] n) | 453 | mergePat' ist orig@(PRef fc _ n) new@(PRef _ _ n') t
| isDConName n' (tt_ctxt ist) = do addUpdate n new
return new
| otherwise
= do ms <- get
case lookup n' (namemap ms) of
Just x -> do addUpdate n (PRef fc [] x)
return (PRef fc [] x)
Nothing -> do put (ms { namemap = ((n', n) : namemap ms) })
return (PRef fc [] n) | 453 | false | false | 1 | 21 | 206 | 218 | 100 | 118 | null | null |
uduki/hsQt | Qtc/Enums/Gui/QLineEdit.hs | bsd-2-clause | ePasswordEchoOnEdit :: EchoMode
ePasswordEchoOnEdit
= ieEchoMode $ 3 | 70 | ePasswordEchoOnEdit :: EchoMode
ePasswordEchoOnEdit
= ieEchoMode $ 3 | 70 | ePasswordEchoOnEdit
= ieEchoMode $ 3 | 38 | false | true | 2 | 6 | 9 | 20 | 8 | 12 | null | null |
nikita-volkov/hasql-th | library/Hasql/TH/Extraction/Exp.hs | mit | byTypename :: (PrimitiveType.PrimitiveType -> Bool -> Either Text Exp) -> (PrimitiveType.PrimitiveType -> Bool -> Int -> Bool -> Either Text Exp) -> Ast.Typename -> Either Text Exp
byTypename unidimensional multidimensional (Ast.Typename a b c d) =
if a
then Left "SETOF is not supported"
else do
e <- PrimitiveType.simpleTypename b
case d of
Nothing -> unidimensional e c
Just (f, g) -> case f of
Ast.BoundsTypenameArrayDimensions h -> multidimensional e c (length h) g
Ast.ExplicitTypenameArrayDimensions _ -> multidimensional e c 1 g | 594 | byTypename :: (PrimitiveType.PrimitiveType -> Bool -> Either Text Exp) -> (PrimitiveType.PrimitiveType -> Bool -> Int -> Bool -> Either Text Exp) -> Ast.Typename -> Either Text Exp
byTypename unidimensional multidimensional (Ast.Typename a b c d) =
if a
then Left "SETOF is not supported"
else do
e <- PrimitiveType.simpleTypename b
case d of
Nothing -> unidimensional e c
Just (f, g) -> case f of
Ast.BoundsTypenameArrayDimensions h -> multidimensional e c (length h) g
Ast.ExplicitTypenameArrayDimensions _ -> multidimensional e c 1 g | 594 | byTypename unidimensional multidimensional (Ast.Typename a b c d) =
if a
then Left "SETOF is not supported"
else do
e <- PrimitiveType.simpleTypename b
case d of
Nothing -> unidimensional e c
Just (f, g) -> case f of
Ast.BoundsTypenameArrayDimensions h -> multidimensional e c (length h) g
Ast.ExplicitTypenameArrayDimensions _ -> multidimensional e c 1 g | 413 | false | true | 0 | 16 | 139 | 201 | 97 | 104 | null | null |
Subsets and Splits