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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
mzini/TcT | source/Tct/Utils/Enum.hs | gpl-3.0 | mapEnum :: (e -> f) -> Enumeration e -> Enumeration f
f `mapEnum` l = [(n,f e) | (n,e) <- l] | 92 | mapEnum :: (e -> f) -> Enumeration e -> Enumeration f
f `mapEnum` l = [(n,f e) | (n,e) <- l] | 92 | f `mapEnum` l = [(n,f e) | (n,e) <- l] | 38 | false | true | 0 | 9 | 20 | 70 | 36 | 34 | null | null |
bitemyapp/ganeti | src/Ganeti/Constants.hs | bsd-2-clause | nvVglist :: String
nvVglist = "vglist" | 38 | nvVglist :: String
nvVglist = "vglist" | 38 | nvVglist = "vglist" | 19 | false | true | 0 | 6 | 5 | 18 | 7 | 11 | null | null |
bendyworks/haskbot-plugins | haskbot-core-0.2/src/Network/Haskbot/Types.hs | mit | prefixCom = '/' | 16 | prefixCom = '/' | 16 | prefixCom = '/' | 16 | false | false | 0 | 4 | 3 | 6 | 3 | 3 | null | null |
epost/psc-query | src/Lib.hs | bsd-3-clause | formatRulesProlog :: [Rule Text] -> Text
formatRulesProlog rules = intercalate "\n" (formatRule <$> rules)
where
formatRule (Rule head body) = formatAtomProlog head <> " :- " <> intercalate ", " (formatAtomProlog <$> body) <> "."
-- Datomic and Datascript formatters | 273 | formatRulesProlog :: [Rule Text] -> Text
formatRulesProlog rules = intercalate "\n" (formatRule <$> rules)
where
formatRule (Rule head body) = formatAtomProlog head <> " :- " <> intercalate ", " (formatAtomProlog <$> body) <> "."
-- Datomic and Datascript formatters | 273 | formatRulesProlog rules = intercalate "\n" (formatRule <$> rules)
where
formatRule (Rule head body) = formatAtomProlog head <> " :- " <> intercalate ", " (formatAtomProlog <$> body) <> "."
-- Datomic and Datascript formatters | 232 | false | true | 0 | 9 | 46 | 88 | 42 | 46 | null | null |
geekingfrog/advent-of-code | src/Y2015/Day05.hs | bsd-3-clause | pairWithNoOverlap s = (not . null) (filter (not . overlap) (allSamePairs s)) | 76 | pairWithNoOverlap s = (not . null) (filter (not . overlap) (allSamePairs s)) | 76 | pairWithNoOverlap s = (not . null) (filter (not . overlap) (allSamePairs s)) | 76 | false | false | 0 | 9 | 11 | 40 | 20 | 20 | null | null |
DavidAlphaFox/ghc | compiler/basicTypes/BasicTypes.hs | bsd-3-clause | -- Fixity of unary negate
funTyFixity = Fixity 0 InfixR | 56 | funTyFixity = Fixity 0 InfixR | 30 | funTyFixity = Fixity 0 InfixR | 30 | true | false | 0 | 5 | 10 | 12 | 6 | 6 | null | null |
DougBurke/swish | src/Swish/RDF/Vocabulary/OWL.hs | lgpl-2.1 | -- | @owl:versionInfo@.
owlversionInfo :: ScopedName
owlversionInfo = toO "versionInfo" | 87 | owlversionInfo :: ScopedName
owlversionInfo = toO "versionInfo" | 63 | owlversionInfo = toO "versionInfo" | 34 | true | true | 0 | 5 | 9 | 15 | 8 | 7 | null | null |
janschulz/pandoc | src/Text/Pandoc/Readers/Markdown.hs | gpl-2.0 | inline :: MarkdownParser (F Inlines)
inline = choice [ whitespace
, bareURL
, str
, endline
, code
, strongOrEmph
, note
, cite
, link
, image
, math
, strikeout
, subscript
, superscript
, inlineNote -- after superscript because of ^[link](/foo)^
, autoLink
, spanHtml
, rawHtmlInline
, escapedChar
, rawLaTeXInline'
, exampleRef
, smart
, return . B.singleton <$> charRef
, emoji
, symbol
, ltSign
] <?> "inline" | 831 | inline :: MarkdownParser (F Inlines)
inline = choice [ whitespace
, bareURL
, str
, endline
, code
, strongOrEmph
, note
, cite
, link
, image
, math
, strikeout
, subscript
, superscript
, inlineNote -- after superscript because of ^[link](/foo)^
, autoLink
, spanHtml
, rawHtmlInline
, escapedChar
, rawLaTeXInline'
, exampleRef
, smart
, return . B.singleton <$> charRef
, emoji
, symbol
, ltSign
] <?> "inline" | 831 | inline = choice [ whitespace
, bareURL
, str
, endline
, code
, strongOrEmph
, note
, cite
, link
, image
, math
, strikeout
, subscript
, superscript
, inlineNote -- after superscript because of ^[link](/foo)^
, autoLink
, spanHtml
, rawHtmlInline
, escapedChar
, rawLaTeXInline'
, exampleRef
, smart
, return . B.singleton <$> charRef
, emoji
, symbol
, ltSign
] <?> "inline" | 794 | false | true | 0 | 10 | 489 | 116 | 71 | 45 | null | null |
sapek/pandoc | src/Text/Pandoc/Pretty.hs | gpl-2.0 | realLength :: String -> Int
realLength = foldr (\a b -> charWidth a + b) 0 | 74 | realLength :: String -> Int
realLength = foldr (\a b -> charWidth a + b) 0 | 74 | realLength = foldr (\a b -> charWidth a + b) 0 | 46 | false | true | 0 | 9 | 15 | 37 | 19 | 18 | null | null |
Lifelovinglight/randomTools | arpSniffer.hs | gpl-3.0 | (>>+) :: (a -> (a1, b)) -> (a1 -> b -> c) -> a -> c
a >>+ b = a >>> uncurry b | 77 | (>>+) :: (a -> (a1, b)) -> (a1 -> b -> c) -> a -> c
a >>+ b = a >>> uncurry b | 77 | a >>+ b = a >>> uncurry b | 25 | false | true | 0 | 10 | 23 | 63 | 33 | 30 | null | null |
Thell/pandoc | src/Text/Pandoc/Writers/DokuWiki.hs | gpl-2.0 | backSlashLineBreaks :: String -> String
backSlashLineBreaks cs = reverse $ g $ reverse $ concatMap f cs
where f '\n' = "\\\\ "
f c = [c]
g (' ' : '\\':'\\': xs) = xs
g s = s
-- Auxiliary functions for tables: | 238 | backSlashLineBreaks :: String -> String
backSlashLineBreaks cs = reverse $ g $ reverse $ concatMap f cs
where f '\n' = "\\\\ "
f c = [c]
g (' ' : '\\':'\\': xs) = xs
g s = s
-- Auxiliary functions for tables: | 238 | backSlashLineBreaks cs = reverse $ g $ reverse $ concatMap f cs
where f '\n' = "\\\\ "
f c = [c]
g (' ' : '\\':'\\': xs) = xs
g s = s
-- Auxiliary functions for tables: | 198 | false | true | 3 | 8 | 73 | 85 | 43 | 42 | null | null |
markflorisson/hpack | testrepo/bytestring-0.10.2.0/Data/ByteString/Internal.hs | bsd-3-clause | -- short cut for empty strings
compareBytes (PS fp1 off1 len1) (PS fp2 off2 len2) =
inlinePerformIO $
withForeignPtr fp1 $ \p1 ->
withForeignPtr fp2 $ \p2 -> do
i <- memcmp (p1 `plusPtr` off1) (p2 `plusPtr` off2) (min len1 len2)
return $! case i `compare` 0 of
EQ -> len1 `compare` len2
x -> x | 368 | compareBytes (PS fp1 off1 len1) (PS fp2 off2 len2) =
inlinePerformIO $
withForeignPtr fp1 $ \p1 ->
withForeignPtr fp2 $ \p2 -> do
i <- memcmp (p1 `plusPtr` off1) (p2 `plusPtr` off2) (min len1 len2)
return $! case i `compare` 0 of
EQ -> len1 `compare` len2
x -> x | 337 | compareBytes (PS fp1 off1 len1) (PS fp2 off2 len2) =
inlinePerformIO $
withForeignPtr fp1 $ \p1 ->
withForeignPtr fp2 $ \p2 -> do
i <- memcmp (p1 `plusPtr` off1) (p2 `plusPtr` off2) (min len1 len2)
return $! case i `compare` 0 of
EQ -> len1 `compare` len2
x -> x | 337 | true | false | 7 | 13 | 130 | 144 | 71 | 73 | null | null |
Deewiant/haschoo | Haschoo/Evaluator/Standard/Numeric.hs | bsd-3-clause | liftScmNum2 f (ScmComplex a) (ScmInt b) = Right . ScmComplex$ f a (fInt b) | 78 | liftScmNum2 f (ScmComplex a) (ScmInt b) = Right . ScmComplex$ f a (fInt b) | 78 | liftScmNum2 f (ScmComplex a) (ScmInt b) = Right . ScmComplex$ f a (fInt b) | 78 | false | false | 0 | 8 | 17 | 45 | 21 | 24 | null | null |
Undeterminant/taffybar | src/System/Taffybar/DiskIOMonitor.hs | bsd-3-clause | probeDisk :: String -> IO [Double]
probeDisk disk = do
transfer <- getDiskTransfer disk
let top = foldr max 1.0 transfer
return $ map (/top) transfer | 155 | probeDisk :: String -> IO [Double]
probeDisk disk = do
transfer <- getDiskTransfer disk
let top = foldr max 1.0 transfer
return $ map (/top) transfer | 155 | probeDisk disk = do
transfer <- getDiskTransfer disk
let top = foldr max 1.0 transfer
return $ map (/top) transfer | 120 | false | true | 0 | 10 | 31 | 66 | 31 | 35 | null | null |
tokiwoousaka/takahashi | src/Control/Monad/Takahashi/HtmlBuilder.hs | mit | drawType2Style :: DrawType -> Style
drawType2Style dt = execMakeStyle defaultStyle (drawType2MakeStyle dt)
where
drawType2MakeStyle :: DrawType -> MakeStyle ()
drawType2MakeStyle SimpleDraw = return ()
drawType2MakeStyle HStretch = size.height .= Just (Per 90)
drawType2MakeStyle WStretch = size.width .= Just (Per 90)
drawType2MakeStyle Stretch = do
size.height .= Just (Per 90)
size.width .= Just (Per 90) | 442 | drawType2Style :: DrawType -> Style
drawType2Style dt = execMakeStyle defaultStyle (drawType2MakeStyle dt)
where
drawType2MakeStyle :: DrawType -> MakeStyle ()
drawType2MakeStyle SimpleDraw = return ()
drawType2MakeStyle HStretch = size.height .= Just (Per 90)
drawType2MakeStyle WStretch = size.width .= Just (Per 90)
drawType2MakeStyle Stretch = do
size.height .= Just (Per 90)
size.width .= Just (Per 90) | 442 | drawType2Style dt = execMakeStyle defaultStyle (drawType2MakeStyle dt)
where
drawType2MakeStyle :: DrawType -> MakeStyle ()
drawType2MakeStyle SimpleDraw = return ()
drawType2MakeStyle HStretch = size.height .= Just (Per 90)
drawType2MakeStyle WStretch = size.width .= Just (Per 90)
drawType2MakeStyle Stretch = do
size.height .= Just (Per 90)
size.width .= Just (Per 90) | 406 | false | true | 0 | 10 | 88 | 149 | 70 | 79 | null | null |
kim/amazonka | amazonka-autoscaling/gen/Network/AWS/AutoScaling/CreateLaunchConfiguration.hs | mpl-2.0 | -- | The IDs of one or more security groups for the VPC specified in 'ClassicLinkVPCId'. This parameter is required if 'ClassicLinkVPCId' is specified, and cannot be
-- used otherwise. For more information, see <http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/vpc-classiclink.html ClassicLink> in the /Amazon ElasticCompute Cloud User Guide/.
clcClassicLinkVPCSecurityGroups :: Lens' CreateLaunchConfiguration [Text]
clcClassicLinkVPCSecurityGroups =
lens _clcClassicLinkVPCSecurityGroups
(\s a -> s { _clcClassicLinkVPCSecurityGroups = a })
. _List | 576 | clcClassicLinkVPCSecurityGroups :: Lens' CreateLaunchConfiguration [Text]
clcClassicLinkVPCSecurityGroups =
lens _clcClassicLinkVPCSecurityGroups
(\s a -> s { _clcClassicLinkVPCSecurityGroups = a })
. _List | 230 | clcClassicLinkVPCSecurityGroups =
lens _clcClassicLinkVPCSecurityGroups
(\s a -> s { _clcClassicLinkVPCSecurityGroups = a })
. _List | 156 | true | true | 0 | 10 | 86 | 48 | 27 | 21 | null | null |
feliposz/learning-stuff | haskell/learn_chapter9.hs | mit | -- To compile a program: ghc --make helloworld
-- To execute it on the fly: runhaskell helloworld.hs
-- === Input and Output ===
helloworld = putStrLn "hello, world" | 167 | helloworld = putStrLn "hello, world" | 36 | helloworld = putStrLn "hello, world" | 36 | true | false | 0 | 5 | 29 | 12 | 7 | 5 | null | null |
snoyberg/yesodcms | Settings/StaticFiles.hs | bsd-2-clause | static = Static.static | 22 | static = Static.static | 22 | static = Static.static | 22 | false | false | 0 | 5 | 2 | 8 | 4 | 4 | null | null |
z0isch/aoc2016 | src/Day8.hs | bsd-3-clause | test1 :: String
test1="rect 3x2\nrotate column x=1 by 1\nrotate row y=0 by 4\nrotate column x=1 by 1" | 101 | test1 :: String
test1="rect 3x2\nrotate column x=1 by 1\nrotate row y=0 by 4\nrotate column x=1 by 1" | 101 | test1="rect 3x2\nrotate column x=1 by 1\nrotate row y=0 by 4\nrotate column x=1 by 1" | 85 | false | true | 0 | 6 | 16 | 18 | 7 | 11 | null | null |
ku-fpg/kansas-amber | System/Hardware/Haskino/Protocol.hs | bsd-3-clause | packageExpr (RemI32 e1 e2) = packageTwoSubExpr (exprCmdVal EXPR_INT32 EXPR_REM) e1 e2 | 85 | packageExpr (RemI32 e1 e2) = packageTwoSubExpr (exprCmdVal EXPR_INT32 EXPR_REM) e1 e2 | 85 | packageExpr (RemI32 e1 e2) = packageTwoSubExpr (exprCmdVal EXPR_INT32 EXPR_REM) e1 e2 | 85 | false | false | 0 | 7 | 10 | 32 | 15 | 17 | null | null |
kmate/HaRe | old/testing/unfoldDef/GuardIn1_AstOut.hs | bsd-3-clause | sq x
| x == 0 = 0
| otherwise = x ^ pow | 47 | sq x
| x == 0 = 0
| otherwise = x ^ pow | 47 | sq x
| x == 0 = 0
| otherwise = x ^ pow | 47 | false | false | 0 | 8 | 21 | 32 | 14 | 18 | null | null |
edwardwas/euler | shared/src/Shared.hs | mit | intSqrt :: Integral a => a -> a
intSqrt = floor . sqrt . fromIntegral | 69 | intSqrt :: Integral a => a -> a
intSqrt = floor . sqrt . fromIntegral | 69 | intSqrt = floor . sqrt . fromIntegral | 37 | false | true | 0 | 6 | 14 | 30 | 15 | 15 | null | null |
PeterBeard/project-euler | haskell/src/problem-009.hs | gpl-2.0 | main = putStrLn $ "The product of the triple where a + b + c = 1,000 is " ++ (show solution) | 92 | main = putStrLn $ "The product of the triple where a + b + c = 1,000 is " ++ (show solution) | 92 | main = putStrLn $ "The product of the triple where a + b + c = 1,000 is " ++ (show solution) | 92 | false | false | 3 | 8 | 21 | 25 | 10 | 15 | null | null |
forked-upstream-packages-for-ghcjs/ghc | compiler/nativeGen/PPC/Ppr.hs | bsd-3-clause | pprBasicBlock :: BlockEnv CmmStatics -> NatBasicBlock Instr -> SDoc
pprBasicBlock info_env (BasicBlock blockid instrs)
= maybe_infotable $$
pprLabel (mkAsmTempLabel (getUnique blockid)) $$
vcat (map pprInstr instrs)
where
maybe_infotable = case mapLookup blockid info_env of
Nothing -> empty
Just (Statics info_lbl info) ->
pprSectionHeader Text $$
vcat (map pprData info) $$
pprLabel info_lbl | 458 | pprBasicBlock :: BlockEnv CmmStatics -> NatBasicBlock Instr -> SDoc
pprBasicBlock info_env (BasicBlock blockid instrs)
= maybe_infotable $$
pprLabel (mkAsmTempLabel (getUnique blockid)) $$
vcat (map pprInstr instrs)
where
maybe_infotable = case mapLookup blockid info_env of
Nothing -> empty
Just (Statics info_lbl info) ->
pprSectionHeader Text $$
vcat (map pprData info) $$
pprLabel info_lbl | 458 | pprBasicBlock info_env (BasicBlock blockid instrs)
= maybe_infotable $$
pprLabel (mkAsmTempLabel (getUnique blockid)) $$
vcat (map pprInstr instrs)
where
maybe_infotable = case mapLookup blockid info_env of
Nothing -> empty
Just (Statics info_lbl info) ->
pprSectionHeader Text $$
vcat (map pprData info) $$
pprLabel info_lbl | 390 | false | true | 5 | 11 | 116 | 130 | 62 | 68 | null | null |
icetortoise/ftphs | src/Network/FTP/Server.hs | lgpl-2.1 | trapIOError :: FTPServer -> IO a -> (a -> IO Bool) -> IO Bool
trapIOError h testAction remainingAction =
do result <- tryIOError testAction
case result of
Left err -> do sendReply h 550 (show err)
return True
Right result -> remainingAction result | 300 | trapIOError :: FTPServer -> IO a -> (a -> IO Bool) -> IO Bool
trapIOError h testAction remainingAction =
do result <- tryIOError testAction
case result of
Left err -> do sendReply h 550 (show err)
return True
Right result -> remainingAction result | 300 | trapIOError h testAction remainingAction =
do result <- tryIOError testAction
case result of
Left err -> do sendReply h 550 (show err)
return True
Right result -> remainingAction result | 238 | false | true | 0 | 15 | 95 | 111 | 48 | 63 | null | null |
yigitozkavci/ivy | src/Cenary/Codegen/Register.hs | mit | storeRegVal :: (OpcodeM m, MemoryM m) => Register -> Integer -> m ()
storeRegVal reg val = push32 val >> storeReg reg | 117 | storeRegVal :: (OpcodeM m, MemoryM m) => Register -> Integer -> m ()
storeRegVal reg val = push32 val >> storeReg reg | 117 | storeRegVal reg val = push32 val >> storeReg reg | 48 | false | true | 0 | 9 | 21 | 54 | 26 | 28 | null | null |
Mikolaj/miniutter | NLP/Miniutter/English.hs | bsd-3-clause | personVerb _ "would" = "would" | 31 | personVerb _ "would" = "would" | 31 | personVerb _ "would" = "would" | 31 | false | false | 1 | 5 | 5 | 13 | 5 | 8 | null | null |
diminishedprime/.org | programmey_stuff/write_yourself_a_scheme/ch_07/wyas/app/Eval.hs | mit | liftThrows :: ThrowsError a -> IOThrowsError a
liftThrows (Left err) = throwError err | 85 | liftThrows :: ThrowsError a -> IOThrowsError a
liftThrows (Left err) = throwError err | 85 | liftThrows (Left err) = throwError err | 38 | false | true | 0 | 9 | 12 | 37 | 16 | 21 | null | null |
gcampax/ghc | compiler/coreSyn/CoreArity.hs | bsd-3-clause | -- There is always an explicit lambda
-- to justify the [OneShot], or the Arity
vanillaArityType :: ArityType
vanillaArityType = ATop [] | 142 | vanillaArityType :: ArityType
vanillaArityType = ATop [] | 56 | vanillaArityType = ATop [] | 26 | true | true | 0 | 6 | 27 | 25 | 11 | 14 | null | null |
rbtcollins/causes | Application.hs | apache-2.0 | -- | The @main@ function for an executable running this site.
appMain :: IO ()
appMain = do
-- Get the settings from all relevant sources
settings <- loadAppSettingsArgs
-- fall back to compile-time values, set to [] to require values at runtime
[configSettingsYmlValue]
-- allow environment variables to override
useEnv
-- Generate the foundation from the settings
foundation <- makeFoundation settings
-- Generate a WAI Application from the foundation
app <- makeApplication foundation
-- Run the application with Warp
runSettings (warpSettings foundation) app
--------------------------------------------------------------
-- Functions for DevelMain.hs (a way to run the app from GHCi)
-------------------------------------------------------------- | 821 | appMain :: IO ()
appMain = do
-- Get the settings from all relevant sources
settings <- loadAppSettingsArgs
-- fall back to compile-time values, set to [] to require values at runtime
[configSettingsYmlValue]
-- allow environment variables to override
useEnv
-- Generate the foundation from the settings
foundation <- makeFoundation settings
-- Generate a WAI Application from the foundation
app <- makeApplication foundation
-- Run the application with Warp
runSettings (warpSettings foundation) app
--------------------------------------------------------------
-- Functions for DevelMain.hs (a way to run the app from GHCi)
-------------------------------------------------------------- | 759 | appMain = do
-- Get the settings from all relevant sources
settings <- loadAppSettingsArgs
-- fall back to compile-time values, set to [] to require values at runtime
[configSettingsYmlValue]
-- allow environment variables to override
useEnv
-- Generate the foundation from the settings
foundation <- makeFoundation settings
-- Generate a WAI Application from the foundation
app <- makeApplication foundation
-- Run the application with Warp
runSettings (warpSettings foundation) app
--------------------------------------------------------------
-- Functions for DevelMain.hs (a way to run the app from GHCi)
-------------------------------------------------------------- | 742 | true | true | 0 | 9 | 167 | 75 | 39 | 36 | null | null |
nbrendler/hackerrank-exercises | balanced-brackets/Main.hs | mit | process :: [Char] -> Char -> [Char]
process ('{':xs) '}' = xs | 61 | process :: [Char] -> Char -> [Char]
process ('{':xs) '}' = xs | 61 | process ('{':xs) '}' = xs | 25 | false | true | 0 | 7 | 11 | 37 | 20 | 17 | null | null |
olsner/ghc | compiler/backpack/DriverBkp.hs | bsd-3-clause | renameHsUnits :: DynFlags -> PackageNameMap HsComponentId -> [LHsUnit PackageName] -> [LHsUnit HsComponentId]
renameHsUnits dflags m units = map (fmap renameHsUnit) units
where
renamePackageName :: PackageName -> HsComponentId
renamePackageName pn =
case Map.lookup pn m of
Nothing ->
case lookupPackageName dflags pn of
Nothing -> error "no package name"
Just cid -> HsComponentId pn cid
Just hscid -> hscid
renameHsUnit :: HsUnit PackageName -> HsUnit HsComponentId
renameHsUnit u =
HsUnit {
hsunitName = fmap renamePackageName (hsunitName u),
hsunitBody = map (fmap renameHsUnitDecl) (hsunitBody u)
}
renameHsUnitDecl :: HsUnitDecl PackageName -> HsUnitDecl HsComponentId
renameHsUnitDecl (DeclD a b c) = DeclD a b c
renameHsUnitDecl (IncludeD idecl) =
IncludeD IncludeDecl {
idUnitId = fmap renameHsUnitId (idUnitId idecl),
idModRenaming = idModRenaming idecl
}
renameHsUnitId :: HsUnitId PackageName -> HsUnitId HsComponentId
renameHsUnitId (HsUnitId ln subst)
= HsUnitId (fmap renamePackageName ln) (map (fmap renameHsModuleSubst) subst)
renameHsModuleSubst :: HsModuleSubst PackageName -> HsModuleSubst HsComponentId
renameHsModuleSubst (lk, lm)
= (lk, fmap renameHsModuleId lm)
renameHsModuleId :: HsModuleId PackageName -> HsModuleId HsComponentId
renameHsModuleId (HsModuleVar lm) = HsModuleVar lm
renameHsModuleId (HsModuleId luid lm) = HsModuleId (fmap renameHsUnitId luid) lm | 1,636 | renameHsUnits :: DynFlags -> PackageNameMap HsComponentId -> [LHsUnit PackageName] -> [LHsUnit HsComponentId]
renameHsUnits dflags m units = map (fmap renameHsUnit) units
where
renamePackageName :: PackageName -> HsComponentId
renamePackageName pn =
case Map.lookup pn m of
Nothing ->
case lookupPackageName dflags pn of
Nothing -> error "no package name"
Just cid -> HsComponentId pn cid
Just hscid -> hscid
renameHsUnit :: HsUnit PackageName -> HsUnit HsComponentId
renameHsUnit u =
HsUnit {
hsunitName = fmap renamePackageName (hsunitName u),
hsunitBody = map (fmap renameHsUnitDecl) (hsunitBody u)
}
renameHsUnitDecl :: HsUnitDecl PackageName -> HsUnitDecl HsComponentId
renameHsUnitDecl (DeclD a b c) = DeclD a b c
renameHsUnitDecl (IncludeD idecl) =
IncludeD IncludeDecl {
idUnitId = fmap renameHsUnitId (idUnitId idecl),
idModRenaming = idModRenaming idecl
}
renameHsUnitId :: HsUnitId PackageName -> HsUnitId HsComponentId
renameHsUnitId (HsUnitId ln subst)
= HsUnitId (fmap renamePackageName ln) (map (fmap renameHsModuleSubst) subst)
renameHsModuleSubst :: HsModuleSubst PackageName -> HsModuleSubst HsComponentId
renameHsModuleSubst (lk, lm)
= (lk, fmap renameHsModuleId lm)
renameHsModuleId :: HsModuleId PackageName -> HsModuleId HsComponentId
renameHsModuleId (HsModuleVar lm) = HsModuleVar lm
renameHsModuleId (HsModuleId luid lm) = HsModuleId (fmap renameHsUnitId luid) lm | 1,636 | renameHsUnits dflags m units = map (fmap renameHsUnit) units
where
renamePackageName :: PackageName -> HsComponentId
renamePackageName pn =
case Map.lookup pn m of
Nothing ->
case lookupPackageName dflags pn of
Nothing -> error "no package name"
Just cid -> HsComponentId pn cid
Just hscid -> hscid
renameHsUnit :: HsUnit PackageName -> HsUnit HsComponentId
renameHsUnit u =
HsUnit {
hsunitName = fmap renamePackageName (hsunitName u),
hsunitBody = map (fmap renameHsUnitDecl) (hsunitBody u)
}
renameHsUnitDecl :: HsUnitDecl PackageName -> HsUnitDecl HsComponentId
renameHsUnitDecl (DeclD a b c) = DeclD a b c
renameHsUnitDecl (IncludeD idecl) =
IncludeD IncludeDecl {
idUnitId = fmap renameHsUnitId (idUnitId idecl),
idModRenaming = idModRenaming idecl
}
renameHsUnitId :: HsUnitId PackageName -> HsUnitId HsComponentId
renameHsUnitId (HsUnitId ln subst)
= HsUnitId (fmap renamePackageName ln) (map (fmap renameHsModuleSubst) subst)
renameHsModuleSubst :: HsModuleSubst PackageName -> HsModuleSubst HsComponentId
renameHsModuleSubst (lk, lm)
= (lk, fmap renameHsModuleId lm)
renameHsModuleId :: HsModuleId PackageName -> HsModuleId HsComponentId
renameHsModuleId (HsModuleVar lm) = HsModuleVar lm
renameHsModuleId (HsModuleId luid lm) = HsModuleId (fmap renameHsUnitId luid) lm | 1,526 | false | true | 0 | 11 | 424 | 443 | 216 | 227 | null | null |
HJvT/hdirect | src/Parser.hs | bsd-3-clause | happySpecReduce_2 i fn 1# tk st sts stk
= happyFail 1# tk st sts stk | 73 | happySpecReduce_2 i fn 1# tk st sts stk
= happyFail 1# tk st sts stk | 73 | happySpecReduce_2 i fn 1# tk st sts stk
= happyFail 1# tk st sts stk | 73 | false | false | 0 | 5 | 19 | 32 | 15 | 17 | null | null |
jrclogic/SMCDEL | src/SMCDEL/Internal/Help.hs | gpl-2.0 | fusion (b:bs) = let
cs = filter (overlap b) bs
xs = mergeL (b:cs)
ds = filter (overlap xs) bs
in if cs == ds then xs : fusion (bs \\ cs) else fusion (xs : bs) | 172 | fusion (b:bs) = let
cs = filter (overlap b) bs
xs = mergeL (b:cs)
ds = filter (overlap xs) bs
in if cs == ds then xs : fusion (bs \\ cs) else fusion (xs : bs) | 172 | fusion (b:bs) = let
cs = filter (overlap b) bs
xs = mergeL (b:cs)
ds = filter (overlap xs) bs
in if cs == ds then xs : fusion (bs \\ cs) else fusion (xs : bs) | 172 | false | false | 0 | 11 | 50 | 105 | 53 | 52 | null | null |
jailson-dias/Arca | src/Main.hs | bsd-3-clause | randomMapa :: Int -> Int -> IORef ConfiguracaoNivel -> IO [[Int]]
randomMapa 0 l _ = return [] | 94 | randomMapa :: Int -> Int -> IORef ConfiguracaoNivel -> IO [[Int]]
randomMapa 0 l _ = return [] | 94 | randomMapa 0 l _ = return [] | 28 | false | true | 0 | 10 | 17 | 47 | 23 | 24 | null | null |
CGenie/platform | shared/src/Unison/ABT.hs | mit | cycle :: Term f v () -> Term f v ()
cycle = cycle' () | 53 | cycle :: Term f v () -> Term f v ()
cycle = cycle' () | 53 | cycle = cycle' () | 17 | false | true | 0 | 7 | 14 | 38 | 18 | 20 | null | null |
acowley/ghc | compiler/iface/IfaceType.hs | bsd-3-clause | eqIfaceCoercion _ _ _ = False | 29 | eqIfaceCoercion _ _ _ = False | 29 | eqIfaceCoercion _ _ _ = False | 29 | false | false | 0 | 5 | 5 | 13 | 6 | 7 | null | null |
brendanhay/gogol | gogol-cloudiot/gen/Network/Google/Resource/CloudIOT/Projects/Locations/Registries/Groups/Devices/ConfigVersions/List.hs | mpl-2.0 | -- | Creates a value of 'ProjectsLocationsRegistriesGroupsDevicesConfigVersionsList' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'plrgdcvlXgafv'
--
-- * 'plrgdcvlUploadProtocol'
--
-- * 'plrgdcvlAccessToken'
--
-- * 'plrgdcvlUploadType'
--
-- * 'plrgdcvlNumVersions'
--
-- * 'plrgdcvlName'
--
-- * 'plrgdcvlCallback'
projectsLocationsRegistriesGroupsDevicesConfigVersionsList
:: Text -- ^ 'plrgdcvlName'
-> ProjectsLocationsRegistriesGroupsDevicesConfigVersionsList
projectsLocationsRegistriesGroupsDevicesConfigVersionsList pPlrgdcvlName_ =
ProjectsLocationsRegistriesGroupsDevicesConfigVersionsList'
{ _plrgdcvlXgafv = Nothing
, _plrgdcvlUploadProtocol = Nothing
, _plrgdcvlAccessToken = Nothing
, _plrgdcvlUploadType = Nothing
, _plrgdcvlNumVersions = Nothing
, _plrgdcvlName = pPlrgdcvlName_
, _plrgdcvlCallback = Nothing
} | 958 | projectsLocationsRegistriesGroupsDevicesConfigVersionsList
:: Text -- ^ 'plrgdcvlName'
-> ProjectsLocationsRegistriesGroupsDevicesConfigVersionsList
projectsLocationsRegistriesGroupsDevicesConfigVersionsList pPlrgdcvlName_ =
ProjectsLocationsRegistriesGroupsDevicesConfigVersionsList'
{ _plrgdcvlXgafv = Nothing
, _plrgdcvlUploadProtocol = Nothing
, _plrgdcvlAccessToken = Nothing
, _plrgdcvlUploadType = Nothing
, _plrgdcvlNumVersions = Nothing
, _plrgdcvlName = pPlrgdcvlName_
, _plrgdcvlCallback = Nothing
} | 552 | projectsLocationsRegistriesGroupsDevicesConfigVersionsList pPlrgdcvlName_ =
ProjectsLocationsRegistriesGroupsDevicesConfigVersionsList'
{ _plrgdcvlXgafv = Nothing
, _plrgdcvlUploadProtocol = Nothing
, _plrgdcvlAccessToken = Nothing
, _plrgdcvlUploadType = Nothing
, _plrgdcvlNumVersions = Nothing
, _plrgdcvlName = pPlrgdcvlName_
, _plrgdcvlCallback = Nothing
} | 395 | true | true | 0 | 6 | 140 | 80 | 56 | 24 | null | null |
yigitozkavci/glow | src/Parser.hs | mit | charArray :: Parser Expr
charArray = CharArray <$> array singleChar
where singleChar :: Parser Char -- TODO: This is ugly, needs fix
singleChar = do
char '\''
c <- anyChar
char '\''
return c | 240 | charArray :: Parser Expr
charArray = CharArray <$> array singleChar
where singleChar :: Parser Char -- TODO: This is ugly, needs fix
singleChar = do
char '\''
c <- anyChar
char '\''
return c | 240 | charArray = CharArray <$> array singleChar
where singleChar :: Parser Char -- TODO: This is ugly, needs fix
singleChar = do
char '\''
c <- anyChar
char '\''
return c | 215 | false | true | 2 | 8 | 83 | 75 | 30 | 45 | null | null |
jwiegley/ghc-release | libraries/binary/src/Data/Binary/Get/Internal.hs | gpl-3.0 | -- | Skip ahead @n@ bytes. Fails if fewer than @n@ bytes are available.
skip :: Int -> Get ()
skip n = readN n (const ()) | 121 | skip :: Int -> Get ()
skip n = readN n (const ()) | 49 | skip n = readN n (const ()) | 27 | true | true | 0 | 8 | 26 | 37 | 18 | 19 | null | null |
input-output-hk/pos-haskell-prototype | auxx/src/Lang/Argument.hs | mit | lookupArgOpt ::
Name
-> [Arg Value]
-> (Maybe Value, [Arg Value])
lookupArgOpt name = \case
[] -> (Nothing, [])
ArgPos a : args -> (Just a, args)
arg@(ArgKw name' a) : args ->
if name == name'
then (Just a, args)
else over _2 (arg:) $ lookupArgOpt name args | 308 | lookupArgOpt ::
Name
-> [Arg Value]
-> (Maybe Value, [Arg Value])
lookupArgOpt name = \case
[] -> (Nothing, [])
ArgPos a : args -> (Just a, args)
arg@(ArgKw name' a) : args ->
if name == name'
then (Just a, args)
else over _2 (arg:) $ lookupArgOpt name args | 308 | lookupArgOpt name = \case
[] -> (Nothing, [])
ArgPos a : args -> (Just a, args)
arg@(ArgKw name' a) : args ->
if name == name'
then (Just a, args)
else over _2 (arg:) $ lookupArgOpt name args | 227 | false | true | 3 | 11 | 99 | 148 | 76 | 72 | null | null |
Cognimeta/cognimeta-utils | src/Cgm/Control/InFunctor.hs | apache-2.0 | injectionA' :: InjectionA f => f a b -> InjectionA' a b
injectionA' f = uncheckedInjectionA (apply f) (unapply f) | 113 | injectionA' :: InjectionA f => f a b -> InjectionA' a b
injectionA' f = uncheckedInjectionA (apply f) (unapply f) | 113 | injectionA' f = uncheckedInjectionA (apply f) (unapply f) | 57 | false | true | 0 | 8 | 19 | 56 | 25 | 31 | null | null |
olsner/ghc | compiler/codeGen/StgCmmMonad.hs | bsd-3-clause | setTickyCtrLabel :: CLabel -> FCode a -> FCode a
setTickyCtrLabel ticky code = do
info <- getInfoDown
withInfoDown code (info {cgd_ticky = ticky})
-- ----------------------------------------------------------------------------
-- Manage tick scopes
-- | The current tick scope. We will assign this to generated blocks. | 336 | setTickyCtrLabel :: CLabel -> FCode a -> FCode a
setTickyCtrLabel ticky code = do
info <- getInfoDown
withInfoDown code (info {cgd_ticky = ticky})
-- ----------------------------------------------------------------------------
-- Manage tick scopes
-- | The current tick scope. We will assign this to generated blocks. | 336 | setTickyCtrLabel ticky code = do
info <- getInfoDown
withInfoDown code (info {cgd_ticky = ticky})
-- ----------------------------------------------------------------------------
-- Manage tick scopes
-- | The current tick scope. We will assign this to generated blocks. | 287 | false | true | 0 | 11 | 59 | 64 | 31 | 33 | null | null |
nfjinjing/mps | src/MPS/Math/PermutationGroupExamples.hs | bsd-3-clause | -- this is the Fano plane, viewed as a Steiner Triple System on 7 points
alphaSTS7 = fromCycles [[1,2,3,4,5,6,7]] | 116 | alphaSTS7 = fromCycles [[1,2,3,4,5,6,7]] | 40 | alphaSTS7 = fromCycles [[1,2,3,4,5,6,7]] | 40 | true | false | 0 | 7 | 21 | 34 | 21 | 13 | null | null |
UCSD-PL/nano-js | Language/Nano/Liquid/Liquid.hs | bsd-3-clause | consStmt :: CGEnv -> Statement AnnType -> CGM (Maybe CGEnv)
--------------------------------------------------------------------------------
-- | @consStmt g s@ returns the environment extended with binders that are
-- due to the execution of statement s. @Nothing@ is returned if the
-- statement has (definitely) hit a `return` along the way.
-- skip
consStmt g (EmptyStmt _)
= return $ Just g | 401 | consStmt :: CGEnv -> Statement AnnType -> CGM (Maybe CGEnv)
consStmt g (EmptyStmt _)
= return $ Just g | 105 | consStmt g (EmptyStmt _)
= return $ Just g | 45 | true | true | 2 | 9 | 63 | 60 | 29 | 31 | null | null |
ddssff/lens | src/Control/Lens/Internal/ByteString.hs | bsd-3-clause | ifoldrBL8 :: (Int -> Char -> a -> a) -> a -> BL8.ByteString -> a
ifoldrBL8 f z xs = BL8.foldr (\ x g i -> i `seq` f i x (g (i+1))) (const z) xs 0 | 145 | ifoldrBL8 :: (Int -> Char -> a -> a) -> a -> BL8.ByteString -> a
ifoldrBL8 f z xs = BL8.foldr (\ x g i -> i `seq` f i x (g (i+1))) (const z) xs 0 | 145 | ifoldrBL8 f z xs = BL8.foldr (\ x g i -> i `seq` f i x (g (i+1))) (const z) xs 0 | 80 | false | true | 0 | 13 | 36 | 102 | 53 | 49 | null | null |
brendanhay/gogol | gogol-datafusion/gen/Network/Google/DataFusion/Types/Product.hs | mpl-2.0 | -- | Locations that could not be reached.
lirUnreachable :: Lens' ListInstancesResponse [Text]
lirUnreachable
= lens _lirUnreachable
(\ s a -> s{_lirUnreachable = a})
. _Default
. _Coerce | 207 | lirUnreachable :: Lens' ListInstancesResponse [Text]
lirUnreachable
= lens _lirUnreachable
(\ s a -> s{_lirUnreachable = a})
. _Default
. _Coerce | 165 | lirUnreachable
= lens _lirUnreachable
(\ s a -> s{_lirUnreachable = a})
. _Default
. _Coerce | 112 | true | true | 0 | 11 | 47 | 53 | 28 | 25 | null | null |
keera-studios/hsQt | Qtc/Enums/Gui/QPrinter.hs | bsd-2-clause | iePageSize :: Int -> PageSize
iePageSize x = QEnum (CPageSize x) | 64 | iePageSize :: Int -> PageSize
iePageSize x = QEnum (CPageSize x) | 64 | iePageSize x = QEnum (CPageSize x) | 34 | false | true | 0 | 7 | 10 | 32 | 14 | 18 | null | null |
gbaz/cabal | cabal-install/Distribution/Client/Dependency/Modular/Preference.hs | bsd-3-clause | processPackageConstraintP :: PP
-> ConflictSet QPN
-> I
-> LabeledPackageConstraint
-> Tree a
-> Tree a
processPackageConstraintP pp _ _ (LabeledPackageConstraint _ src) r
| src == ConstraintSourceUserTarget && not (primaryPP pp) = r | 373 | processPackageConstraintP :: PP
-> ConflictSet QPN
-> I
-> LabeledPackageConstraint
-> Tree a
-> Tree a
processPackageConstraintP pp _ _ (LabeledPackageConstraint _ src) r
| src == ConstraintSourceUserTarget && not (primaryPP pp) = r | 373 | processPackageConstraintP pp _ _ (LabeledPackageConstraint _ src) r
| src == ConstraintSourceUserTarget && not (primaryPP pp) = r | 139 | false | true | 0 | 11 | 173 | 82 | 38 | 44 | null | null |
edsko/cabal | Cabal/src/Distribution/Simple/LocalBuildInfo.hs | bsd-3-clause | -- |See 'InstallDirs.prefixRelativeInstallDirs'
prefixRelativeInstallDirs :: PackageId -> LocalBuildInfo
-> InstallDirs (Maybe FilePath)
prefixRelativeInstallDirs pkg_descr lbi =
InstallDirs.prefixRelativeInstallDirs
(packageId pkg_descr)
(localUnitId lbi)
(compilerInfo (compiler lbi))
(hostPlatform lbi)
(installDirTemplates lbi) | 379 | prefixRelativeInstallDirs :: PackageId -> LocalBuildInfo
-> InstallDirs (Maybe FilePath)
prefixRelativeInstallDirs pkg_descr lbi =
InstallDirs.prefixRelativeInstallDirs
(packageId pkg_descr)
(localUnitId lbi)
(compilerInfo (compiler lbi))
(hostPlatform lbi)
(installDirTemplates lbi) | 331 | prefixRelativeInstallDirs pkg_descr lbi =
InstallDirs.prefixRelativeInstallDirs
(packageId pkg_descr)
(localUnitId lbi)
(compilerInfo (compiler lbi))
(hostPlatform lbi)
(installDirTemplates lbi) | 216 | true | true | 0 | 9 | 75 | 87 | 41 | 46 | null | null |
kristoff3r/importify | HLint.hs | mit | warn = (case m of Right x -> f x; Left _ -> pure () ) ==> Universum.whenRight m f | 82 | warn = (case m of Right x -> f x; Left _ -> pure () ) ==> Universum.whenRight m f | 82 | warn = (case m of Right x -> f x; Left _ -> pure () ) ==> Universum.whenRight m f | 82 | false | false | 0 | 11 | 20 | 51 | 24 | 27 | null | null |
sdiehl/ghc | compiler/GHC/Stg/CSE.hs | bsd-3-clause | stgCseExpr _ (StgLam _ _)
= pprPanic "stgCseExp" (text "StgLam") | 68 | stgCseExpr _ (StgLam _ _)
= pprPanic "stgCseExp" (text "StgLam") | 68 | stgCseExpr _ (StgLam _ _)
= pprPanic "stgCseExp" (text "StgLam") | 68 | false | false | 1 | 7 | 13 | 34 | 14 | 20 | null | null |
joelburget/haste-compiler | src/Data/JSTarget/Optimize.hs | bsd-3-clause | tailLoopify :: Var -> Exp -> TravM Exp
tailLoopify f fun@(Fun mname args body) = do
tailrecs <- occurrences (not <$> isLambda) isTailRec body
if tailrecs > Never
then do
needToCopy <- createsClosures body
case needToCopy of
True -> do
let args' = map newName args
ret = Return (Lit $ LNull)
b <- mapJS (not <$> isLambda) pure (replaceByAssign ret args') body
let (AST nullRetLbl _) = lblFor NullRet
nn = newName f
nv = NewVar False nn
body' =
Forever $
Assign nv (Call 0 (Fast False) (Fun Nothing args b)
(map Var args')) $
Case (Var nn) (Return (Var nn)) [(Lit $ LNull, NullRet)] $
(Shared nullRetLbl)
putRef nullRetLbl NullRet
return $ Fun mname args' body'
False -> do
let c = Cont
body' <- mapJS (not <$> isLambda) pure (replaceByAssign c args) body
return $ Fun mname args (Forever body')
else do
return fun
where
isTailRec (Stm (Return (Call _ _ (Var f') _))) = f == f'
isTailRec _ = False
-- Only traverse until we find a closure
createsClosures = foldJS (\acc _ -> not acc) isClosure False
isClosure _ (Exp (Fun _ _ _)) = pure True
isClosure _ (Exp (Thunk _ _)) = pure True
isClosure acc _ = pure acc
-- Assign any changed vars, then loop.
replaceByAssign end as (Return (Call _ _ (Var f') as')) | f == f' = do
let (first, second) = foldr assignUnlessEqual (id, end) (zip as as')
return $ first second
replaceByAssign _ _ stm =
return stm
-- Assign an expression to a variable, unless that expression happens to
-- be the variable itself.
assignUnlessEqual (v, (Var v')) (next, final) | v == v' =
(next, final)
assignUnlessEqual (v, x) (next, final) | any (x `contains`) args =
(Assign (NewVar False (newName v)) x . next,
Assign (LhsExp (Var v)) (Var $ newName v) final)
| otherwise =
(Assign (LhsExp (Var v)) x . next, final)
newName (Internal (Name n mmod) _) =
Internal (Name (' ':n) mmod) ""
newName n =
n
contains (Var v) var = v == var
contains (Lit _) _ = False
contains (Not x) var = x `contains` var
contains (BinOp _ a b) var = a `contains` var || b `contains` var
contains (Fun _ _ _) _ = False
contains (Call _ _ f' xs) var = f' `contains` var||any (`contains` var) xs
contains (Index a i) var = a `contains` var || i `contains` var
contains (Arr xs) var = any (`contains` var) xs
contains (AssignEx l r) var = l `contains` var || r `contains` var
contains (IfEx c t e) var = any (`contains` var) [c,t,e]
contains (Eval x) var = x `contains` var
contains (Thunk _ _) _ = False | 3,084 | tailLoopify :: Var -> Exp -> TravM Exp
tailLoopify f fun@(Fun mname args body) = do
tailrecs <- occurrences (not <$> isLambda) isTailRec body
if tailrecs > Never
then do
needToCopy <- createsClosures body
case needToCopy of
True -> do
let args' = map newName args
ret = Return (Lit $ LNull)
b <- mapJS (not <$> isLambda) pure (replaceByAssign ret args') body
let (AST nullRetLbl _) = lblFor NullRet
nn = newName f
nv = NewVar False nn
body' =
Forever $
Assign nv (Call 0 (Fast False) (Fun Nothing args b)
(map Var args')) $
Case (Var nn) (Return (Var nn)) [(Lit $ LNull, NullRet)] $
(Shared nullRetLbl)
putRef nullRetLbl NullRet
return $ Fun mname args' body'
False -> do
let c = Cont
body' <- mapJS (not <$> isLambda) pure (replaceByAssign c args) body
return $ Fun mname args (Forever body')
else do
return fun
where
isTailRec (Stm (Return (Call _ _ (Var f') _))) = f == f'
isTailRec _ = False
-- Only traverse until we find a closure
createsClosures = foldJS (\acc _ -> not acc) isClosure False
isClosure _ (Exp (Fun _ _ _)) = pure True
isClosure _ (Exp (Thunk _ _)) = pure True
isClosure acc _ = pure acc
-- Assign any changed vars, then loop.
replaceByAssign end as (Return (Call _ _ (Var f') as')) | f == f' = do
let (first, second) = foldr assignUnlessEqual (id, end) (zip as as')
return $ first second
replaceByAssign _ _ stm =
return stm
-- Assign an expression to a variable, unless that expression happens to
-- be the variable itself.
assignUnlessEqual (v, (Var v')) (next, final) | v == v' =
(next, final)
assignUnlessEqual (v, x) (next, final) | any (x `contains`) args =
(Assign (NewVar False (newName v)) x . next,
Assign (LhsExp (Var v)) (Var $ newName v) final)
| otherwise =
(Assign (LhsExp (Var v)) x . next, final)
newName (Internal (Name n mmod) _) =
Internal (Name (' ':n) mmod) ""
newName n =
n
contains (Var v) var = v == var
contains (Lit _) _ = False
contains (Not x) var = x `contains` var
contains (BinOp _ a b) var = a `contains` var || b `contains` var
contains (Fun _ _ _) _ = False
contains (Call _ _ f' xs) var = f' `contains` var||any (`contains` var) xs
contains (Index a i) var = a `contains` var || i `contains` var
contains (Arr xs) var = any (`contains` var) xs
contains (AssignEx l r) var = l `contains` var || r `contains` var
contains (IfEx c t e) var = any (`contains` var) [c,t,e]
contains (Eval x) var = x `contains` var
contains (Thunk _ _) _ = False | 3,084 | tailLoopify f fun@(Fun mname args body) = do
tailrecs <- occurrences (not <$> isLambda) isTailRec body
if tailrecs > Never
then do
needToCopy <- createsClosures body
case needToCopy of
True -> do
let args' = map newName args
ret = Return (Lit $ LNull)
b <- mapJS (not <$> isLambda) pure (replaceByAssign ret args') body
let (AST nullRetLbl _) = lblFor NullRet
nn = newName f
nv = NewVar False nn
body' =
Forever $
Assign nv (Call 0 (Fast False) (Fun Nothing args b)
(map Var args')) $
Case (Var nn) (Return (Var nn)) [(Lit $ LNull, NullRet)] $
(Shared nullRetLbl)
putRef nullRetLbl NullRet
return $ Fun mname args' body'
False -> do
let c = Cont
body' <- mapJS (not <$> isLambda) pure (replaceByAssign c args) body
return $ Fun mname args (Forever body')
else do
return fun
where
isTailRec (Stm (Return (Call _ _ (Var f') _))) = f == f'
isTailRec _ = False
-- Only traverse until we find a closure
createsClosures = foldJS (\acc _ -> not acc) isClosure False
isClosure _ (Exp (Fun _ _ _)) = pure True
isClosure _ (Exp (Thunk _ _)) = pure True
isClosure acc _ = pure acc
-- Assign any changed vars, then loop.
replaceByAssign end as (Return (Call _ _ (Var f') as')) | f == f' = do
let (first, second) = foldr assignUnlessEqual (id, end) (zip as as')
return $ first second
replaceByAssign _ _ stm =
return stm
-- Assign an expression to a variable, unless that expression happens to
-- be the variable itself.
assignUnlessEqual (v, (Var v')) (next, final) | v == v' =
(next, final)
assignUnlessEqual (v, x) (next, final) | any (x `contains`) args =
(Assign (NewVar False (newName v)) x . next,
Assign (LhsExp (Var v)) (Var $ newName v) final)
| otherwise =
(Assign (LhsExp (Var v)) x . next, final)
newName (Internal (Name n mmod) _) =
Internal (Name (' ':n) mmod) ""
newName n =
n
contains (Var v) var = v == var
contains (Lit _) _ = False
contains (Not x) var = x `contains` var
contains (BinOp _ a b) var = a `contains` var || b `contains` var
contains (Fun _ _ _) _ = False
contains (Call _ _ f' xs) var = f' `contains` var||any (`contains` var) xs
contains (Index a i) var = a `contains` var || i `contains` var
contains (Arr xs) var = any (`contains` var) xs
contains (AssignEx l r) var = l `contains` var || r `contains` var
contains (IfEx c t e) var = any (`contains` var) [c,t,e]
contains (Eval x) var = x `contains` var
contains (Thunk _ _) _ = False | 3,045 | false | true | 0 | 25 | 1,145 | 1,214 | 617 | 597 | null | null |
rumblesan/proviz | src/Gfx/Context.hs | bsd-3-clause | empty :: GfxContext
empty = GfxContext { drawShape = \_ _ _ _ -> print "No GFX Context"
, rotate = \_ _ _ -> print "No GFX Context"
, scale = \_ _ _ -> print "No GFX Context"
, move = \_ _ _ -> print "No GFX Context"
, colourFill = \_ _ _ _ -> print "No GFX Context"
, noFill = print "No Gfx Context"
, textureFill = \_ _ -> print "No Gfx Context"
, colourStroke = \_ _ _ _ -> print "No GFX Context"
, noStroke = print "No Gfx Context"
, setMaterial = \_ -> print "No Gfx Context"
, setMaterialVar = \_ _ -> print "No Gfx Context"
, setBackground = \_ _ _ -> print "No Gfx Context"
, pushScope = print "No Gfx Context"
, popScope = print "No Gfx Context"
, setAnimationStyle = \_ -> print "No Gfx Context"
, setDepthChecking = \_ -> print "No Gfx Context"
, reset = print "No Gfx Context"
, renderCode = \_ -> print "No Gfx Context"
, renderCodeToBuffer = \_ -> print "No Gfx Context"
} | 1,397 | empty :: GfxContext
empty = GfxContext { drawShape = \_ _ _ _ -> print "No GFX Context"
, rotate = \_ _ _ -> print "No GFX Context"
, scale = \_ _ _ -> print "No GFX Context"
, move = \_ _ _ -> print "No GFX Context"
, colourFill = \_ _ _ _ -> print "No GFX Context"
, noFill = print "No Gfx Context"
, textureFill = \_ _ -> print "No Gfx Context"
, colourStroke = \_ _ _ _ -> print "No GFX Context"
, noStroke = print "No Gfx Context"
, setMaterial = \_ -> print "No Gfx Context"
, setMaterialVar = \_ _ -> print "No Gfx Context"
, setBackground = \_ _ _ -> print "No Gfx Context"
, pushScope = print "No Gfx Context"
, popScope = print "No Gfx Context"
, setAnimationStyle = \_ -> print "No Gfx Context"
, setDepthChecking = \_ -> print "No Gfx Context"
, reset = print "No Gfx Context"
, renderCode = \_ -> print "No Gfx Context"
, renderCodeToBuffer = \_ -> print "No Gfx Context"
} | 1,397 | empty = GfxContext { drawShape = \_ _ _ _ -> print "No GFX Context"
, rotate = \_ _ _ -> print "No GFX Context"
, scale = \_ _ _ -> print "No GFX Context"
, move = \_ _ _ -> print "No GFX Context"
, colourFill = \_ _ _ _ -> print "No GFX Context"
, noFill = print "No Gfx Context"
, textureFill = \_ _ -> print "No Gfx Context"
, colourStroke = \_ _ _ _ -> print "No GFX Context"
, noStroke = print "No Gfx Context"
, setMaterial = \_ -> print "No Gfx Context"
, setMaterialVar = \_ _ -> print "No Gfx Context"
, setBackground = \_ _ _ -> print "No Gfx Context"
, pushScope = print "No Gfx Context"
, popScope = print "No Gfx Context"
, setAnimationStyle = \_ -> print "No Gfx Context"
, setDepthChecking = \_ -> print "No Gfx Context"
, reset = print "No Gfx Context"
, renderCode = \_ -> print "No Gfx Context"
, renderCodeToBuffer = \_ -> print "No Gfx Context"
} | 1,377 | false | true | 0 | 8 | 697 | 292 | 163 | 129 | null | null |
capn-freako/lambda-ccc | src/LambdaCCC/Unused/CoreEncode.hs | bsd-3-clause | -- | Expression has only standard sub-terms (including itself).
allStandardE :: ReExpr
allStandardE = alltdE (passT (standardTyT . exprTypeT)) | 142 | allStandardE :: ReExpr
allStandardE = alltdE (passT (standardTyT . exprTypeT)) | 78 | allStandardE = alltdE (passT (standardTyT . exprTypeT)) | 55 | true | true | 0 | 9 | 18 | 28 | 15 | 13 | null | null |
zachsully/hakaru | haskell/Language/Hakaru/Parser/Parser.hs | bsd-3-clause | lam_expr :: Parser (AST' Text)
lam_expr =
reserved "fn"
*> (Lam
<$> identifier
<*> type_expr
<* reservedOp ":"
<*> expr
) | 171 | lam_expr :: Parser (AST' Text)
lam_expr =
reserved "fn"
*> (Lam
<$> identifier
<*> type_expr
<* reservedOp ":"
<*> expr
) | 171 | lam_expr =
reserved "fn"
*> (Lam
<$> identifier
<*> type_expr
<* reservedOp ":"
<*> expr
) | 140 | false | true | 4 | 10 | 70 | 58 | 25 | 33 | null | null |
rvion/lamdu | bottlelib/Graphics/UI/Bottle/EventMap.hs | gpl-3.0 | filterCharGroups ::
(Char -> Bool) ->
[CharGroupHandler a] ->
[CharGroupHandler a]
filterCharGroups f =
filter (not . Set.null . (^. cgChars)) .
(Lens.traversed . cgChars %~ Set.filter f) | 207 | filterCharGroups ::
(Char -> Bool) ->
[CharGroupHandler a] ->
[CharGroupHandler a]
filterCharGroups f =
filter (not . Set.null . (^. cgChars)) .
(Lens.traversed . cgChars %~ Set.filter f) | 207 | filterCharGroups f =
filter (not . Set.null . (^. cgChars)) .
(Lens.traversed . cgChars %~ Set.filter f) | 112 | false | true | 0 | 10 | 47 | 89 | 44 | 45 | null | null |
zerobuzz/hs-webdriver | src/Test/WebDriver/Commands/Wait.hs | bsd-3-clause | -- |throws 'ExpectFailed'. This is nice for writing your own abstractions.
unexpected :: MonadBaseControl IO m =>
String -- ^ Reason why the expected condition failed.
-> m a
unexpected = throwIO . ExpectFailed | 235 | unexpected :: MonadBaseControl IO m =>
String -- ^ Reason why the expected condition failed.
-> m a
unexpected = throwIO . ExpectFailed | 160 | unexpected = throwIO . ExpectFailed | 35 | true | true | 0 | 7 | 58 | 33 | 17 | 16 | null | null |
afronski/playground-fp | books/learn-you-a-haskell-for-great-good/for-a-few-monads-more/operations.hs | mit | powerset :: [ a ] -> [ [ a ] ]
powerset xs = filterM (\x -> [ True, False ]) xs | 79 | powerset :: [ a ] -> [ [ a ] ]
powerset xs = filterM (\x -> [ True, False ]) xs | 79 | powerset xs = filterM (\x -> [ True, False ]) xs | 48 | false | true | 0 | 9 | 21 | 52 | 27 | 25 | null | null |
input-output-hk/pos-haskell-prototype | binary/test/Test/Pos/Binary/BiSerialize.hs | mit | golden_TestSimpleIndexed3 :: Property
golden_TestSimpleIndexed3 = goldenTestBi ti "test/golden/TestSimpleIndexed3"
where
ti = TiPair (TiInteger (-515200628427138351744076))
(TiInt 4238472394723423) | 219 | golden_TestSimpleIndexed3 :: Property
golden_TestSimpleIndexed3 = goldenTestBi ti "test/golden/TestSimpleIndexed3"
where
ti = TiPair (TiInteger (-515200628427138351744076))
(TiInt 4238472394723423) | 219 | golden_TestSimpleIndexed3 = goldenTestBi ti "test/golden/TestSimpleIndexed3"
where
ti = TiPair (TiInteger (-515200628427138351744076))
(TiInt 4238472394723423) | 181 | false | true | 0 | 9 | 37 | 46 | 23 | 23 | null | null |
wuerges/vlsi_verification | test/TestKuelmann97.hs | bsd-3-clause | tests = TestList $ (map (makeTest True) filesCorrect) ++ (map (makeTest False) filesWrong) | 90 | tests = TestList $ (map (makeTest True) filesCorrect) ++ (map (makeTest False) filesWrong) | 90 | tests = TestList $ (map (makeTest True) filesCorrect) ++ (map (makeTest False) filesWrong) | 90 | false | false | 0 | 10 | 12 | 42 | 21 | 21 | null | null |
diku-dk/futhark | src/Futhark/Optimise/Simplify/Engine.hs | isc | simplifyBody ::
SimplifiableRep rep =>
BlockPred (Wise rep) ->
UT.UsageTable ->
[UT.Usages] ->
Body (Wise rep) ->
SimpleM rep (Stms (Wise rep), Body (Wise rep))
simplifyBody blocker usage res_usages (Body _ stms res) = do
(res', stms', hoisted) <-
blockIf blocker stms $ do
(res', res_usage) <- simplifyResult res_usages res
pure (res', res_usage <> usage)
body' <- constructBody stms' res'
pure (hoisted, body')
-- | Simplify a single body. | 476 | simplifyBody ::
SimplifiableRep rep =>
BlockPred (Wise rep) ->
UT.UsageTable ->
[UT.Usages] ->
Body (Wise rep) ->
SimpleM rep (Stms (Wise rep), Body (Wise rep))
simplifyBody blocker usage res_usages (Body _ stms res) = do
(res', stms', hoisted) <-
blockIf blocker stms $ do
(res', res_usage) <- simplifyResult res_usages res
pure (res', res_usage <> usage)
body' <- constructBody stms' res'
pure (hoisted, body')
-- | Simplify a single body. | 476 | simplifyBody blocker usage res_usages (Body _ stms res) = do
(res', stms', hoisted) <-
blockIf blocker stms $ do
(res', res_usage) <- simplifyResult res_usages res
pure (res', res_usage <> usage)
body' <- constructBody stms' res'
pure (hoisted, body')
-- | Simplify a single body. | 303 | false | true | 0 | 14 | 103 | 191 | 94 | 97 | null | null |
meteogrid/bindings-gdal | src/GDAL/Internal/Types.hs | bsd-3-clause | getInternalState :: GDAL s (GDALInternalState s)
getInternalState = GDALInternalState <$> GDAL ask | 98 | getInternalState :: GDAL s (GDALInternalState s)
getInternalState = GDALInternalState <$> GDAL ask | 98 | getInternalState = GDALInternalState <$> GDAL ask | 49 | false | true | 0 | 7 | 11 | 29 | 14 | 15 | null | null |
siddhanathan/ghc | libraries/base/Data/OldList.hs | bsd-3-clause | tails lst = build (\c n ->
let tailsGo xs = xs `c` case xs of
[] -> n
_ : xs' -> tailsGo xs'
in tailsGo lst) | 190 | tails lst = build (\c n ->
let tailsGo xs = xs `c` case xs of
[] -> n
_ : xs' -> tailsGo xs'
in tailsGo lst) | 190 | tails lst = build (\c n ->
let tailsGo xs = xs `c` case xs of
[] -> n
_ : xs' -> tailsGo xs'
in tailsGo lst) | 190 | false | false | 0 | 16 | 109 | 70 | 34 | 36 | null | null |
xmonad/xmonad-contrib | XMonad/Util/XUtils.hs | bsd-3-clause | hideWindows :: [Window] -> X ()
hideWindows = mapM_ hideWindow | 62 | hideWindows :: [Window] -> X ()
hideWindows = mapM_ hideWindow | 62 | hideWindows = mapM_ hideWindow | 30 | false | true | 0 | 7 | 9 | 26 | 13 | 13 | null | null |
acamino/state-codes | src/Data/StateCodes/ISO31662US.hs | mit | toName UT = "Utah" | 18 | toName UT = "Utah" | 18 | toName UT = "Utah" | 18 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
hepek/ErrorProp | src/Math/Symbolic.hs | gpl-2.0 | s a = a | 7 | s a = a | 7 | s a = a | 7 | false | false | 1 | 5 | 3 | 13 | 4 | 9 | null | null |
supki/liblastfm | src/Lastfm/Library.hs | mit | -- | Remove an artist from a user's Last.fm library
--
-- <http://www.last.fm/api/show/library.removeArtist>
removeArtist :: Request f (Artist -> APIKey -> SessionKey -> Sign)
removeArtist = api "library.removeArtist" <* post | 225 | removeArtist :: Request f (Artist -> APIKey -> SessionKey -> Sign)
removeArtist = api "library.removeArtist" <* post | 116 | removeArtist = api "library.removeArtist" <* post | 49 | true | true | 0 | 9 | 29 | 41 | 22 | 19 | null | null |
jefdaj/todotree | src/TodoTree/Parse.hs | gpl-3.0 | isTag [_] = False | 17 | isTag [_] = False | 17 | isTag [_] = False | 17 | false | false | 0 | 6 | 3 | 12 | 6 | 6 | null | null |
mightymoose/liquidhaskell | benchmarks/unordered-containers-0.2.1.0/Data/HashSet.hs | bsd-3-clause | -- | /O(1)/ Construct a set with a single element.
singleton :: Hashable a => a -> HashSet a
singleton a = HashSet (H.singleton a ()) | 133 | singleton :: Hashable a => a -> HashSet a
singleton a = HashSet (H.singleton a ()) | 82 | singleton a = HashSet (H.singleton a ()) | 40 | true | true | 0 | 8 | 25 | 49 | 22 | 27 | null | null |
GaloisInc/network-hans | src/Network/Socket.hs | bsd-3-clause | getAddrInfo mai Nothing msn =
getAddrInfo mai (Just "127.0.0.1") msn | 70 | getAddrInfo mai Nothing msn =
getAddrInfo mai (Just "127.0.0.1") msn | 70 | getAddrInfo mai Nothing msn =
getAddrInfo mai (Just "127.0.0.1") msn | 70 | false | false | 0 | 7 | 11 | 26 | 12 | 14 | null | null |
shouya/thinking-dumps | wys48h/code/Primitive.hs | mit | substring args@[String str, Number s, Number e]
| e <= (fromIntegral $ length str) && s <= e && 0 <= s =
return $ String $ drop (fromIntegral s) $ take (fromIntegral (e-s)) str
| otherwise = throwError $
BadSpecialForm "0 <= s <= e <= len(str)" (List args) | 281 | substring args@[String str, Number s, Number e]
| e <= (fromIntegral $ length str) && s <= e && 0 <= s =
return $ String $ drop (fromIntegral s) $ take (fromIntegral (e-s)) str
| otherwise = throwError $
BadSpecialForm "0 <= s <= e <= len(str)" (List args) | 281 | substring args@[String str, Number s, Number e]
| e <= (fromIntegral $ length str) && s <= e && 0 <= s =
return $ String $ drop (fromIntegral s) $ take (fromIntegral (e-s)) str
| otherwise = throwError $
BadSpecialForm "0 <= s <= e <= len(str)" (List args) | 281 | false | false | 8 | 15 | 74 | 141 | 64 | 77 | null | null |
Fizzixnerd/silveretta-hs | exp/Indents.hs | gpl-3.0 | identifier = T.identifier tok | 29 | identifier = T.identifier tok | 29 | identifier = T.identifier tok | 29 | false | false | 0 | 6 | 3 | 11 | 5 | 6 | null | null |
gokhankici/symmetry | checker/tests/pos/Worker00.hs | mit | continue :: DSL repr => repr (() :+: ())
continue = inl tt | 60 | continue :: DSL repr => repr (() :+: ())
continue = inl tt | 58 | continue = inl tt | 17 | false | true | 0 | 9 | 14 | 35 | 17 | 18 | null | null |
google/codeworld | codeworld-server/src/Main.hs | apache-2.0 | logHandler :: CodeWorldHandler
logHandler = public $ \ctx -> do
Just message <- fmap T.decodeUtf8 <$> getParam "message"
title <-
fromMaybe "User-reported unhelpful error message"
<$> fmap T.decodeUtf8
<$> getParam "title"
tag <- fromMaybe "error-message" <$> fmap T.decodeUtf8 <$> getParam "tag"
liftIO $ do
let body =
object
[ ("title", String title),
("body", String message),
("labels", toJSON [tag])
]
authToken <- B.readFile "github-auth-token.txt"
let authHeader = "token " <> authToken
let userAgent = "https://code.world github integration by cdsmith"
request <-
addRequestHeader "Authorization" authHeader
<$> addRequestHeader "User-agent" userAgent
<$> setRequestBodyJSON body
<$> parseRequestThrow "POST https://api.github.com/repos/google/codeworld/issues"
httpNoBody request
return () | 941 | logHandler :: CodeWorldHandler
logHandler = public $ \ctx -> do
Just message <- fmap T.decodeUtf8 <$> getParam "message"
title <-
fromMaybe "User-reported unhelpful error message"
<$> fmap T.decodeUtf8
<$> getParam "title"
tag <- fromMaybe "error-message" <$> fmap T.decodeUtf8 <$> getParam "tag"
liftIO $ do
let body =
object
[ ("title", String title),
("body", String message),
("labels", toJSON [tag])
]
authToken <- B.readFile "github-auth-token.txt"
let authHeader = "token " <> authToken
let userAgent = "https://code.world github integration by cdsmith"
request <-
addRequestHeader "Authorization" authHeader
<$> addRequestHeader "User-agent" userAgent
<$> setRequestBodyJSON body
<$> parseRequestThrow "POST https://api.github.com/repos/google/codeworld/issues"
httpNoBody request
return () | 941 | logHandler = public $ \ctx -> do
Just message <- fmap T.decodeUtf8 <$> getParam "message"
title <-
fromMaybe "User-reported unhelpful error message"
<$> fmap T.decodeUtf8
<$> getParam "title"
tag <- fromMaybe "error-message" <$> fmap T.decodeUtf8 <$> getParam "tag"
liftIO $ do
let body =
object
[ ("title", String title),
("body", String message),
("labels", toJSON [tag])
]
authToken <- B.readFile "github-auth-token.txt"
let authHeader = "token " <> authToken
let userAgent = "https://code.world github integration by cdsmith"
request <-
addRequestHeader "Authorization" authHeader
<$> addRequestHeader "User-agent" userAgent
<$> setRequestBodyJSON body
<$> parseRequestThrow "POST https://api.github.com/repos/google/codeworld/issues"
httpNoBody request
return () | 910 | false | true | 2 | 19 | 240 | 243 | 109 | 134 | null | null |
Teaspot-Studio/Urho3D-Haskell | src/Graphics/Urho3D/Input/InputConstants.hs | mit | scancodeKpD :: Int
scancodeKpD = fromIntegral $ [C.pure| int {SCANCODE_KP_D} |] | 79 | scancodeKpD :: Int
scancodeKpD = fromIntegral $ [C.pure| int {SCANCODE_KP_D} |] | 79 | scancodeKpD = fromIntegral $ [C.pure| int {SCANCODE_KP_D} |] | 60 | false | true | 0 | 6 | 10 | 21 | 13 | 8 | null | null |
Baranowski/SourceGraph | Analyse/GraphRepr.hs | gpl-3.0 | onlyNormalCalls' :: GraphData Entity (Int, CallType)
-> GraphData Entity (Int, CallType)
onlyNormalCalls' = updateGraph go
where
go = elfilter (isNormalCall . snd) | 189 | onlyNormalCalls' :: GraphData Entity (Int, CallType)
-> GraphData Entity (Int, CallType)
onlyNormalCalls' = updateGraph go
where
go = elfilter (isNormalCall . snd) | 189 | onlyNormalCalls' = updateGraph go
where
go = elfilter (isNormalCall . snd) | 80 | false | true | 0 | 7 | 47 | 58 | 30 | 28 | null | null |
brendanhay/gogol | gogol-cloudsearch/gen/Network/Google/Resource/CloudSearch/Stats/GetUser.hs | mpl-2.0 | -- | Year of date. Must be from 1 to 9999.
sguFromDateYear :: Lens' StatsGetUser (Maybe Int32)
sguFromDateYear
= lens _sguFromDateYear
(\ s a -> s{_sguFromDateYear = a})
. mapping _Coerce | 201 | sguFromDateYear :: Lens' StatsGetUser (Maybe Int32)
sguFromDateYear
= lens _sguFromDateYear
(\ s a -> s{_sguFromDateYear = a})
. mapping _Coerce | 158 | sguFromDateYear
= lens _sguFromDateYear
(\ s a -> s{_sguFromDateYear = a})
. mapping _Coerce | 106 | true | true | 1 | 8 | 44 | 57 | 28 | 29 | null | null |
contivero/hasmin | tests/Hasmin/Types/BasicShapeSpec.hs | bsd-3-clause | spec :: Spec
spec = basicShapeTests | 35 | spec :: Spec
spec = basicShapeTests | 35 | spec = basicShapeTests | 22 | false | true | 0 | 4 | 5 | 11 | 6 | 5 | null | null |
CulpaBS/wbBach | src/futhark-c.hs | bsd-3-clause | futharkConfig :: CompilerConfig -> FutharkConfig
futharkConfig config =
newFutharkConfig { futharkVerbose = compilerVerbose config } | 134 | futharkConfig :: CompilerConfig -> FutharkConfig
futharkConfig config =
newFutharkConfig { futharkVerbose = compilerVerbose config } | 134 | futharkConfig config =
newFutharkConfig { futharkVerbose = compilerVerbose config } | 85 | false | true | 0 | 7 | 16 | 29 | 15 | 14 | null | null |
adbrowne/dynamodb-eventstore | dynamodb-eventstore-client/client/Main.hs | mit | renderNode :: Node -> Text
renderNode node = T.pack $ renderMarkup $ toMarkup False node | 88 | renderNode :: Node -> Text
renderNode node = T.pack $ renderMarkup $ toMarkup False node | 88 | renderNode node = T.pack $ renderMarkup $ toMarkup False node | 61 | false | true | 0 | 7 | 14 | 33 | 16 | 17 | null | null |
lexml/lexml-linker | src/main/haskell/LinkerServer.hs | gpl-2.0 | extractDomain (Just s) = case parseURI s of
Nothing -> ""
Just uri -> case uriAuthority uri of
Nothing -> ""
Just aut -> uriRegName aut | 156 | extractDomain (Just s) = case parseURI s of
Nothing -> ""
Just uri -> case uriAuthority uri of
Nothing -> ""
Just aut -> uriRegName aut | 156 | extractDomain (Just s) = case parseURI s of
Nothing -> ""
Just uri -> case uriAuthority uri of
Nothing -> ""
Just aut -> uriRegName aut | 156 | false | false | 0 | 11 | 46 | 63 | 28 | 35 | null | null |
vinnymac/glot-www | Model/Language.hs | mit | languageDefaultContent Elixir = [multiline|IO.puts "Hello World!"|] | 67 | languageDefaultContent Elixir = [multiline|IO.puts "Hello World!"|] | 67 | languageDefaultContent Elixir = [multiline|IO.puts "Hello World!"|] | 67 | false | false | 0 | 5 | 5 | 13 | 8 | 5 | null | null |
ComputationWithBoundedResources/ara-inference | doc/tpdb_trs/Haskell/basic_haskell/isOctDigit_1.hs | mit | esEsOrdering EQ LT = MyFalse | 28 | esEsOrdering EQ LT = MyFalse | 28 | esEsOrdering EQ LT = MyFalse | 28 | false | false | 0 | 5 | 4 | 11 | 5 | 6 | null | null |
nitrix/lspace | legacy/Link.hs | unlicense | saveContext :: Context -> IO ()
saveContext ctx = do
-- putStrLn "Saving context"
cache <- readIORef (ctxCache ctx)
mapM_ (lcwSaveLink . snd) (L.toList cache)
-- TODO: Link is breaking referential transparency. TIL. It needs a good refactoring.
performMajorGC | 279 | saveContext :: Context -> IO ()
saveContext ctx = do
-- putStrLn "Saving context"
cache <- readIORef (ctxCache ctx)
mapM_ (lcwSaveLink . snd) (L.toList cache)
-- TODO: Link is breaking referential transparency. TIL. It needs a good refactoring.
performMajorGC | 279 | saveContext ctx = do
-- putStrLn "Saving context"
cache <- readIORef (ctxCache ctx)
mapM_ (lcwSaveLink . snd) (L.toList cache)
-- TODO: Link is breaking referential transparency. TIL. It needs a good refactoring.
performMajorGC | 247 | false | true | 0 | 10 | 58 | 67 | 32 | 35 | null | null |
forked-upstream-packages-for-ghcjs/ghcjs | ghcjs/src/Gen2/Prim.hs | mit | genPrim _ _ DoubleAddOp [r] [x,y] = PrimInline [j| `r` = `x` + `y` |] | 75 | genPrim _ _ DoubleAddOp [r] [x,y] = PrimInline [j| `r` = `x` + `y` |] | 75 | genPrim _ _ DoubleAddOp [r] [x,y] = PrimInline [j| `r` = `x` + `y` |] | 75 | false | false | 0 | 6 | 20 | 33 | 19 | 14 | null | null |
lemol/HaskellNet | src/Network/HaskellNet/IMAP.hs | bsd-3-clause | appendFull :: IMAPConnection -> MailboxName -> ByteString
-> [Flag] -> Maybe CalendarTime -> IO ()
appendFull conn mbox mailData flags' time =
do (buf, num) <- sendCommand' conn
(unwords ["APPEND", mbox
, fstr, tstr, "{" ++ show len ++ "}"])
unless (BS.null buf || (BS.head buf /= '+')) $
fail "illegal server response"
mapM_ (bsPutCrLf $ stream conn) mailLines
buf2 <- getResponse $ stream conn
let (resp, mboxUp, ()) = eval pNone (show6 num) buf2
case resp of
OK _ _ -> mboxUpdate conn mboxUp
NO _ msg -> fail ("NO: "++msg)
BAD _ msg -> fail ("BAD: "++msg)
PREAUTH _ msg -> fail ("PREAUTH: "++msg)
where mailLines = BS.lines mailData
len = sum $ map ((2+) . BS.length) mailLines
tstr = maybe "" show time
fstr = unwords $ map show flags' | 931 | appendFull :: IMAPConnection -> MailboxName -> ByteString
-> [Flag] -> Maybe CalendarTime -> IO ()
appendFull conn mbox mailData flags' time =
do (buf, num) <- sendCommand' conn
(unwords ["APPEND", mbox
, fstr, tstr, "{" ++ show len ++ "}"])
unless (BS.null buf || (BS.head buf /= '+')) $
fail "illegal server response"
mapM_ (bsPutCrLf $ stream conn) mailLines
buf2 <- getResponse $ stream conn
let (resp, mboxUp, ()) = eval pNone (show6 num) buf2
case resp of
OK _ _ -> mboxUpdate conn mboxUp
NO _ msg -> fail ("NO: "++msg)
BAD _ msg -> fail ("BAD: "++msg)
PREAUTH _ msg -> fail ("PREAUTH: "++msg)
where mailLines = BS.lines mailData
len = sum $ map ((2+) . BS.length) mailLines
tstr = maybe "" show time
fstr = unwords $ map show flags' | 931 | appendFull conn mbox mailData flags' time =
do (buf, num) <- sendCommand' conn
(unwords ["APPEND", mbox
, fstr, tstr, "{" ++ show len ++ "}"])
unless (BS.null buf || (BS.head buf /= '+')) $
fail "illegal server response"
mapM_ (bsPutCrLf $ stream conn) mailLines
buf2 <- getResponse $ stream conn
let (resp, mboxUp, ()) = eval pNone (show6 num) buf2
case resp of
OK _ _ -> mboxUpdate conn mboxUp
NO _ msg -> fail ("NO: "++msg)
BAD _ msg -> fail ("BAD: "++msg)
PREAUTH _ msg -> fail ("PREAUTH: "++msg)
where mailLines = BS.lines mailData
len = sum $ map ((2+) . BS.length) mailLines
tstr = maybe "" show time
fstr = unwords $ map show flags' | 821 | false | true | 3 | 14 | 324 | 360 | 175 | 185 | null | null |
brendanhay/gogol | gogol-cloudsearch/gen/Network/Google/CloudSearch/Types/Product.hs | mpl-2.0 | -- | If set, describes how the date should be used as a search operator.
dOperatorOptions :: Lens' DatePropertyOptions (Maybe DateOperatorOptions)
dOperatorOptions
= lens _dOperatorOptions
(\ s a -> s{_dOperatorOptions = a}) | 232 | dOperatorOptions :: Lens' DatePropertyOptions (Maybe DateOperatorOptions)
dOperatorOptions
= lens _dOperatorOptions
(\ s a -> s{_dOperatorOptions = a}) | 159 | dOperatorOptions
= lens _dOperatorOptions
(\ s a -> s{_dOperatorOptions = a}) | 85 | true | true | 1 | 9 | 39 | 52 | 25 | 27 | null | null |
amccausl/Swish | Swish/HaskellUtils/LookupMapTest.hs | lgpl-2.1 | testRevLookupMapFind00 = testRevLookupMapFind "00" rlm00 "" revdef | 66 | testRevLookupMapFind00 = testRevLookupMapFind "00" rlm00 "" revdef | 66 | testRevLookupMapFind00 = testRevLookupMapFind "00" rlm00 "" revdef | 66 | false | false | 1 | 5 | 6 | 18 | 7 | 11 | null | null |
23Skidoo/erp | ERP.hs | gpl-3.0 | mapSTVars f (STList te) = STList . mapSTVars f $ te | 54 | mapSTVars f (STList te) = STList . mapSTVars f $ te | 54 | mapSTVars f (STList te) = STList . mapSTVars f $ te | 54 | false | false | 0 | 7 | 13 | 30 | 13 | 17 | null | null |
omefire/megaparsec | tests/Perm.hs | bsd-2-clause | prop_perm_0 :: String -> Char -> CharRows -> Property
prop_perm_0 a' c' v = checkParser (makePermParser p) r s
where (a,b,c) = getChars v
p = (,,) <$?> (a', some (char a))
<||> char b
<|?> (c', char c)
r | length bis > 1 && (length cis <= 1 || head bis < head cis) =
posErr (bis !! 1) s $ [uneCh b, exEof] ++
[exCh a | a `notElem` preb] ++
[exCh c | c `notElem` preb]
| length cis > 1 =
posErr (cis !! 1) s $ [uneCh c] ++
[exCh a | a `notElem` prec] ++
[bool (exCh b) exEof (b `elem` prec)]
| b `notElem` s = posErr (length s) s $ [uneEof, exCh b] ++
[exCh a | a `notElem` s || last s == a] ++
[exCh c | c `notElem` s]
| otherwise = Right ( bool a' (filter (== a) s) (a `elem` s)
, b
, bool c' c (c `elem` s) )
bis = elemIndices b s
preb = take (bis !! 1) s
cis = elemIndices c s
prec = take (cis !! 1) s
s = getInput v | 1,140 | prop_perm_0 :: String -> Char -> CharRows -> Property
prop_perm_0 a' c' v = checkParser (makePermParser p) r s
where (a,b,c) = getChars v
p = (,,) <$?> (a', some (char a))
<||> char b
<|?> (c', char c)
r | length bis > 1 && (length cis <= 1 || head bis < head cis) =
posErr (bis !! 1) s $ [uneCh b, exEof] ++
[exCh a | a `notElem` preb] ++
[exCh c | c `notElem` preb]
| length cis > 1 =
posErr (cis !! 1) s $ [uneCh c] ++
[exCh a | a `notElem` prec] ++
[bool (exCh b) exEof (b `elem` prec)]
| b `notElem` s = posErr (length s) s $ [uneEof, exCh b] ++
[exCh a | a `notElem` s || last s == a] ++
[exCh c | c `notElem` s]
| otherwise = Right ( bool a' (filter (== a) s) (a `elem` s)
, b
, bool c' c (c `elem` s) )
bis = elemIndices b s
preb = take (bis !! 1) s
cis = elemIndices c s
prec = take (cis !! 1) s
s = getInput v | 1,140 | prop_perm_0 a' c' v = checkParser (makePermParser p) r s
where (a,b,c) = getChars v
p = (,,) <$?> (a', some (char a))
<||> char b
<|?> (c', char c)
r | length bis > 1 && (length cis <= 1 || head bis < head cis) =
posErr (bis !! 1) s $ [uneCh b, exEof] ++
[exCh a | a `notElem` preb] ++
[exCh c | c `notElem` preb]
| length cis > 1 =
posErr (cis !! 1) s $ [uneCh c] ++
[exCh a | a `notElem` prec] ++
[bool (exCh b) exEof (b `elem` prec)]
| b `notElem` s = posErr (length s) s $ [uneEof, exCh b] ++
[exCh a | a `notElem` s || last s == a] ++
[exCh c | c `notElem` s]
| otherwise = Right ( bool a' (filter (== a) s) (a `elem` s)
, b
, bool c' c (c `elem` s) )
bis = elemIndices b s
preb = take (bis !! 1) s
cis = elemIndices c s
prec = take (cis !! 1) s
s = getInput v | 1,086 | false | true | 18 | 13 | 513 | 578 | 284 | 294 | null | null |
rueshyna/gogol | gogol-android-publisher/gen/Network/Google/AndroidPublisher/Types/Product.hs | mpl-2.0 | -- | Screen density in DPI
dmScreenDensityDpi :: Lens' DeviceMetadata (Maybe Int32)
dmScreenDensityDpi
= lens _dmScreenDensityDpi
(\ s a -> s{_dmScreenDensityDpi = a})
. mapping _Coerce | 199 | dmScreenDensityDpi :: Lens' DeviceMetadata (Maybe Int32)
dmScreenDensityDpi
= lens _dmScreenDensityDpi
(\ s a -> s{_dmScreenDensityDpi = a})
. mapping _Coerce | 172 | dmScreenDensityDpi
= lens _dmScreenDensityDpi
(\ s a -> s{_dmScreenDensityDpi = a})
. mapping _Coerce | 115 | true | true | 0 | 10 | 39 | 55 | 28 | 27 | null | null |
AlexeyRaga/haskell-es-example | src/Repository.hs | bsd-3-clause | writeAllEvents :: (Data (A.Event a), ToJSON (A.Event a), AggregateId (A.Id a)) =>
Connection
-> A.Id a
-> [A.Event a]
-> IO WriteResult
writeAllEvents conn aid es =
let packEvent e = createEvent (pack . show $ toConstr e) Nothing (withJson $ toJSON e)
stream = textAggregateId aid
in sendEvents conn stream anyStream (packEvent <$> es) >>= wait | 363 | writeAllEvents :: (Data (A.Event a), ToJSON (A.Event a), AggregateId (A.Id a)) =>
Connection
-> A.Id a
-> [A.Event a]
-> IO WriteResult
writeAllEvents conn aid es =
let packEvent e = createEvent (pack . show $ toConstr e) Nothing (withJson $ toJSON e)
stream = textAggregateId aid
in sendEvents conn stream anyStream (packEvent <$> es) >>= wait | 363 | writeAllEvents conn aid es =
let packEvent e = createEvent (pack . show $ toConstr e) Nothing (withJson $ toJSON e)
stream = textAggregateId aid
in sendEvents conn stream anyStream (packEvent <$> es) >>= wait | 219 | false | true | 0 | 12 | 75 | 172 | 81 | 91 | null | null |
justinethier/husk-scheme | hs-src/Language/Scheme/Numerical.hs | mit | numBoolBinopGt (n : ns) = numBoolBinopCompare cmp n ns
where
f a b = a > b
cmp (Number a) (Number b) = return $ Bool $ f a b
cmp (Float a) (Float b) = return $ Bool $ f a b
cmp (Rational a) (Rational b) = return $ Bool $ f a b
cmp _ _ = throwError $ Default "Unexpected error in >"
-- |Numeric greater than equal | 335 | numBoolBinopGt (n : ns) = numBoolBinopCompare cmp n ns
where
f a b = a > b
cmp (Number a) (Number b) = return $ Bool $ f a b
cmp (Float a) (Float b) = return $ Bool $ f a b
cmp (Rational a) (Rational b) = return $ Bool $ f a b
cmp _ _ = throwError $ Default "Unexpected error in >"
-- |Numeric greater than equal | 335 | numBoolBinopGt (n : ns) = numBoolBinopCompare cmp n ns
where
f a b = a > b
cmp (Number a) (Number b) = return $ Bool $ f a b
cmp (Float a) (Float b) = return $ Bool $ f a b
cmp (Rational a) (Rational b) = return $ Bool $ f a b
cmp _ _ = throwError $ Default "Unexpected error in >"
-- |Numeric greater than equal | 335 | false | false | 0 | 7 | 94 | 163 | 79 | 84 | null | null |
adept/hledger | hledger-lib/Hledger/Utils/Regex.hs | gpl-3.0 | -- | Tests whether a Regexp matches a Text.
--
-- This currently unpacks the Text to a String an works on that. This is due to
-- a performance bug in regex-tdfa (#9), which may or may not be relevant here.
regexMatchText :: Regexp -> Text -> Bool
regexMatchText r = matchTest r . T.unpack | 289 | regexMatchText :: Regexp -> Text -> Bool
regexMatchText r = matchTest r . T.unpack | 82 | regexMatchText r = matchTest r . T.unpack | 41 | true | true | 0 | 6 | 55 | 35 | 19 | 16 | null | null |
hferreiro/replay | compiler/nativeGen/X86/Ppr.hs | bsd-3-clause | pprInstr (MUL2 size op) = pprSizeOp (sLit "mul") size op | 56 | pprInstr (MUL2 size op) = pprSizeOp (sLit "mul") size op | 56 | pprInstr (MUL2 size op) = pprSizeOp (sLit "mul") size op | 56 | false | false | 0 | 7 | 9 | 30 | 14 | 16 | null | null |
guillaume-nargeot/codecov-haskell | src/Trace/Hpc/Codecov/Util.hs | bsd-3-clause | mapLast _ [] = [] | 23 | mapLast _ [] = [] | 23 | mapLast _ [] = [] | 23 | false | false | 0 | 6 | 10 | 19 | 8 | 11 | null | null |
foreverbell/project-euler-solutions | src/124.hs | bsd-3-clause | where ds = fst $ factorize (mkStdGen n) n | 41 | where ds = fst $ factorize (mkStdGen n) n | 41 | where ds = fst $ factorize (mkStdGen n) n | 41 | false | false | 0 | 8 | 8 | 24 | 11 | 13 | null | null |
Peaker/cabal | Cabal/Distribution/PackageDescription/Configuration.hs | bsd-3-clause | flattenPackageDescription :: GenericPackageDescription -> PackageDescription
flattenPackageDescription (GenericPackageDescription pkg _ mlib0 exes0 tests0 bms0) =
pkg { library = mlib
, executables = reverse exes
, testSuites = reverse tests
, benchmarks = reverse bms
, buildDepends = ldeps ++ reverse edeps ++ reverse tdeps ++ reverse bdeps
}
where
(mlib, ldeps) = case mlib0 of
Just lib -> let (l,ds) = ignoreConditions lib in
(Just (libFillInDefaults l), ds)
Nothing -> (Nothing, [])
(exes, edeps) = foldr flattenExe ([],[]) exes0
(tests, tdeps) = foldr flattenTst ([],[]) tests0
(bms, bdeps) = foldr flattenBm ([],[]) bms0
flattenExe (n, t) (es, ds) =
let (e, ds') = ignoreConditions t in
( (exeFillInDefaults $ e { exeName = n }) : es, ds' ++ ds )
flattenTst (n, t) (es, ds) =
let (e, ds') = ignoreConditions t in
( (testFillInDefaults $ e { testName = n }) : es, ds' ++ ds )
flattenBm (n, t) (es, ds) =
let (e, ds') = ignoreConditions t in
( (benchFillInDefaults $ e { benchmarkName = n }) : es, ds' ++ ds )
-- This is in fact rather a hack. The original version just overrode the
-- default values, however, when adding conditions we had to switch to a
-- modifier-based approach. There, nothing is ever overwritten, but only
-- joined together.
--
-- This is the cleanest way i could think of, that doesn't require
-- changing all field parsing functions to return modifiers instead. | 1,553 | flattenPackageDescription :: GenericPackageDescription -> PackageDescription
flattenPackageDescription (GenericPackageDescription pkg _ mlib0 exes0 tests0 bms0) =
pkg { library = mlib
, executables = reverse exes
, testSuites = reverse tests
, benchmarks = reverse bms
, buildDepends = ldeps ++ reverse edeps ++ reverse tdeps ++ reverse bdeps
}
where
(mlib, ldeps) = case mlib0 of
Just lib -> let (l,ds) = ignoreConditions lib in
(Just (libFillInDefaults l), ds)
Nothing -> (Nothing, [])
(exes, edeps) = foldr flattenExe ([],[]) exes0
(tests, tdeps) = foldr flattenTst ([],[]) tests0
(bms, bdeps) = foldr flattenBm ([],[]) bms0
flattenExe (n, t) (es, ds) =
let (e, ds') = ignoreConditions t in
( (exeFillInDefaults $ e { exeName = n }) : es, ds' ++ ds )
flattenTst (n, t) (es, ds) =
let (e, ds') = ignoreConditions t in
( (testFillInDefaults $ e { testName = n }) : es, ds' ++ ds )
flattenBm (n, t) (es, ds) =
let (e, ds') = ignoreConditions t in
( (benchFillInDefaults $ e { benchmarkName = n }) : es, ds' ++ ds )
-- This is in fact rather a hack. The original version just overrode the
-- default values, however, when adding conditions we had to switch to a
-- modifier-based approach. There, nothing is ever overwritten, but only
-- joined together.
--
-- This is the cleanest way i could think of, that doesn't require
-- changing all field parsing functions to return modifiers instead. | 1,553 | flattenPackageDescription (GenericPackageDescription pkg _ mlib0 exes0 tests0 bms0) =
pkg { library = mlib
, executables = reverse exes
, testSuites = reverse tests
, benchmarks = reverse bms
, buildDepends = ldeps ++ reverse edeps ++ reverse tdeps ++ reverse bdeps
}
where
(mlib, ldeps) = case mlib0 of
Just lib -> let (l,ds) = ignoreConditions lib in
(Just (libFillInDefaults l), ds)
Nothing -> (Nothing, [])
(exes, edeps) = foldr flattenExe ([],[]) exes0
(tests, tdeps) = foldr flattenTst ([],[]) tests0
(bms, bdeps) = foldr flattenBm ([],[]) bms0
flattenExe (n, t) (es, ds) =
let (e, ds') = ignoreConditions t in
( (exeFillInDefaults $ e { exeName = n }) : es, ds' ++ ds )
flattenTst (n, t) (es, ds) =
let (e, ds') = ignoreConditions t in
( (testFillInDefaults $ e { testName = n }) : es, ds' ++ ds )
flattenBm (n, t) (es, ds) =
let (e, ds') = ignoreConditions t in
( (benchFillInDefaults $ e { benchmarkName = n }) : es, ds' ++ ds )
-- This is in fact rather a hack. The original version just overrode the
-- default values, however, when adding conditions we had to switch to a
-- modifier-based approach. There, nothing is ever overwritten, but only
-- joined together.
--
-- This is the cleanest way i could think of, that doesn't require
-- changing all field parsing functions to return modifiers instead. | 1,476 | false | true | 0 | 13 | 401 | 501 | 267 | 234 | null | null |
andreyk0/HSOpenSCAD | Graphics/OpenSCAD.hs | bsd-3-clause | showFacet (Fs f) = "$fs=" ++ show f | 35 | showFacet (Fs f) = "$fs=" ++ show f | 35 | showFacet (Fs f) = "$fs=" ++ show f | 35 | false | false | 0 | 7 | 7 | 22 | 10 | 12 | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.