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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
gamelost/pcgen-rules
|
src/Bonus.hs
|
apache-2.0
|
parseBonusWeaponProf :: PParser BonusWeaponProf
parseBonusWeaponProf = do
_ <- labeled "WEAPONPROF="
bonusWeaponProficency <- parseWeaponProficiency <* char '|'
-- moderndispatch075_equip_armorshields.lst has no weapon property
bonusWeaponProfProperties <- option [] ((parseWeaponProperty `sepBy` char ',') <* char '|')
bonusWeaponProfFormulas <- parseFormula
return BonusWeaponProf { .. } where
parseWeaponProficiency = try (labeled "TYPE=" >> (WeaponType <$> parseString))
<|> try (labeled "TYPE." >> (WeaponType <$> parseString))
<|> WeaponList <$ labeled "%LIST"
<|> WeaponName <$> parseString
parseWeaponProperty = try (CRITMULTADD <$ labeled "CRITMULTADD")
<|> try (CRITRANGEADD <$ labeled "CRITRANGEADD")
<|> try (CRITRANGEDOUBLE <$ labeled "CRITRANGEDOUBLE")
<|> try (DAMAGEMULT <$ labeled "DAMAGEMULT")
<|> try (DAMAGESIZE <$ labeled "DAMAGESIZE")
<|> try (DAMAGESHORTRANGE <$ labeled "DAMAGE-SHORTRANGE")
<|> try (DAMAGE <$ labeled "DAMAGE")
<|> try (PCSIZE <$ labeled "PCSIZE")
<|> try (REACH <$ labeled "REACH")
<|> try (TOHITSHORTRANGE <$ labeled "TOHIT-SHORTRANGE")
<|> try (TOHITOVERSIZE <$ labeled "TOHITOVERSIZE")
<|> try (TOHIT <$ labeled "TOHIT")
<|> (WIELDCATEGORY <$ labeled "WIELDCATEGORY")
-- BONUS:UDAM|x|y
-- x is CLASS.text
-- y is formula
| 1,629
|
parseBonusWeaponProf :: PParser BonusWeaponProf
parseBonusWeaponProf = do
_ <- labeled "WEAPONPROF="
bonusWeaponProficency <- parseWeaponProficiency <* char '|'
-- moderndispatch075_equip_armorshields.lst has no weapon property
bonusWeaponProfProperties <- option [] ((parseWeaponProperty `sepBy` char ',') <* char '|')
bonusWeaponProfFormulas <- parseFormula
return BonusWeaponProf { .. } where
parseWeaponProficiency = try (labeled "TYPE=" >> (WeaponType <$> parseString))
<|> try (labeled "TYPE." >> (WeaponType <$> parseString))
<|> WeaponList <$ labeled "%LIST"
<|> WeaponName <$> parseString
parseWeaponProperty = try (CRITMULTADD <$ labeled "CRITMULTADD")
<|> try (CRITRANGEADD <$ labeled "CRITRANGEADD")
<|> try (CRITRANGEDOUBLE <$ labeled "CRITRANGEDOUBLE")
<|> try (DAMAGEMULT <$ labeled "DAMAGEMULT")
<|> try (DAMAGESIZE <$ labeled "DAMAGESIZE")
<|> try (DAMAGESHORTRANGE <$ labeled "DAMAGE-SHORTRANGE")
<|> try (DAMAGE <$ labeled "DAMAGE")
<|> try (PCSIZE <$ labeled "PCSIZE")
<|> try (REACH <$ labeled "REACH")
<|> try (TOHITSHORTRANGE <$ labeled "TOHIT-SHORTRANGE")
<|> try (TOHITOVERSIZE <$ labeled "TOHITOVERSIZE")
<|> try (TOHIT <$ labeled "TOHIT")
<|> (WIELDCATEGORY <$ labeled "WIELDCATEGORY")
-- BONUS:UDAM|x|y
-- x is CLASS.text
-- y is formula
| 1,629
|
parseBonusWeaponProf = do
_ <- labeled "WEAPONPROF="
bonusWeaponProficency <- parseWeaponProficiency <* char '|'
-- moderndispatch075_equip_armorshields.lst has no weapon property
bonusWeaponProfProperties <- option [] ((parseWeaponProperty `sepBy` char ',') <* char '|')
bonusWeaponProfFormulas <- parseFormula
return BonusWeaponProf { .. } where
parseWeaponProficiency = try (labeled "TYPE=" >> (WeaponType <$> parseString))
<|> try (labeled "TYPE." >> (WeaponType <$> parseString))
<|> WeaponList <$ labeled "%LIST"
<|> WeaponName <$> parseString
parseWeaponProperty = try (CRITMULTADD <$ labeled "CRITMULTADD")
<|> try (CRITRANGEADD <$ labeled "CRITRANGEADD")
<|> try (CRITRANGEDOUBLE <$ labeled "CRITRANGEDOUBLE")
<|> try (DAMAGEMULT <$ labeled "DAMAGEMULT")
<|> try (DAMAGESIZE <$ labeled "DAMAGESIZE")
<|> try (DAMAGESHORTRANGE <$ labeled "DAMAGE-SHORTRANGE")
<|> try (DAMAGE <$ labeled "DAMAGE")
<|> try (PCSIZE <$ labeled "PCSIZE")
<|> try (REACH <$ labeled "REACH")
<|> try (TOHITSHORTRANGE <$ labeled "TOHIT-SHORTRANGE")
<|> try (TOHITOVERSIZE <$ labeled "TOHITOVERSIZE")
<|> try (TOHIT <$ labeled "TOHIT")
<|> (WIELDCATEGORY <$ labeled "WIELDCATEGORY")
-- BONUS:UDAM|x|y
-- x is CLASS.text
-- y is formula
| 1,581
| false
| true
| 0
| 22
| 520
| 385
| 186
| 199
| null | null |
tomasherman/fun-w-yesod
|
Chat.hs
|
bsd-2-clause
|
chatWidget :: YesodChat master
=> (Route Chat -> Route master)
-> GWidget sub master ()
chatWidget toMaster = do
chat <- lift newIdent
output <- lift newIdent
input <- lift newIdent
[whamlet| <h1> Sup son|]
| 243
|
chatWidget :: YesodChat master
=> (Route Chat -> Route master)
-> GWidget sub master ()
chatWidget toMaster = do
chat <- lift newIdent
output <- lift newIdent
input <- lift newIdent
[whamlet| <h1> Sup son|]
| 243
|
chatWidget toMaster = do
chat <- lift newIdent
output <- lift newIdent
input <- lift newIdent
[whamlet| <h1> Sup son|]
| 127
| false
| true
| 0
| 10
| 71
| 89
| 40
| 49
| null | null |
Fizzixnerd/xmonad-config
|
site-haskell/src/XMonad/Hooks/DynamicLog/PrettyPrinter/DynamicDoc.hs
|
gpl-3.0
|
-- -- | Laws:
-- -- (i) process $ f .$. x == f <$> process $ x
-- -- (ii) id .$. x == x
-- -- (iii) (f . g) .$. x == f .$. (g .$. x)
-- class Processable c a where
-- (.$.) :: Magma c => (a -> a) -> c -> c
-- process :: (MonadIO m, Magma c) => c -> m a
-- class Magma a where
-- (.+.) :: a -> a -> a
-- magSum :: Container a => [a] -> a
-- magSum = foldl (\acc x -> acc .+. x) empty
-- class Container a where
-- empty :: a
-- instance Magma DynamicDoc where
-- x .+. y = Compound ([x, y], id)
-- instance Container DynamicDoc where
-- empty = Atom (DynDoc mempty, id)
-- instance Processable DynamicDoc Doc where
-- f .$. (Atom (d, g)) = Atom (d, f . g)
-- f .$. (Compound (d, g)) = Compound (d, f . g)
-- process = compileDynamicDoc
dynStr :: (Monad m) => String -> DynamicDoc m
dynStr = return . text
| 860
|
dynStr :: (Monad m) => String -> DynamicDoc m
dynStr = return . text
| 68
|
dynStr = return . text
| 22
| true
| true
| 0
| 7
| 243
| 52
| 37
| 15
| null | null |
hekt/blog-system
|
src/Web/Kirstie/Hooks/RelatedPosts.hs
|
mit
|
calcRelated :: [(Text, Float)] -> [Text] -> [Document] -> [(ArticleId, Float)]
calcRelated scores tags = calcScores scores tags . map doc2pair
| 142
|
calcRelated :: [(Text, Float)] -> [Text] -> [Document] -> [(ArticleId, Float)]
calcRelated scores tags = calcScores scores tags . map doc2pair
| 142
|
calcRelated scores tags = calcScores scores tags . map doc2pair
| 63
| false
| true
| 0
| 9
| 20
| 64
| 35
| 29
| null | null |
fmapfmapfmap/amazonka
|
amazonka-redshift/gen/Network/AWS/Redshift/DescribeEvents.hs
|
mpl-2.0
|
-- | The response status code.
dersResponseStatus :: Lens' DescribeEventsResponse Int
dersResponseStatus = lens _dersResponseStatus (\ s a -> s{_dersResponseStatus = a})
| 169
|
dersResponseStatus :: Lens' DescribeEventsResponse Int
dersResponseStatus = lens _dersResponseStatus (\ s a -> s{_dersResponseStatus = a})
| 138
|
dersResponseStatus = lens _dersResponseStatus (\ s a -> s{_dersResponseStatus = a})
| 83
| true
| true
| 0
| 9
| 21
| 40
| 22
| 18
| null | null |
brendanhay/gogol
|
gogol-firebase-rules/gen/Network/Google/Resource/FirebaseRules/Projects/Rulesets/List.hs
|
mpl-2.0
|
-- | OAuth access token.
prlAccessToken :: Lens' ProjectsRulesetsList (Maybe Text)
prlAccessToken
= lens _prlAccessToken
(\ s a -> s{_prlAccessToken = a})
| 162
|
prlAccessToken :: Lens' ProjectsRulesetsList (Maybe Text)
prlAccessToken
= lens _prlAccessToken
(\ s a -> s{_prlAccessToken = a})
| 137
|
prlAccessToken
= lens _prlAccessToken
(\ s a -> s{_prlAccessToken = a})
| 79
| true
| true
| 1
| 9
| 29
| 52
| 25
| 27
| null | null |
tismith/tlisp
|
write-yourself-a-scheme/listings/listing8.hs
|
mit
|
runIOThrows :: IOThrowsError String -> IO String
runIOThrows action = runErrorT (trapError action) >>= return . extractValue
| 124
|
runIOThrows :: IOThrowsError String -> IO String
runIOThrows action = runErrorT (trapError action) >>= return . extractValue
| 124
|
runIOThrows action = runErrorT (trapError action) >>= return . extractValue
| 75
| false
| true
| 0
| 9
| 16
| 45
| 20
| 25
| null | null |
JacquesCarette/literate-scientific-software
|
code/drasil-gool/GOOL/Drasil/LanguageRenderer/CppRenderer.hs
|
bsd-2-clause
|
cppODEFile :: (RenderSym repr) => ODEInfo repr ->
(repr (RenderFile repr), GOOLState)
cppODEFile info = (fl, fst s)
where (fl, s) = runState odeFile (initialState, initialFS)
olddv = depVar info
oldiv = indepVar info
ovars = otherVars info
odeFile = join $ on3StateValues (\dpv idpv ovs ->
let n = variableName dpv
t = variableName idpv
-- dv below is a hack. Needed to "rebuild" it because its state has already been evaluated higher up (for building the file where the ode solver is called) (the evaluation happens in the pair instance). This hack won't be necessary when we do things right as this file won't be built so deep in GOOL.
dv = var (variableName dpv) (listType $ innerVarType dpv)
cn = n ++ "_ODE"
dn = "d" ++ n ++ "d" ++ t
innerVarType = (listInnerType . toState . variableType)
tElem = var t $ innerVarType idpv
dvptr = var ('&':n) (onStateValue variableType dv)
dvElem = var n (innerVarType dpv)
othVars = map (modify (setODEOthVars (map variableName
ovs)) >>) ovars
in fileDoc (buildModule cn [] [] [buildClass cn Nothing
(pubMVar dv : map privMVar othVars)
[initializer (map param othVars) (zip othVars (map valueOf othVars)),
pubMethod "operator()" void [param dvElem,
pointerParam $ var dn float, param tElem]
(oneLiner $ var dn float &= (modify (setODEOthVars
(map variableName ovs)) >> ode info))],
buildClass ("Populate_" ++ n) Nothing [pubMVar dvptr]
[initializer [pointerParam dv] [(dv, valueOf dv)],
pubMethod "operator()" void [pointerParam dvElem, param tElem]
(oneLiner $ valState $ listAppend (valueOf $ objVarSelf dv)
(valueOf dv))]]))
(zoom lensFStoVS olddv) (zoom lensFStoVS oldiv) (mapM (zoom lensFStoVS) ovars)
| 2,019
|
cppODEFile :: (RenderSym repr) => ODEInfo repr ->
(repr (RenderFile repr), GOOLState)
cppODEFile info = (fl, fst s)
where (fl, s) = runState odeFile (initialState, initialFS)
olddv = depVar info
oldiv = indepVar info
ovars = otherVars info
odeFile = join $ on3StateValues (\dpv idpv ovs ->
let n = variableName dpv
t = variableName idpv
-- dv below is a hack. Needed to "rebuild" it because its state has already been evaluated higher up (for building the file where the ode solver is called) (the evaluation happens in the pair instance). This hack won't be necessary when we do things right as this file won't be built so deep in GOOL.
dv = var (variableName dpv) (listType $ innerVarType dpv)
cn = n ++ "_ODE"
dn = "d" ++ n ++ "d" ++ t
innerVarType = (listInnerType . toState . variableType)
tElem = var t $ innerVarType idpv
dvptr = var ('&':n) (onStateValue variableType dv)
dvElem = var n (innerVarType dpv)
othVars = map (modify (setODEOthVars (map variableName
ovs)) >>) ovars
in fileDoc (buildModule cn [] [] [buildClass cn Nothing
(pubMVar dv : map privMVar othVars)
[initializer (map param othVars) (zip othVars (map valueOf othVars)),
pubMethod "operator()" void [param dvElem,
pointerParam $ var dn float, param tElem]
(oneLiner $ var dn float &= (modify (setODEOthVars
(map variableName ovs)) >> ode info))],
buildClass ("Populate_" ++ n) Nothing [pubMVar dvptr]
[initializer [pointerParam dv] [(dv, valueOf dv)],
pubMethod "operator()" void [pointerParam dvElem, param tElem]
(oneLiner $ valState $ listAppend (valueOf $ objVarSelf dv)
(valueOf dv))]]))
(zoom lensFStoVS olddv) (zoom lensFStoVS oldiv) (mapM (zoom lensFStoVS) ovars)
| 2,019
|
cppODEFile info = (fl, fst s)
where (fl, s) = runState odeFile (initialState, initialFS)
olddv = depVar info
oldiv = indepVar info
ovars = otherVars info
odeFile = join $ on3StateValues (\dpv idpv ovs ->
let n = variableName dpv
t = variableName idpv
-- dv below is a hack. Needed to "rebuild" it because its state has already been evaluated higher up (for building the file where the ode solver is called) (the evaluation happens in the pair instance). This hack won't be necessary when we do things right as this file won't be built so deep in GOOL.
dv = var (variableName dpv) (listType $ innerVarType dpv)
cn = n ++ "_ODE"
dn = "d" ++ n ++ "d" ++ t
innerVarType = (listInnerType . toState . variableType)
tElem = var t $ innerVarType idpv
dvptr = var ('&':n) (onStateValue variableType dv)
dvElem = var n (innerVarType dpv)
othVars = map (modify (setODEOthVars (map variableName
ovs)) >>) ovars
in fileDoc (buildModule cn [] [] [buildClass cn Nothing
(pubMVar dv : map privMVar othVars)
[initializer (map param othVars) (zip othVars (map valueOf othVars)),
pubMethod "operator()" void [param dvElem,
pointerParam $ var dn float, param tElem]
(oneLiner $ var dn float &= (modify (setODEOthVars
(map variableName ovs)) >> ode info))],
buildClass ("Populate_" ++ n) Nothing [pubMVar dvptr]
[initializer [pointerParam dv] [(dv, valueOf dv)],
pubMethod "operator()" void [pointerParam dvElem, param tElem]
(oneLiner $ valState $ listAppend (valueOf $ objVarSelf dv)
(valueOf dv))]]))
(zoom lensFStoVS olddv) (zoom lensFStoVS oldiv) (mapM (zoom lensFStoVS) ovars)
| 1,931
| false
| true
| 2
| 26
| 634
| 617
| 309
| 308
| null | null |
brendanhay/gogol
|
gogol-shopping-content/gen/Network/Google/ShoppingContent/Types/Product.hs
|
mpl-2.0
|
-- | The return address ID. This should be set only if the method is
-- \`delete\` or \`get\`.
rcbrecReturnAddressId :: Lens' ReturnaddressCustomBatchRequestEntry (Maybe Text)
rcbrecReturnAddressId
= lens _rcbrecReturnAddressId
(\ s a -> s{_rcbrecReturnAddressId = a})
| 276
|
rcbrecReturnAddressId :: Lens' ReturnaddressCustomBatchRequestEntry (Maybe Text)
rcbrecReturnAddressId
= lens _rcbrecReturnAddressId
(\ s a -> s{_rcbrecReturnAddressId = a})
| 181
|
rcbrecReturnAddressId
= lens _rcbrecReturnAddressId
(\ s a -> s{_rcbrecReturnAddressId = a})
| 100
| true
| true
| 0
| 9
| 43
| 49
| 26
| 23
| null | null |
sdiehl/ghc
|
compiler/GHC/StgToCmm/Closure.hs
|
bsd-3-clause
|
-----------------------------------------------------------------------------
-- Choosing SM reps
-----------------------------------------------------------------------------
lfClosureType :: LambdaFormInfo -> ClosureTypeInfo
lfClosureType (LFReEntrant _ _ arity _ argd) = Fun arity argd
| 304
|
lfClosureType :: LambdaFormInfo -> ClosureTypeInfo
lfClosureType (LFReEntrant _ _ arity _ argd) = Fun arity argd
| 112
|
lfClosureType (LFReEntrant _ _ arity _ argd) = Fun arity argd
| 61
| true
| true
| 0
| 7
| 37
| 40
| 21
| 19
| null | null |
peterokagey/haskellOEIS
|
src/Helpers/DistinctDistances.hs
|
apache-2.0
|
distinctDistances :: Integer -> Integer -> Int
distinctDistances n k = length $ nub [i^2 + j^2 | i <- [0..n-1], j <- [0..k-1]]
| 126
|
distinctDistances :: Integer -> Integer -> Int
distinctDistances n k = length $ nub [i^2 + j^2 | i <- [0..n-1], j <- [0..k-1]]
| 126
|
distinctDistances n k = length $ nub [i^2 + j^2 | i <- [0..n-1], j <- [0..k-1]]
| 79
| false
| true
| 0
| 11
| 23
| 85
| 42
| 43
| null | null |
JohnL4/HaskellXamlScan
|
file-content-matcher.hs
|
mit
|
fileContentsMatch :: String -> Bool
fileContentsMatch s = (s =~ resourcesSectionRegex)
| 86
|
fileContentsMatch :: String -> Bool
fileContentsMatch s = (s =~ resourcesSectionRegex)
| 86
|
fileContentsMatch s = (s =~ resourcesSectionRegex)
| 50
| false
| true
| 0
| 7
| 10
| 31
| 14
| 17
| null | null |
hferreiro/replay
|
compiler/cmm/CLabel.hs
|
bsd-3-clause
|
mkCmmRetInfoLabel pkg str = CmmLabel pkg str CmmRetInfo
| 61
|
mkCmmRetInfoLabel pkg str = CmmLabel pkg str CmmRetInfo
| 61
|
mkCmmRetInfoLabel pkg str = CmmLabel pkg str CmmRetInfo
| 61
| false
| false
| 0
| 5
| 13
| 18
| 8
| 10
| null | null |
DavidAlphaFox/ghc
|
libraries/terminfo/System/Console/Terminfo/Base.hs
|
bsd-3-clause
|
-- | Output a string capability. Applys padding information to the string if
-- necessary.
tPuts :: String -> LinesAffected -> FunPtr CharOutput -> IO ()
tPuts s n putc = withCString s $ \c_str -> tputs c_str (toEnum n) putc
| 225
|
tPuts :: String -> LinesAffected -> FunPtr CharOutput -> IO ()
tPuts s n putc = withCString s $ \c_str -> tputs c_str (toEnum n) putc
| 133
|
tPuts s n putc = withCString s $ \c_str -> tputs c_str (toEnum n) putc
| 70
| true
| true
| 0
| 9
| 41
| 65
| 32
| 33
| null | null |
gwright83/Wheeler
|
src/Math/Symbolic/Wheeler/Pattern.hs
|
bsd-3-clause
|
isPattern (Symbol (DiracSpinor d)) = diracSpinorType d == Pattern
| 65
|
isPattern (Symbol (DiracSpinor d)) = diracSpinorType d == Pattern
| 65
|
isPattern (Symbol (DiracSpinor d)) = diracSpinorType d == Pattern
| 65
| false
| false
| 0
| 9
| 8
| 28
| 13
| 15
| null | null |
ganeti/htools
|
Ganeti/HTools/Types.hs
|
gpl-2.0
|
apolToString AllocUnallocable = "unallocable"
| 45
|
apolToString AllocUnallocable = "unallocable"
| 45
|
apolToString AllocUnallocable = "unallocable"
| 45
| false
| false
| 0
| 4
| 3
| 10
| 4
| 6
| null | null |
spire/spire
|
src/Spire/Surface/Types.hs
|
bsd-3-clause
|
nepic :: String -> String -> Syntax
nepic nm _N = sApps (sVar nm) $
[sVar (_N ++ "N") , sVar (_N ++ "E") , sVar (_N ++ "P") ,
sVar (_N ++ "I") , sVar (_N ++ "C")]
| 167
|
nepic :: String -> String -> Syntax
nepic nm _N = sApps (sVar nm) $
[sVar (_N ++ "N") , sVar (_N ++ "E") , sVar (_N ++ "P") ,
sVar (_N ++ "I") , sVar (_N ++ "C")]
| 167
|
nepic nm _N = sApps (sVar nm) $
[sVar (_N ++ "N") , sVar (_N ++ "E") , sVar (_N ++ "P") ,
sVar (_N ++ "I") , sVar (_N ++ "C")]
| 131
| false
| true
| 2
| 9
| 43
| 109
| 54
| 55
| null | null |
andrey013/blog
|
src/blog.hs
|
bsd-3-clause
|
main :: IO ()
main = hakyll $ do
-- Compress CSS
match "css/*" $ do
route $ setExtension "css"
compile $ getResourceString >>> unixFilter "lessc" ["--include-path=./css", "--yui-compress", "-"]
-- Render posts
match "posts/*" $ do
route $ setExtension ".html"
compile $ pageCompiler
>>> arr (renderDateField "date" "%B %e, %Y" "Date unknown")
>>> renderTagsField "prettytags" (fromCapture "tags/*")
>>> applyTemplateCompiler "templates/post.hml"
>>> arr (copyBodyToField "description")
>>> applyTemplateCompiler "templates/default.hml"
>>> relativizeUrlsCompiler
-- Render posts list
match "posts.html" $ route idRoute
create "posts.html" $ constA mempty
>>> arr (setField "title" "All posts")
>>> requireAllA "posts/*" addPostList
>>> applyTemplateCompiler "templates/posts.hml"
>>> applyTemplateCompiler "templates/default.hml"
>>> relativizeUrlsCompiler
-- Index
match "index.html" $ route idRoute
create "index.html" $ constA mempty
>>> arr (setField "title" "Home")
>>> requireA "tags" (setFieldA "tagcloud" (renderTagCloud'))
>>> requireAllA "posts/*" (id *** arr (take 3 . reverse . chronological) >>> addPostList)
>>> applyTemplateCompiler "templates/index.hml"
>>> applyTemplateCompiler "templates/default.hml"
>>> relativizeUrlsCompiler
-- Tags
create "tags" $
requireAll "posts/*" (\_ ps -> readTags ps :: Tags String)
-- Add a tag list compiler for every tag
match "tags/*" $ route $ setExtension ".html"
metaCompile $ require_ "tags"
>>> arr tagsMap
>>> arr (map (\(t, p) -> (tagIdentifier t, makeTagList t p)))
-- Render RSS feed
match "rss.xml" $ route idRoute
create "rss.xml" $
requireAll_ "posts/*"
>>> renderRss feedConfiguration
-- Read templates
match "templates/*" $ compile templateCompiler
where
renderTagCloud' :: Compiler (Tags String) String
renderTagCloud' = renderTagCloud tagIdentifier 100 120
tagIdentifier :: String -> Identifier (Page String)
tagIdentifier = fromCapture "tags/*"
-- | Auxiliary compiler: generate a post list from a list of given posts, and
-- add it to the current page under @$posts@
--
| 2,385
|
main :: IO ()
main = hakyll $ do
-- Compress CSS
match "css/*" $ do
route $ setExtension "css"
compile $ getResourceString >>> unixFilter "lessc" ["--include-path=./css", "--yui-compress", "-"]
-- Render posts
match "posts/*" $ do
route $ setExtension ".html"
compile $ pageCompiler
>>> arr (renderDateField "date" "%B %e, %Y" "Date unknown")
>>> renderTagsField "prettytags" (fromCapture "tags/*")
>>> applyTemplateCompiler "templates/post.hml"
>>> arr (copyBodyToField "description")
>>> applyTemplateCompiler "templates/default.hml"
>>> relativizeUrlsCompiler
-- Render posts list
match "posts.html" $ route idRoute
create "posts.html" $ constA mempty
>>> arr (setField "title" "All posts")
>>> requireAllA "posts/*" addPostList
>>> applyTemplateCompiler "templates/posts.hml"
>>> applyTemplateCompiler "templates/default.hml"
>>> relativizeUrlsCompiler
-- Index
match "index.html" $ route idRoute
create "index.html" $ constA mempty
>>> arr (setField "title" "Home")
>>> requireA "tags" (setFieldA "tagcloud" (renderTagCloud'))
>>> requireAllA "posts/*" (id *** arr (take 3 . reverse . chronological) >>> addPostList)
>>> applyTemplateCompiler "templates/index.hml"
>>> applyTemplateCompiler "templates/default.hml"
>>> relativizeUrlsCompiler
-- Tags
create "tags" $
requireAll "posts/*" (\_ ps -> readTags ps :: Tags String)
-- Add a tag list compiler for every tag
match "tags/*" $ route $ setExtension ".html"
metaCompile $ require_ "tags"
>>> arr tagsMap
>>> arr (map (\(t, p) -> (tagIdentifier t, makeTagList t p)))
-- Render RSS feed
match "rss.xml" $ route idRoute
create "rss.xml" $
requireAll_ "posts/*"
>>> renderRss feedConfiguration
-- Read templates
match "templates/*" $ compile templateCompiler
where
renderTagCloud' :: Compiler (Tags String) String
renderTagCloud' = renderTagCloud tagIdentifier 100 120
tagIdentifier :: String -> Identifier (Page String)
tagIdentifier = fromCapture "tags/*"
-- | Auxiliary compiler: generate a post list from a list of given posts, and
-- add it to the current page under @$posts@
--
| 2,385
|
main = hakyll $ do
-- Compress CSS
match "css/*" $ do
route $ setExtension "css"
compile $ getResourceString >>> unixFilter "lessc" ["--include-path=./css", "--yui-compress", "-"]
-- Render posts
match "posts/*" $ do
route $ setExtension ".html"
compile $ pageCompiler
>>> arr (renderDateField "date" "%B %e, %Y" "Date unknown")
>>> renderTagsField "prettytags" (fromCapture "tags/*")
>>> applyTemplateCompiler "templates/post.hml"
>>> arr (copyBodyToField "description")
>>> applyTemplateCompiler "templates/default.hml"
>>> relativizeUrlsCompiler
-- Render posts list
match "posts.html" $ route idRoute
create "posts.html" $ constA mempty
>>> arr (setField "title" "All posts")
>>> requireAllA "posts/*" addPostList
>>> applyTemplateCompiler "templates/posts.hml"
>>> applyTemplateCompiler "templates/default.hml"
>>> relativizeUrlsCompiler
-- Index
match "index.html" $ route idRoute
create "index.html" $ constA mempty
>>> arr (setField "title" "Home")
>>> requireA "tags" (setFieldA "tagcloud" (renderTagCloud'))
>>> requireAllA "posts/*" (id *** arr (take 3 . reverse . chronological) >>> addPostList)
>>> applyTemplateCompiler "templates/index.hml"
>>> applyTemplateCompiler "templates/default.hml"
>>> relativizeUrlsCompiler
-- Tags
create "tags" $
requireAll "posts/*" (\_ ps -> readTags ps :: Tags String)
-- Add a tag list compiler for every tag
match "tags/*" $ route $ setExtension ".html"
metaCompile $ require_ "tags"
>>> arr tagsMap
>>> arr (map (\(t, p) -> (tagIdentifier t, makeTagList t p)))
-- Render RSS feed
match "rss.xml" $ route idRoute
create "rss.xml" $
requireAll_ "posts/*"
>>> renderRss feedConfiguration
-- Read templates
match "templates/*" $ compile templateCompiler
where
renderTagCloud' :: Compiler (Tags String) String
renderTagCloud' = renderTagCloud tagIdentifier 100 120
tagIdentifier :: String -> Identifier (Page String)
tagIdentifier = fromCapture "tags/*"
-- | Auxiliary compiler: generate a post list from a list of given posts, and
-- add it to the current page under @$posts@
--
| 2,371
| false
| true
| 0
| 23
| 615
| 562
| 262
| 300
| null | null |
matthieubulte/sequent
|
src/Sequent/Inference.hs
|
bsd-3-clause
|
iWeakenSuccedent _ _ = mzero
| 28
|
iWeakenSuccedent _ _ = mzero
| 28
|
iWeakenSuccedent _ _ = mzero
| 28
| false
| false
| 0
| 5
| 4
| 11
| 5
| 6
| null | null |
jgm/haddock
|
src/Haddock/InterfaceFile.hs
|
bsd-2-clause
|
ifPackageId :: InterfaceFile -> PackageId
ifPackageId if_ =
case ifInstalledIfaces if_ of
[] -> error "empty InterfaceFile"
iface:_ -> modulePackageId $ instMod iface
| 176
|
ifPackageId :: InterfaceFile -> PackageId
ifPackageId if_ =
case ifInstalledIfaces if_ of
[] -> error "empty InterfaceFile"
iface:_ -> modulePackageId $ instMod iface
| 176
|
ifPackageId if_ =
case ifInstalledIfaces if_ of
[] -> error "empty InterfaceFile"
iface:_ -> modulePackageId $ instMod iface
| 134
| false
| true
| 0
| 9
| 32
| 58
| 26
| 32
| null | null |
josefs/autosar
|
oldARSim/tmp-ABS.hs
|
bsd-3-clause
|
pressure_step valve accel n | even n = do
rte_write valve True
Ok a <- rte_read accel
trace ("Pressure " ++ show a) (return ())
return (Running 0 (round (a*50)) (n+1))
| 199
|
pressure_step valve accel n | even n = do
rte_write valve True
Ok a <- rte_read accel
trace ("Pressure " ++ show a) (return ())
return (Running 0 (round (a*50)) (n+1))
| 199
|
pressure_step valve accel n | even n = do
rte_write valve True
Ok a <- rte_read accel
trace ("Pressure " ++ show a) (return ())
return (Running 0 (round (a*50)) (n+1))
| 199
| false
| false
| 0
| 14
| 62
| 105
| 47
| 58
| null | null |
ombocomp/Renaming
|
Data/Renaming.hs
|
apache-2.0
|
-- |Sorts a list of filenames.
sortBy :: (Monad m)
=> (b -> b -> Ordering)
-> ParArrow (EitherT String m) a b b
sortBy f = liftPar' (LS.sortBy f)
| 159
|
sortBy :: (Monad m)
=> (b -> b -> Ordering)
-> ParArrow (EitherT String m) a b b
sortBy f = liftPar' (LS.sortBy f)
| 128
|
sortBy f = liftPar' (LS.sortBy f)
| 33
| true
| true
| 0
| 9
| 43
| 67
| 34
| 33
| null | null |
projectorhq/haskell-liquid
|
src/Text/Liquid/VariableFinder.hs
|
bsd-3-clause
|
aggregateElem af pf (IfClause x) =
IfClause (aggregateElem af pf x)
| 88
|
aggregateElem af pf (IfClause x) =
IfClause (aggregateElem af pf x)
| 88
|
aggregateElem af pf (IfClause x) =
IfClause (aggregateElem af pf x)
| 88
| false
| false
| 0
| 7
| 31
| 32
| 15
| 17
| null | null |
haroldcarr/learn-haskell-coq-ml-etc
|
haskell/book/2014-Alejandro_Serrano_Mena-Beginning_Haskell/old/code/src/C04.hs
|
unlicense
|
------------------------------------------------------------------------------
-- graphs - p. 91
-- (value , key , edge-to
timeMachineGraph :: [(String, String, [String])]
timeMachineGraph =
[ ("wood" ,"wood" ,["walls"])
, ("plastic" ,"plastic" ,["walls","wheels"])
, ("aluminum","aluminum",["wheels","door"])
, ("walls" ,"walls" ,["done"])
, ("wheels" ,"wheels" ,["done"])
, ("door" ,"door" ,["done"])
, ("done" ,"done" ,[])
]
| 503
|
timeMachineGraph :: [(String, String, [String])]
timeMachineGraph =
[ ("wood" ,"wood" ,["walls"])
, ("plastic" ,"plastic" ,["walls","wheels"])
, ("aluminum","aluminum",["wheels","door"])
, ("walls" ,"walls" ,["done"])
, ("wheels" ,"wheels" ,["done"])
, ("door" ,"door" ,["done"])
, ("done" ,"done" ,[])
]
| 360
|
timeMachineGraph =
[ ("wood" ,"wood" ,["walls"])
, ("plastic" ,"plastic" ,["walls","wheels"])
, ("aluminum","aluminum",["wheels","door"])
, ("walls" ,"walls" ,["done"])
, ("wheels" ,"wheels" ,["done"])
, ("door" ,"door" ,["done"])
, ("done" ,"done" ,[])
]
| 311
| true
| true
| 0
| 7
| 121
| 139
| 92
| 47
| null | null |
alephcloud/bayhac2014
|
src/BayHac2014/Cryptmail/ByteString.hs
|
mit
|
prop_empty ∷ Bool
prop_empty = mempty ≡ ("" ∷ ByteString)
| 57
|
prop_empty ∷ Bool
prop_empty = mempty ≡ ("" ∷ ByteString)
| 57
|
prop_empty = mempty ≡ ("" ∷ ByteString)
| 39
| false
| true
| 0
| 6
| 9
| 21
| 12
| 9
| null | null |
maurotrb/xmonadrc
|
xmonadrc.hs
|
bsd-3-clause
|
-- gimpLayout = withIM (0.18) (Role "gimp-toolbox") $ reflectHoriz $ withIM (0.20) (Role "gimp-dock") Full
--gimpLayout = named "Gimp" $ split 0.20 Grid gimpMainAndRight (Role "gimp-toolbox")
--gimpMainAndRight = split (0.73 / (0.73 + 0.20)) simpleTabbed (Column 1.6) (Role "gimp-image-window")
--split x = combineTwoP (TwoPane 0.03 x)
myPrettyPrinter :: D.Client -> PP
myPrettyPrinter dbus = defaultPP
{ ppOutput = dbusOutput dbus
, ppTitle = pangoColor "#586e75" . shorten 50 . pangoSanitize
, ppCurrent = pangoColor "#d33682" . wrap "[" "]" . pangoSanitize
, ppVisible = pangoColor "#6c71c4" . wrap "(" ")" . pangoSanitize
, ppHidden = pangoColor "#93a1a1" . wrap " " " "
, ppUrgent = pangoColor "#dc322f"
, ppLayout = const ""
, ppSep = " "
}
| 966
|
myPrettyPrinter :: D.Client -> PP
myPrettyPrinter dbus = defaultPP
{ ppOutput = dbusOutput dbus
, ppTitle = pangoColor "#586e75" . shorten 50 . pangoSanitize
, ppCurrent = pangoColor "#d33682" . wrap "[" "]" . pangoSanitize
, ppVisible = pangoColor "#6c71c4" . wrap "(" ")" . pangoSanitize
, ppHidden = pangoColor "#93a1a1" . wrap " " " "
, ppUrgent = pangoColor "#dc322f"
, ppLayout = const ""
, ppSep = " "
}
| 629
|
myPrettyPrinter dbus = defaultPP
{ ppOutput = dbusOutput dbus
, ppTitle = pangoColor "#586e75" . shorten 50 . pangoSanitize
, ppCurrent = pangoColor "#d33682" . wrap "[" "]" . pangoSanitize
, ppVisible = pangoColor "#6c71c4" . wrap "(" ")" . pangoSanitize
, ppHidden = pangoColor "#93a1a1" . wrap " " " "
, ppUrgent = pangoColor "#dc322f"
, ppLayout = const ""
, ppSep = " "
}
| 595
| true
| true
| 0
| 10
| 338
| 145
| 76
| 69
| null | null |
chadbrewbaker/combinat
|
Math/Combinat/LatticePaths.hs
|
bsd-3-clause
|
------------------------------------------------------------------------------
-- * Zero-level touches
-- | @touchingDyckPaths k m@ lists all Dyck paths from @(0,0)@ to @(2m,0)@ which touch the
-- zero level line @y=0@ exactly @k@ times (excluding the starting point, but including the endpoint;
-- thus, @k@ should be positive). Synonym for 'touchingDyckPathsNaive'.
touchingDyckPaths
:: Int -- ^ @k@ = number of zero-touches
-> Int -- ^ @m@ = half-length
-> [LatticePath]
touchingDyckPaths = touchingDyckPathsNaive
| 540
|
touchingDyckPaths
:: Int -- ^ @k@ = number of zero-touches
-> Int -- ^ @m@ = half-length
-> [LatticePath]
touchingDyckPaths = touchingDyckPathsNaive
| 161
|
touchingDyckPaths = touchingDyckPathsNaive
| 42
| true
| true
| 0
| 9
| 91
| 35
| 20
| 15
| null | null |
brendanhay/gogol
|
gogol-monitoring/gen/Network/Google/Resource/Monitoring/Projects/NotificationChannelDescriptors/List.hs
|
mpl-2.0
|
-- | V1 error format.
pncdlXgafv :: Lens' ProjectsNotificationChannelDescriptorsList (Maybe Xgafv)
pncdlXgafv
= lens _pncdlXgafv (\ s a -> s{_pncdlXgafv = a})
| 160
|
pncdlXgafv :: Lens' ProjectsNotificationChannelDescriptorsList (Maybe Xgafv)
pncdlXgafv
= lens _pncdlXgafv (\ s a -> s{_pncdlXgafv = a})
| 138
|
pncdlXgafv
= lens _pncdlXgafv (\ s a -> s{_pncdlXgafv = a})
| 61
| true
| true
| 0
| 9
| 23
| 48
| 25
| 23
| null | null |
tomwadeson/adventofcode
|
06.hs
|
mit
|
perform :: Grid -> Instruction -> Grid
perform g i = foldl' (changeBulb i) g (expandCoords . range $ i)
| 103
|
perform :: Grid -> Instruction -> Grid
perform g i = foldl' (changeBulb i) g (expandCoords . range $ i)
| 103
|
perform g i = foldl' (changeBulb i) g (expandCoords . range $ i)
| 64
| false
| true
| 0
| 8
| 19
| 48
| 24
| 24
| null | null |
Stulv/sudoku
|
src/Queries.hs
|
bsd-3-clause
|
insertPuzzle :: Query
insertPuzzle =
fromString
"insert or ignore into puzzle (solutionId, data) values (?,?)"
| 114
|
insertPuzzle :: Query
insertPuzzle =
fromString
"insert or ignore into puzzle (solutionId, data) values (?,?)"
| 114
|
insertPuzzle =
fromString
"insert or ignore into puzzle (solutionId, data) values (?,?)"
| 92
| false
| true
| 0
| 6
| 18
| 21
| 8
| 13
| null | null |
martomi/AI-Reversi
|
Reversi_AI.hs
|
mit
|
generateNode :: [Board] -> Player -> [Coordinates] -> [Node]
generateNode [] _ [] = []
| 86
|
generateNode :: [Board] -> Player -> [Coordinates] -> [Node]
generateNode [] _ [] = []
| 86
|
generateNode [] _ [] = []
| 25
| false
| true
| 0
| 10
| 14
| 51
| 25
| 26
| null | null |
kawamuray/ganeti
|
src/Ganeti/OpCodes.hs
|
gpl-2.0
|
opSummaryVal OpInstanceMigrate { opInstanceName = s } = Just s
| 62
|
opSummaryVal OpInstanceMigrate { opInstanceName = s } = Just s
| 62
|
opSummaryVal OpInstanceMigrate { opInstanceName = s } = Just s
| 62
| false
| false
| 0
| 7
| 9
| 22
| 10
| 12
| null | null |
erochest/text-regex-replace
|
specs/Data/Text/ICU/ReplaceSpec.hs
|
apache-2.0
|
spec :: Spec
spec = do
describe "replace" $ do
it "should replace the first match." $
replace "a" "b" " aaa" `shouldBe` " baa"
it "should include the prefix before the first match." $
replace "\\d{2}" "R1" "abc: 10 12" `shouldBe` "abc: R1 12"
describe "replaceAll" $ do
it "should replace all matches." $
replaceAll "a" "b" " aaa" `shouldBe` " bbb"
it "should replace all matches with stuff in between." $
replaceAll "a" "b" " a a a " `shouldBe` " b b b "
it "should include the prefix before the first match." $
replaceAll "\\d{2}" "R1" "abc: 10 12" `shouldBe` "abc: R1 R1"
it "should include the prefix before the last match." $
replaceAll "\\d{2}" "R1" "abc: 10 12 14" `shouldBe` "abc: R1 R1 R1"
describe "rgroup" $
it "should create a Replace that replaces an RE group." $
let r = rgroup 1
in replace "a(b)c" r "abcabcabc" `shouldBe` "babcabc"
describe "rtext" $
it "should create a Replace that replaces with a static Text." $
let r = rtext "d"
in replace "a(b)c" r "abcabcabc" `shouldBe` "dabcabc"
describe "rstring" $
it "should create a Replace that replaces with a static String." $
let r = rstring "e"
in replace "a(b)c" r "abcabcabc" `shouldBe` "eabcabc"
describe "rfn" $
it "should create a Replace that uses a function that returns a Builder." $
let r = rfn $ const "f"
in replace "a(b)c" r "abcabcabc" `shouldBe` "fabcabc"
describe "rtfn" $
it "should create a Replace that uses a function that returns a Text." $
let r = rtfn $ const "g"
in replace "a(b)c" r "abcabcabc" `shouldBe` "gabcabc"
describe "rbuilder" $
it "should create a Replace that replaces with a static Builder." $
let r = rbuilder "h"
in replace "a(b)c" r "abcabcabc" `shouldBe` "habcabc"
describe "parser" $ do
it "should create a Replace that has replaces with a static Text." $
replace "a(b)c" "xyz" "abcabcabc" `shouldBe` "xyzabcabc"
it "should create a Replace that replaces with an RE group." $
replace "a(b)c" "$1" "abcabcabc" `shouldBe` "babcabc"
it "should create a Replace that replaces with a dollar sign." $
replace "a(b)c" "$$" "abcabcabc" `shouldBe` "$abcabc"
it "should create a Replace that combines other Replaces." $
replace "a(b)c" "$$ hi $1 bye " "abcabcabc" `shouldBe`
"$ hi b bye abcabc"
it "should handle examples in the comments." $ do
replaceAll "a" "b" "aaa" `shouldBe` "bbb"
replaceAll "ab" "ba" "cdababcd" `shouldBe` "cdbabacd"
replaceAll "(.*), (.*)" "$2 $1" "Beeblebrox, Zaphod" `shouldBe`
"Zaphod Beeblebrox"
replaceAll "4(\\d)" "${1}4" "7458" `shouldBe` "7548"
replaceAll "(\\d+\\.\\d+)" "$$$1" "9.99" `shouldBe` "$9.99"
| 3,072
|
spec :: Spec
spec = do
describe "replace" $ do
it "should replace the first match." $
replace "a" "b" " aaa" `shouldBe` " baa"
it "should include the prefix before the first match." $
replace "\\d{2}" "R1" "abc: 10 12" `shouldBe` "abc: R1 12"
describe "replaceAll" $ do
it "should replace all matches." $
replaceAll "a" "b" " aaa" `shouldBe` " bbb"
it "should replace all matches with stuff in between." $
replaceAll "a" "b" " a a a " `shouldBe` " b b b "
it "should include the prefix before the first match." $
replaceAll "\\d{2}" "R1" "abc: 10 12" `shouldBe` "abc: R1 R1"
it "should include the prefix before the last match." $
replaceAll "\\d{2}" "R1" "abc: 10 12 14" `shouldBe` "abc: R1 R1 R1"
describe "rgroup" $
it "should create a Replace that replaces an RE group." $
let r = rgroup 1
in replace "a(b)c" r "abcabcabc" `shouldBe` "babcabc"
describe "rtext" $
it "should create a Replace that replaces with a static Text." $
let r = rtext "d"
in replace "a(b)c" r "abcabcabc" `shouldBe` "dabcabc"
describe "rstring" $
it "should create a Replace that replaces with a static String." $
let r = rstring "e"
in replace "a(b)c" r "abcabcabc" `shouldBe` "eabcabc"
describe "rfn" $
it "should create a Replace that uses a function that returns a Builder." $
let r = rfn $ const "f"
in replace "a(b)c" r "abcabcabc" `shouldBe` "fabcabc"
describe "rtfn" $
it "should create a Replace that uses a function that returns a Text." $
let r = rtfn $ const "g"
in replace "a(b)c" r "abcabcabc" `shouldBe` "gabcabc"
describe "rbuilder" $
it "should create a Replace that replaces with a static Builder." $
let r = rbuilder "h"
in replace "a(b)c" r "abcabcabc" `shouldBe` "habcabc"
describe "parser" $ do
it "should create a Replace that has replaces with a static Text." $
replace "a(b)c" "xyz" "abcabcabc" `shouldBe` "xyzabcabc"
it "should create a Replace that replaces with an RE group." $
replace "a(b)c" "$1" "abcabcabc" `shouldBe` "babcabc"
it "should create a Replace that replaces with a dollar sign." $
replace "a(b)c" "$$" "abcabcabc" `shouldBe` "$abcabc"
it "should create a Replace that combines other Replaces." $
replace "a(b)c" "$$ hi $1 bye " "abcabcabc" `shouldBe`
"$ hi b bye abcabc"
it "should handle examples in the comments." $ do
replaceAll "a" "b" "aaa" `shouldBe` "bbb"
replaceAll "ab" "ba" "cdababcd" `shouldBe` "cdbabacd"
replaceAll "(.*), (.*)" "$2 $1" "Beeblebrox, Zaphod" `shouldBe`
"Zaphod Beeblebrox"
replaceAll "4(\\d)" "${1}4" "7458" `shouldBe` "7548"
replaceAll "(\\d+\\.\\d+)" "$$$1" "9.99" `shouldBe` "$9.99"
| 3,072
|
spec = do
describe "replace" $ do
it "should replace the first match." $
replace "a" "b" " aaa" `shouldBe` " baa"
it "should include the prefix before the first match." $
replace "\\d{2}" "R1" "abc: 10 12" `shouldBe` "abc: R1 12"
describe "replaceAll" $ do
it "should replace all matches." $
replaceAll "a" "b" " aaa" `shouldBe` " bbb"
it "should replace all matches with stuff in between." $
replaceAll "a" "b" " a a a " `shouldBe` " b b b "
it "should include the prefix before the first match." $
replaceAll "\\d{2}" "R1" "abc: 10 12" `shouldBe` "abc: R1 R1"
it "should include the prefix before the last match." $
replaceAll "\\d{2}" "R1" "abc: 10 12 14" `shouldBe` "abc: R1 R1 R1"
describe "rgroup" $
it "should create a Replace that replaces an RE group." $
let r = rgroup 1
in replace "a(b)c" r "abcabcabc" `shouldBe` "babcabc"
describe "rtext" $
it "should create a Replace that replaces with a static Text." $
let r = rtext "d"
in replace "a(b)c" r "abcabcabc" `shouldBe` "dabcabc"
describe "rstring" $
it "should create a Replace that replaces with a static String." $
let r = rstring "e"
in replace "a(b)c" r "abcabcabc" `shouldBe` "eabcabc"
describe "rfn" $
it "should create a Replace that uses a function that returns a Builder." $
let r = rfn $ const "f"
in replace "a(b)c" r "abcabcabc" `shouldBe` "fabcabc"
describe "rtfn" $
it "should create a Replace that uses a function that returns a Text." $
let r = rtfn $ const "g"
in replace "a(b)c" r "abcabcabc" `shouldBe` "gabcabc"
describe "rbuilder" $
it "should create a Replace that replaces with a static Builder." $
let r = rbuilder "h"
in replace "a(b)c" r "abcabcabc" `shouldBe` "habcabc"
describe "parser" $ do
it "should create a Replace that has replaces with a static Text." $
replace "a(b)c" "xyz" "abcabcabc" `shouldBe` "xyzabcabc"
it "should create a Replace that replaces with an RE group." $
replace "a(b)c" "$1" "abcabcabc" `shouldBe` "babcabc"
it "should create a Replace that replaces with a dollar sign." $
replace "a(b)c" "$$" "abcabcabc" `shouldBe` "$abcabc"
it "should create a Replace that combines other Replaces." $
replace "a(b)c" "$$ hi $1 bye " "abcabcabc" `shouldBe`
"$ hi b bye abcabc"
it "should handle examples in the comments." $ do
replaceAll "a" "b" "aaa" `shouldBe` "bbb"
replaceAll "ab" "ba" "cdababcd" `shouldBe` "cdbabacd"
replaceAll "(.*), (.*)" "$2 $1" "Beeblebrox, Zaphod" `shouldBe`
"Zaphod Beeblebrox"
replaceAll "4(\\d)" "${1}4" "7458" `shouldBe` "7548"
replaceAll "(\\d+\\.\\d+)" "$$$1" "9.99" `shouldBe` "$9.99"
| 3,059
| false
| true
| 0
| 14
| 960
| 640
| 297
| 343
| null | null |
nixorn/SQL-Solvent
|
src/Database/SQL/SQLSolvent/Server.hs
|
gpl-3.0
|
handleDelete :: MonadSnap m => MVar GraphEnv -> m ()
handleDelete e_ment = do
body <- readRequestBody 100000
case (readMaybe (U.toString body) :: Maybe [[Int]] ) of --на самом деле тут должно быть хотябы ([Int], [Int]), но мы json+хардкодинг.
Just todel ->
case (length todel == 2 ) of
True -> (liftIO $ do
e <- takeMVar e_ment
let lc = localGraph e
mrkrs = markers e
nodedel = todel !! 0
edgedel = todel !! 1
putMVar e_ment $ e {localGraph = delEdges' (delNodes' lc nodedel) edgedel}
--, markers =
) >> return ()
False -> return ()
Nothing -> return ()
| 921
|
handleDelete :: MonadSnap m => MVar GraphEnv -> m ()
handleDelete e_ment = do
body <- readRequestBody 100000
case (readMaybe (U.toString body) :: Maybe [[Int]] ) of --на самом деле тут должно быть хотябы ([Int], [Int]), но мы json+хардкодинг.
Just todel ->
case (length todel == 2 ) of
True -> (liftIO $ do
e <- takeMVar e_ment
let lc = localGraph e
mrkrs = markers e
nodedel = todel !! 0
edgedel = todel !! 1
putMVar e_ment $ e {localGraph = delEdges' (delNodes' lc nodedel) edgedel}
--, markers =
) >> return ()
False -> return ()
Nothing -> return ()
| 920
|
handleDelete e_ment = do
body <- readRequestBody 100000
case (readMaybe (U.toString body) :: Maybe [[Int]] ) of --на самом деле тут должно быть хотябы ([Int], [Int]), но мы json+хардкодинг.
Just todel ->
case (length todel == 2 ) of
True -> (liftIO $ do
e <- takeMVar e_ment
let lc = localGraph e
mrkrs = markers e
nodedel = todel !! 0
edgedel = todel !! 1
putMVar e_ment $ e {localGraph = delEdges' (delNodes' lc nodedel) edgedel}
--, markers =
) >> return ()
False -> return ()
Nothing -> return ()
| 867
| false
| true
| 0
| 23
| 470
| 224
| 108
| 116
| null | null |
phischu/fragnix
|
benchmarks/containers/Data.Map.Strict.hs
|
bsd-3-clause
|
-- | /O(n)/. Map a function over all values in the map.
--
-- > let f key x = (show key) ++ ":" ++ x
-- > mapWithKey f (fromList [(5,"a"), (3,"b")]) == fromList [(3, "3:b"), (5, "5:a")]
mapWithKey :: (k -> a -> b) -> Map k a -> Map k b
mapWithKey _ Tip = Tip
| 259
|
mapWithKey :: (k -> a -> b) -> Map k a -> Map k b
mapWithKey _ Tip = Tip
| 72
|
mapWithKey _ Tip = Tip
| 22
| true
| true
| 0
| 9
| 59
| 54
| 27
| 27
| null | null |
rimmington/servant-pandoc
|
example.hs
|
mit
|
-- Build some extra information for the DELETE /greet/:greetid endpoint. We
-- want to add documentation about a secret unicorn header and some extra
-- notes.
extra :: ExtraInfo TestApi
extra =
extraInfo (Proxy :: Proxy ("greet" :> Capture "greetid" Text :> Delete '[JSON] Greet)) $
defAction & headers <>~ ["unicorns"]
& notes <>~ [ DocNote "Title" ["This is some text"]
, DocNote "Second secton" ["And some more"]
]
| 534
|
extra :: ExtraInfo TestApi
extra =
extraInfo (Proxy :: Proxy ("greet" :> Capture "greetid" Text :> Delete '[JSON] Greet)) $
defAction & headers <>~ ["unicorns"]
& notes <>~ [ DocNote "Title" ["This is some text"]
, DocNote "Second secton" ["And some more"]
]
| 374
|
extra =
extraInfo (Proxy :: Proxy ("greet" :> Capture "greetid" Text :> Delete '[JSON] Greet)) $
defAction & headers <>~ ["unicorns"]
& notes <>~ [ DocNote "Title" ["This is some text"]
, DocNote "Second secton" ["And some more"]
]
| 347
| true
| true
| 0
| 18
| 184
| 100
| 53
| 47
| null | null |
darthdeus/schedooler
|
src/Schedooler/Internal.hs
|
bsd-3-clause
|
start :: Schedule -> IO ()
start (Schedule t q) = do
mtid <- readTVarIO t
case mtid of
Just _ -> putStrLn "Already running"
Nothing -> do
tid <- forkIO (loop q)
atomically $ writeTVar t (Just tid)
| 245
|
start :: Schedule -> IO ()
start (Schedule t q) = do
mtid <- readTVarIO t
case mtid of
Just _ -> putStrLn "Already running"
Nothing -> do
tid <- forkIO (loop q)
atomically $ writeTVar t (Just tid)
| 245
|
start (Schedule t q) = do
mtid <- readTVarIO t
case mtid of
Just _ -> putStrLn "Already running"
Nothing -> do
tid <- forkIO (loop q)
atomically $ writeTVar t (Just tid)
| 218
| false
| true
| 0
| 15
| 87
| 100
| 45
| 55
| null | null |
bjorg/HPlug
|
uriparser.hs
|
mit
|
parseScheme :: Parser Text
parseScheme = do
schemeFirst <- A.satisfy isAlpha
schemeRest <- A.takeWhile isAlphaNum
_ <- string "://"
return $ schemeFirst `cons` schemeRest
| 186
|
parseScheme :: Parser Text
parseScheme = do
schemeFirst <- A.satisfy isAlpha
schemeRest <- A.takeWhile isAlphaNum
_ <- string "://"
return $ schemeFirst `cons` schemeRest
| 186
|
parseScheme = do
schemeFirst <- A.satisfy isAlpha
schemeRest <- A.takeWhile isAlphaNum
_ <- string "://"
return $ schemeFirst `cons` schemeRest
| 159
| false
| true
| 0
| 9
| 39
| 61
| 28
| 33
| null | null |
scott-fleischman/greek-grammar
|
haskell/greek-grammar/src/Data/Unicode/DecomposeChar.hs
|
mit
|
decomposeChar '\x1FE0' = "\x03C5\x0306"
| 39
|
decomposeChar '\x1FE0' = "\x03C5\x0306"
| 39
|
decomposeChar '\x1FE0' = "\x03C5\x0306"
| 39
| false
| false
| 0
| 4
| 3
| 10
| 4
| 6
| null | null |
MichelBoucey/glabrous
|
src/Text/Glabrous.hs
|
bsd-3-clause
|
deleteVariables :: [T.Text] -> Context -> Context
deleteVariables ts Context{..} =
go ts variables
where
go _ts vs =
case uncons _ts of
Just (k,ts') -> go ts' (H.delete k vs)
Nothing -> Context { variables = vs }
-- | Build a 'Context' from a list of 'Tag's and replacement 'T.Text's.
--
-- >λ>fromList [("tag","replacement"), ("etc.","...")]
-- >Context {variables = fromList [("etc.","..."),("tag","replacement")]}
--
| 455
|
deleteVariables :: [T.Text] -> Context -> Context
deleteVariables ts Context{..} =
go ts variables
where
go _ts vs =
case uncons _ts of
Just (k,ts') -> go ts' (H.delete k vs)
Nothing -> Context { variables = vs }
-- | Build a 'Context' from a list of 'Tag's and replacement 'T.Text's.
--
-- >λ>fromList [("tag","replacement"), ("etc.","...")]
-- >Context {variables = fromList [("etc.","..."),("tag","replacement")]}
--
| 455
|
deleteVariables ts Context{..} =
go ts variables
where
go _ts vs =
case uncons _ts of
Just (k,ts') -> go ts' (H.delete k vs)
Nothing -> Context { variables = vs }
-- | Build a 'Context' from a list of 'Tag's and replacement 'T.Text's.
--
-- >λ>fromList [("tag","replacement"), ("etc.","...")]
-- >Context {variables = fromList [("etc.","..."),("tag","replacement")]}
--
| 405
| false
| true
| 9
| 8
| 99
| 134
| 75
| 59
| null | null |
axch/dysvunctional-language
|
dvl/examples/mandelbrot/mandelbrot.ghc-2.hs
|
agpl-3.0
|
worker q w m n = forever (do
(coord, reply) <- readChan q
p <- mallocArray0 n
unfold (next_x w m n) p coord
putMVar reply p)
| 140
|
worker q w m n = forever (do
(coord, reply) <- readChan q
p <- mallocArray0 n
unfold (next_x w m n) p coord
putMVar reply p)
| 140
|
worker q w m n = forever (do
(coord, reply) <- readChan q
p <- mallocArray0 n
unfold (next_x w m n) p coord
putMVar reply p)
| 140
| false
| false
| 1
| 11
| 42
| 81
| 34
| 47
| null | null |
sdiehl/ghc
|
libraries/base/GHC/IO/Handle/Internals.hs
|
bsd-3-clause
|
flushWriteBuffer :: Handle__ -> IO ()
flushWriteBuffer h_@Handle__{..} = do
buf <- readIORef haByteBuffer
when (isWriteBuffer buf) $ flushByteWriteBuffer h_
| 160
|
flushWriteBuffer :: Handle__ -> IO ()
flushWriteBuffer h_@Handle__{..} = do
buf <- readIORef haByteBuffer
when (isWriteBuffer buf) $ flushByteWriteBuffer h_
| 160
|
flushWriteBuffer h_@Handle__{..} = do
buf <- readIORef haByteBuffer
when (isWriteBuffer buf) $ flushByteWriteBuffer h_
| 122
| false
| true
| 0
| 10
| 23
| 61
| 28
| 33
| null | null |
lukexi/game-pal
|
src/Graphics/VR/Pal/Hands.hs
|
bsd-3-clause
|
onRightHandEvent :: Monad m => VRPalEvent -> (HandEvent -> m ()) -> m ()
onRightHandEvent (VREvent (HandEvent RightHand handEvent)) f = f handEvent
| 147
|
onRightHandEvent :: Monad m => VRPalEvent -> (HandEvent -> m ()) -> m ()
onRightHandEvent (VREvent (HandEvent RightHand handEvent)) f = f handEvent
| 147
|
onRightHandEvent (VREvent (HandEvent RightHand handEvent)) f = f handEvent
| 74
| false
| true
| 0
| 13
| 22
| 69
| 32
| 37
| null | null |
bitemyapp/ganeti
|
src/Ganeti/Query/Instance.hs
|
bsd-2-clause
|
-- | The instance fields map.
fieldsMap :: FieldMap Instance Runtime
fieldsMap = fieldListToFieldMap aliasedFields
| 114
|
fieldsMap :: FieldMap Instance Runtime
fieldsMap = fieldListToFieldMap aliasedFields
| 84
|
fieldsMap = fieldListToFieldMap aliasedFields
| 45
| true
| true
| 0
| 6
| 14
| 26
| 11
| 15
| null | null |
ezyang/ghc
|
compiler/typecheck/TcRnTypes.hs
|
bsd-3-clause
|
topSpliceStage = Splice Untyped
| 31
|
topSpliceStage = Splice Untyped
| 31
|
topSpliceStage = Splice Untyped
| 31
| false
| false
| 0
| 5
| 3
| 9
| 4
| 5
| null | null |
GaloisInc/saw-script
|
saw-core-what4/src/Verifier/SAW/Simulator/What4/FirstOrder.hs
|
bsd-3-clause
|
fotToBaseType (FOTTuple fots)
| Just (Some assn) <- listToAssn fots
= Just (Some (BaseStructRepr assn))
| 107
|
fotToBaseType (FOTTuple fots)
| Just (Some assn) <- listToAssn fots
= Just (Some (BaseStructRepr assn))
| 107
|
fotToBaseType (FOTTuple fots)
| Just (Some assn) <- listToAssn fots
= Just (Some (BaseStructRepr assn))
| 107
| false
| false
| 0
| 11
| 18
| 52
| 23
| 29
| null | null |
bus000/Dikunt
|
src/Parsers/IRCMessageParser.hs
|
bsd-3-clause
|
quitMessage :: BotParser BT.ServerMessage
quitMessage = BT.ServerQuit <$> prefix nickUserHost <* P.string "QUIT " <*>
message
| 129
|
quitMessage :: BotParser BT.ServerMessage
quitMessage = BT.ServerQuit <$> prefix nickUserHost <* P.string "QUIT " <*>
message
| 129
|
quitMessage = BT.ServerQuit <$> prefix nickUserHost <* P.string "QUIT " <*>
message
| 87
| false
| true
| 0
| 8
| 19
| 38
| 18
| 20
| null | null |
GaloisInc/saw-script
|
heapster-saw/src/Verifier/SAW/Heapster/PermParser.hs
|
bsd-3-clause
|
-- | Parse a 'FunPerm' named by the first 'String' from the second 'String'.
-- The 'FunPerm' can either be standard Heapster syntax, which begins with an
-- open parenthesis (after optional whitespace), or it could be given in Rust
-- syntax, which begins with an angle bracket. The @w@ argument gives the bit
-- width of pointers in the current architecture.
parseFunPermStringMaybeRust ::
(1 <= w, KnownNat w, Fail.MonadFail m) =>
String {- ^ object name -} ->
prx w {- ^ pointer bit-width proxy -} ->
PermEnv {- ^ permission environment -} ->
CruCtx args {- ^ argument types -} ->
TypeRepr ret {- ^ return type -} ->
String {- ^ input text -} ->
m (SomeFunPerm args ret)
parseFunPermStringMaybeRust nm w env args ret str =
case find (\c -> c == '<' || c == '(') str of
Just '<' -> parseFunPermFromRust env w args ret str
_ -> parseFunPermString nm env args ret str
-- | Parse a 'SomeNamedShape' from the given 'String'. This 'SomeNamedShape'
-- must be a valid Rust @struct@ or @enum@ declaration given in Rust syntax.
-- The @w@ argument gives the bit width of pointers in the current\
-- architecture.
| 1,278
|
parseFunPermStringMaybeRust ::
(1 <= w, KnownNat w, Fail.MonadFail m) =>
String {- ^ object name -} ->
prx w {- ^ pointer bit-width proxy -} ->
PermEnv {- ^ permission environment -} ->
CruCtx args {- ^ argument types -} ->
TypeRepr ret {- ^ return type -} ->
String {- ^ input text -} ->
m (SomeFunPerm args ret)
parseFunPermStringMaybeRust nm w env args ret str =
case find (\c -> c == '<' || c == '(') str of
Just '<' -> parseFunPermFromRust env w args ret str
_ -> parseFunPermString nm env args ret str
-- | Parse a 'SomeNamedShape' from the given 'String'. This 'SomeNamedShape'
-- must be a valid Rust @struct@ or @enum@ declaration given in Rust syntax.
-- The @w@ argument gives the bit width of pointers in the current\
-- architecture.
| 917
|
parseFunPermStringMaybeRust nm w env args ret str =
case find (\c -> c == '<' || c == '(') str of
Just '<' -> parseFunPermFromRust env w args ret str
_ -> parseFunPermString nm env args ret str
-- | Parse a 'SomeNamedShape' from the given 'String'. This 'SomeNamedShape'
-- must be a valid Rust @struct@ or @enum@ declaration given in Rust syntax.
-- The @w@ argument gives the bit width of pointers in the current\
-- architecture.
| 443
| true
| true
| 3
| 11
| 370
| 172
| 92
| 80
| null | null |
frelindb/agsyHOL
|
PrintProof.hs
|
mit
|
prNTElimStep :: (a -> IO String) -> Int -> NTElimStep a -> IO String
prNTElimStep pr ctx p =
case p of
AndEl p -> do
p <- pr p
return $ "(And-El " ++ p ++ ")"
AndEr p -> do
p <- pr p
return $ "(And-Er " ++ p ++ ")"
ExistsE p -> do
p <- pr p
return $ "(Exists-E " ++ p ++ ")"
ImpliesE p1 p2 -> do
p1 <- prProof ctx p1
p2 <- pr p2
return $ "(Implies-E " ++ p1 ++ " " ++ p2 ++ ")"
ForallE f p -> do
f <- prForm ctx $ Meta f
p <- pr p
return $ "(Forall-E " ++ f ++ " " ++ p ++ ")"
InvBoolExtl p1 p2 -> do
p1 <- prProof ctx p1
p2 <- pr p2
return $ "(inv-bool-extl " ++ p1 ++ " " ++ p2 ++ ")"
InvBoolExtr p1 p2 -> do
p1 <- prProof ctx p1
p2 <- pr p2
return $ "(inv-bool-extr " ++ p1 ++ " " ++ p2 ++ ")"
InvFunExt f p -> do
f <- prForm ctx $ Meta f
p <- pr p
return $ "(inv-fun-ext " ++ f ++ " " ++ p ++ ")"
| 880
|
prNTElimStep :: (a -> IO String) -> Int -> NTElimStep a -> IO String
prNTElimStep pr ctx p =
case p of
AndEl p -> do
p <- pr p
return $ "(And-El " ++ p ++ ")"
AndEr p -> do
p <- pr p
return $ "(And-Er " ++ p ++ ")"
ExistsE p -> do
p <- pr p
return $ "(Exists-E " ++ p ++ ")"
ImpliesE p1 p2 -> do
p1 <- prProof ctx p1
p2 <- pr p2
return $ "(Implies-E " ++ p1 ++ " " ++ p2 ++ ")"
ForallE f p -> do
f <- prForm ctx $ Meta f
p <- pr p
return $ "(Forall-E " ++ f ++ " " ++ p ++ ")"
InvBoolExtl p1 p2 -> do
p1 <- prProof ctx p1
p2 <- pr p2
return $ "(inv-bool-extl " ++ p1 ++ " " ++ p2 ++ ")"
InvBoolExtr p1 p2 -> do
p1 <- prProof ctx p1
p2 <- pr p2
return $ "(inv-bool-extr " ++ p1 ++ " " ++ p2 ++ ")"
InvFunExt f p -> do
f <- prForm ctx $ Meta f
p <- pr p
return $ "(inv-fun-ext " ++ f ++ " " ++ p ++ ")"
| 880
|
prNTElimStep pr ctx p =
case p of
AndEl p -> do
p <- pr p
return $ "(And-El " ++ p ++ ")"
AndEr p -> do
p <- pr p
return $ "(And-Er " ++ p ++ ")"
ExistsE p -> do
p <- pr p
return $ "(Exists-E " ++ p ++ ")"
ImpliesE p1 p2 -> do
p1 <- prProof ctx p1
p2 <- pr p2
return $ "(Implies-E " ++ p1 ++ " " ++ p2 ++ ")"
ForallE f p -> do
f <- prForm ctx $ Meta f
p <- pr p
return $ "(Forall-E " ++ f ++ " " ++ p ++ ")"
InvBoolExtl p1 p2 -> do
p1 <- prProof ctx p1
p2 <- pr p2
return $ "(inv-bool-extl " ++ p1 ++ " " ++ p2 ++ ")"
InvBoolExtr p1 p2 -> do
p1 <- prProof ctx p1
p2 <- pr p2
return $ "(inv-bool-extr " ++ p1 ++ " " ++ p2 ++ ")"
InvFunExt f p -> do
f <- prForm ctx $ Meta f
p <- pr p
return $ "(inv-fun-ext " ++ f ++ " " ++ p ++ ")"
| 811
| false
| true
| 0
| 14
| 288
| 442
| 198
| 244
| null | null |
mdsteele/fallback
|
src/Fallback/State/Simple.hs
|
gpl-3.0
|
-- | Zero for all stats.
nullStats :: Stats
nullStats = TM.make (const 0)
| 73
|
nullStats :: Stats
nullStats = TM.make (const 0)
| 48
|
nullStats = TM.make (const 0)
| 29
| true
| true
| 0
| 7
| 13
| 23
| 12
| 11
| null | null |
rueshyna/gogol
|
gogol-apps-calendar/gen/Network/Google/AppsCalendar/Types/Product.hs
|
mpl-2.0
|
-- | Creates a value of 'ACLRule' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'arEtag'
--
-- * 'arKind'
--
-- * 'arRole'
--
-- * 'arScope'
--
-- * 'arId'
aclRule
:: ACLRule
aclRule =
ACLRule'
{ _arEtag = Nothing
, _arKind = "calendar#aclRule"
, _arRole = Nothing
, _arScope = Nothing
, _arId = Nothing
}
| 424
|
aclRule
:: ACLRule
aclRule =
ACLRule'
{ _arEtag = Nothing
, _arKind = "calendar#aclRule"
, _arRole = Nothing
, _arScope = Nothing
, _arId = Nothing
}
| 181
|
aclRule =
ACLRule'
{ _arEtag = Nothing
, _arKind = "calendar#aclRule"
, _arRole = Nothing
, _arScope = Nothing
, _arId = Nothing
}
| 158
| true
| true
| 1
| 7
| 108
| 63
| 41
| 22
| null | null |
Chouser/mal
|
haskell/Core.hs
|
mpl-2.0
|
run_1 _ _ = throwStr "function takes a single argument"
| 55
|
run_1 _ _ = throwStr "function takes a single argument"
| 55
|
run_1 _ _ = throwStr "function takes a single argument"
| 55
| false
| false
| 1
| 5
| 9
| 14
| 6
| 8
| null | null |
zinfra/khan
|
amazonka-limited/src/Network/AWS/Route53/Types.hs
|
mpl-2.0
|
-- | Helper to define Route53 namespaced XML elements.
route53Elem :: ByteString -> NName ByteString
route53Elem = mkNName route53NS
| 132
|
route53Elem :: ByteString -> NName ByteString
route53Elem = mkNName route53NS
| 77
|
route53Elem = mkNName route53NS
| 31
| true
| true
| 0
| 6
| 18
| 22
| 11
| 11
| null | null |
leshchevds/ganeti
|
src/Ganeti/Constants.hs
|
bsd-2-clause
|
diskValidAccessModes :: FrozenSet String
diskValidAccessModes =
ConstantUtils.mkSet $ map Types.diskAccessModeToRaw [minBound..]
| 130
|
diskValidAccessModes :: FrozenSet String
diskValidAccessModes =
ConstantUtils.mkSet $ map Types.diskAccessModeToRaw [minBound..]
| 130
|
diskValidAccessModes =
ConstantUtils.mkSet $ map Types.diskAccessModeToRaw [minBound..]
| 89
| false
| true
| 0
| 7
| 12
| 30
| 15
| 15
| null | null |
keera-studios/hsQt
|
Qtc/ClassTypes/Gui.hs
|
bsd-2-clause
|
qCast_QWhatsThisClickedEvent :: Object a -> IO (QWhatsThisClickedEvent ())
qCast_QWhatsThisClickedEvent _qobj
= return (objectCast _qobj)
| 139
|
qCast_QWhatsThisClickedEvent :: Object a -> IO (QWhatsThisClickedEvent ())
qCast_QWhatsThisClickedEvent _qobj
= return (objectCast _qobj)
| 139
|
qCast_QWhatsThisClickedEvent _qobj
= return (objectCast _qobj)
| 64
| false
| true
| 0
| 9
| 15
| 41
| 19
| 22
| null | null |
remusao/IDF
|
Math/IDF.hs
|
gpl-2.0
|
countAllWords i (d:t) m = countAllWords (i + 1) t $! countWords i d m
| 69
|
countAllWords i (d:t) m = countAllWords (i + 1) t $! countWords i d m
| 69
|
countAllWords i (d:t) m = countAllWords (i + 1) t $! countWords i d m
| 69
| false
| false
| 1
| 8
| 14
| 48
| 21
| 27
| null | null |
ChrisPenner/rasa
|
rasa-ext-vim/src/Rasa/Ext/Vim.hs
|
gpl-3.0
|
normal [Keypress 'K' []] = do
ranges <- getRanges
moveRangesByC (Coord (-1) 0)
overRanges (ranges ++)
| 107
|
normal [Keypress 'K' []] = do
ranges <- getRanges
moveRangesByC (Coord (-1) 0)
overRanges (ranges ++)
| 107
|
normal [Keypress 'K' []] = do
ranges <- getRanges
moveRangesByC (Coord (-1) 0)
overRanges (ranges ++)
| 107
| false
| false
| 0
| 11
| 21
| 55
| 26
| 29
| null | null |
ganeti-github-testing/ganeti-test-1
|
src/Ganeti/OpParams.hs
|
bsd-2-clause
|
pIAllocatorMemory :: Field
pIAllocatorMemory =
withDoc "IAllocator memory field" .
renameField "IAllocatorMem" .
optionalField $
simpleField "memory" [t| NonNegative Int |]
| 180
|
pIAllocatorMemory :: Field
pIAllocatorMemory =
withDoc "IAllocator memory field" .
renameField "IAllocatorMem" .
optionalField $
simpleField "memory" [t| NonNegative Int |]
| 180
|
pIAllocatorMemory =
withDoc "IAllocator memory field" .
renameField "IAllocatorMem" .
optionalField $
simpleField "memory" [t| NonNegative Int |]
| 153
| false
| true
| 2
| 6
| 28
| 46
| 21
| 25
| null | null |
skadinyo/conc
|
haskell/clojure.hs
|
epl-1.0
|
reduceI f ini xs = reduce f (ini:xs)
| 36
|
reduceI f ini xs = reduce f (ini:xs)
| 36
|
reduceI f ini xs = reduce f (ini:xs)
| 36
| false
| false
| 0
| 7
| 7
| 25
| 12
| 13
| null | null |
phischu/fragnix
|
builtins/base/GHC.Conc.Sync.hs
|
bsd-3-clause
|
{- |
Like 'forkIO', but lets you specify on which capability the thread
should run. Unlike a `forkIO` thread, a thread created by `forkOn`
will stay on the same capability for its entire lifetime (`forkIO`
threads can migrate between capabilities according to the scheduling
policy). `forkOn` is useful for overriding the scheduling policy when
you know in advance how best to distribute the threads.
The `Int` argument specifies a /capability number/ (see
'getNumCapabilities'). Typically capabilities correspond to physical
processors, but the exact behaviour is implementation-dependent. The
value passed to 'forkOn' is interpreted modulo the total number of
capabilities as returned by 'getNumCapabilities'.
GHC note: the number of capabilities is specified by the @+RTS -N@
option when the program is started. Capabilities can be fixed to
actual processor cores with @+RTS -qa@ if the underlying operating
system supports that, although in practice this is usually unnecessary
(and may actually degrade performance in some cases - experimentation
is recommended).
@since 4.4.0.0
-}
forkOn :: Int -> IO () -> IO ThreadId
forkOn (I# cpu) action = IO $ \ s ->
case (forkOn# cpu action_plus s) of (# s1, tid #) -> (# s1, ThreadId tid #)
where
action_plus = catchException action childHandler
-- | Like 'forkIOWithUnmask', but the child thread is pinned to the
-- given CPU, as with 'forkOn'.
--
-- @since 4.4.0.0
| 1,428
|
forkOn :: Int -> IO () -> IO ThreadId
forkOn (I# cpu) action = IO $ \ s ->
case (forkOn# cpu action_plus s) of (# s1, tid #) -> (# s1, ThreadId tid #)
where
action_plus = catchException action childHandler
-- | Like 'forkIOWithUnmask', but the child thread is pinned to the
-- given CPU, as with 'forkOn'.
--
-- @since 4.4.0.0
| 333
|
forkOn (I# cpu) action = IO $ \ s ->
case (forkOn# cpu action_plus s) of (# s1, tid #) -> (# s1, ThreadId tid #)
where
action_plus = catchException action childHandler
-- | Like 'forkIOWithUnmask', but the child thread is pinned to the
-- given CPU, as with 'forkOn'.
--
-- @since 4.4.0.0
| 295
| true
| true
| 0
| 11
| 237
| 98
| 51
| 47
| null | null |
brendanhay/gogol
|
gogol-youtube/gen/Network/Google/YouTube/Types/Product.hs
|
mpl-2.0
|
-- | Channel title for the channel that the subscription belongs to.
ssChannelTitle :: Lens' SubscriptionSnippet (Maybe Text)
ssChannelTitle
= lens _ssChannelTitle
(\ s a -> s{_ssChannelTitle = a})
| 205
|
ssChannelTitle :: Lens' SubscriptionSnippet (Maybe Text)
ssChannelTitle
= lens _ssChannelTitle
(\ s a -> s{_ssChannelTitle = a})
| 136
|
ssChannelTitle
= lens _ssChannelTitle
(\ s a -> s{_ssChannelTitle = a})
| 79
| true
| true
| 0
| 9
| 36
| 48
| 25
| 23
| null | null |
BartAdv/Idris-dev
|
src/IRTS/CodegenC.hs
|
bsd-3-clause
|
doOp v (LOr (ITFixed ty)) [x, y] = bitOp v "Or" ty [x, y]
| 57
|
doOp v (LOr (ITFixed ty)) [x, y] = bitOp v "Or" ty [x, y]
| 57
|
doOp v (LOr (ITFixed ty)) [x, y] = bitOp v "Or" ty [x, y]
| 57
| false
| false
| 0
| 9
| 13
| 46
| 24
| 22
| null | null |
jtojnar/haste-compiler
|
src/Haste/Linker.hs
|
bsd-3-clause
|
-- | Log a message to stdout if verbose reporting is on.
info :: String -> DepM ()
info s = do
st <- get
liftIO $ infoLogger st s
-- | Run a dependency resolution computation.
| 180
|
info :: String -> DepM ()
info s = do
st <- get
liftIO $ infoLogger st s
-- | Run a dependency resolution computation.
| 123
|
info s = do
st <- get
liftIO $ infoLogger st s
-- | Run a dependency resolution computation.
| 97
| true
| true
| 0
| 8
| 41
| 44
| 21
| 23
| null | null |
duckwork/dots
|
xmonad/lib/TermAppLauncher.hs
|
unlicense
|
tSpawn :: MonadIO m => Term -> TermArgs -> String -> m ()
tSpawn t ta x = xfork (executeFile t
True
(ta ++ ["-e", encodeString x])
Nothing
) >> return ()
| 280
|
tSpawn :: MonadIO m => Term -> TermArgs -> String -> m ()
tSpawn t ta x = xfork (executeFile t
True
(ta ++ ["-e", encodeString x])
Nothing
) >> return ()
| 280
|
tSpawn t ta x = xfork (executeFile t
True
(ta ++ ["-e", encodeString x])
Nothing
) >> return ()
| 222
| false
| true
| 0
| 12
| 158
| 82
| 40
| 42
| null | null |
juventietis/HLINQ
|
benchmark/Query.hs
|
mit
|
getCouples = withDB $ \db -> query db simpleSelection
| 53
|
getCouples = withDB $ \db -> query db simpleSelection
| 53
|
getCouples = withDB $ \db -> query db simpleSelection
| 53
| false
| false
| 0
| 7
| 8
| 20
| 10
| 10
| null | null |
ssaavedra/liquidhaskell
|
src/Language/Haskell/Liquid/Types/PredType.hs
|
bsd-3-clause
|
freeArgsPs _ (RExprArg _)
= []
| 32
|
freeArgsPs _ (RExprArg _)
= []
| 32
|
freeArgsPs _ (RExprArg _)
= []
| 32
| false
| false
| 1
| 6
| 7
| 22
| 9
| 13
| null | null |
ssoudan/hsCRDT
|
test/MonotonicCounterTest.hs
|
apache-2.0
|
testUpdatesMonotonicallyAdvance ::(KnownNat ix) => Fin ix -> MonotonicCounter ix -> CounterUpdate -> Bool
testUpdatesMonotonicallyAdvance _ s u = let s2 = update s u
in case s2 of Just s2' -> is s s2'
Nothing -> True
| 309
|
testUpdatesMonotonicallyAdvance ::(KnownNat ix) => Fin ix -> MonotonicCounter ix -> CounterUpdate -> Bool
testUpdatesMonotonicallyAdvance _ s u = let s2 = update s u
in case s2 of Just s2' -> is s s2'
Nothing -> True
| 309
|
testUpdatesMonotonicallyAdvance _ s u = let s2 = update s u
in case s2 of Just s2' -> is s s2'
Nothing -> True
| 203
| false
| true
| 0
| 10
| 129
| 91
| 41
| 50
| null | null |
DanielSchuessler/hstri
|
Triangulation/CanonOrdered.hs
|
gpl-3.0
|
polyprop_CanonicallyOrderable
:: (Eq ot, Show ot, CanonicallyOrderable t ot) =>
Proxy ot -> Triangulation -> Property
polyprop_CanonicallyOrderable (_ :: Proxy ot) tr =
forAllElements (allCanonicallyOrdered tr :: [CanonOrdered ot])
(isCanonicallyOrdered tr . unCanonOrdered)
| 293
|
polyprop_CanonicallyOrderable
:: (Eq ot, Show ot, CanonicallyOrderable t ot) =>
Proxy ot -> Triangulation -> Property
polyprop_CanonicallyOrderable (_ :: Proxy ot) tr =
forAllElements (allCanonicallyOrdered tr :: [CanonOrdered ot])
(isCanonicallyOrdered tr . unCanonOrdered)
| 293
|
polyprop_CanonicallyOrderable (_ :: Proxy ot) tr =
forAllElements (allCanonicallyOrdered tr :: [CanonOrdered ot])
(isCanonicallyOrdered tr . unCanonOrdered)
| 168
| false
| true
| 0
| 8
| 51
| 93
| 46
| 47
| null | null |
ideas-edu/ideas
|
src/Ideas/Utils/QuickCheck.hs
|
apache-2.0
|
rare = changeFrequency (1/5)
| 32
|
rare = changeFrequency (1/5)
| 32
|
rare = changeFrequency (1/5)
| 32
| false
| false
| 0
| 7
| 7
| 16
| 8
| 8
| null | null |
seppeljordan/geimskell
|
Geimskell.hs
|
gpl-3.0
|
v2ToVector :: V2 Number -> Vector
v2ToVector (L.V2 x y) = makeVector x y
| 72
|
v2ToVector :: V2 Number -> Vector
v2ToVector (L.V2 x y) = makeVector x y
| 72
|
v2ToVector (L.V2 x y) = makeVector x y
| 38
| false
| true
| 0
| 10
| 13
| 41
| 18
| 23
| null | null |
rueshyna/gogol
|
gogol-ml/gen/Network/Google/Resource/Ml/Projects/Models/Create.hs
|
mpl-2.0
|
-- | OAuth access token.
pmcAccessToken :: Lens' ProjectsModelsCreate (Maybe Text)
pmcAccessToken
= lens _pmcAccessToken
(\ s a -> s{_pmcAccessToken = a})
| 162
|
pmcAccessToken :: Lens' ProjectsModelsCreate (Maybe Text)
pmcAccessToken
= lens _pmcAccessToken
(\ s a -> s{_pmcAccessToken = a})
| 137
|
pmcAccessToken
= lens _pmcAccessToken
(\ s a -> s{_pmcAccessToken = a})
| 79
| true
| true
| 1
| 9
| 29
| 51
| 25
| 26
| null | null |
ssaavedra/liquidhaskell
|
src/Language/Haskell/Liquid/Types/RefType.hs
|
bsd-3-clause
|
toType (RAllS _ t)
= toType t
| 31
|
toType (RAllS _ t)
= toType t
| 31
|
toType (RAllS _ t)
= toType t
| 31
| false
| false
| 0
| 6
| 8
| 21
| 9
| 12
| null | null |
ideas-edu/ideas
|
src/Ideas/Service/BasicServices.hs
|
apache-2.0
|
setLocation :: Location -> Context a -> Context a
setLocation loc c0 = fromMaybe c0 (navigateTo loc c0)
| 104
|
setLocation :: Location -> Context a -> Context a
setLocation loc c0 = fromMaybe c0 (navigateTo loc c0)
| 103
|
setLocation loc c0 = fromMaybe c0 (navigateTo loc c0)
| 53
| false
| true
| 0
| 7
| 18
| 43
| 20
| 23
| null | null |
Denommus/stack
|
src/Options/Applicative/Builder/Extra.hs
|
bsd-3-clause
|
-- | Enable/disable flags for any type, without a default (to allow chaining @<|>@s)
enableDisableFlagsNoDefault :: a -> a -> String -> String -> Mod FlagFields a -> Parser a
enableDisableFlagsNoDefault enabledValue disabledValue name helpSuffix mods =
last <$> some (enableDisableFlagsNoDefault' enabledValue disabledValue name helpSuffix mods)
| 347
|
enableDisableFlagsNoDefault :: a -> a -> String -> String -> Mod FlagFields a -> Parser a
enableDisableFlagsNoDefault enabledValue disabledValue name helpSuffix mods =
last <$> some (enableDisableFlagsNoDefault' enabledValue disabledValue name helpSuffix mods)
| 262
|
enableDisableFlagsNoDefault enabledValue disabledValue name helpSuffix mods =
last <$> some (enableDisableFlagsNoDefault' enabledValue disabledValue name helpSuffix mods)
| 172
| true
| true
| 2
| 10
| 47
| 74
| 35
| 39
| null | null |
phischu/fragnix
|
tests/packages/scotty/System.Console.ANSI.Codes.hs
|
bsd-3-clause
|
cursorBackwardCode n = csi [n] "D"
| 34
|
cursorBackwardCode n = csi [n] "D"
| 34
|
cursorBackwardCode n = csi [n] "D"
| 34
| false
| false
| 0
| 6
| 5
| 17
| 8
| 9
| null | null |
awgn/ass
|
src/Ass/Compiler.hs
|
gpl-2.0
|
getCompilerVersion Gcc5 = "5"
| 32
|
getCompilerVersion Gcc5 = "5"
| 32
|
getCompilerVersion Gcc5 = "5"
| 32
| false
| false
| 0
| 4
| 6
| 10
| 4
| 6
| null | null |
parvmor/codeworld
|
codeworld-server/src/DataUtil.hs
|
apache-2.0
|
deployLink :: DeployId -> FilePath
deployLink (DeployId d) = let s = T.unpack d in take 3 s </> s
| 97
|
deployLink :: DeployId -> FilePath
deployLink (DeployId d) = let s = T.unpack d in take 3 s </> s
| 97
|
deployLink (DeployId d) = let s = T.unpack d in take 3 s </> s
| 62
| false
| true
| 0
| 10
| 19
| 49
| 23
| 26
| null | null |
BartAdv/idris-cil
|
test/IRTS/CodegenCilSpec.hs
|
bsd-3-clause
|
traceProcess :: String -> [String] -> IO ()
traceProcess exe args = do
(code, stdout, stderr) <- readProcessWithExitCode exe args ""
case code of
ExitFailure _ -> error $ exe ++ " error: " ++ stdout ++ stderr
_ -> return ()
| 247
|
traceProcess :: String -> [String] -> IO ()
traceProcess exe args = do
(code, stdout, stderr) <- readProcessWithExitCode exe args ""
case code of
ExitFailure _ -> error $ exe ++ " error: " ++ stdout ++ stderr
_ -> return ()
| 247
|
traceProcess exe args = do
(code, stdout, stderr) <- readProcessWithExitCode exe args ""
case code of
ExitFailure _ -> error $ exe ++ " error: " ++ stdout ++ stderr
_ -> return ()
| 203
| false
| true
| 0
| 13
| 65
| 98
| 48
| 50
| null | null |
emilaxelsson/ag-graph
|
src/Dag/Rename.hs
|
bsd-3-clause
|
getMemo :: MonadState (St v) m => m (Memo v)
getMemo = do
(_,_,memo) <- get
return memo
| 95
|
getMemo :: MonadState (St v) m => m (Memo v)
getMemo = do
(_,_,memo) <- get
return memo
| 95
|
getMemo = do
(_,_,memo) <- get
return memo
| 50
| false
| true
| 0
| 8
| 25
| 57
| 28
| 29
| null | null |
gatlin/psilo
|
src/Lib/Parser.hs
|
gpl-3.0
|
quantified :: Parser Type
quantified = do
skipSpace
string "forall"
skipSpace
vars <- parens (sym `sepBy` (many space))
skipSpace
t <- sigma
skipSpace
return $ TForall (fmap (\v -> TyVar (string_hash v) Star) vars) t
| 248
|
quantified :: Parser Type
quantified = do
skipSpace
string "forall"
skipSpace
vars <- parens (sym `sepBy` (many space))
skipSpace
t <- sigma
skipSpace
return $ TForall (fmap (\v -> TyVar (string_hash v) Star) vars) t
| 248
|
quantified = do
skipSpace
string "forall"
skipSpace
vars <- parens (sym `sepBy` (many space))
skipSpace
t <- sigma
skipSpace
return $ TForall (fmap (\v -> TyVar (string_hash v) Star) vars) t
| 222
| false
| true
| 0
| 15
| 66
| 103
| 48
| 55
| null | null |
siddhanathan/ghc
|
testsuite/tests/rename/should_compile/timing001.hs
|
bsd-3-clause
|
a293 = a294
| 11
|
a293 = a294
| 11
|
a293 = a294
| 11
| false
| false
| 1
| 5
| 2
| 10
| 3
| 7
| null | null |
mydaum/cabal
|
cabal-install/Distribution/Client/InstallSymlink.hs
|
bsd-3-clause
|
symlinkBinary :: FilePath -> FilePath -> UnqualComponentName -> String -> IO Bool
symlinkBinary _ _ _ _ = fail "Symlinking feature not available on Windows"
| 156
|
symlinkBinary :: FilePath -> FilePath -> UnqualComponentName -> String -> IO Bool
symlinkBinary _ _ _ _ = fail "Symlinking feature not available on Windows"
| 156
|
symlinkBinary _ _ _ _ = fail "Symlinking feature not available on Windows"
| 74
| false
| true
| 0
| 9
| 24
| 42
| 20
| 22
| null | null |
amerlyq/airy
|
xmonad/cfg/Navigation.hs
|
mit
|
tagActions = [ ("M-S-", tagMark), ("M-", tagFocus), ("M-C-", tagShift) ]
| 72
|
tagActions = [ ("M-S-", tagMark), ("M-", tagFocus), ("M-C-", tagShift) ]
| 72
|
tagActions = [ ("M-S-", tagMark), ("M-", tagFocus), ("M-C-", tagShift) ]
| 72
| false
| false
| 1
| 6
| 9
| 36
| 21
| 15
| null | null |
TachoMex/MiniSequel
|
src/MiniSequel/Expression.hs
|
mit
|
applyBooleanFunctor op a@SequelBoolOperation{} b@SequelRelationalOperation{} = SequelBoolOperation op a b
| 105
|
applyBooleanFunctor op a@SequelBoolOperation{} b@SequelRelationalOperation{} = SequelBoolOperation op a b
| 105
|
applyBooleanFunctor op a@SequelBoolOperation{} b@SequelRelationalOperation{} = SequelBoolOperation op a b
| 105
| false
| false
| 0
| 7
| 8
| 34
| 17
| 17
| null | null |
dolio/primitive
|
Data/Primitive/MachDeps.hs
|
bsd-3-clause
|
sIZEOF_INT8 = SIZEOF_INT8
| 25
|
sIZEOF_INT8 = SIZEOF_INT8
| 25
|
sIZEOF_INT8 = SIZEOF_INT8
| 25
| false
| false
| 0
| 4
| 2
| 6
| 3
| 3
| null | null |
PelleJuul/popl
|
src/Parser/Statement.hs
|
mit
|
-- STATEMENT --
semicolon :: Parser ()
semicolon = do
spaces
char ';'
spaces
return ()
| 95
|
semicolon :: Parser ()
semicolon = do
spaces
char ';'
spaces
return ()
| 78
|
semicolon = do
spaces
char ';'
spaces
return ()
| 55
| true
| true
| 0
| 8
| 24
| 37
| 16
| 21
| null | null |
AlexanderPankiv/ghc
|
compiler/utils/IOEnv.hs
|
bsd-3-clause
|
runIOEnv :: env -> IOEnv env a -> IO a
runIOEnv env (IOEnv m) = m env
| 69
|
runIOEnv :: env -> IOEnv env a -> IO a
runIOEnv env (IOEnv m) = m env
| 69
|
runIOEnv env (IOEnv m) = m env
| 30
| false
| true
| 0
| 7
| 16
| 41
| 19
| 22
| null | null |
Garygunn94/DFS
|
.stack-work/dist/x86_64-linux/Cabal-1.24.0.0/build/autogen/Paths_DFS.hs
|
bsd-3-clause
|
getSysconfDir = catchIO (getEnv "DFS_sysconfdir") (\_ -> return sysconfdir)
| 75
|
getSysconfDir = catchIO (getEnv "DFS_sysconfdir") (\_ -> return sysconfdir)
| 75
|
getSysconfDir = catchIO (getEnv "DFS_sysconfdir") (\_ -> return sysconfdir)
| 75
| false
| false
| 0
| 8
| 8
| 28
| 14
| 14
| null | null |
scott-fleischman/parsec
|
Text/Parsec/Prim.hs
|
bsd-2-clause
|
-- | An alias for modifyState for backwards compatibility.
updateState :: (Monad m) => (u -> u) -> ParsecT s u m ()
updateState = modifyState
| 142
|
updateState :: (Monad m) => (u -> u) -> ParsecT s u m ()
updateState = modifyState
| 82
|
updateState = modifyState
| 25
| true
| true
| 0
| 9
| 26
| 49
| 24
| 25
| null | null |
jqyu/bustle-chi
|
src/Bustle/Data/Post.hs
|
bsd-3-clause
|
fetchAll :: B.ByteString -> [BlockedFetch PostReq] -> Redis ()
fetchAll kp bfs = do
conts <- traverse (fetchReq kp) bfs
traverse_ (liftIO . resolveCont) conts
| 162
|
fetchAll :: B.ByteString -> [BlockedFetch PostReq] -> Redis ()
fetchAll kp bfs = do
conts <- traverse (fetchReq kp) bfs
traverse_ (liftIO . resolveCont) conts
| 162
|
fetchAll kp bfs = do
conts <- traverse (fetchReq kp) bfs
traverse_ (liftIO . resolveCont) conts
| 99
| false
| true
| 0
| 10
| 28
| 70
| 33
| 37
| null | null |
revnull/fixfile
|
src/Data/FixFile/Trie.hs
|
lgpl-3.0
|
-- | Iterate over a Trie for all of the 'ByteString' and value tuples for a
-- given 'ByteString' prefix.
iterateTrie :: Fixed g => BS.ByteString -> g (Trie v) -> [(BS.ByteString, v)]
iterateTrie a b = cata phi b a BS.empty [] where
phi (Value v) _ k' l = (k',v):l
phi (Tail vm) k k' l = maybe l (\va -> va k k' l) (guard (BS.null k) >> vm)
phi (String vm s ta) k k' l =
let (_, lt, rt) = splitKey k s
f l' = maybe l' (\va -> va k k' l') (guard (BS.null k) >> vm)
in if BS.null lt || BS.null rt
then f $ ta lt (BS.append k' s) l
else f l
phi (Small vm ts) k k' l =
let f l' = maybe l' (\va -> va k k' l') (guard (BS.null k) >> vm)
in case BS.uncons k of
Nothing -> ($ l) . (f .) . Prelude.foldr (.) id $ do
(i, r) <- ts
return $ r BS.empty (BS.snoc k' i)
Just (i, k'') -> case lookupAscending i ts of
Nothing -> l
Just r -> r k'' (BS.snoc k' i) l
phi (Big vm ts) k k' l =
let f l' = maybe l' (\va -> va k k' l') (guard (BS.null k) >> vm)
in case BS.uncons k of
Nothing -> ($ l) . (f .) . Prelude.foldr (.) id $ do
(i, Just r) <- assocs ts
return $ r BS.empty (BS.snoc k' i)
Just (i, k'') -> case guard (inRange (bounds ts) i) >> ts ! i of
Nothing -> l
Just r -> r k'' (BS.snoc k' i) l
phi (Mutable vm ts) k k' l =
let f l' = maybe l' (\va -> va k k' l') (guard (BS.null k) >> vm)
in case BS.uncons k of
Nothing -> ($ l) . (f .) . Prelude.foldr (.) id $ do
(i, r) <- M.toList ts
return $ r BS.empty (BS.snoc k' i)
Just (i, k'') -> case M.lookup i ts of
Nothing -> l
Just r -> r k'' (BS.snoc k' i) l
-- | 'Transaction' version of 'iterateTrie'.
| 1,938
|
iterateTrie :: Fixed g => BS.ByteString -> g (Trie v) -> [(BS.ByteString, v)]
iterateTrie a b = cata phi b a BS.empty [] where
phi (Value v) _ k' l = (k',v):l
phi (Tail vm) k k' l = maybe l (\va -> va k k' l) (guard (BS.null k) >> vm)
phi (String vm s ta) k k' l =
let (_, lt, rt) = splitKey k s
f l' = maybe l' (\va -> va k k' l') (guard (BS.null k) >> vm)
in if BS.null lt || BS.null rt
then f $ ta lt (BS.append k' s) l
else f l
phi (Small vm ts) k k' l =
let f l' = maybe l' (\va -> va k k' l') (guard (BS.null k) >> vm)
in case BS.uncons k of
Nothing -> ($ l) . (f .) . Prelude.foldr (.) id $ do
(i, r) <- ts
return $ r BS.empty (BS.snoc k' i)
Just (i, k'') -> case lookupAscending i ts of
Nothing -> l
Just r -> r k'' (BS.snoc k' i) l
phi (Big vm ts) k k' l =
let f l' = maybe l' (\va -> va k k' l') (guard (BS.null k) >> vm)
in case BS.uncons k of
Nothing -> ($ l) . (f .) . Prelude.foldr (.) id $ do
(i, Just r) <- assocs ts
return $ r BS.empty (BS.snoc k' i)
Just (i, k'') -> case guard (inRange (bounds ts) i) >> ts ! i of
Nothing -> l
Just r -> r k'' (BS.snoc k' i) l
phi (Mutable vm ts) k k' l =
let f l' = maybe l' (\va -> va k k' l') (guard (BS.null k) >> vm)
in case BS.uncons k of
Nothing -> ($ l) . (f .) . Prelude.foldr (.) id $ do
(i, r) <- M.toList ts
return $ r BS.empty (BS.snoc k' i)
Just (i, k'') -> case M.lookup i ts of
Nothing -> l
Just r -> r k'' (BS.snoc k' i) l
-- | 'Transaction' version of 'iterateTrie'.
| 1,832
|
iterateTrie a b = cata phi b a BS.empty [] where
phi (Value v) _ k' l = (k',v):l
phi (Tail vm) k k' l = maybe l (\va -> va k k' l) (guard (BS.null k) >> vm)
phi (String vm s ta) k k' l =
let (_, lt, rt) = splitKey k s
f l' = maybe l' (\va -> va k k' l') (guard (BS.null k) >> vm)
in if BS.null lt || BS.null rt
then f $ ta lt (BS.append k' s) l
else f l
phi (Small vm ts) k k' l =
let f l' = maybe l' (\va -> va k k' l') (guard (BS.null k) >> vm)
in case BS.uncons k of
Nothing -> ($ l) . (f .) . Prelude.foldr (.) id $ do
(i, r) <- ts
return $ r BS.empty (BS.snoc k' i)
Just (i, k'') -> case lookupAscending i ts of
Nothing -> l
Just r -> r k'' (BS.snoc k' i) l
phi (Big vm ts) k k' l =
let f l' = maybe l' (\va -> va k k' l') (guard (BS.null k) >> vm)
in case BS.uncons k of
Nothing -> ($ l) . (f .) . Prelude.foldr (.) id $ do
(i, Just r) <- assocs ts
return $ r BS.empty (BS.snoc k' i)
Just (i, k'') -> case guard (inRange (bounds ts) i) >> ts ! i of
Nothing -> l
Just r -> r k'' (BS.snoc k' i) l
phi (Mutable vm ts) k k' l =
let f l' = maybe l' (\va -> va k k' l') (guard (BS.null k) >> vm)
in case BS.uncons k of
Nothing -> ($ l) . (f .) . Prelude.foldr (.) id $ do
(i, r) <- M.toList ts
return $ r BS.empty (BS.snoc k' i)
Just (i, k'') -> case M.lookup i ts of
Nothing -> l
Just r -> r k'' (BS.snoc k' i) l
-- | 'Transaction' version of 'iterateTrie'.
| 1,754
| true
| true
| 3
| 17
| 759
| 1,006
| 488
| 518
| null | null |
gsdlab/clafer
|
src/Language/ClaferT.hs
|
mit
|
throwErr :: (Monad m, Throwable t) => t -> ClaferT m a
throwErr throw = throwErrs [throw]
| 89
|
throwErr :: (Monad m, Throwable t) => t -> ClaferT m a
throwErr throw = throwErrs [throw]
| 89
|
throwErr throw = throwErrs [throw]
| 34
| false
| true
| 0
| 8
| 16
| 48
| 23
| 25
| null | null |
eklavya/Idris-dev
|
src/Idris/Reflection.hs
|
bsd-3-clause
|
reifyInt :: Term -> ElabD Int
reifyInt (Constant (I i)) = return i
| 66
|
reifyInt :: Term -> ElabD Int
reifyInt (Constant (I i)) = return i
| 66
|
reifyInt (Constant (I i)) = return i
| 36
| false
| true
| 0
| 9
| 12
| 36
| 17
| 19
| null | null |
geekingfrog/advent-of-code
|
src/Y2017/Day05.hs
|
bsd-3-clause
|
initStack :: [a] -> (forall s . ST s (MV.MVector s a))
initStack jumps = do
let n = length jumps
js <- MV.new n
mapM_ (\(v, i) -> MV.write js i v) (zip jumps [0 ..])
pure js
| 189
|
initStack :: [a] -> (forall s . ST s (MV.MVector s a))
initStack jumps = do
let n = length jumps
js <- MV.new n
mapM_ (\(v, i) -> MV.write js i v) (zip jumps [0 ..])
pure js
| 189
|
initStack jumps = do
let n = length jumps
js <- MV.new n
mapM_ (\(v, i) -> MV.write js i v) (zip jumps [0 ..])
pure js
| 134
| false
| true
| 0
| 13
| 54
| 123
| 59
| 64
| null | null |
diku-dk/futhark
|
src/Futhark/IR/TypeCheck.hs
|
isc
|
checkCerts :: Checkable rep => Certs -> TypeM rep ()
checkCerts (Certs cs) = mapM_ (requireI [Prim Unit]) cs
| 108
|
checkCerts :: Checkable rep => Certs -> TypeM rep ()
checkCerts (Certs cs) = mapM_ (requireI [Prim Unit]) cs
| 108
|
checkCerts (Certs cs) = mapM_ (requireI [Prim Unit]) cs
| 55
| false
| true
| 0
| 9
| 18
| 59
| 27
| 32
| null | null |
tippenein/scrape_the_truth
|
HLint.hs
|
mit
|
-- error "generalize fmap" = map ==> fmap
-- AMP fallout
error "generalize mapM" = mapM ==> traverse
| 105
|
error "generalize mapM" = mapM ==> traverse
| 45
|
error "generalize mapM" = mapM ==> traverse
| 45
| true
| false
| 0
| 5
| 22
| 15
| 8
| 7
| null | null |
djfo/foobot
|
examples/count.hs
|
bsd-3-clause
|
main :: IO ()
main = do
args <- getArgs
case args of
token : _ -> runSlackbot token 0 count
_ -> do
progName <- getProgName
putStrLn $ "Usage: " ++ progName ++ " <token>"
| 194
|
main :: IO ()
main = do
args <- getArgs
case args of
token : _ -> runSlackbot token 0 count
_ -> do
progName <- getProgName
putStrLn $ "Usage: " ++ progName ++ " <token>"
| 194
|
main = do
args <- getArgs
case args of
token : _ -> runSlackbot token 0 count
_ -> do
progName <- getProgName
putStrLn $ "Usage: " ++ progName ++ " <token>"
| 180
| false
| true
| 0
| 14
| 59
| 75
| 35
| 40
| null | null |
holdenlee/fluidity
|
SeekWhence/formulas/MathParser.hs
|
mit
|
funTree :: Crumbs -> GenParser Char st Crumbs
funTree t =
do {
char '(';
(funTree (down t))
} <|>
do {
num <- many1 digit;
funTree (changeMe (Node (AInt $ read num) []) t)
} <|>
do {
str <- word;
case str of
'n':'_':num -> funTree (changeMe (Node (AVar $ read num) []) t)
_ -> (funTree (changeMe (Node (AStr str) []) t))
} <|>
do {
oneOf ", "; -- disallowed \n
(funTree (next t))
} <|>
do {
char ')';
(funTree (up t))
} <|>
do {
eof;
return t
}
| 532
|
funTree :: Crumbs -> GenParser Char st Crumbs
funTree t =
do {
char '(';
(funTree (down t))
} <|>
do {
num <- many1 digit;
funTree (changeMe (Node (AInt $ read num) []) t)
} <|>
do {
str <- word;
case str of
'n':'_':num -> funTree (changeMe (Node (AVar $ read num) []) t)
_ -> (funTree (changeMe (Node (AStr str) []) t))
} <|>
do {
oneOf ", "; -- disallowed \n
(funTree (next t))
} <|>
do {
char ')';
(funTree (up t))
} <|>
do {
eof;
return t
}
| 532
|
funTree t =
do {
char '(';
(funTree (down t))
} <|>
do {
num <- many1 digit;
funTree (changeMe (Node (AInt $ read num) []) t)
} <|>
do {
str <- word;
case str of
'n':'_':num -> funTree (changeMe (Node (AVar $ read num) []) t)
_ -> (funTree (changeMe (Node (AStr str) []) t))
} <|>
do {
oneOf ", "; -- disallowed \n
(funTree (next t))
} <|>
do {
char ')';
(funTree (up t))
} <|>
do {
eof;
return t
}
| 486
| false
| true
| 0
| 21
| 182
| 275
| 137
| 138
| null | null |
hsinhuang/codebase
|
h99/H4.hs
|
gpl-2.0
|
main = do
runTests
| 22
|
main = do
runTests
| 22
|
main = do
runTests
| 22
| false
| false
| 0
| 6
| 7
| 9
| 4
| 5
| null | null |
alexander-at-github/eta
|
compiler/ETA/Iface/FlagChecker.hs
|
bsd-3-clause
|
-- | Produce a fingerprint of a @DynFlags@ value. We only base
-- the finger print on important fields in @DynFlags@ so that
-- the recompilation checker can use this fingerprint.
fingerprintDynFlags :: DynFlags -> Module -> (BinHandle -> Name -> IO ())
-> IO Fingerprint
fingerprintDynFlags dflags@DynFlags{..} this_mod nameio =
let mainis = if mainModIs == this_mod then Just mainFunIs else Nothing
-- see #5878
-- pkgopts = (thisPackage dflags, sort $ packageFlags dflags)
safeHs = setSafeMode safeHaskell
-- oflags = sort $ filter filterOFlags $ flags dflags
-- *all* the extension flags and the language
lang = (fmap fromEnum language,
IntSet.toList $ extensionFlags)
-- -I, -D and -U flags affect CPP
cpp = (map normalise includePaths, opt_P dflags ++ picPOpts dflags)
-- normalise: eliminate spurious differences due to "./foo" vs "foo"
-- Note [path flags and recompilation]
paths = [ hcSuf ]
-- -fprof-auto etc.
prof = if gopt Opt_SccProfilingOn dflags then fromEnum profAuto else 0
in -- pprTrace "flags" (ppr (mainis, safeHs, lang, cpp, paths)) $
computeFingerprint nameio (mainis, safeHs, lang, cpp, paths, prof)
| 1,310
|
fingerprintDynFlags :: DynFlags -> Module -> (BinHandle -> Name -> IO ())
-> IO Fingerprint
fingerprintDynFlags dflags@DynFlags{..} this_mod nameio =
let mainis = if mainModIs == this_mod then Just mainFunIs else Nothing
-- see #5878
-- pkgopts = (thisPackage dflags, sort $ packageFlags dflags)
safeHs = setSafeMode safeHaskell
-- oflags = sort $ filter filterOFlags $ flags dflags
-- *all* the extension flags and the language
lang = (fmap fromEnum language,
IntSet.toList $ extensionFlags)
-- -I, -D and -U flags affect CPP
cpp = (map normalise includePaths, opt_P dflags ++ picPOpts dflags)
-- normalise: eliminate spurious differences due to "./foo" vs "foo"
-- Note [path flags and recompilation]
paths = [ hcSuf ]
-- -fprof-auto etc.
prof = if gopt Opt_SccProfilingOn dflags then fromEnum profAuto else 0
in -- pprTrace "flags" (ppr (mainis, safeHs, lang, cpp, paths)) $
computeFingerprint nameio (mainis, safeHs, lang, cpp, paths, prof)
| 1,129
|
fingerprintDynFlags dflags@DynFlags{..} this_mod nameio =
let mainis = if mainModIs == this_mod then Just mainFunIs else Nothing
-- see #5878
-- pkgopts = (thisPackage dflags, sort $ packageFlags dflags)
safeHs = setSafeMode safeHaskell
-- oflags = sort $ filter filterOFlags $ flags dflags
-- *all* the extension flags and the language
lang = (fmap fromEnum language,
IntSet.toList $ extensionFlags)
-- -I, -D and -U flags affect CPP
cpp = (map normalise includePaths, opt_P dflags ++ picPOpts dflags)
-- normalise: eliminate spurious differences due to "./foo" vs "foo"
-- Note [path flags and recompilation]
paths = [ hcSuf ]
-- -fprof-auto etc.
prof = if gopt Opt_SccProfilingOn dflags then fromEnum profAuto else 0
in -- pprTrace "flags" (ppr (mainis, safeHs, lang, cpp, paths)) $
computeFingerprint nameio (mainis, safeHs, lang, cpp, paths, prof)
| 1,017
| true
| true
| 12
| 9
| 362
| 205
| 115
| 90
| null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.