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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
GaloisInc/halvm-ghc | compiler/hsSyn/HsExpr.hs | bsd-3-clause | ppr_expr (NegApp e _) = char '-' <+> pprDebugParendExpr e | 57 | ppr_expr (NegApp e _) = char '-' <+> pprDebugParendExpr e | 57 | ppr_expr (NegApp e _) = char '-' <+> pprDebugParendExpr e | 57 | false | false | 0 | 7 | 9 | 27 | 12 | 15 | null | null |
mydaum/cabal | Cabal/Distribution/Simple/Build/PathsModule.hs | bsd-3-clause | filename_stuff :: String
filename_stuff =
"minusFileName :: FilePath -> String -> FilePath\n"++
"minusFileName dir \"\" = dir\n"++
"minusFileName dir \".\" = dir\n"++
"minusFileName dir suffix =\n"++
" minusFileName (fst (splitFileName dir)) (fst (splitFileName suffix))\n"++
"\n"++
"joinFileName :: String -> String -> FilePath\n"++
"joinFileName \"\" fname = fname\n"++
"joinFileName \".\" fname = fname\n"++
"joinFileName dir \"\" = dir\n"++
"joinFileName dir fname\n"++
" | isPathSeparator (last dir) = dir++fname\n"++
" | otherwise = dir++pathSeparator:fname\n"++
"\n"++
"splitFileName :: FilePath -> (String, String)\n"++
"splitFileName p = (reverse (path2++drive), reverse fname)\n"++
" where\n"++
" (path,drive) = case p of\n"++
" (c:':':p') -> (reverse p',[':',c])\n"++
" _ -> (reverse p ,\"\")\n"++
" (fname,path1) = break isPathSeparator path\n"++
" path2 = case path1 of\n"++
" [] -> \".\"\n"++
" [_] -> path1 -- don't remove the trailing slash if \n"++
" -- there is only one character\n"++
" (c:path') | isPathSeparator c -> path'\n"++
" _ -> path1\n"++
"\n"++
"pathSeparator :: Char\n"++
(case buildOS of
Windows -> "pathSeparator = '\\\\'\n"
_ -> "pathSeparator = '/'\n") ++
"\n"++
"isPathSeparator :: Char -> Bool\n"++
(case buildOS of
Windows -> "isPathSeparator c = c == '/' || c == '\\\\'\n"
_ -> "isPathSeparator c = c == '/'\n") | 1,672 | filename_stuff :: String
filename_stuff =
"minusFileName :: FilePath -> String -> FilePath\n"++
"minusFileName dir \"\" = dir\n"++
"minusFileName dir \".\" = dir\n"++
"minusFileName dir suffix =\n"++
" minusFileName (fst (splitFileName dir)) (fst (splitFileName suffix))\n"++
"\n"++
"joinFileName :: String -> String -> FilePath\n"++
"joinFileName \"\" fname = fname\n"++
"joinFileName \".\" fname = fname\n"++
"joinFileName dir \"\" = dir\n"++
"joinFileName dir fname\n"++
" | isPathSeparator (last dir) = dir++fname\n"++
" | otherwise = dir++pathSeparator:fname\n"++
"\n"++
"splitFileName :: FilePath -> (String, String)\n"++
"splitFileName p = (reverse (path2++drive), reverse fname)\n"++
" where\n"++
" (path,drive) = case p of\n"++
" (c:':':p') -> (reverse p',[':',c])\n"++
" _ -> (reverse p ,\"\")\n"++
" (fname,path1) = break isPathSeparator path\n"++
" path2 = case path1 of\n"++
" [] -> \".\"\n"++
" [_] -> path1 -- don't remove the trailing slash if \n"++
" -- there is only one character\n"++
" (c:path') | isPathSeparator c -> path'\n"++
" _ -> path1\n"++
"\n"++
"pathSeparator :: Char\n"++
(case buildOS of
Windows -> "pathSeparator = '\\\\'\n"
_ -> "pathSeparator = '/'\n") ++
"\n"++
"isPathSeparator :: Char -> Bool\n"++
(case buildOS of
Windows -> "isPathSeparator c = c == '/' || c == '\\\\'\n"
_ -> "isPathSeparator c = c == '/'\n") | 1,672 | filename_stuff =
"minusFileName :: FilePath -> String -> FilePath\n"++
"minusFileName dir \"\" = dir\n"++
"minusFileName dir \".\" = dir\n"++
"minusFileName dir suffix =\n"++
" minusFileName (fst (splitFileName dir)) (fst (splitFileName suffix))\n"++
"\n"++
"joinFileName :: String -> String -> FilePath\n"++
"joinFileName \"\" fname = fname\n"++
"joinFileName \".\" fname = fname\n"++
"joinFileName dir \"\" = dir\n"++
"joinFileName dir fname\n"++
" | isPathSeparator (last dir) = dir++fname\n"++
" | otherwise = dir++pathSeparator:fname\n"++
"\n"++
"splitFileName :: FilePath -> (String, String)\n"++
"splitFileName p = (reverse (path2++drive), reverse fname)\n"++
" where\n"++
" (path,drive) = case p of\n"++
" (c:':':p') -> (reverse p',[':',c])\n"++
" _ -> (reverse p ,\"\")\n"++
" (fname,path1) = break isPathSeparator path\n"++
" path2 = case path1 of\n"++
" [] -> \".\"\n"++
" [_] -> path1 -- don't remove the trailing slash if \n"++
" -- there is only one character\n"++
" (c:path') | isPathSeparator c -> path'\n"++
" _ -> path1\n"++
"\n"++
"pathSeparator :: Char\n"++
(case buildOS of
Windows -> "pathSeparator = '\\\\'\n"
_ -> "pathSeparator = '/'\n") ++
"\n"++
"isPathSeparator :: Char -> Bool\n"++
(case buildOS of
Windows -> "isPathSeparator c = c == '/' || c == '\\\\'\n"
_ -> "isPathSeparator c = c == '/'\n") | 1,647 | false | true | 0 | 36 | 519 | 177 | 90 | 87 | null | null |
mathologist/CTYCrypto | Util.hs | gpl-3.0 | link (Branch k v left right) q = Branch k v right (myunion left q) | 66 | link (Branch k v left right) q = Branch k v right (myunion left q) | 66 | link (Branch k v left right) q = Branch k v right (myunion left q) | 66 | false | false | 0 | 7 | 14 | 40 | 19 | 21 | null | null |
dancor/melang | src/Lang/De/Noun.hs | mit | inflNDe _ Sing (NDeEn w) = w | 37 | inflNDe _ Sing (NDeEn w) = w | 37 | inflNDe _ Sing (NDeEn w) = w | 37 | false | false | 0 | 7 | 15 | 19 | 9 | 10 | null | null |
yangjueji/hblas | tests/UnitBLAS/Level1.hs | bsd-3-clause | vecTest1SROTG :: IO ()
vecTest1SROTG = do
a <- Matrix.generateMutableValue 3
b <- Matrix.generateMutableValue 4
c <- Matrix.generateMutableValue 0
s <- Matrix.generateMutableValue 0
srotg a b c s
av <- Matrix.mutableValueToValue a
bv <- Matrix.mutableValueToValue b
cv <- Matrix.mutableValueToValue c
sv <- Matrix.mutableValueToValue s
av @?= 5
True @?= 1e-6 > (abs $ bv - 1/0.6)
cv @?= 0.6
sv @?= 0.8 | 427 | vecTest1SROTG :: IO ()
vecTest1SROTG = do
a <- Matrix.generateMutableValue 3
b <- Matrix.generateMutableValue 4
c <- Matrix.generateMutableValue 0
s <- Matrix.generateMutableValue 0
srotg a b c s
av <- Matrix.mutableValueToValue a
bv <- Matrix.mutableValueToValue b
cv <- Matrix.mutableValueToValue c
sv <- Matrix.mutableValueToValue s
av @?= 5
True @?= 1e-6 > (abs $ bv - 1/0.6)
cv @?= 0.6
sv @?= 0.8 | 427 | vecTest1SROTG = do
a <- Matrix.generateMutableValue 3
b <- Matrix.generateMutableValue 4
c <- Matrix.generateMutableValue 0
s <- Matrix.generateMutableValue 0
srotg a b c s
av <- Matrix.mutableValueToValue a
bv <- Matrix.mutableValueToValue b
cv <- Matrix.mutableValueToValue c
sv <- Matrix.mutableValueToValue s
av @?= 5
True @?= 1e-6 > (abs $ bv - 1/0.6)
cv @?= 0.6
sv @?= 0.8 | 404 | false | true | 0 | 11 | 87 | 171 | 75 | 96 | null | null |
keithodulaigh/Hets | Comorphisms/HasCASL2IsabelleHOL.hs | gpl-2.0 | transTotalLambda sign t@(QualOp _ (PolyId opId _ _) _ _ _ _) =
if opId == trueId || opId == falseId then transTerm sign t
else conDouble $ showIsaConstT opId baseSign | 172 | transTotalLambda sign t@(QualOp _ (PolyId opId _ _) _ _ _ _) =
if opId == trueId || opId == falseId then transTerm sign t
else conDouble $ showIsaConstT opId baseSign | 172 | transTotalLambda sign t@(QualOp _ (PolyId opId _ _) _ _ _ _) =
if opId == trueId || opId == falseId then transTerm sign t
else conDouble $ showIsaConstT opId baseSign | 172 | false | false | 0 | 10 | 36 | 74 | 37 | 37 | null | null |
scast/bigbrother | src/TypeChecking.hs | gpl-2.0 | boperator ">" Char Char = Just Bool | 35 | boperator ">" Char Char = Just Bool | 35 | boperator ">" Char Char = Just Bool | 35 | false | false | 0 | 5 | 6 | 16 | 7 | 9 | null | null |
bb010g/aura | aura/lib/Aura/Languages.hs | gpl-3.0 | security_8 :: Text -> Language -> Doc AnsiStyle
security_8 (bt -> t) = \case
Spanish -> t <+> "es un comando bash integrado en los campos de la matriz del PKGBUILD."
Italian -> t <+> "è un comando bash presente all'interno degli array del tuo PKGBUILD."
Dutch -> t <+> "is een bash-opdracht die is opgenomen in uw PKGBUILD-arrayvelden."
_ -> t <+> "is a bash command inlined in your PKGBUILD array fields." | 422 | security_8 :: Text -> Language -> Doc AnsiStyle
security_8 (bt -> t) = \case
Spanish -> t <+> "es un comando bash integrado en los campos de la matriz del PKGBUILD."
Italian -> t <+> "è un comando bash presente all'interno degli array del tuo PKGBUILD."
Dutch -> t <+> "is een bash-opdracht die is opgenomen in uw PKGBUILD-arrayvelden."
_ -> t <+> "is a bash command inlined in your PKGBUILD array fields." | 422 | security_8 (bt -> t) = \case
Spanish -> t <+> "es un comando bash integrado en los campos de la matriz del PKGBUILD."
Italian -> t <+> "è un comando bash presente all'interno degli array del tuo PKGBUILD."
Dutch -> t <+> "is een bash-opdracht die is opgenomen in uw PKGBUILD-arrayvelden."
_ -> t <+> "is a bash command inlined in your PKGBUILD array fields." | 374 | false | true | 4 | 7 | 88 | 80 | 37 | 43 | null | null |
input-output-hk/pos-haskell-prototype | wallet/src/Cardano/Wallet/Server/CLI.hs | mit | walletStartupOptionsParser :: Parser WalletStartupOptions
walletStartupOptionsParser = WalletStartupOptions <$> CLI.commonNodeArgsParser
<*> walletBackendParamsParser | 216 | walletStartupOptionsParser :: Parser WalletStartupOptions
walletStartupOptionsParser = WalletStartupOptions <$> CLI.commonNodeArgsParser
<*> walletBackendParamsParser | 216 | walletStartupOptionsParser = WalletStartupOptions <$> CLI.commonNodeArgsParser
<*> walletBackendParamsParser | 158 | false | true | 0 | 7 | 60 | 24 | 12 | 12 | null | null |
wildsebastian/PurelyFunctionalDataStructures | chapter02/CustomList.hs | apache-2.0 | cons :: a -> List a -> List a
cons = Cons | 41 | cons :: a -> List a -> List a
cons = Cons | 41 | cons = Cons | 11 | false | true | 0 | 7 | 11 | 25 | 12 | 13 | null | null |
vikraman/ghc | compiler/main/DynFlags.hs | bsd-3-clause | hasArg :: (String -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
hasArg fn = HasArg (upd . fn) | 103 | hasArg :: (String -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
hasArg fn = HasArg (upd . fn) | 103 | hasArg fn = HasArg (upd . fn) | 29 | false | true | 0 | 9 | 17 | 53 | 25 | 28 | null | null |
VictorDenisov/vim-netbeans | src/Test/AllTests.hs | gpl-2.0 | printDisconnect :: Assertion
printDisconnect = "DISCONNECT\n"
@?=
(N.printMessage $ N.DisconnectCommand) | 154 | printDisconnect :: Assertion
printDisconnect = "DISCONNECT\n"
@?=
(N.printMessage $ N.DisconnectCommand) | 154 | printDisconnect = "DISCONNECT\n"
@?=
(N.printMessage $ N.DisconnectCommand) | 125 | false | true | 0 | 8 | 59 | 26 | 14 | 12 | null | null |
houshuang/frame | Example1.hs | mit | test5 = frame1 & sans "a" | 25 | test5 = frame1 & sans "a" | 25 | test5 = frame1 & sans "a" | 25 | false | false | 0 | 6 | 5 | 13 | 6 | 7 | null | null |
eric-stanley/cabal | Cabal/Distribution/Simple/Utils.hs | bsd-3-clause | currentDir :: FilePath
currentDir = "." | 39 | currentDir :: FilePath
currentDir = "." | 39 | currentDir = "." | 16 | false | true | 0 | 4 | 5 | 11 | 6 | 5 | null | null |
postgres-haskell/postgres-wire | tests/Driver.hs | mit | testDescribeStatementNoData :: IO ()
testDescribeStatementNoData = withConnectionCommon $ \c -> do
r <- fromRight <$> describeStatement c "SET client_encoding TO UTF8"
assertBool "Should be empty" $ null (fst r)
assertBool "Should be empty" $ null (snd r)
-- | Describes statement that is empty string. | 315 | testDescribeStatementNoData :: IO ()
testDescribeStatementNoData = withConnectionCommon $ \c -> do
r <- fromRight <$> describeStatement c "SET client_encoding TO UTF8"
assertBool "Should be empty" $ null (fst r)
assertBool "Should be empty" $ null (snd r)
-- | Describes statement that is empty string. | 315 | testDescribeStatementNoData = withConnectionCommon $ \c -> do
r <- fromRight <$> describeStatement c "SET client_encoding TO UTF8"
assertBool "Should be empty" $ null (fst r)
assertBool "Should be empty" $ null (snd r)
-- | Describes statement that is empty string. | 278 | false | true | 0 | 12 | 57 | 80 | 37 | 43 | null | null |
hithroc/hsvkbot | src/Card.hs | bsd-3-clause | processTag _ x = return x | 25 | processTag _ x = return x | 25 | processTag _ x = return x | 25 | false | false | 0 | 5 | 5 | 14 | 6 | 8 | null | null |
michaelficarra/purescript | src/Language/PureScript/Docs/AsMarkdown.hs | mit | moduleAsMarkdown :: Module -> Docs
moduleAsMarkdown Module{..} = do
headerLevel 2 $ "Module " ++ modName
spacer
for_ modComments tell'
mapM_ declAsMarkdown modDeclarations
spacer | 188 | moduleAsMarkdown :: Module -> Docs
moduleAsMarkdown Module{..} = do
headerLevel 2 $ "Module " ++ modName
spacer
for_ modComments tell'
mapM_ declAsMarkdown modDeclarations
spacer | 188 | moduleAsMarkdown Module{..} = do
headerLevel 2 $ "Module " ++ modName
spacer
for_ modComments tell'
mapM_ declAsMarkdown modDeclarations
spacer | 153 | false | true | 1 | 10 | 33 | 70 | 28 | 42 | null | null |
FPtje/LuaAnalysis | analysis/src/GLua/Parser.hs | lgpl-2.1 | parseNameList :: AParser [MToken]
parseNameList = (:) <$> pName <*> pMany (pMTok Comma *> pName) | 96 | parseNameList :: AParser [MToken]
parseNameList = (:) <$> pName <*> pMany (pMTok Comma *> pName) | 96 | parseNameList = (:) <$> pName <*> pMany (pMTok Comma *> pName) | 62 | false | true | 5 | 8 | 14 | 49 | 24 | 25 | null | null |
DavidAlphaFox/darcs | containers-0.5.2.1/Darcs/Data/Map/Base.hs | gpl-2.0 | mapMaybe :: (a -> Maybe b) -> Map k a -> Map k b
mapMaybe f = mapMaybeWithKey (\_ x -> f x) | 91 | mapMaybe :: (a -> Maybe b) -> Map k a -> Map k b
mapMaybe f = mapMaybeWithKey (\_ x -> f x) | 91 | mapMaybe f = mapMaybeWithKey (\_ x -> f x) | 42 | false | true | 0 | 9 | 22 | 63 | 29 | 34 | null | null |
orome/crypto-enigma | Crypto/Enigma.hs | bsd-3-clause | enigmaMappingList :: EnigmaConfig -> [Mapping]
enigmaMappingList ec = scanl1 (flip encode') (stageMappingList ec) | 113 | enigmaMappingList :: EnigmaConfig -> [Mapping]
enigmaMappingList ec = scanl1 (flip encode') (stageMappingList ec) | 113 | enigmaMappingList ec = scanl1 (flip encode') (stageMappingList ec) | 66 | false | true | 0 | 8 | 12 | 44 | 20 | 24 | null | null |
benmos/pathtype | System/Path/Internal.hs | bsd-3-clause | enericDropExtensions :: Path ar fd -> Path ar fd
genericDropExtensions = fst . genericSplitExtensions
| 102 | genericDropExtensions :: Path ar fd -> Path ar fd
genericDropExtensions = fst . genericSplitExtensions | 102 | genericDropExtensions = fst . genericSplitExtensions | 52 | false | true | 0 | 6 | 14 | 29 | 14 | 15 | null | null |
cshung/MiscLab | Haskell99/q28.hs | mit | merge (p:q) (r:s) comp = if comp p r == GT then r:(merge (p:q) s comp) else p:(merge q (r:s) comp) | 98 | merge (p:q) (r:s) comp = if comp p r == GT then r:(merge (p:q) s comp) else p:(merge q (r:s) comp) | 98 | merge (p:q) (r:s) comp = if comp p r == GT then r:(merge (p:q) s comp) else p:(merge q (r:s) comp) | 98 | false | false | 0 | 10 | 20 | 86 | 45 | 41 | null | null |
clauderichard/Euclaude | Centres.hs | mit | napoleonpoint1 = centre $ a / sin (a' + pi/6) | 46 | napoleonpoint1 = centre $ a / sin (a' + pi/6) | 46 | napoleonpoint1 = centre $ a / sin (a' + pi/6) | 46 | false | false | 5 | 8 | 10 | 34 | 14 | 20 | null | null |
oldmanmike/haskellSDL2Examples | src/lesson08.hs | gpl-2.0 | main :: IO ()
main = inWindow (withRenderer doRender) | 53 | main :: IO ()
main = inWindow (withRenderer doRender) | 53 | main = inWindow (withRenderer doRender) | 39 | false | true | 0 | 7 | 8 | 25 | 12 | 13 | null | null |
andrewthad/vinyl-vectors | examples/sorting.hs | bsd-3-clause | printHeading :: String -> IO ()
printHeading s = do
putStrLn "-------------------"
putStrLn s
putStrLn "-------------------" | 130 | printHeading :: String -> IO ()
printHeading s = do
putStrLn "-------------------"
putStrLn s
putStrLn "-------------------" | 130 | printHeading s = do
putStrLn "-------------------"
putStrLn s
putStrLn "-------------------" | 98 | false | true | 0 | 7 | 21 | 41 | 17 | 24 | null | null |
shepheb/hork | Hork/Core.hs | bsd-3-clause | pcGetWord :: Hork Word16
pcGetWord = do
a <- use pc
w <- rw a
pcBumpBy 2
return w
-- variables
-- use cases for variables:
-- * store instructions
-- * arguments (by value)
-- * "by name" tweaks like inc and dec
-- locals and the stack can be handled with lenses, globals can't. | 289 | pcGetWord :: Hork Word16
pcGetWord = do
a <- use pc
w <- rw a
pcBumpBy 2
return w
-- variables
-- use cases for variables:
-- * store instructions
-- * arguments (by value)
-- * "by name" tweaks like inc and dec
-- locals and the stack can be handled with lenses, globals can't. | 289 | pcGetWord = do
a <- use pc
w <- rw a
pcBumpBy 2
return w
-- variables
-- use cases for variables:
-- * store instructions
-- * arguments (by value)
-- * "by name" tweaks like inc and dec
-- locals and the stack can be handled with lenses, globals can't. | 264 | false | true | 0 | 8 | 66 | 52 | 25 | 27 | null | null |
ghc-android/ghc | compiler/prelude/PrelNames.hs | bsd-3-clause | c1TyConKey = mkPreludeTyConUnique 152 | 40 | c1TyConKey = mkPreludeTyConUnique 152 | 40 | c1TyConKey = mkPreludeTyConUnique 152 | 40 | false | false | 0 | 5 | 6 | 9 | 4 | 5 | null | null |
anton-dessiatov/ghc | compiler/main/GhcMake.hs | bsd-3-clause | cyclicModuleErr :: [ModSummary] -> SDoc
-- From a strongly connected component we find
-- a single cycle to report
cyclicModuleErr mss
= ASSERT( not (null mss) )
case findCycle graph of
Nothing -> ptext (sLit "Unexpected non-cycle") <+> ppr mss
Just path -> vcat [ ptext (sLit "Module imports form a cycle:")
, nest 2 (show_path path) ]
where
graph :: [Node NodeKey ModSummary]
graph = [(ms, msKey ms, get_deps ms) | ms <- mss]
get_deps :: ModSummary -> [NodeKey]
get_deps ms = ([ (unLoc m, IsBoot) | m <- ms_home_srcimps ms ] ++
[ (unLoc m, NotBoot) | m <- ms_home_imps ms ])
show_path [] = panic "show_path"
show_path [m] = ptext (sLit "module") <+> ppr_ms m
<+> ptext (sLit "imports itself")
show_path (m1:m2:ms) = vcat ( nest 7 (ptext (sLit "module") <+> ppr_ms m1)
: nest 6 (ptext (sLit "imports") <+> ppr_ms m2)
: go ms )
where
go [] = [ptext (sLit "which imports") <+> ppr_ms m1]
go (m:ms) = (ptext (sLit "which imports") <+> ppr_ms m) : go ms
ppr_ms :: ModSummary -> SDoc
ppr_ms ms = quotes (ppr (moduleName (ms_mod ms))) <+>
(parens (text (msHsFilePath ms))) | 1,330 | cyclicModuleErr :: [ModSummary] -> SDoc
cyclicModuleErr mss
= ASSERT( not (null mss) )
case findCycle graph of
Nothing -> ptext (sLit "Unexpected non-cycle") <+> ppr mss
Just path -> vcat [ ptext (sLit "Module imports form a cycle:")
, nest 2 (show_path path) ]
where
graph :: [Node NodeKey ModSummary]
graph = [(ms, msKey ms, get_deps ms) | ms <- mss]
get_deps :: ModSummary -> [NodeKey]
get_deps ms = ([ (unLoc m, IsBoot) | m <- ms_home_srcimps ms ] ++
[ (unLoc m, NotBoot) | m <- ms_home_imps ms ])
show_path [] = panic "show_path"
show_path [m] = ptext (sLit "module") <+> ppr_ms m
<+> ptext (sLit "imports itself")
show_path (m1:m2:ms) = vcat ( nest 7 (ptext (sLit "module") <+> ppr_ms m1)
: nest 6 (ptext (sLit "imports") <+> ppr_ms m2)
: go ms )
where
go [] = [ptext (sLit "which imports") <+> ppr_ms m1]
go (m:ms) = (ptext (sLit "which imports") <+> ppr_ms m) : go ms
ppr_ms :: ModSummary -> SDoc
ppr_ms ms = quotes (ppr (moduleName (ms_mod ms))) <+>
(parens (text (msHsFilePath ms))) | 1,255 | cyclicModuleErr mss
= ASSERT( not (null mss) )
case findCycle graph of
Nothing -> ptext (sLit "Unexpected non-cycle") <+> ppr mss
Just path -> vcat [ ptext (sLit "Module imports form a cycle:")
, nest 2 (show_path path) ]
where
graph :: [Node NodeKey ModSummary]
graph = [(ms, msKey ms, get_deps ms) | ms <- mss]
get_deps :: ModSummary -> [NodeKey]
get_deps ms = ([ (unLoc m, IsBoot) | m <- ms_home_srcimps ms ] ++
[ (unLoc m, NotBoot) | m <- ms_home_imps ms ])
show_path [] = panic "show_path"
show_path [m] = ptext (sLit "module") <+> ppr_ms m
<+> ptext (sLit "imports itself")
show_path (m1:m2:ms) = vcat ( nest 7 (ptext (sLit "module") <+> ppr_ms m1)
: nest 6 (ptext (sLit "imports") <+> ppr_ms m2)
: go ms )
where
go [] = [ptext (sLit "which imports") <+> ppr_ms m1]
go (m:ms) = (ptext (sLit "which imports") <+> ppr_ms m) : go ms
ppr_ms :: ModSummary -> SDoc
ppr_ms ms = quotes (ppr (moduleName (ms_mod ms))) <+>
(parens (text (msHsFilePath ms))) | 1,215 | true | true | 4 | 14 | 453 | 454 | 232 | 222 | null | null |
gridaphobe/target | src/Test/Target/Targetable/Function.hs | mit | dataConSymbol_noUnique :: GHC.DataCon -> Symbol
dataConSymbol_noUnique = qualifiedNameSymbol . GHC.getName | 106 | dataConSymbol_noUnique :: GHC.DataCon -> Symbol
dataConSymbol_noUnique = qualifiedNameSymbol . GHC.getName | 106 | dataConSymbol_noUnique = qualifiedNameSymbol . GHC.getName | 58 | false | true | 0 | 6 | 9 | 23 | 12 | 11 | null | null |
apyrgio/ganeti | test/hs/Test/Ganeti/Query/Filter.hs | bsd-2-clause | makeNodeQuery :: Filter FilterField -> Query
makeNodeQuery = Query (ItemTypeOpCode QRNode) ["name"] | 99 | makeNodeQuery :: Filter FilterField -> Query
makeNodeQuery = Query (ItemTypeOpCode QRNode) ["name"] | 99 | makeNodeQuery = Query (ItemTypeOpCode QRNode) ["name"] | 54 | false | true | 0 | 7 | 11 | 32 | 16 | 16 | null | null |
rueshyna/gogol | gogol-maps-engine/gen/Network/Google/Resource/MapsEngine/Layers/GetPublished.hs | mpl-2.0 | -- | The ID of the layer.
lgpId :: Lens' LayersGetPublished Text
lgpId = lens _lgpId (\ s a -> s{_lgpId = a}) | 109 | lgpId :: Lens' LayersGetPublished Text
lgpId = lens _lgpId (\ s a -> s{_lgpId = a}) | 83 | lgpId = lens _lgpId (\ s a -> s{_lgpId = a}) | 44 | true | true | 0 | 9 | 22 | 40 | 22 | 18 | null | null |
ezyang/ghc | compiler/typecheck/TcEvidence.hs | bsd-3-clause | -- | @mkWpFuns [(ty1, wrap1), (ty2, wrap2)] ty_res wrap_res@,
-- where @wrap1 :: ty1 "->" ty1'@ and @wrap2 :: ty2 "->" ty2'@,
-- @wrap3 :: ty3 "->" ty3'@ and @ty_res@ is /either/ @ty3@ or @ty3'@,
-- gives a wrapper @(ty1' -> ty2' -> ty3) "->" (ty1 -> ty2 -> ty3')@.
-- Notice that the result wrapper goes the other way round to all
-- the others. This is a result of sub-typing contravariance.
-- The SDoc is a description of what you were doing when you called mkWpFuns.
mkWpFuns :: [(TcType, HsWrapper)] -> TcType -> HsWrapper -> SDoc -> HsWrapper
mkWpFuns args res_ty res_wrap doc = snd $ go args res_ty res_wrap
where
go [] res_ty res_wrap = (res_ty, res_wrap)
go ((arg_ty, arg_wrap) : args) res_ty res_wrap
= let (tail_ty, tail_wrap) = go args res_ty res_wrap in
(arg_ty `mkFunTy` tail_ty, mkWpFun arg_wrap tail_wrap arg_ty tail_ty doc) | 865 | mkWpFuns :: [(TcType, HsWrapper)] -> TcType -> HsWrapper -> SDoc -> HsWrapper
mkWpFuns args res_ty res_wrap doc = snd $ go args res_ty res_wrap
where
go [] res_ty res_wrap = (res_ty, res_wrap)
go ((arg_ty, arg_wrap) : args) res_ty res_wrap
= let (tail_ty, tail_wrap) = go args res_ty res_wrap in
(arg_ty `mkFunTy` tail_ty, mkWpFun arg_wrap tail_wrap arg_ty tail_ty doc) | 393 | mkWpFuns args res_ty res_wrap doc = snd $ go args res_ty res_wrap
where
go [] res_ty res_wrap = (res_ty, res_wrap)
go ((arg_ty, arg_wrap) : args) res_ty res_wrap
= let (tail_ty, tail_wrap) = go args res_ty res_wrap in
(arg_ty `mkFunTy` tail_ty, mkWpFun arg_wrap tail_wrap arg_ty tail_ty doc) | 315 | true | true | 1 | 10 | 169 | 172 | 88 | 84 | null | null |
henvic/plc | src/FuncoesDeAltaOrdemFilterFold.hs | cc0-1.0 | reprovadosa l = alunos menor7 l | 31 | reprovadosa l = alunos menor7 l | 31 | reprovadosa l = alunos menor7 l | 31 | false | false | 1 | 5 | 5 | 19 | 6 | 13 | null | null |
chrisnc/tangaroa | src/Network/Tangaroa/Types.hs | bsd-3-clause | startTerm :: Term
startTerm = Term (-1) | 39 | startTerm :: Term
startTerm = Term (-1) | 39 | startTerm = Term (-1) | 21 | false | true | 0 | 7 | 6 | 19 | 10 | 9 | null | null |
jamesdabbs/pi-base-2 | src/Models.hs | bsd-3-clause | runDB :: (MonadReader Config m, Monad m, MonadIO m) => SqlPersistT IO a -> m a
runDB q = asks getPool >>= liftIO . runSqlPool q | 127 | runDB :: (MonadReader Config m, Monad m, MonadIO m) => SqlPersistT IO a -> m a
runDB q = asks getPool >>= liftIO . runSqlPool q | 127 | runDB q = asks getPool >>= liftIO . runSqlPool q | 48 | false | true | 0 | 7 | 25 | 63 | 30 | 33 | null | null |
AlexanderPankiv/ghc | compiler/deSugar/DsForeign.hs | bsd-3-clause | ret_addr_arg :: DynFlags -> (SDoc, SDoc, Type, CmmType)
ret_addr_arg dflags = (text "original_return_addr", text "void*", undefined,
typeCmmType dflags addrPrimTy) | 186 | ret_addr_arg :: DynFlags -> (SDoc, SDoc, Type, CmmType)
ret_addr_arg dflags = (text "original_return_addr", text "void*", undefined,
typeCmmType dflags addrPrimTy) | 186 | ret_addr_arg dflags = (text "original_return_addr", text "void*", undefined,
typeCmmType dflags addrPrimTy) | 130 | false | true | 0 | 6 | 41 | 53 | 29 | 24 | null | null |
bixuanzju/fcore | lib/JvmTypeQuery.hs | bsd-2-clause | fixRet :: String -> IO (Maybe String)
fixRet "$" = return Nothing | 65 | fixRet :: String -> IO (Maybe String)
fixRet "$" = return Nothing | 65 | fixRet "$" = return Nothing | 27 | false | true | 0 | 9 | 11 | 35 | 15 | 20 | null | null |
dpieroux/euler | 0105.hs | mit | sssSum (Just set) = sum_ set | 28 | sssSum (Just set) = sum_ set | 28 | sssSum (Just set) = sum_ set | 28 | false | false | 0 | 6 | 5 | 19 | 8 | 11 | null | null |
aburnett88/HSat | tests-src/Test/Make/Instances/Common/Literal.hs | mit | getRandomLiteralTest1 :: TestTree
getRandomLiteralTest1 =
testProperty "getRandomLiteral has correct effects" $ monadicIO $ do
literalSet <- pick arbitrary
stop =<< run (
catch (
do
(literal,literalSet') <- runMake getRandomLiteral literalSet
return $ if getHasGeneratedTrue literalSet' > 0 then
checkTrue literal literalSet literalSet' else
checkGeneral literal literalSet literalSet'
)
(\exception ->
let _ = exception :: MakeException
in return $ counterexample "Incorrect error thrown" False
)
)
where
checkGeneral :: Literal -> LiteralSet -> LiteralSet -> Property
checkGeneral literal literalSet literalSet' =
let exptdCanAppear = (
if getVarsAppearTwice literalSet then
id else S.delete (getVariable literal)
) (getVarsThatCanAppear literalSet)
gottenCanAppear = getVarsThatCanAppear literalSet'
in exptdCanAppear === gottenCanAppear | 1,055 | getRandomLiteralTest1 :: TestTree
getRandomLiteralTest1 =
testProperty "getRandomLiteral has correct effects" $ monadicIO $ do
literalSet <- pick arbitrary
stop =<< run (
catch (
do
(literal,literalSet') <- runMake getRandomLiteral literalSet
return $ if getHasGeneratedTrue literalSet' > 0 then
checkTrue literal literalSet literalSet' else
checkGeneral literal literalSet literalSet'
)
(\exception ->
let _ = exception :: MakeException
in return $ counterexample "Incorrect error thrown" False
)
)
where
checkGeneral :: Literal -> LiteralSet -> LiteralSet -> Property
checkGeneral literal literalSet literalSet' =
let exptdCanAppear = (
if getVarsAppearTwice literalSet then
id else S.delete (getVariable literal)
) (getVarsThatCanAppear literalSet)
gottenCanAppear = getVarsThatCanAppear literalSet'
in exptdCanAppear === gottenCanAppear | 1,055 | getRandomLiteralTest1 =
testProperty "getRandomLiteral has correct effects" $ monadicIO $ do
literalSet <- pick arbitrary
stop =<< run (
catch (
do
(literal,literalSet') <- runMake getRandomLiteral literalSet
return $ if getHasGeneratedTrue literalSet' > 0 then
checkTrue literal literalSet literalSet' else
checkGeneral literal literalSet literalSet'
)
(\exception ->
let _ = exception :: MakeException
in return $ counterexample "Incorrect error thrown" False
)
)
where
checkGeneral :: Literal -> LiteralSet -> LiteralSet -> Property
checkGeneral literal literalSet literalSet' =
let exptdCanAppear = (
if getVarsAppearTwice literalSet then
id else S.delete (getVariable literal)
) (getVarsThatCanAppear literalSet)
gottenCanAppear = getVarsThatCanAppear literalSet'
in exptdCanAppear === gottenCanAppear | 1,021 | false | true | 0 | 18 | 319 | 228 | 111 | 117 | null | null |
copland/cmdargs | System/Console/CmdArgs/Explicit/Type.hs | bsd-3-clause | remap2 :: Remap m => (a -> b) -> (b -> a) -> m a -> m b
remap2 f g = remap f (\x -> (g x, f)) | 93 | remap2 :: Remap m => (a -> b) -> (b -> a) -> m a -> m b
remap2 f g = remap f (\x -> (g x, f)) | 93 | remap2 f g = remap f (\x -> (g x, f)) | 37 | false | true | 0 | 10 | 28 | 83 | 40 | 43 | null | null |
Lazersmoke/reee-monads | src/Control/Eff/State.hs | bsd-3-clause | put :: Member (State s) r => s -> Eff r ()
put = send . Put | 59 | put :: Member (State s) r => s -> Eff r ()
put = send . Put | 59 | put = send . Put | 16 | false | true | 0 | 8 | 16 | 41 | 20 | 21 | null | null |
anttisalonen/freekick2 | src/FVector.hs | gpl-3.0 | add2 :: FRange -> FRange -> FRange
add2 (x1, y1) (x2, y2) = (x1 + x2, y1 + y2) | 78 | add2 :: FRange -> FRange -> FRange
add2 (x1, y1) (x2, y2) = (x1 + x2, y1 + y2) | 78 | add2 (x1, y1) (x2, y2) = (x1 + x2, y1 + y2) | 43 | false | true | 0 | 9 | 18 | 56 | 29 | 27 | null | null |
Crazycolorz5/Haskell-Code | simplex.hs | unlicense | simplex::Program -> Either Program IsUnbounded
simplex program =
--simplex_solve program
if is_normal (fst program) --if has a basic variable for each column
then simplex_solve program
else two_phase_simplex program | 240 | simplex::Program -> Either Program IsUnbounded
simplex program =
--simplex_solve program
if is_normal (fst program) --if has a basic variable for each column
then simplex_solve program
else two_phase_simplex program | 240 | simplex program =
--simplex_solve program
if is_normal (fst program) --if has a basic variable for each column
then simplex_solve program
else two_phase_simplex program | 193 | false | true | 0 | 8 | 52 | 48 | 24 | 24 | null | null |
zerobuzz/configifier | tests/Data/ConfigifierSpec.hs | agpl-3.0 | tests :: IO ()
tests = hspec spec | 33 | tests :: IO ()
tests = hspec spec | 33 | tests = hspec spec | 18 | false | true | 0 | 6 | 7 | 19 | 9 | 10 | null | null |
pminten/xhaskell | list-ops/ListOps.hs | mit | concat :: [[a]] -> [a]
concat = undefined | 41 | concat :: [[a]] -> [a]
concat = undefined | 41 | concat = undefined | 18 | false | true | 0 | 8 | 7 | 31 | 15 | 16 | null | null |
akc/gfscript | HOPS/GF.hs | bsd-3-clause | coreExpr2 (EComp e1 e2) = App "comp" [coreExpr3 e1, coreExpr3 e2] | 65 | coreExpr2 (EComp e1 e2) = App "comp" [coreExpr3 e1, coreExpr3 e2] | 65 | coreExpr2 (EComp e1 e2) = App "comp" [coreExpr3 e1, coreExpr3 e2] | 65 | false | false | 0 | 7 | 10 | 34 | 16 | 18 | null | null |
batterseapower/supercompilation-by-evaluation | Core/Parser.hs | bsd-3-clause | expCore (LHE.Lit lit) = literalCore lit | 39 | expCore (LHE.Lit lit) = literalCore lit | 39 | expCore (LHE.Lit lit) = literalCore lit | 39 | false | false | 0 | 8 | 5 | 20 | 9 | 11 | null | null |
bordaigorl/jamesbound | src/Language/PiCalc/Semantics/ReachTree.hs | gpl-2.0 | mkRTState p =
PiState { stateProc = p
, stateDepth = depth $ term p
, stateSucc = Nothing
, stateParent = Nothing } | 155 | mkRTState p =
PiState { stateProc = p
, stateDepth = depth $ term p
, stateSucc = Nothing
, stateParent = Nothing } | 155 | mkRTState p =
PiState { stateProc = p
, stateDepth = depth $ term p
, stateSucc = Nothing
, stateParent = Nothing } | 155 | false | false | 0 | 8 | 63 | 42 | 24 | 18 | null | null |
ancientlanguage/haskell-analysis | prepare/src/Prepare/Decompose.hs | mit | decomposeChar '\xFACA' = "\x97FF" | 33 | decomposeChar '\xFACA' = "\x97FF" | 33 | decomposeChar '\xFACA' = "\x97FF" | 33 | false | false | 1 | 5 | 3 | 13 | 4 | 9 | null | null |
IreneKnapp/Faction | faction/Distribution/Client/HttpUtils.hs | bsd-3-clause | envProxyString = do
env <- getEnvironment
return (lookup "http_proxy" env `mplus` lookup "HTTP_PROXY" env) | 110 | envProxyString = do
env <- getEnvironment
return (lookup "http_proxy" env `mplus` lookup "HTTP_PROXY" env) | 110 | envProxyString = do
env <- getEnvironment
return (lookup "http_proxy" env `mplus` lookup "HTTP_PROXY" env) | 110 | false | false | 0 | 10 | 17 | 38 | 18 | 20 | null | null |
KukovecJ/Nemogoci_Funkcionali | Testing.hs | gpl-2.0 | a = find predikat | 17 | a = find predikat | 17 | a = find predikat | 17 | false | false | 1 | 5 | 3 | 12 | 4 | 8 | null | null |
IreneKnapp/direct-opengl | Graphics/Rendering/OpenGL/GL/PixelRectangles/Convolution.hs | bsd-3-clause | --------------------------------------------------------------------------------
separableFilter2D ::
PixelInternalFormat -> Size -> PixelData a -> PixelData a -> IO ()
separableFilter2D int (Size w h) pdRow pdCol =
withPixelData pdRow $ \f1 d1 p1 ->
withPixelData pdCol $ \f2 d2 p2 ->
if f1 == f2 && d1 == d2
then glSeparableFilter2D
(marshalConvolutionTarget Separable2D)
(marshalPixelInternalFormat' int) w h f1 d1 p1 p2
else recordInvalidValue | 533 | separableFilter2D ::
PixelInternalFormat -> Size -> PixelData a -> PixelData a -> IO ()
separableFilter2D int (Size w h) pdRow pdCol =
withPixelData pdRow $ \f1 d1 p1 ->
withPixelData pdCol $ \f2 d2 p2 ->
if f1 == f2 && d1 == d2
then glSeparableFilter2D
(marshalConvolutionTarget Separable2D)
(marshalPixelInternalFormat' int) w h f1 d1 p1 p2
else recordInvalidValue | 451 | separableFilter2D int (Size w h) pdRow pdCol =
withPixelData pdRow $ \f1 d1 p1 ->
withPixelData pdCol $ \f2 d2 p2 ->
if f1 == f2 && d1 == d2
then glSeparableFilter2D
(marshalConvolutionTarget Separable2D)
(marshalPixelInternalFormat' int) w h f1 d1 p1 p2
else recordInvalidValue | 360 | true | true | 0 | 12 | 144 | 137 | 68 | 69 | null | null |
siddhanathan/yi | yi-keymap-vim/src/Yi/Keymap/Vim/NormalOperatorPendingMap.hs | gpl-2.0 | parseCommand _ _ _ "a" = PartialOperand | 39 | parseCommand _ _ _ "a" = PartialOperand | 39 | parseCommand _ _ _ "a" = PartialOperand | 39 | false | false | 0 | 5 | 6 | 15 | 7 | 8 | null | null |
DavidAlphaFox/ghc | libraries/Cabal/Cabal/Distribution/Simple/Program/GHC.hs | bsd-3-clause | runGHC :: Verbosity -> ConfiguredProgram -> Compiler -> GhcOptions -> IO ()
runGHC verbosity ghcProg comp opts = do
runProgramInvocation verbosity (ghcInvocation ghcProg comp opts) | 182 | runGHC :: Verbosity -> ConfiguredProgram -> Compiler -> GhcOptions -> IO ()
runGHC verbosity ghcProg comp opts = do
runProgramInvocation verbosity (ghcInvocation ghcProg comp opts) | 182 | runGHC verbosity ghcProg comp opts = do
runProgramInvocation verbosity (ghcInvocation ghcProg comp opts) | 106 | false | true | 0 | 11 | 26 | 64 | 29 | 35 | null | null |
CloudI/CloudI | src/api/haskell/external/bytestring-0.10.10.0/Data/ByteString/Lazy.hs | mit | -- | Write a 'ByteString' to a file.
--
writeFile :: FilePath -> ByteString -> IO ()
writeFile = modifyFile WriteMode | 117 | writeFile :: FilePath -> ByteString -> IO ()
writeFile = modifyFile WriteMode | 77 | writeFile = modifyFile WriteMode | 32 | true | true | 0 | 9 | 20 | 35 | 16 | 19 | null | null |
SeanTater/albemarle | test/NLP/Albemarle/Test/Dict.hs | bsd-3-clause | test = describe "Monoid-style Dictionary" $ do
let sentences = words <$> [
"Maybe not today. Maybe not tomorrow. But soon.",
"Pay no attention to the man behind the curtain.",
"Life is like a box of chocolates."]:: [[Text]]
it "Generates single dictionaries" $ do
let d = Dict.dictify $ head sentences
Dict.idOf d "tomorrow." `shouldBe` 6
Dict.countOf d "tomorrow." `shouldBe` 1
Dict.idOf d "Maybe" `shouldBe` 2
Dict.countOf d "Maybe" `shouldBe` 2
Dict.idOf d "punk?" `shouldBe` 0
Dict.countOf d "punk?" `shouldBe` 0
it "Generates all-words dictionaries" $ do
let d = Dict.dictifyAllWords sentences
Dict.idOf d "Maybe" `shouldBe` 3
Dict.countOf d "Maybe" `shouldBe` 2
it "Generates first-words dictionaries" $ do
let d = Dict.dictifyFirstWords sentences
Dict.idOf d "Maybe" `shouldBe` 3
Dict.countOf d "Maybe" `shouldBe` 1
it "Merges dictionaries" $ do
let d1 = Dict.dictify $ head sentences
let d2 = Dict.dictifyAllWords $ tail sentences
let d3 = Dict.dictifyAllWords sentences
d1 <> d2 `shouldBe` d3
d1 `shouldNotBe` d2 <> d3
it "Filters dictionaries" $ do
let d1 = Dict.dictify $ words "Maybe not today . Maybe not tomorrow . But soon ."
let d2 = Dict.dictify $ words "Maybe not Maybe not"
-- At least 2 times, not more than 25% (2.75), at most 100 words
Dict.filterDict 2 0.25 100 d1 `shouldBe` d2
Dict.idOf d1 "Maybe" `shouldBe` 3
let letters = [
"a t x y ",
"a b c d e f g h i j k q r s t u v x y z",
"a b c d e f g h i j k l m n o p q r s t u v x y z"]
let d3 = Dict.dictifyAllWords $ words <$> letters
let d4 = Dict.filterDict 2 0.25 15 d3
let uniq_letters = mconcat $ words <$> letters
for_ uniq_letters $ \letter -> case Dict.countOf d2 letter of
1 -> Dict.countOf d3 letter `shouldBe` 0 -- delete all
-- 2 is undefined. It should be uniformly distributed!
-- So we _don't_ just want r, s, u, v, and z to be deleted.
3 -> Dict.countOf d3 letter `shouldBe` 3 -- keep all
_ -> True `shouldBe` True
it "Remaps dictionaries" $ do
-- The example is the same as in "Filters dictionaries"
let d1 = Dict.dictify $ words "Maybe not today . Maybe not tomorrow . But soon ."
let d2 = Dict.dictify $ words "Maybe not Maybe not"
let remap = Dict.shift d1 d2
remap (Dict.idOf d1 "Maybe") `shouldBe` Dict.idOf d2 "Maybe"
remap (Dict.idOf d1 "") `shouldBe` 0
remap (Dict.idOf d1 "ggiuyg") `shouldBe` 0
-- \, Maybe, not
Dict.select d1 d2 `shouldBe` [0, 3, 4] | 2,684 | test = describe "Monoid-style Dictionary" $ do
let sentences = words <$> [
"Maybe not today. Maybe not tomorrow. But soon.",
"Pay no attention to the man behind the curtain.",
"Life is like a box of chocolates."]:: [[Text]]
it "Generates single dictionaries" $ do
let d = Dict.dictify $ head sentences
Dict.idOf d "tomorrow." `shouldBe` 6
Dict.countOf d "tomorrow." `shouldBe` 1
Dict.idOf d "Maybe" `shouldBe` 2
Dict.countOf d "Maybe" `shouldBe` 2
Dict.idOf d "punk?" `shouldBe` 0
Dict.countOf d "punk?" `shouldBe` 0
it "Generates all-words dictionaries" $ do
let d = Dict.dictifyAllWords sentences
Dict.idOf d "Maybe" `shouldBe` 3
Dict.countOf d "Maybe" `shouldBe` 2
it "Generates first-words dictionaries" $ do
let d = Dict.dictifyFirstWords sentences
Dict.idOf d "Maybe" `shouldBe` 3
Dict.countOf d "Maybe" `shouldBe` 1
it "Merges dictionaries" $ do
let d1 = Dict.dictify $ head sentences
let d2 = Dict.dictifyAllWords $ tail sentences
let d3 = Dict.dictifyAllWords sentences
d1 <> d2 `shouldBe` d3
d1 `shouldNotBe` d2 <> d3
it "Filters dictionaries" $ do
let d1 = Dict.dictify $ words "Maybe not today . Maybe not tomorrow . But soon ."
let d2 = Dict.dictify $ words "Maybe not Maybe not"
-- At least 2 times, not more than 25% (2.75), at most 100 words
Dict.filterDict 2 0.25 100 d1 `shouldBe` d2
Dict.idOf d1 "Maybe" `shouldBe` 3
let letters = [
"a t x y ",
"a b c d e f g h i j k q r s t u v x y z",
"a b c d e f g h i j k l m n o p q r s t u v x y z"]
let d3 = Dict.dictifyAllWords $ words <$> letters
let d4 = Dict.filterDict 2 0.25 15 d3
let uniq_letters = mconcat $ words <$> letters
for_ uniq_letters $ \letter -> case Dict.countOf d2 letter of
1 -> Dict.countOf d3 letter `shouldBe` 0 -- delete all
-- 2 is undefined. It should be uniformly distributed!
-- So we _don't_ just want r, s, u, v, and z to be deleted.
3 -> Dict.countOf d3 letter `shouldBe` 3 -- keep all
_ -> True `shouldBe` True
it "Remaps dictionaries" $ do
-- The example is the same as in "Filters dictionaries"
let d1 = Dict.dictify $ words "Maybe not today . Maybe not tomorrow . But soon ."
let d2 = Dict.dictify $ words "Maybe not Maybe not"
let remap = Dict.shift d1 d2
remap (Dict.idOf d1 "Maybe") `shouldBe` Dict.idOf d2 "Maybe"
remap (Dict.idOf d1 "") `shouldBe` 0
remap (Dict.idOf d1 "ggiuyg") `shouldBe` 0
-- \, Maybe, not
Dict.select d1 d2 `shouldBe` [0, 3, 4] | 2,684 | test = describe "Monoid-style Dictionary" $ do
let sentences = words <$> [
"Maybe not today. Maybe not tomorrow. But soon.",
"Pay no attention to the man behind the curtain.",
"Life is like a box of chocolates."]:: [[Text]]
it "Generates single dictionaries" $ do
let d = Dict.dictify $ head sentences
Dict.idOf d "tomorrow." `shouldBe` 6
Dict.countOf d "tomorrow." `shouldBe` 1
Dict.idOf d "Maybe" `shouldBe` 2
Dict.countOf d "Maybe" `shouldBe` 2
Dict.idOf d "punk?" `shouldBe` 0
Dict.countOf d "punk?" `shouldBe` 0
it "Generates all-words dictionaries" $ do
let d = Dict.dictifyAllWords sentences
Dict.idOf d "Maybe" `shouldBe` 3
Dict.countOf d "Maybe" `shouldBe` 2
it "Generates first-words dictionaries" $ do
let d = Dict.dictifyFirstWords sentences
Dict.idOf d "Maybe" `shouldBe` 3
Dict.countOf d "Maybe" `shouldBe` 1
it "Merges dictionaries" $ do
let d1 = Dict.dictify $ head sentences
let d2 = Dict.dictifyAllWords $ tail sentences
let d3 = Dict.dictifyAllWords sentences
d1 <> d2 `shouldBe` d3
d1 `shouldNotBe` d2 <> d3
it "Filters dictionaries" $ do
let d1 = Dict.dictify $ words "Maybe not today . Maybe not tomorrow . But soon ."
let d2 = Dict.dictify $ words "Maybe not Maybe not"
-- At least 2 times, not more than 25% (2.75), at most 100 words
Dict.filterDict 2 0.25 100 d1 `shouldBe` d2
Dict.idOf d1 "Maybe" `shouldBe` 3
let letters = [
"a t x y ",
"a b c d e f g h i j k q r s t u v x y z",
"a b c d e f g h i j k l m n o p q r s t u v x y z"]
let d3 = Dict.dictifyAllWords $ words <$> letters
let d4 = Dict.filterDict 2 0.25 15 d3
let uniq_letters = mconcat $ words <$> letters
for_ uniq_letters $ \letter -> case Dict.countOf d2 letter of
1 -> Dict.countOf d3 letter `shouldBe` 0 -- delete all
-- 2 is undefined. It should be uniformly distributed!
-- So we _don't_ just want r, s, u, v, and z to be deleted.
3 -> Dict.countOf d3 letter `shouldBe` 3 -- keep all
_ -> True `shouldBe` True
it "Remaps dictionaries" $ do
-- The example is the same as in "Filters dictionaries"
let d1 = Dict.dictify $ words "Maybe not today . Maybe not tomorrow . But soon ."
let d2 = Dict.dictify $ words "Maybe not Maybe not"
let remap = Dict.shift d1 d2
remap (Dict.idOf d1 "Maybe") `shouldBe` Dict.idOf d2 "Maybe"
remap (Dict.idOf d1 "") `shouldBe` 0
remap (Dict.idOf d1 "ggiuyg") `shouldBe` 0
-- \, Maybe, not
Dict.select d1 d2 `shouldBe` [0, 3, 4] | 2,684 | false | false | 0 | 18 | 763 | 765 | 373 | 392 | null | null |
nevrenato/Hets_Fork | CSL/Keywords.hs | gpl-2.0 | sym_equalS :: String
sym_equalS = "=" | 37 | sym_equalS :: String
sym_equalS = "=" | 37 | sym_equalS = "=" | 16 | false | true | 0 | 6 | 5 | 18 | 7 | 11 | null | null |
forsyde/forsyde-atom | src/ForSyDe/Atom/Skel/FastVector/Matrix.hs | bsd-3-clause | farm21 :: (a -> b -> c)
-> Matrix a -- ^ /size/ = @(xa,ya)@
-> Matrix b -- ^ /size/ = @(xb,yb)@
-> Matrix c -- ^ /size/ = @(minimum [xa,xb], minimum [ya,yb])@
farm21 f = V.farm21 (V.farm21 f) | 224 | farm21 :: (a -> b -> c)
-> Matrix a -- ^ /size/ = @(xa,ya)@
-> Matrix b -- ^ /size/ = @(xb,yb)@
-> Matrix c
farm21 f = V.farm21 (V.farm21 f) | 173 | farm21 f = V.farm21 (V.farm21 f) | 32 | true | true | 0 | 8 | 72 | 62 | 31 | 31 | null | null |
forked-upstream-packages-for-ghcjs/ghc | testsuite/tests/rename/should_fail/rnfail045.hs | bsd-3-clause | x `op2` y = True | 16 | x `op2` y = True | 16 | x `op2` y = True | 16 | false | false | 0 | 5 | 4 | 18 | 8 | 10 | null | null |
AngelitoJ/HsDynamics | src/ConstrainOptimization.hs | bsd-3-clause | updateHess :: Position -> Gradient -> Hessian -> Hessian
updateHess dx dgrad hess = hess `add` termGrad `sub` termHess
where termGrad = scale (recip $ dgrad <.> dx) $ (toMatrixColumn dgrad) <> (toMatrixRow dgrad)
termHess = scale (recip dot) $ mtx1 <> mtx2
dot = dx <.> (hess <> dx)
mtx1 = hess <> (toMatrixColumn dx)
mtx2 = trans mtx1 | 371 | updateHess :: Position -> Gradient -> Hessian -> Hessian
updateHess dx dgrad hess = hess `add` termGrad `sub` termHess
where termGrad = scale (recip $ dgrad <.> dx) $ (toMatrixColumn dgrad) <> (toMatrixRow dgrad)
termHess = scale (recip dot) $ mtx1 <> mtx2
dot = dx <.> (hess <> dx)
mtx1 = hess <> (toMatrixColumn dx)
mtx2 = trans mtx1 | 371 | updateHess dx dgrad hess = hess `add` termGrad `sub` termHess
where termGrad = scale (recip $ dgrad <.> dx) $ (toMatrixColumn dgrad) <> (toMatrixRow dgrad)
termHess = scale (recip dot) $ mtx1 <> mtx2
dot = dx <.> (hess <> dx)
mtx1 = hess <> (toMatrixColumn dx)
mtx2 = trans mtx1 | 314 | false | true | 10 | 9 | 95 | 172 | 79 | 93 | null | null |
phdenzel/dotfiles | .config/xmonad/xmonad.hs | mit | -- | Finally, a copy of the default bindings in simple textual tabular format.
help :: String
help = unlines [
"The modifier key is 'Super'. Default keybindings:",
"",
"-- launching and killing programs",
"mod-Shift-Enter Launch xterminal",
"mod-p Launch dmenu",
"mod-Shift-p Launch gmrun",
"mod-Shift-c Close/kill the focused window",
"mod-Space Rotate through the available layout algorithms",
"mod-Shift-Space Reset the layouts on the current workSpace to default",
"mod-n Resize/refresh viewed windows to the correct size",
"",
"-- move focus up or down the window stack",
"mod-Tab Move focus to the next window",
"mod-Shift-Tab Move focus to the previous window",
"mod-j Move focus to the next window",
"mod-k Move focus to the previous window",
"mod-m Move focus to the master window",
"",
"-- modifying the window order",
"mod-Return Swap the focused window and the master window",
"mod-Shift-j Swap the focused window with the next window",
"mod-Shift-k Swap the focused window with the previous window",
"",
"-- resizing the master/slave ratio",
"mod-h Shrink the master area",
"mod-l Expand the master area",
"",
"-- floating layer support",
"mod-t Push window back into tiling; unfloat and re-tile it",
"",
"-- increase or decrease number of windows in the master area",
"mod-comma (mod-,) Increment the number of windows in the master area",
"mod-period (mod-.) Deincrement the number of windows in the master area",
"",
"-- quit, or restart",
"mod-Shift-q Quit xmonad",
"mod-q Restart xmonad",
"mod-[1..9] Switch to workSpace N",
"",
"-- Workspaces & screens",
"mod-Shift-[1..9] Move client to workspace N",
"mod-{w,e,r} Switch to physical/Xinerama screens 1, 2, or 3",
"mod-Shift-{w,e,r} Move client to screen 1, 2, or 3",
"",
"-- Mouse bindings: default actions bound to mouse events",
"mod-button1 Set the window to floating mode and move by dragging",
"mod-button2 Raise the window to the top of the stack",
"mod-button3 Set the window to floating mode and resize by dragging"] | 2,201 | help :: String
help = unlines [
"The modifier key is 'Super'. Default keybindings:",
"",
"-- launching and killing programs",
"mod-Shift-Enter Launch xterminal",
"mod-p Launch dmenu",
"mod-Shift-p Launch gmrun",
"mod-Shift-c Close/kill the focused window",
"mod-Space Rotate through the available layout algorithms",
"mod-Shift-Space Reset the layouts on the current workSpace to default",
"mod-n Resize/refresh viewed windows to the correct size",
"",
"-- move focus up or down the window stack",
"mod-Tab Move focus to the next window",
"mod-Shift-Tab Move focus to the previous window",
"mod-j Move focus to the next window",
"mod-k Move focus to the previous window",
"mod-m Move focus to the master window",
"",
"-- modifying the window order",
"mod-Return Swap the focused window and the master window",
"mod-Shift-j Swap the focused window with the next window",
"mod-Shift-k Swap the focused window with the previous window",
"",
"-- resizing the master/slave ratio",
"mod-h Shrink the master area",
"mod-l Expand the master area",
"",
"-- floating layer support",
"mod-t Push window back into tiling; unfloat and re-tile it",
"",
"-- increase or decrease number of windows in the master area",
"mod-comma (mod-,) Increment the number of windows in the master area",
"mod-period (mod-.) Deincrement the number of windows in the master area",
"",
"-- quit, or restart",
"mod-Shift-q Quit xmonad",
"mod-q Restart xmonad",
"mod-[1..9] Switch to workSpace N",
"",
"-- Workspaces & screens",
"mod-Shift-[1..9] Move client to workspace N",
"mod-{w,e,r} Switch to physical/Xinerama screens 1, 2, or 3",
"mod-Shift-{w,e,r} Move client to screen 1, 2, or 3",
"",
"-- Mouse bindings: default actions bound to mouse events",
"mod-button1 Set the window to floating mode and move by dragging",
"mod-button2 Raise the window to the top of the stack",
"mod-button3 Set the window to floating mode and resize by dragging"] | 2,122 | help = unlines [
"The modifier key is 'Super'. Default keybindings:",
"",
"-- launching and killing programs",
"mod-Shift-Enter Launch xterminal",
"mod-p Launch dmenu",
"mod-Shift-p Launch gmrun",
"mod-Shift-c Close/kill the focused window",
"mod-Space Rotate through the available layout algorithms",
"mod-Shift-Space Reset the layouts on the current workSpace to default",
"mod-n Resize/refresh viewed windows to the correct size",
"",
"-- move focus up or down the window stack",
"mod-Tab Move focus to the next window",
"mod-Shift-Tab Move focus to the previous window",
"mod-j Move focus to the next window",
"mod-k Move focus to the previous window",
"mod-m Move focus to the master window",
"",
"-- modifying the window order",
"mod-Return Swap the focused window and the master window",
"mod-Shift-j Swap the focused window with the next window",
"mod-Shift-k Swap the focused window with the previous window",
"",
"-- resizing the master/slave ratio",
"mod-h Shrink the master area",
"mod-l Expand the master area",
"",
"-- floating layer support",
"mod-t Push window back into tiling; unfloat and re-tile it",
"",
"-- increase or decrease number of windows in the master area",
"mod-comma (mod-,) Increment the number of windows in the master area",
"mod-period (mod-.) Deincrement the number of windows in the master area",
"",
"-- quit, or restart",
"mod-Shift-q Quit xmonad",
"mod-q Restart xmonad",
"mod-[1..9] Switch to workSpace N",
"",
"-- Workspaces & screens",
"mod-Shift-[1..9] Move client to workspace N",
"mod-{w,e,r} Switch to physical/Xinerama screens 1, 2, or 3",
"mod-Shift-{w,e,r} Move client to screen 1, 2, or 3",
"",
"-- Mouse bindings: default actions bound to mouse events",
"mod-button1 Set the window to floating mode and move by dragging",
"mod-button2 Raise the window to the top of the stack",
"mod-button3 Set the window to floating mode and resize by dragging"] | 2,107 | true | true | 0 | 6 | 509 | 165 | 105 | 60 | null | null |
JamieBeverley/InnerEar | src/InnerEar/Exercises/MultipleChoice.hs | gpl-3.0 | answerSelected _ s | mode s == ExploreMode = s | 46 | answerSelected _ s | mode s == ExploreMode = s | 46 | answerSelected _ s | mode s == ExploreMode = s | 46 | false | false | 0 | 9 | 9 | 24 | 10 | 14 | null | null |
psibi/yesod | yesod-core/Yesod/Core/Widget.hs | mit | -- | Link to the specified remote stylesheet.
addStylesheetRemote :: MonadWidget m => Text -> m ()
addStylesheetRemote = flip addStylesheetRemoteAttrs [] | 153 | addStylesheetRemote :: MonadWidget m => Text -> m ()
addStylesheetRemote = flip addStylesheetRemoteAttrs [] | 107 | addStylesheetRemote = flip addStylesheetRemoteAttrs [] | 54 | true | true | 0 | 8 | 21 | 35 | 17 | 18 | null | null |
alexander-at-github/eta | compiler/ETA/BasicTypes/Literal.hs | bsd-3-clause | inCharRange :: Char -> Bool
inCharRange c = c >= '\0' && c <= chr tARGET_MAX_CHAR | 82 | inCharRange :: Char -> Bool
inCharRange c = c >= '\0' && c <= chr tARGET_MAX_CHAR | 82 | inCharRange c = c >= '\0' && c <= chr tARGET_MAX_CHAR | 54 | false | true | 0 | 7 | 16 | 33 | 16 | 17 | null | null |
snoyberg/ghc | compiler/main/HscTypes.hs | bsd-3-clause | metaRequestD :: Functor f => MetaHook f -> LHsExpr Id -> f [LHsDecl RdrName]
metaRequestD h = fmap unMetaResD . h (MetaD MetaResD) | 130 | metaRequestD :: Functor f => MetaHook f -> LHsExpr Id -> f [LHsDecl RdrName]
metaRequestD h = fmap unMetaResD . h (MetaD MetaResD) | 130 | metaRequestD h = fmap unMetaResD . h (MetaD MetaResD) | 53 | false | true | 1 | 11 | 22 | 65 | 28 | 37 | null | null |
facebookincubator/duckling | Duckling/Rules/BN.hs | bsd-3-clause | localeRules _ _ = [] | 20 | localeRules _ _ = [] | 20 | localeRules _ _ = [] | 20 | false | false | 1 | 6 | 4 | 14 | 6 | 8 | null | null |
choener/GrammarProducts | old/BioInf/GrammarProducts.hs | gpl-3.0 | ruleProduct xs' ys' = combine xs ys where
xs = groupBy ((==) `on` symType) xs'
ys = groupBy ((==) `on` symType) ys'
combine :: [[VSym]] -> [[VSym]] -> [VSym]
combine [] [] = []
combine (as:ass) []
| symType as == N = error $ "can't handle unmatched non-terminals in: " ++ show (xs',ys')
| otherwise = prod as [] ++ combine ass []
combine [] (bs:bss)
| symType bs == N = error $ "can't handle unmatched non-terminals in: " ++ show (xs',ys')
| otherwise = prod [] bs ++ combine [] bss
combine (as:ass) (bs:bss)
| symType as == symType bs = prod as bs ++ combine ass bss
| symType as == T = prod as [] ++ combine ass (bs:bss)
| symType bs == T = prod [] bs ++ combine (as:ass) bss
prod :: [VSym] -> [VSym] -> [VSym]
-- lonely terminal in as
prod as []
| symType as == T = take (length as) $ zipWith (\(VSym a) (VSym b) -> VSym $ a++b) as bs'
-- lonely terminal in bs
prod [] bs
| symType bs == T = take (length bs) $ zipWith (\(VSym a) (VSym b) -> VSym $ a++b) as' bs
-- combination of non-terminals
prod as bs
| symType as == N
, symType bs == N
, length as == length bs = zipWith (\(VSym a) (VSym b) -> VSym $ a++b) as bs
-- non-terminal special error handling
| symType as == N
, symType bs == N = error $ "can't handle different-length group of non-terminals: " ++ show (xs',ys')
-- terminals of different lengths are handled by injecting ``delete'' symbols
| symType as == T
, symType bs == T = take (max (length as) (length bs)) $ zipWith (\(VSym a) (VSym b) -> VSym $ a++b) (as++as') (bs++bs')
-- some other error occured
prod _ _ = error $ "ran into a 'prod' error: " ++ show (xs',ys')
as' = let (VSym a:_) = xs' in repeat (VSym $ replicate (length a) (Sym T "-"))
bs' = let (VSym b:_) = ys' in repeat (VSym $ replicate (length b) (Sym T "-"))
-- | Removal of a symbol and cleanup of rules
-- | consistency check
-- ** old
--testF (f :: forall c . Show c => c -> String) (a,b) = (f a, f b) | 2,042 | ruleProduct xs' ys' = combine xs ys where
xs = groupBy ((==) `on` symType) xs'
ys = groupBy ((==) `on` symType) ys'
combine :: [[VSym]] -> [[VSym]] -> [VSym]
combine [] [] = []
combine (as:ass) []
| symType as == N = error $ "can't handle unmatched non-terminals in: " ++ show (xs',ys')
| otherwise = prod as [] ++ combine ass []
combine [] (bs:bss)
| symType bs == N = error $ "can't handle unmatched non-terminals in: " ++ show (xs',ys')
| otherwise = prod [] bs ++ combine [] bss
combine (as:ass) (bs:bss)
| symType as == symType bs = prod as bs ++ combine ass bss
| symType as == T = prod as [] ++ combine ass (bs:bss)
| symType bs == T = prod [] bs ++ combine (as:ass) bss
prod :: [VSym] -> [VSym] -> [VSym]
-- lonely terminal in as
prod as []
| symType as == T = take (length as) $ zipWith (\(VSym a) (VSym b) -> VSym $ a++b) as bs'
-- lonely terminal in bs
prod [] bs
| symType bs == T = take (length bs) $ zipWith (\(VSym a) (VSym b) -> VSym $ a++b) as' bs
-- combination of non-terminals
prod as bs
| symType as == N
, symType bs == N
, length as == length bs = zipWith (\(VSym a) (VSym b) -> VSym $ a++b) as bs
-- non-terminal special error handling
| symType as == N
, symType bs == N = error $ "can't handle different-length group of non-terminals: " ++ show (xs',ys')
-- terminals of different lengths are handled by injecting ``delete'' symbols
| symType as == T
, symType bs == T = take (max (length as) (length bs)) $ zipWith (\(VSym a) (VSym b) -> VSym $ a++b) (as++as') (bs++bs')
-- some other error occured
prod _ _ = error $ "ran into a 'prod' error: " ++ show (xs',ys')
as' = let (VSym a:_) = xs' in repeat (VSym $ replicate (length a) (Sym T "-"))
bs' = let (VSym b:_) = ys' in repeat (VSym $ replicate (length b) (Sym T "-"))
-- | Removal of a symbol and cleanup of rules
-- | consistency check
-- ** old
--testF (f :: forall c . Show c => c -> String) (a,b) = (f a, f b) | 2,042 | ruleProduct xs' ys' = combine xs ys where
xs = groupBy ((==) `on` symType) xs'
ys = groupBy ((==) `on` symType) ys'
combine :: [[VSym]] -> [[VSym]] -> [VSym]
combine [] [] = []
combine (as:ass) []
| symType as == N = error $ "can't handle unmatched non-terminals in: " ++ show (xs',ys')
| otherwise = prod as [] ++ combine ass []
combine [] (bs:bss)
| symType bs == N = error $ "can't handle unmatched non-terminals in: " ++ show (xs',ys')
| otherwise = prod [] bs ++ combine [] bss
combine (as:ass) (bs:bss)
| symType as == symType bs = prod as bs ++ combine ass bss
| symType as == T = prod as [] ++ combine ass (bs:bss)
| symType bs == T = prod [] bs ++ combine (as:ass) bss
prod :: [VSym] -> [VSym] -> [VSym]
-- lonely terminal in as
prod as []
| symType as == T = take (length as) $ zipWith (\(VSym a) (VSym b) -> VSym $ a++b) as bs'
-- lonely terminal in bs
prod [] bs
| symType bs == T = take (length bs) $ zipWith (\(VSym a) (VSym b) -> VSym $ a++b) as' bs
-- combination of non-terminals
prod as bs
| symType as == N
, symType bs == N
, length as == length bs = zipWith (\(VSym a) (VSym b) -> VSym $ a++b) as bs
-- non-terminal special error handling
| symType as == N
, symType bs == N = error $ "can't handle different-length group of non-terminals: " ++ show (xs',ys')
-- terminals of different lengths are handled by injecting ``delete'' symbols
| symType as == T
, symType bs == T = take (max (length as) (length bs)) $ zipWith (\(VSym a) (VSym b) -> VSym $ a++b) (as++as') (bs++bs')
-- some other error occured
prod _ _ = error $ "ran into a 'prod' error: " ++ show (xs',ys')
as' = let (VSym a:_) = xs' in repeat (VSym $ replicate (length a) (Sym T "-"))
bs' = let (VSym b:_) = ys' in repeat (VSym $ replicate (length b) (Sym T "-"))
-- | Removal of a symbol and cleanup of rules
-- | consistency check
-- ** old
--testF (f :: forall c . Show c => c -> String) (a,b) = (f a, f b) | 2,042 | false | false | 0 | 14 | 541 | 947 | 469 | 478 | null | null |
amccausl/Swish | Swish/HaskellRDF/GraphTest.hs | lgpl-2.1 | v105 = LV "v105" | 17 | v105 = LV "v105" | 17 | v105 = LV "v105" | 17 | false | false | 0 | 5 | 4 | 9 | 4 | 5 | null | null |
fredmorcos/attic | snippets/haskell/Happstack.hs | isc | fortune :: ServerPart Response
fortune = msum [ viewFortune, updateFortune ]
where
viewFortune :: ServerPart Response
viewFortune =
do method GET
mMemory <- optional $ lookCookieValue "fortune"
let memory = fromMaybe "Your future will be filled with web programming." mMemory
ok $ template "fortune" $ do
H.p "The message in your (fortune) cookie says:"
H.p (toHtml memory)
form ! action "/fortune" ! enctype "multipart/form-data" ! A.method "POST" $ do
label ! A.for "fortune" $ "Change your fortune: "
input ! type_ "text" ! A.id "fortune" ! name "new_fortune"
input ! type_ "submit" ! value "Say it!"
updateFortune :: ServerPart Response
updateFortune =
do method POST
fortune <- lookText "new_fortune"
addCookies [(Session, mkCookie "fortune" (unpack fortune))]
seeOther ("/fortune" :: String) (toResponse ()) | 1,060 | fortune :: ServerPart Response
fortune = msum [ viewFortune, updateFortune ]
where
viewFortune :: ServerPart Response
viewFortune =
do method GET
mMemory <- optional $ lookCookieValue "fortune"
let memory = fromMaybe "Your future will be filled with web programming." mMemory
ok $ template "fortune" $ do
H.p "The message in your (fortune) cookie says:"
H.p (toHtml memory)
form ! action "/fortune" ! enctype "multipart/form-data" ! A.method "POST" $ do
label ! A.for "fortune" $ "Change your fortune: "
input ! type_ "text" ! A.id "fortune" ! name "new_fortune"
input ! type_ "submit" ! value "Say it!"
updateFortune :: ServerPart Response
updateFortune =
do method POST
fortune <- lookText "new_fortune"
addCookies [(Session, mkCookie "fortune" (unpack fortune))]
seeOther ("/fortune" :: String) (toResponse ()) | 1,060 | fortune = msum [ viewFortune, updateFortune ]
where
viewFortune :: ServerPart Response
viewFortune =
do method GET
mMemory <- optional $ lookCookieValue "fortune"
let memory = fromMaybe "Your future will be filled with web programming." mMemory
ok $ template "fortune" $ do
H.p "The message in your (fortune) cookie says:"
H.p (toHtml memory)
form ! action "/fortune" ! enctype "multipart/form-data" ! A.method "POST" $ do
label ! A.for "fortune" $ "Change your fortune: "
input ! type_ "text" ! A.id "fortune" ! name "new_fortune"
input ! type_ "submit" ! value "Say it!"
updateFortune :: ServerPart Response
updateFortune =
do method POST
fortune <- lookText "new_fortune"
addCookies [(Session, mkCookie "fortune" (unpack fortune))]
seeOther ("/fortune" :: String) (toResponse ()) | 1,029 | false | true | 3 | 16 | 367 | 285 | 124 | 161 | null | null |
jozefg/pcf | src/Language/Pcf.hs | mit | fauxc (IfzL i t e) = do
v <- gen
e' <- abstract1 v <$> fauxc (instantiate1 (VL v) e)
IfzFC <$> fauxc i <*> fauxc t <*> return e' | 134 | fauxc (IfzL i t e) = do
v <- gen
e' <- abstract1 v <$> fauxc (instantiate1 (VL v) e)
IfzFC <$> fauxc i <*> fauxc t <*> return e' | 134 | fauxc (IfzL i t e) = do
v <- gen
e' <- abstract1 v <$> fauxc (instantiate1 (VL v) e)
IfzFC <$> fauxc i <*> fauxc t <*> return e' | 134 | false | false | 0 | 13 | 35 | 81 | 36 | 45 | null | null |
brendanhay/gogol | gogol-manufacturers/gen/Network/Google/Manufacturers/Types/Product.hs | mpl-2.0 | -- | Creates a value of 'Issue' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'issAttribute'
--
-- * 'issDestination'
--
-- * 'issSeverity'
--
-- * 'issResolution'
--
-- * 'issTitle'
--
-- * 'issType'
--
-- * 'issTimestamp'
--
-- * 'issDescription'
issue
:: Issue
issue =
Issue'
{ _issAttribute = Nothing
, _issDestination = Nothing
, _issSeverity = Nothing
, _issResolution = Nothing
, _issTitle = Nothing
, _issType = Nothing
, _issTimestamp = Nothing
, _issDescription = Nothing
} | 612 | issue
:: Issue
issue =
Issue'
{ _issAttribute = Nothing
, _issDestination = Nothing
, _issSeverity = Nothing
, _issResolution = Nothing
, _issTitle = Nothing
, _issType = Nothing
, _issTimestamp = Nothing
, _issDescription = Nothing
} | 276 | issue =
Issue'
{ _issAttribute = Nothing
, _issDestination = Nothing
, _issSeverity = Nothing
, _issResolution = Nothing
, _issTitle = Nothing
, _issType = Nothing
, _issTimestamp = Nothing
, _issDescription = Nothing
} | 257 | true | true | 0 | 7 | 142 | 90 | 60 | 30 | null | null |
kejace/ethereum-data-sql | src/Blockchain/ExtWord.hs | bsd-3-clause | word128ToBytes::Word128->[Word8]
word128ToBytes word = map (fromIntegral . (word `shiftR`)) [128-8, 128-16..0] | 110 | word128ToBytes::Word128->[Word8]
word128ToBytes word = map (fromIntegral . (word `shiftR`)) [128-8, 128-16..0] | 110 | word128ToBytes word = map (fromIntegral . (word `shiftR`)) [128-8, 128-16..0] | 77 | false | true | 0 | 8 | 10 | 55 | 31 | 24 | null | null |
sqd/haskell-C89-interpreter | Parse.hs | mit | mergeOps (a:b:xs) =
if a ++ b `elem` list
then (a ++ b):(mergeOps xs)
else a:(mergeOps (b:xs))
where
list = ["++", "--", "+=", "-=", "*=", "/=", "&&", "||", "==", "!=", ">=", "<=", ">>", "<<", "^=", "|=", "&=", "%=", "->"]
-- >>= and <<=, shame you for being the only 3-char operators
-- Input: initialization list WITH BOTH BRACES | 364 | mergeOps (a:b:xs) =
if a ++ b `elem` list
then (a ++ b):(mergeOps xs)
else a:(mergeOps (b:xs))
where
list = ["++", "--", "+=", "-=", "*=", "/=", "&&", "||", "==", "!=", ">=", "<=", ">>", "<<", "^=", "|=", "&=", "%=", "->"]
-- >>= and <<=, shame you for being the only 3-char operators
-- Input: initialization list WITH BOTH BRACES | 364 | mergeOps (a:b:xs) =
if a ++ b `elem` list
then (a ++ b):(mergeOps xs)
else a:(mergeOps (b:xs))
where
list = ["++", "--", "+=", "-=", "*=", "/=", "&&", "||", "==", "!=", ">=", "<=", ">>", "<<", "^=", "|=", "&=", "%=", "->"]
-- >>= and <<=, shame you for being the only 3-char operators
-- Input: initialization list WITH BOTH BRACES | 364 | false | false | 0 | 10 | 90 | 138 | 83 | 55 | null | null |
Happy0/liscrabble | src/Controllers/GameLobby/CreateGame.hs | gpl-2.0 | addGameLobby :: App -> Text -> Game -> Int -> IO ()
addGameLobby app gameId game numPlayers =
do
generator <- getStdGen
timeCreated <- getCurrentTime
atomically $ do
let lobbies = gameLobbies app
broadcastChan <- newBroadcastTChan
newGenerator <- newTVar generator
gameLobby <- newTVar (GameLobby game [] numPlayers broadcastChan newGenerator timeCreated)
modifyTVar lobbies $ M.insert gameId gameLobby | 530 | addGameLobby :: App -> Text -> Game -> Int -> IO ()
addGameLobby app gameId game numPlayers =
do
generator <- getStdGen
timeCreated <- getCurrentTime
atomically $ do
let lobbies = gameLobbies app
broadcastChan <- newBroadcastTChan
newGenerator <- newTVar generator
gameLobby <- newTVar (GameLobby game [] numPlayers broadcastChan newGenerator timeCreated)
modifyTVar lobbies $ M.insert gameId gameLobby | 526 | addGameLobby app gameId game numPlayers =
do
generator <- getStdGen
timeCreated <- getCurrentTime
atomically $ do
let lobbies = gameLobbies app
broadcastChan <- newBroadcastTChan
newGenerator <- newTVar generator
gameLobby <- newTVar (GameLobby game [] numPlayers broadcastChan newGenerator timeCreated)
modifyTVar lobbies $ M.insert gameId gameLobby | 474 | false | true | 0 | 15 | 183 | 141 | 62 | 79 | null | null |
amccausl/Swish | Swish/HaskellRDF/RDFGraphTest.hs | lgpl-2.1 | testGraphFormula09c = testFormulaLookup "09c" f9 s3 Nothing | 59 | testGraphFormula09c = testFormulaLookup "09c" f9 s3 Nothing | 59 | testGraphFormula09c = testFormulaLookup "09c" f9 s3 Nothing | 59 | false | false | 0 | 5 | 6 | 15 | 7 | 8 | null | null |
quickdudley/hypermine | World/Geometry.hs | agpl-3.0 | {-
Calculating the edge length:
1: The corners of each pentagon are right-angled
2: If the pentagon is divided into 5 triangles: each triangle has 2 angles
of Π/4, and one of 2Π/5
3: The relevant trigonometric formula is:
cosC = -cosA cosB + sinA sinB cosh c
Substitute A for B because they are the same and rearranged:
c = arcosh ((cos C + (cos A)^2) / (sin A)^2)
c = arcosh ((cos 2Π/5 + (cos Π/4)^2) / (sin Π/4)^2)
-}
angle x y z = let
a = distance x y
b = distance x z
c = distance y z
in acos ((cosh a * cosh b - cosh c) / (sinh a * sinh b)) | 558 | angle x y z = let
a = distance x y
b = distance x z
c = distance y z
in acos ((cosh a * cosh b - cosh c) / (sinh a * sinh b)) | 133 | angle x y z = let
a = distance x y
b = distance x z
c = distance y z
in acos ((cosh a * cosh b - cosh c) / (sinh a * sinh b)) | 133 | true | false | 0 | 13 | 131 | 93 | 44 | 49 | null | null |
GaloisInc/saw-script | cryptol-saw-core/src/Verifier/SAW/Cryptol.hs | bsd-3-clause | tNestedTuple [t] = t | 20 | tNestedTuple [t] = t | 20 | tNestedTuple [t] = t | 20 | false | false | 0 | 6 | 3 | 12 | 6 | 6 | null | null |
kosmoskatten/programmable-endpoint-demo | src/Behaviors/Counter.hs | mit | -- | Add to the total fetch time.
addTotalFetchTime :: NominalDiffTime -> Counter -> Counter
addTotalFetchTime duration c =
c { totalFetchTime = totalFetchTime c + duration } | 177 | addTotalFetchTime :: NominalDiffTime -> Counter -> Counter
addTotalFetchTime duration c =
c { totalFetchTime = totalFetchTime c + duration } | 143 | addTotalFetchTime duration c =
c { totalFetchTime = totalFetchTime c + duration } | 84 | true | true | 0 | 9 | 30 | 44 | 22 | 22 | null | null |
dmwit/beeminder-api | Data/Aeson/Encode/Shim.hs | bsd-3-clause | string :: T.Text -> Builder
string s = {-# SCC "string" #-} singleton '"' <> quote s <> singleton '"'
where
quote q = case T.uncons t of
Nothing -> fromText h
Just (!c,t') -> fromText h <> escape c <> quote t'
where (h,t) = {-# SCC "break" #-} T.break isEscape q
isEscape c = c == '\"' ||
c == '\\' ||
c == '<' ||
c == '>' ||
c < '\x20'
escape '\"' = "\\\""
escape '\\' = "\\\\"
escape '\n' = "\\n"
escape '\r' = "\\r"
escape '\t' = "\\t"
-- The following prevents untrusted JSON strings containing </script> or -->
-- from causing an XSS vulnerability:
escape '<' = "\\u003c"
escape '>' = "\\u003e"
escape c
| c < '\x20' = fromString $ "\\u" ++ replicate (4 - length h) '0' ++ h
| otherwise = singleton c
where h = showHex (fromEnum c) "" | 933 | string :: T.Text -> Builder
string s = {-# SCC "string" #-} singleton '"' <> quote s <> singleton '"'
where
quote q = case T.uncons t of
Nothing -> fromText h
Just (!c,t') -> fromText h <> escape c <> quote t'
where (h,t) = {-# SCC "break" #-} T.break isEscape q
isEscape c = c == '\"' ||
c == '\\' ||
c == '<' ||
c == '>' ||
c < '\x20'
escape '\"' = "\\\""
escape '\\' = "\\\\"
escape '\n' = "\\n"
escape '\r' = "\\r"
escape '\t' = "\\t"
-- The following prevents untrusted JSON strings containing </script> or -->
-- from causing an XSS vulnerability:
escape '<' = "\\u003c"
escape '>' = "\\u003e"
escape c
| c < '\x20' = fromString $ "\\u" ++ replicate (4 - length h) '0' ++ h
| otherwise = singleton c
where h = showHex (fromEnum c) "" | 933 | string s = {-# SCC "string" #-} singleton '"' <> quote s <> singleton '"'
where
quote q = case T.uncons t of
Nothing -> fromText h
Just (!c,t') -> fromText h <> escape c <> quote t'
where (h,t) = {-# SCC "break" #-} T.break isEscape q
isEscape c = c == '\"' ||
c == '\\' ||
c == '<' ||
c == '>' ||
c < '\x20'
escape '\"' = "\\\""
escape '\\' = "\\\\"
escape '\n' = "\\n"
escape '\r' = "\\r"
escape '\t' = "\\t"
-- The following prevents untrusted JSON strings containing </script> or -->
-- from causing an XSS vulnerability:
escape '<' = "\\u003c"
escape '>' = "\\u003e"
escape c
| c < '\x20' = fromString $ "\\u" ++ replicate (4 - length h) '0' ++ h
| otherwise = singleton c
where h = showHex (fromEnum c) "" | 905 | false | true | 10 | 14 | 344 | 346 | 150 | 196 | null | null |
chrisdotcode/hackage-server | tests/Run.hs | bsd-3-clause | systemSession :: FilePath -> [String] -> IO ProcessID
systemSession cmd args =
forkProcess $ do
void createSession
executeFile cmd False args Nothing
-- need to use exec() directly here, rather than something like
-- System.Process.system, because we are in a forked child and some
-- pthread libraries get all upset if you start doing certain
-- things in a forked child of a pthread process, such as forking
-- more threads. | 448 | systemSession :: FilePath -> [String] -> IO ProcessID
systemSession cmd args =
forkProcess $ do
void createSession
executeFile cmd False args Nothing
-- need to use exec() directly here, rather than something like
-- System.Process.system, because we are in a forked child and some
-- pthread libraries get all upset if you start doing certain
-- things in a forked child of a pthread process, such as forking
-- more threads. | 448 | systemSession cmd args =
forkProcess $ do
void createSession
executeFile cmd False args Nothing
-- need to use exec() directly here, rather than something like
-- System.Process.system, because we are in a forked child and some
-- pthread libraries get all upset if you start doing certain
-- things in a forked child of a pthread process, such as forking
-- more threads. | 394 | false | true | 0 | 8 | 92 | 57 | 29 | 28 | null | null |
mitar/nxt | src/Status.hs | lgpl-3.0 | options :: [OptDescr Option]
options = [
Option "h" ["help"] (NoArg Help) "show this help",
Option "d" ["device"] (ReqArg Device "filename") "serial port device"
] | 173 | options :: [OptDescr Option]
options = [
Option "h" ["help"] (NoArg Help) "show this help",
Option "d" ["device"] (ReqArg Device "filename") "serial port device"
] | 173 | options = [
Option "h" ["help"] (NoArg Help) "show this help",
Option "d" ["device"] (ReqArg Device "filename") "serial port device"
] | 144 | false | true | 0 | 9 | 34 | 68 | 33 | 35 | null | null |
pgj/bead | src/Bead/View/ContentHandler.hs | bsd-3-clause | blazeI18n :: (I18N -> Html) -> ContentHandler ()
blazeI18n h = i18nE >>= blaze . h | 82 | blazeI18n :: (I18N -> Html) -> ContentHandler ()
blazeI18n h = i18nE >>= blaze . h | 82 | blazeI18n h = i18nE >>= blaze . h | 33 | false | true | 0 | 7 | 15 | 38 | 19 | 19 | null | null |
lambdacms/lambdacms.org | lambdacmsorg-tutorial/LambdaCmsOrg/Tutorial/Message.hs | mit | englishMessage Content = "Content" | 49 | englishMessage Content = "Content" | 49 | englishMessage Content = "Content" | 49 | false | false | 0 | 4 | 18 | 10 | 4 | 6 | null | null |
DougBurke/swish | tests/N3ParserTest.hs | lgpl-2.1 | tx1507 = arc b1 p1 o1 | 21 | tx1507 = arc b1 p1 o1 | 21 | tx1507 = arc b1 p1 o1 | 21 | false | false | 1 | 5 | 5 | 19 | 6 | 13 | null | null |
beni55/haste-compiler | libraries/ghc-7.10/base/Data/Void.hs | bsd-3-clause | -- | If 'Void' is uninhabited then any 'Functor' that holds only
-- values of type 'Void' is holding no values.
--
-- @since 4.8.0.0
vacuous :: Functor f => f Void -> f a
vacuous = fmap absurd | 192 | vacuous :: Functor f => f Void -> f a
vacuous = fmap absurd | 59 | vacuous = fmap absurd | 21 | true | true | 0 | 7 | 38 | 35 | 18 | 17 | null | null |
brendanhay/gogol | gogol-file/gen/Network/Google/Resource/File/Projects/Locations/Instances/Get.hs | mpl-2.0 | -- | V1 error format.
pligXgafv :: Lens' ProjectsLocationsInstancesGet (Maybe Xgafv)
pligXgafv
= lens _pligXgafv (\ s a -> s{_pligXgafv = a}) | 143 | pligXgafv :: Lens' ProjectsLocationsInstancesGet (Maybe Xgafv)
pligXgafv
= lens _pligXgafv (\ s a -> s{_pligXgafv = a}) | 121 | pligXgafv
= lens _pligXgafv (\ s a -> s{_pligXgafv = a}) | 58 | true | true | 0 | 9 | 23 | 48 | 25 | 23 | null | null |
smaccm/capDL-tool | CapDL/Model.hs | bsd-2-clause | irqControl = "irq_control" | 26 | irqControl = "irq_control" | 26 | irqControl = "irq_control" | 26 | false | false | 1 | 5 | 2 | 10 | 3 | 7 | null | null |
nikivazou/hscolour | Language/Haskell/HsColour/Classify.hs | gpl-2.0 | layoutchars =
map (:[]) ";{}()," | 34 | layoutchars =
map (:[]) ";{}()," | 34 | layoutchars =
map (:[]) ";{}()," | 34 | false | false | 0 | 7 | 6 | 18 | 9 | 9 | null | null |
FranklinChen/hugs98-plus-Sep2006 | packages/HaXml/src/tools/MkOneOf.hs | bsd-3-clause | constructor :: Int -> Int -> String
constructor n m = ordinal n ++"Of" ++ show m | 80 | constructor :: Int -> Int -> String
constructor n m = ordinal n ++"Of" ++ show m | 80 | constructor n m = ordinal n ++"Of" ++ show m | 44 | false | true | 0 | 7 | 16 | 38 | 18 | 20 | null | null |
ekmett/wxHaskell | wxcore/src/haskell/Graphics/UI/WXCore/WxcDefs.hs | lgpl-2.1 | wxFLOOD_SURFACE :: Int
wxFLOOD_SURFACE = 1 | 42 | wxFLOOD_SURFACE :: Int
wxFLOOD_SURFACE = 1 | 42 | wxFLOOD_SURFACE = 1 | 19 | false | true | 0 | 6 | 5 | 18 | 7 | 11 | null | null |
arirahikkala/yaml-with-class | src/Text/YamlPickle.hs | bsd-3-clause | parseS :: Position
-> ([FromYamlObject] -> [FromYamlObject])
-> E.Iteratee (Position, Event) Parser FromYamlObject
parseS start front = do
me <- E.peek
case me of
Just (pos, EventSequenceEnd) -> do
EL.drop 1
return $ Sequence (FromYamlAnnotation pos `startedAt` start) $ front []
_ -> do
o <- parseO
parseS start $ front . (:) o
--toB = Data.ByteString.pack . map (toEnum . fromEnum)
{- Data merge handling adds a fair bit of complexity to this function.
Any time we process a mapping that has an anchor, we create surrogate anchors
for each element of the mapping, and store the anchor and the list of keys
and their generated anchors in the state.
The simple and wrong thing to do would be to process merges right when we
see them, like any other key. Thing is, earlier mapping node keys override
later ones *unless* they come from merges. So we need to store the merges
and add them right at the end (mapping node order is a serialization detail
that we're allowed to define as we like)
-} | 1,109 | parseS :: Position
-> ([FromYamlObject] -> [FromYamlObject])
-> E.Iteratee (Position, Event) Parser FromYamlObject
parseS start front = do
me <- E.peek
case me of
Just (pos, EventSequenceEnd) -> do
EL.drop 1
return $ Sequence (FromYamlAnnotation pos `startedAt` start) $ front []
_ -> do
o <- parseO
parseS start $ front . (:) o
--toB = Data.ByteString.pack . map (toEnum . fromEnum)
{- Data merge handling adds a fair bit of complexity to this function.
Any time we process a mapping that has an anchor, we create surrogate anchors
for each element of the mapping, and store the anchor and the list of keys
and their generated anchors in the state.
The simple and wrong thing to do would be to process merges right when we
see them, like any other key. Thing is, earlier mapping node keys override
later ones *unless* they come from merges. So we need to store the merges
and add them right at the end (mapping node order is a serialization detail
that we're allowed to define as we like)
-} | 1,109 | parseS start front = do
me <- E.peek
case me of
Just (pos, EventSequenceEnd) -> do
EL.drop 1
return $ Sequence (FromYamlAnnotation pos `startedAt` start) $ front []
_ -> do
o <- parseO
parseS start $ front . (:) o
--toB = Data.ByteString.pack . map (toEnum . fromEnum)
{- Data merge handling adds a fair bit of complexity to this function.
Any time we process a mapping that has an anchor, we create surrogate anchors
for each element of the mapping, and store the anchor and the list of keys
and their generated anchors in the state.
The simple and wrong thing to do would be to process merges right when we
see them, like any other key. Thing is, earlier mapping node keys override
later ones *unless* they come from merges. So we need to store the merges
and add them right at the end (mapping node order is a serialization detail
that we're allowed to define as we like)
-} | 980 | false | true | 0 | 17 | 292 | 156 | 78 | 78 | null | null |
enolan/Idris-dev | src/IRTS/CodegenC.hs | bsd-3-clause | doOp v (LGe (ITFixed ty)) [x, y] = bitOp v "Gte" ty [x, y] | 58 | doOp v (LGe (ITFixed ty)) [x, y] = bitOp v "Gte" ty [x, y] | 58 | doOp v (LGe (ITFixed ty)) [x, y] = bitOp v "Gte" ty [x, y] | 58 | false | false | 1 | 9 | 13 | 49 | 24 | 25 | null | null |
jeannekamikaze/Spear | Spear/GL.hs | mit | -- | Enable the given vertex attribute of the bound vao.
--
-- See also 'bindVAO'.
enableVAOAttrib :: GLuint -- ^ Attribute index.
-> IO ()
enableVAOAttrib = glEnableVertexAttribArray | 204 | enableVAOAttrib :: GLuint -- ^ Attribute index.
-> IO ()
enableVAOAttrib = glEnableVertexAttribArray | 117 | enableVAOAttrib = glEnableVertexAttribArray | 43 | true | true | 0 | 7 | 49 | 24 | 14 | 10 | null | null |
haroldcarr/learn-haskell-coq-ml-etc | haskell/topic/type-level/2018-09-alex-peitsinis-writing-and-using-proofs/src/Lib.hs | unlicense | ------------------------------------------------------------------------------
-- since all of above except are inferred automatically by the + type family
-- only the induction step is needed to help the second step type-check
plusAssocX
:: SNat a
-> SNat b
-> SNat c
-> ((a + b) + c) :~: (a + (b + c))
plusAssocX _ _ SZ = Refl | 342 | plusAssocX
:: SNat a
-> SNat b
-> SNat c
-> ((a + b) + c) :~: (a + (b + c))
plusAssocX _ _ SZ = Refl | 112 | plusAssocX _ _ SZ = Refl | 28 | true | true | 0 | 14 | 69 | 80 | 40 | 40 | null | null |
vTurbine/ghc | compiler/main/Packages.hs | bsd-3-clause | fromReexportedModules False pkg = ModOrigin Nothing [] [pkg] False | 66 | fromReexportedModules False pkg = ModOrigin Nothing [] [pkg] False | 66 | fromReexportedModules False pkg = ModOrigin Nothing [] [pkg] False | 66 | false | false | 0 | 6 | 8 | 25 | 12 | 13 | null | null |
zaxtax/hakaru | haskell/Language/Hakaru/Evaluation/EvalMonad.hs | bsd-3-clause | emitUnpair_
:: forall abt a b
. (ABT Term abt)
=> Variable a
-> Variable b
-> abt '[] (HPair a b)
-> Eval abt (abt '[] a, abt '[] b)
emitUnpair_ x y = loop
where
done :: abt '[] (HPair a b) -> Eval abt (abt '[] a, abt '[] b)
done e =
#ifdef __TRACE_DISINTEGRATE__
trace "-- emitUnpair: done (term is not Datum_ nor Case_)" $
#endif
Eval $ \c h ->
( syn
. Case_ e
. (:[])
. Branch (pPair PVar PVar)
. bind x
. bind y
) $ c (var x, var y) h
loop :: abt '[] (HPair a b) -> Eval abt (abt '[] a, abt '[] b)
loop e0 =
caseVarSyn e0 (done . var) $ \t ->
case t of
Datum_ d -> do
#ifdef __TRACE_DISINTEGRATE__
trace "-- emitUnpair: found Datum_" $ return ()
#endif
return $ reifyPair (WDatum d)
Case_ e bs -> do
#ifdef __TRACE_DISINTEGRATE__
trace "-- emitUnpair: going under Case_" $ return ()
#endif
-- TODO: we want this to duplicate the current
-- continuation for (the evaluation of @loop@ in)
-- all branches. So far our traces all end up
-- returning @bot@ on the first branch, and hence
-- @bot@ for the whole case-expression, so we can't
-- quite tell whether it does what is intended.
--
-- N.B., the only 'Eval'-effects in 'applyBranch'
-- are to freshen variables; thus this use of
-- 'traverse' is perfectly sound.
emitCaseWith loop e bs
_ -> done e0
-- TODO: emitUneither
-- | Run each of the elements of the traversable using the same
-- heap and continuation for each one, then pass the results to a
-- function for emitting code. | 1,868 | emitUnpair_
:: forall abt a b
. (ABT Term abt)
=> Variable a
-> Variable b
-> abt '[] (HPair a b)
-> Eval abt (abt '[] a, abt '[] b)
emitUnpair_ x y = loop
where
done :: abt '[] (HPair a b) -> Eval abt (abt '[] a, abt '[] b)
done e =
#ifdef __TRACE_DISINTEGRATE__
trace "-- emitUnpair: done (term is not Datum_ nor Case_)" $
#endif
Eval $ \c h ->
( syn
. Case_ e
. (:[])
. Branch (pPair PVar PVar)
. bind x
. bind y
) $ c (var x, var y) h
loop :: abt '[] (HPair a b) -> Eval abt (abt '[] a, abt '[] b)
loop e0 =
caseVarSyn e0 (done . var) $ \t ->
case t of
Datum_ d -> do
#ifdef __TRACE_DISINTEGRATE__
trace "-- emitUnpair: found Datum_" $ return ()
#endif
return $ reifyPair (WDatum d)
Case_ e bs -> do
#ifdef __TRACE_DISINTEGRATE__
trace "-- emitUnpair: going under Case_" $ return ()
#endif
-- TODO: we want this to duplicate the current
-- continuation for (the evaluation of @loop@ in)
-- all branches. So far our traces all end up
-- returning @bot@ on the first branch, and hence
-- @bot@ for the whole case-expression, so we can't
-- quite tell whether it does what is intended.
--
-- N.B., the only 'Eval'-effects in 'applyBranch'
-- are to freshen variables; thus this use of
-- 'traverse' is perfectly sound.
emitCaseWith loop e bs
_ -> done e0
-- TODO: emitUneither
-- | Run each of the elements of the traversable using the same
-- heap and continuation for each one, then pass the results to a
-- function for emitting code. | 1,868 | emitUnpair_ x y = loop
where
done :: abt '[] (HPair a b) -> Eval abt (abt '[] a, abt '[] b)
done e =
#ifdef __TRACE_DISINTEGRATE__
trace "-- emitUnpair: done (term is not Datum_ nor Case_)" $
#endif
Eval $ \c h ->
( syn
. Case_ e
. (:[])
. Branch (pPair PVar PVar)
. bind x
. bind y
) $ c (var x, var y) h
loop :: abt '[] (HPair a b) -> Eval abt (abt '[] a, abt '[] b)
loop e0 =
caseVarSyn e0 (done . var) $ \t ->
case t of
Datum_ d -> do
#ifdef __TRACE_DISINTEGRATE__
trace "-- emitUnpair: found Datum_" $ return ()
#endif
return $ reifyPair (WDatum d)
Case_ e bs -> do
#ifdef __TRACE_DISINTEGRATE__
trace "-- emitUnpair: going under Case_" $ return ()
#endif
-- TODO: we want this to duplicate the current
-- continuation for (the evaluation of @loop@ in)
-- all branches. So far our traces all end up
-- returning @bot@ on the first branch, and hence
-- @bot@ for the whole case-expression, so we can't
-- quite tell whether it does what is intended.
--
-- N.B., the only 'Eval'-effects in 'applyBranch'
-- are to freshen variables; thus this use of
-- 'traverse' is perfectly sound.
emitCaseWith loop e bs
_ -> done e0
-- TODO: emitUneither
-- | Run each of the elements of the traversable using the same
-- heap and continuation for each one, then pass the results to a
-- function for emitting code. | 1,710 | false | true | 0 | 15 | 715 | 449 | 225 | 224 | null | null |
zoranbosnjak/deseo | tests/TestAsterix.hs | gpl-3.0 | testGet2b :: Assertion
testGet2b = do
cat0 <- readFile (xmldir </> "cat000_1.2.xml")
>>= return . categoryDescription
let _profiles = Map.fromList [(cCat c, c) | c<-(rights [cat0])]
(Right cat0') = cat0
(Just cat0'') = uapByName cat0' "uap"
ae = assertEqual
rec = create cat0'' $ do
"030" <! fromRawInt 0xFFFFFF
"031" <! fromValues fromRawInt [("X", 0xFFFFFF), ("Y", 0xFFFFFF)]
"041" <! fromValues fromRawInt [("X", 0xFF), ("Y", 0xFF)]
"042" <! fromValues fromRawInt [("X", 0xFF), ("Y", 0xFF)]
Just i030 = rec >>= child "030" >>= toNatural
Just i031x = rec >>= childR ["031","X"] >>= toNatural
Just i031y = rec >>= childR ["031","Y"] >>= toNatural
Just i041x = rec >>= childR ["041","X"] >>= toNatural
Just i042x = rec >>= childR ["042","X"] >>= toNatural
ae "030" (EDouble (0xffffff/128)) i030
ae "031x" (EDouble (-0.5)) i031x
ae "031y" (EDouble (-0.5)) i031y
ae "i041x" (EInteger (-1)) i041x
ae "i042x" (EInteger 255) i042x | 1,084 | testGet2b :: Assertion
testGet2b = do
cat0 <- readFile (xmldir </> "cat000_1.2.xml")
>>= return . categoryDescription
let _profiles = Map.fromList [(cCat c, c) | c<-(rights [cat0])]
(Right cat0') = cat0
(Just cat0'') = uapByName cat0' "uap"
ae = assertEqual
rec = create cat0'' $ do
"030" <! fromRawInt 0xFFFFFF
"031" <! fromValues fromRawInt [("X", 0xFFFFFF), ("Y", 0xFFFFFF)]
"041" <! fromValues fromRawInt [("X", 0xFF), ("Y", 0xFF)]
"042" <! fromValues fromRawInt [("X", 0xFF), ("Y", 0xFF)]
Just i030 = rec >>= child "030" >>= toNatural
Just i031x = rec >>= childR ["031","X"] >>= toNatural
Just i031y = rec >>= childR ["031","Y"] >>= toNatural
Just i041x = rec >>= childR ["041","X"] >>= toNatural
Just i042x = rec >>= childR ["042","X"] >>= toNatural
ae "030" (EDouble (0xffffff/128)) i030
ae "031x" (EDouble (-0.5)) i031x
ae "031y" (EDouble (-0.5)) i031y
ae "i041x" (EInteger (-1)) i041x
ae "i042x" (EInteger 255) i042x | 1,084 | testGet2b = do
cat0 <- readFile (xmldir </> "cat000_1.2.xml")
>>= return . categoryDescription
let _profiles = Map.fromList [(cCat c, c) | c<-(rights [cat0])]
(Right cat0') = cat0
(Just cat0'') = uapByName cat0' "uap"
ae = assertEqual
rec = create cat0'' $ do
"030" <! fromRawInt 0xFFFFFF
"031" <! fromValues fromRawInt [("X", 0xFFFFFF), ("Y", 0xFFFFFF)]
"041" <! fromValues fromRawInt [("X", 0xFF), ("Y", 0xFF)]
"042" <! fromValues fromRawInt [("X", 0xFF), ("Y", 0xFF)]
Just i030 = rec >>= child "030" >>= toNatural
Just i031x = rec >>= childR ["031","X"] >>= toNatural
Just i031y = rec >>= childR ["031","Y"] >>= toNatural
Just i041x = rec >>= childR ["041","X"] >>= toNatural
Just i042x = rec >>= childR ["042","X"] >>= toNatural
ae "030" (EDouble (0xffffff/128)) i030
ae "031x" (EDouble (-0.5)) i031x
ae "031y" (EDouble (-0.5)) i031y
ae "i041x" (EInteger (-1)) i041x
ae "i042x" (EInteger 255) i042x | 1,061 | false | true | 0 | 16 | 301 | 451 | 227 | 224 | null | null |
vacationlabs/nightwatch | haskell/Nightwatch/Telegram.hs | gpl-2.0 | getUpdatesAsJSON offset = do
asJSON =<< (getUpdates offset) :: IO Resp | 72 | getUpdatesAsJSON offset = do
asJSON =<< (getUpdates offset) :: IO Resp | 72 | getUpdatesAsJSON offset = do
asJSON =<< (getUpdates offset) :: IO Resp | 72 | false | false | 0 | 9 | 12 | 28 | 13 | 15 | null | null |
urv/fixhs | src/Data/FIX/Spec/FIX41.hs | lgpl-2.1 | tEmailThreadID :: FIXTag
tEmailThreadID = FIXTag
{ tName = "EmailThreadID"
, tnum = 164
, tparser = toFIXChar
, arbitraryValue = FIXChar <$> (return 'A') } | 168 | tEmailThreadID :: FIXTag
tEmailThreadID = FIXTag
{ tName = "EmailThreadID"
, tnum = 164
, tparser = toFIXChar
, arbitraryValue = FIXChar <$> (return 'A') } | 168 | tEmailThreadID = FIXTag
{ tName = "EmailThreadID"
, tnum = 164
, tparser = toFIXChar
, arbitraryValue = FIXChar <$> (return 'A') } | 143 | false | true | 0 | 10 | 38 | 51 | 29 | 22 | null | null |
brendanhay/gogol | gogol-androidmanagement/gen/Network/Google/AndroidManagement/Types/Product.hs | mpl-2.0 | -- | If set to true, the rule includes a mitigating action to disable apps so
-- that the device is effectively disabled, but app data is preserved. If
-- the device is running an app in locked task mode, the app will be closed
-- and a UI showing the reason for non-compliance will be displayed.
crDisableApps :: Lens' ComplianceRule (Maybe Bool)
crDisableApps
= lens _crDisableApps
(\ s a -> s{_crDisableApps = a}) | 424 | crDisableApps :: Lens' ComplianceRule (Maybe Bool)
crDisableApps
= lens _crDisableApps
(\ s a -> s{_crDisableApps = a}) | 127 | crDisableApps
= lens _crDisableApps
(\ s a -> s{_crDisableApps = a}) | 76 | true | true | 1 | 9 | 81 | 54 | 28 | 26 | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.