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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
ahushh/Monaba | monaba/src/Foundation.hs | mit | unsafeHandler :: App -> Handler a -> IO a
unsafeHandler = Unsafe.fakeHandlerGetLogger appLogger | 95 | unsafeHandler :: App -> Handler a -> IO a
unsafeHandler = Unsafe.fakeHandlerGetLogger appLogger | 95 | unsafeHandler = Unsafe.fakeHandlerGetLogger appLogger | 53 | false | true | 0 | 7 | 12 | 30 | 14 | 16 | null | null |
uuhan/Idris-dev | codegen/idris-codegen-c/Main.hs | bsd-3-clause | getOpts :: IO Opts
getOpts = do xs <- getArgs
return $ process (Opts [] False "a.out") xs
where
process opts ("-o":o:xs) = process (opts { output = o }) xs
process opts ("--interface":xs) = process (opts { interface = True }) xs
process opts (x:xs) = process (opts { inputs = x:inputs opts }) xs
process opts [] = opts | 349 | getOpts :: IO Opts
getOpts = do xs <- getArgs
return $ process (Opts [] False "a.out") xs
where
process opts ("-o":o:xs) = process (opts { output = o }) xs
process opts ("--interface":xs) = process (opts { interface = True }) xs
process opts (x:xs) = process (opts { inputs = x:inputs opts }) xs
process opts [] = opts | 349 | getOpts = do xs <- getArgs
return $ process (Opts [] False "a.out") xs
where
process opts ("-o":o:xs) = process (opts { output = o }) xs
process opts ("--interface":xs) = process (opts { interface = True }) xs
process opts (x:xs) = process (opts { inputs = x:inputs opts }) xs
process opts [] = opts | 330 | false | true | 3 | 11 | 91 | 167 | 87 | 80 | null | null |
tolysz/Haxl | Haxl/Core/Memo.hs | bsd-3-clause | -- -----------------------------------------------------------------------------
-- A key type that can be used for memoizing computations by a Text key
-- | Memoize a computation using an arbitrary key. The result will be
-- calculated once; the second and subsequent time it will be returned
-- immediately. It is the caller's responsibility to ensure that for
-- every two calls @memo key haxl@, if they have the same @key@ then
-- they compute the same result.
memo
:: (Typeable a, Typeable k, Hashable k, Eq k)
=> k -> GenHaxl u a -> GenHaxl u a
memo key = cachedComputation (MemoKey key) | 600 | memo
:: (Typeable a, Typeable k, Hashable k, Eq k)
=> k -> GenHaxl u a -> GenHaxl u a
memo key = cachedComputation (MemoKey key) | 132 | memo key = cachedComputation (MemoKey key) | 42 | true | true | 0 | 9 | 105 | 79 | 41 | 38 | null | null |
gallais/dailyprogrammer | intermediate/171/Main.hs | mit | rotateAntiClockwise :: [[a]] -> [[a]]
rotateAntiClockwise = reverse . preRotate | 79 | rotateAntiClockwise :: [[a]] -> [[a]]
rotateAntiClockwise = reverse . preRotate | 79 | rotateAntiClockwise = reverse . preRotate | 41 | false | true | 0 | 7 | 9 | 31 | 18 | 13 | null | null |
thasenpusch/scheme | parser.hs | isc | expectGrave :: Parser ()
expectGrave = do
a <- get
case a of
[] -> throwError "Unexpected end of input."
(TGrave : xs) -> put xs
(x:_) -> throwError $ "Expected '`', got " ++ show x ++ "." | 220 | expectGrave :: Parser ()
expectGrave = do
a <- get
case a of
[] -> throwError "Unexpected end of input."
(TGrave : xs) -> put xs
(x:_) -> throwError $ "Expected '`', got " ++ show x ++ "." | 220 | expectGrave = do
a <- get
case a of
[] -> throwError "Unexpected end of input."
(TGrave : xs) -> put xs
(x:_) -> throwError $ "Expected '`', got " ++ show x ++ "." | 195 | false | true | 0 | 13 | 70 | 92 | 42 | 50 | null | null |
ben-schulz/Idris-dev | src/Idris/Elab/Quasiquote.hs | bsd-3-clause | extractTUnquotes n (Induction t) = extract1 n Induction t | 57 | extractTUnquotes n (Induction t) = extract1 n Induction t | 57 | extractTUnquotes n (Induction t) = extract1 n Induction t | 57 | false | false | 0 | 7 | 8 | 24 | 11 | 13 | null | null |
michalkonecny/aern2 | aern2-mfun/src/AERN2/BoxFunMinMax/Expressions/Eliminator.hs | bsd-3-clause | qualifiedEsToCNF ((ps, q) : es) = EBinOp Min (qualifiedEsToCNF [(ps, q)]) (qualifiedEsToCNF es) | 95 | qualifiedEsToCNF ((ps, q) : es) = EBinOp Min (qualifiedEsToCNF [(ps, q)]) (qualifiedEsToCNF es) | 95 | qualifiedEsToCNF ((ps, q) : es) = EBinOp Min (qualifiedEsToCNF [(ps, q)]) (qualifiedEsToCNF es) | 95 | false | false | 0 | 9 | 12 | 50 | 27 | 23 | null | null |
thomie/cabal | cabal-install/Distribution/Solver/Types/PkgConfigDb.hs | bsd-3-clause | -- | Query pkg-config for the list of installed packages, together
-- with their versions. Return a `PkgConfigDb` encapsulating this
-- information.
readPkgConfigDb :: Verbosity -> ProgramConfiguration -> IO PkgConfigDb
readPkgConfigDb verbosity conf = handle ioErrorHandler $ do
(pkgConfig, _) <- requireProgram verbosity pkgConfigProgram conf
pkgList <- lines <$> getProgramOutput verbosity pkgConfig ["--list-all"]
-- The output of @pkg-config --list-all@ also includes a description
-- for each package, which we do not need.
let pkgNames = map (takeWhile (not . isSpace)) pkgList
pkgVersions <- lines <$> getProgramOutput verbosity pkgConfig
("--modversion" : pkgNames)
(return . pkgConfigDbFromList . zip pkgNames) pkgVersions
where
-- For when pkg-config invocation fails (possibly because of a
-- too long command line).
ioErrorHandler :: IOException -> IO PkgConfigDb
ioErrorHandler e = do
info verbosity ("Failed to query pkg-config, Cabal will continue"
++ " without solving for pkg-config constraints: "
++ show e)
return NoPkgConfigDb
-- | Create a `PkgConfigDb` from a list of @(packageName, version)@ pairs. | 1,276 | readPkgConfigDb :: Verbosity -> ProgramConfiguration -> IO PkgConfigDb
readPkgConfigDb verbosity conf = handle ioErrorHandler $ do
(pkgConfig, _) <- requireProgram verbosity pkgConfigProgram conf
pkgList <- lines <$> getProgramOutput verbosity pkgConfig ["--list-all"]
-- The output of @pkg-config --list-all@ also includes a description
-- for each package, which we do not need.
let pkgNames = map (takeWhile (not . isSpace)) pkgList
pkgVersions <- lines <$> getProgramOutput verbosity pkgConfig
("--modversion" : pkgNames)
(return . pkgConfigDbFromList . zip pkgNames) pkgVersions
where
-- For when pkg-config invocation fails (possibly because of a
-- too long command line).
ioErrorHandler :: IOException -> IO PkgConfigDb
ioErrorHandler e = do
info verbosity ("Failed to query pkg-config, Cabal will continue"
++ " without solving for pkg-config constraints: "
++ show e)
return NoPkgConfigDb
-- | Create a `PkgConfigDb` from a list of @(packageName, version)@ pairs. | 1,127 | readPkgConfigDb verbosity conf = handle ioErrorHandler $ do
(pkgConfig, _) <- requireProgram verbosity pkgConfigProgram conf
pkgList <- lines <$> getProgramOutput verbosity pkgConfig ["--list-all"]
-- The output of @pkg-config --list-all@ also includes a description
-- for each package, which we do not need.
let pkgNames = map (takeWhile (not . isSpace)) pkgList
pkgVersions <- lines <$> getProgramOutput verbosity pkgConfig
("--modversion" : pkgNames)
(return . pkgConfigDbFromList . zip pkgNames) pkgVersions
where
-- For when pkg-config invocation fails (possibly because of a
-- too long command line).
ioErrorHandler :: IOException -> IO PkgConfigDb
ioErrorHandler e = do
info verbosity ("Failed to query pkg-config, Cabal will continue"
++ " without solving for pkg-config constraints: "
++ show e)
return NoPkgConfigDb
-- | Create a `PkgConfigDb` from a list of @(packageName, version)@ pairs. | 1,056 | true | true | 0 | 15 | 311 | 214 | 103 | 111 | null | null |
ganeti-github-testing/ganeti-test-1 | src/Ganeti/OpParams.hs | bsd-2-clause | pSkipChecks :: Field
pSkipChecks =
withDoc "Which checks to skip" .
defaultField [| emptyListSet |] $
simpleField "skip_checks" [t| ListSet VerifyOptionalChecks |] | 169 | pSkipChecks :: Field
pSkipChecks =
withDoc "Which checks to skip" .
defaultField [| emptyListSet |] $
simpleField "skip_checks" [t| ListSet VerifyOptionalChecks |] | 169 | pSkipChecks =
withDoc "Which checks to skip" .
defaultField [| emptyListSet |] $
simpleField "skip_checks" [t| ListSet VerifyOptionalChecks |] | 148 | false | true | 0 | 6 | 27 | 44 | 22 | 22 | null | null |
marcmo/includeSpellChecker | src/Analyzer/Checker.hs | bsd-3-clause | fromList = foldr insert Empty | 29 | fromList = foldr insert Empty | 29 | fromList = foldr insert Empty | 29 | false | false | 1 | 5 | 4 | 16 | 5 | 11 | null | null |
kebertx/GoFu | src/Go/Board.hs | bsd-3-clause | playGame :: [Move] -> [Board]
playGame = scanl playMove newBoard | 64 | playGame :: [Move] -> [Board]
playGame = scanl playMove newBoard | 64 | playGame = scanl playMove newBoard | 34 | false | true | 0 | 6 | 9 | 26 | 14 | 12 | null | null |
sherwoodwang/wxHaskell | wxcore/src/haskell/Graphics/UI/WXCore/WxcDefs.hs | lgpl-2.1 | wxSTC_CAML_COMMENT3 :: Int
wxSTC_CAML_COMMENT3 = 15 | 51 | wxSTC_CAML_COMMENT3 :: Int
wxSTC_CAML_COMMENT3 = 15 | 51 | wxSTC_CAML_COMMENT3 = 15 | 24 | false | true | 0 | 6 | 5 | 18 | 7 | 11 | null | null |
spaceships/garbled-circuits | src/Crypto/GarbledCircuits/Eval.hs | apache-2.0 | showGG :: Program GarbledGate -> [Wirelabel] -> [Wirelabel] -> String
showGG prog inpGb inpEv = init $ unlines $ map showGate (M.toList (prog_env prog))
where
showGate (ref, gg) = show ref ++ ": " ++ case gg of
GarbledInput i p -> show i ++ " " ++ show p ++ " " ++ outp ref ++ partyInput p i
FreeXor x y -> "FREEXOR " ++ show x ++ " " ++ show y ++ " " ++ outp ref
HalfGate x y g e -> "HALFGATE " ++ show x ++ " " ++ show y ++ " " ++ outp ref ++ "\n"
++ "\t" ++ showWirelabel g ++ "\n"
++ "\t" ++ showWirelabel e
outp r = case r `elemIndex` prog_output prog
of Just i -> "out" ++ show i; _ -> ""
partyInput Garbler (InputId i) | length inpGb > i = showWirelabel (inpGb !! i)
partyInput Evaluator (InputId i) | length inpEv > i = showWirelabel (inpEv !! i)
partyInput _ _ = "" | 911 | showGG :: Program GarbledGate -> [Wirelabel] -> [Wirelabel] -> String
showGG prog inpGb inpEv = init $ unlines $ map showGate (M.toList (prog_env prog))
where
showGate (ref, gg) = show ref ++ ": " ++ case gg of
GarbledInput i p -> show i ++ " " ++ show p ++ " " ++ outp ref ++ partyInput p i
FreeXor x y -> "FREEXOR " ++ show x ++ " " ++ show y ++ " " ++ outp ref
HalfGate x y g e -> "HALFGATE " ++ show x ++ " " ++ show y ++ " " ++ outp ref ++ "\n"
++ "\t" ++ showWirelabel g ++ "\n"
++ "\t" ++ showWirelabel e
outp r = case r `elemIndex` prog_output prog
of Just i -> "out" ++ show i; _ -> ""
partyInput Garbler (InputId i) | length inpGb > i = showWirelabel (inpGb !! i)
partyInput Evaluator (InputId i) | length inpEv > i = showWirelabel (inpEv !! i)
partyInput _ _ = "" | 911 | showGG prog inpGb inpEv = init $ unlines $ map showGate (M.toList (prog_env prog))
where
showGate (ref, gg) = show ref ++ ": " ++ case gg of
GarbledInput i p -> show i ++ " " ++ show p ++ " " ++ outp ref ++ partyInput p i
FreeXor x y -> "FREEXOR " ++ show x ++ " " ++ show y ++ " " ++ outp ref
HalfGate x y g e -> "HALFGATE " ++ show x ++ " " ++ show y ++ " " ++ outp ref ++ "\n"
++ "\t" ++ showWirelabel g ++ "\n"
++ "\t" ++ showWirelabel e
outp r = case r `elemIndex` prog_output prog
of Just i -> "out" ++ show i; _ -> ""
partyInput Garbler (InputId i) | length inpGb > i = showWirelabel (inpGb !! i)
partyInput Evaluator (InputId i) | length inpEv > i = showWirelabel (inpEv !! i)
partyInput _ _ = "" | 841 | false | true | 0 | 20 | 306 | 389 | 184 | 205 | null | null |
bobjflong/biblesearch-api-haskell | src/Bible/Chapters.hs | mit | listChapters :: Text -> ApiKey -> IO (Maybe [Chapter])
listChapters bookId key = do
raw <- getResourceAtPath path key
return $ fmap (pruneBadResults.chapters) $ decode raw
where path = "/books/" `append` bookId `append` "/chapters.js"
-- API seems to return some garbled data | 282 | listChapters :: Text -> ApiKey -> IO (Maybe [Chapter])
listChapters bookId key = do
raw <- getResourceAtPath path key
return $ fmap (pruneBadResults.chapters) $ decode raw
where path = "/books/" `append` bookId `append` "/chapters.js"
-- API seems to return some garbled data | 282 | listChapters bookId key = do
raw <- getResourceAtPath path key
return $ fmap (pruneBadResults.chapters) $ decode raw
where path = "/books/" `append` bookId `append` "/chapters.js"
-- API seems to return some garbled data | 227 | false | true | 1 | 11 | 48 | 99 | 47 | 52 | null | null |
da-x/buildsome | src/Buildsome/ClangCommands.hs | gpl-2.0 | make :: FilePath -> Stats -> [Target] -> FilePath -> IO ()
make cwd stats rootTargets filePath = do
putStrLn $ "Writing clang commands to: " ++ show (cwd </> filePath)
BS8L.writeFile (BS8.unpack filePath) $
encodePretty $ reverse $
runIdentity $ Revisit.run (buildCommandsTargets cwd stats rootTargets) | 314 | make :: FilePath -> Stats -> [Target] -> FilePath -> IO ()
make cwd stats rootTargets filePath = do
putStrLn $ "Writing clang commands to: " ++ show (cwd </> filePath)
BS8L.writeFile (BS8.unpack filePath) $
encodePretty $ reverse $
runIdentity $ Revisit.run (buildCommandsTargets cwd stats rootTargets) | 314 | make cwd stats rootTargets filePath = do
putStrLn $ "Writing clang commands to: " ++ show (cwd </> filePath)
BS8L.writeFile (BS8.unpack filePath) $
encodePretty $ reverse $
runIdentity $ Revisit.run (buildCommandsTargets cwd stats rootTargets) | 255 | false | true | 0 | 14 | 57 | 112 | 54 | 58 | null | null |
FPtje/GLuaParser | src/GLua/PSParser.hs | lgpl-2.1 | -- | Local function definition
parseLocalFunction :: AParser Stat
parseLocalFunction = ALocFunc <$ pMTok Function <*> parseLocFuncName <*>
between (pMTok LRound) (pMTok RRound) parseParList <*>
parseBlock <*
pMTok End <?> "local function definition" | 312 | parseLocalFunction :: AParser Stat
parseLocalFunction = ALocFunc <$ pMTok Function <*> parseLocFuncName <*>
between (pMTok LRound) (pMTok RRound) parseParList <*>
parseBlock <*
pMTok End <?> "local function definition" | 281 | parseLocalFunction = ALocFunc <$ pMTok Function <*> parseLocFuncName <*>
between (pMTok LRound) (pMTok RRound) parseParList <*>
parseBlock <*
pMTok End <?> "local function definition" | 246 | true | true | 0 | 11 | 95 | 64 | 31 | 33 | null | null |
carletes/project-euler | problem-2.hs | mit | fib 2 = 2 | 9 | fib 2 = 2 | 9 | fib 2 = 2 | 9 | false | false | 1 | 5 | 3 | 13 | 4 | 9 | null | null |
spyked/writer-monkey | src/Markov/Examples.hs | bsd-3-clause | -- character succession example - quite abstract
charChain :: Chain Char
charChain = fromList [
('a', [('a', 25), ('b', 25), ('c', 25), ('d', 25)]),
('b', [('a', 20), ('b', 0), ('c', 80), ('d', 0)]),
('c', [('a', 40), ('b', 40), ('c', 20), ('d', 0)]),
('d', [('a', 10), ('b', 10), ('c', 10), ('d', 70)])
] | 325 | charChain :: Chain Char
charChain = fromList [
('a', [('a', 25), ('b', 25), ('c', 25), ('d', 25)]),
('b', [('a', 20), ('b', 0), ('c', 80), ('d', 0)]),
('c', [('a', 40), ('b', 40), ('c', 20), ('d', 0)]),
('d', [('a', 10), ('b', 10), ('c', 10), ('d', 70)])
] | 276 | charChain = fromList [
('a', [('a', 25), ('b', 25), ('c', 25), ('d', 25)]),
('b', [('a', 20), ('b', 0), ('c', 80), ('d', 0)]),
('c', [('a', 40), ('b', 40), ('c', 20), ('d', 0)]),
('d', [('a', 10), ('b', 10), ('c', 10), ('d', 70)])
] | 252 | true | true | 0 | 9 | 71 | 203 | 130 | 73 | null | null |
beni55/binary | tests/QC.hs | bsd-3-clause | test :: (Eq a, Binary a) => a -> Property
test a = forAll positiveList (roundTrip a . refragment) | 101 | test :: (Eq a, Binary a) => a -> Property
test a = forAll positiveList (roundTrip a . refragment) | 101 | test a = forAll positiveList (roundTrip a . refragment) | 56 | false | true | 0 | 8 | 22 | 48 | 24 | 24 | null | null |
facebookincubator/duckling | Duckling/Time/IT/Rules.hs | bsd-3-clause | ruleLastDayofweekOfTime :: Rule
ruleLastDayofweekOfTime = Rule
{ name = "last <day-of-week> of <time>"
, pattern =
[ regex "(([nd]el)?l')?ultim[oa]"
, Predicate isADayOfWeek
, regex "di|del(l[a'])?"
, dimension Time
]
, prod = \tokens -> case tokens of
(_:Token Time td1:_:Token Time td2:_) ->
tt $ predLastOf td1 td2
_ -> Nothing
} | 380 | ruleLastDayofweekOfTime :: Rule
ruleLastDayofweekOfTime = Rule
{ name = "last <day-of-week> of <time>"
, pattern =
[ regex "(([nd]el)?l')?ultim[oa]"
, Predicate isADayOfWeek
, regex "di|del(l[a'])?"
, dimension Time
]
, prod = \tokens -> case tokens of
(_:Token Time td1:_:Token Time td2:_) ->
tt $ predLastOf td1 td2
_ -> Nothing
} | 380 | ruleLastDayofweekOfTime = Rule
{ name = "last <day-of-week> of <time>"
, pattern =
[ regex "(([nd]el)?l')?ultim[oa]"
, Predicate isADayOfWeek
, regex "di|del(l[a'])?"
, dimension Time
]
, prod = \tokens -> case tokens of
(_:Token Time td1:_:Token Time td2:_) ->
tt $ predLastOf td1 td2
_ -> Nothing
} | 348 | false | true | 0 | 17 | 99 | 118 | 61 | 57 | null | null |
d3zd3z/HaskellNet-old | Network/HaskellNet/IMAP.hs | bsd-3-clause | append :: BSStream s => IMAPConnection s -> Mailbox -> ByteString -> IO ()
append conn mbox mailData = appendFull conn mbox mailData [] Nothing | 143 | append :: BSStream s => IMAPConnection s -> Mailbox -> ByteString -> IO ()
append conn mbox mailData = appendFull conn mbox mailData [] Nothing | 143 | append conn mbox mailData = appendFull conn mbox mailData [] Nothing | 68 | false | true | 0 | 11 | 24 | 62 | 28 | 34 | null | null |
futtetennista/IntroductionToFunctionalProgramming | src/MonadTransformersPlayground.hs | mit | eval2 env (Abs x e) =
return $ FunVal env x e | 47 | eval2 env (Abs x e) =
return $ FunVal env x e | 47 | eval2 env (Abs x e) =
return $ FunVal env x e | 47 | false | false | 2 | 6 | 13 | 34 | 14 | 20 | null | null |
VictorDenisov/mongodb | Database/MongoDB/Internal/Protocol.hs | apache-2.0 | call :: Pipe -> [Notice] -> Request -> IO (IO Reply)
-- ^ Send notices and request as a contiguous batch to server and return reply promise, which will block when invoked until reply arrives. This call and resulting promise will throw IOError if connection fails.
call pipe notices request = do
requestId <- genRequestId
promise <- pcall pipe (notices, Just (request, requestId))
return $ check requestId <$> promise
where
check requestId (responseTo, reply) = if requestId == responseTo then reply else
error $ "expected response id (" ++ show responseTo ++ ") to match request id (" ++ show requestId ++ ")"
-- * Message | 648 | call :: Pipe -> [Notice] -> Request -> IO (IO Reply)
call pipe notices request = do
requestId <- genRequestId
promise <- pcall pipe (notices, Just (request, requestId))
return $ check requestId <$> promise
where
check requestId (responseTo, reply) = if requestId == responseTo then reply else
error $ "expected response id (" ++ show responseTo ++ ") to match request id (" ++ show requestId ++ ")"
-- * Message | 437 | call pipe notices request = do
requestId <- genRequestId
promise <- pcall pipe (notices, Just (request, requestId))
return $ check requestId <$> promise
where
check requestId (responseTo, reply) = if requestId == responseTo then reply else
error $ "expected response id (" ++ show responseTo ++ ") to match request id (" ++ show requestId ++ ")"
-- * Message | 384 | true | true | 0 | 11 | 131 | 149 | 75 | 74 | null | null |
emhoracek/explora | test-suite/GameSpec.hs | gpl-2.0 | spec = do
describe "initGame" $ do
context "a messed up place" $
it "returns an error" $
initGame "1. applesauce (dinosaur)" `shouldBe`
Left "\"Map error: \" (line 1, column 25):\nunexpected end of input\nexpecting \"\\n\""
context "a messed up exit" $
it "returns an error" $
pendingWith "Sooooooo broken"
context "a good game file" $
it "initializes the game" $
initGame sampleFile `shouldBe`
Right sampleGame | 563 | spec = do
describe "initGame" $ do
context "a messed up place" $
it "returns an error" $
initGame "1. applesauce (dinosaur)" `shouldBe`
Left "\"Map error: \" (line 1, column 25):\nunexpected end of input\nexpecting \"\\n\""
context "a messed up exit" $
it "returns an error" $
pendingWith "Sooooooo broken"
context "a good game file" $
it "initializes the game" $
initGame sampleFile `shouldBe`
Right sampleGame | 563 | spec = do
describe "initGame" $ do
context "a messed up place" $
it "returns an error" $
initGame "1. applesauce (dinosaur)" `shouldBe`
Left "\"Map error: \" (line 1, column 25):\nunexpected end of input\nexpecting \"\\n\""
context "a messed up exit" $
it "returns an error" $
pendingWith "Sooooooo broken"
context "a good game file" $
it "initializes the game" $
initGame sampleFile `shouldBe`
Right sampleGame | 563 | false | false | 0 | 13 | 216 | 94 | 41 | 53 | null | null |
harrisi/on-being-better | list-expansion/Haskell/course/src/Course/Parser.hs | cc0-1.0 | -- | Write a parser for Person.
--
-- /Tip:/ Use @bindParser@,
-- @valueParser@,
-- @(>>>)@,
-- @spaces1@,
-- @ageParser@,
-- @firstNameParser@,
-- @surnameParser@,
-- @smokerParser@,
-- @phoneParser@.
--
-- >>> isErrorResult (parse personParser "")
-- True
--
-- >>> isErrorResult (parse personParser "12x Fred Clarkson y 123-456.789#")
-- True
--
-- >>> isErrorResult (parse personParser "123 fred Clarkson y 123-456.789#")
-- True
--
-- >>> isErrorResult (parse personParser "123 Fred Cla y 123-456.789#")
-- True
--
-- >>> isErrorResult (parse personParser "123 Fred clarkson y 123-456.789#")
-- True
--
-- >>> isErrorResult (parse personParser "123 Fred Clarkson x 123-456.789#")
-- True
--
-- >>> isErrorResult (parse personParser "123 Fred Clarkson y 1x3-456.789#")
-- True
--
-- >>> isErrorResult (parse personParser "123 Fred Clarkson y -123-456.789#")
-- True
--
-- >>> isErrorResult (parse personParser "123 Fred Clarkson y 123-456.789")
-- True
--
-- >>> parse personParser "123 Fred Clarkson y 123-456.789#"
-- Result >< Person {age = 123, firstName = "Fred", surname = "Clarkson", smoker = 'y', phone = "123-456.789"}
--
-- >>> parse personParser "123 Fred Clarkson y 123-456.789# rest"
-- Result > rest< Person {age = 123, firstName = "Fred", surname = "Clarkson", smoker = 'y', phone = "123-456.789"}
personParser ::
Parser Person
personParser =
error "todo: Course.Parser#personParser" | 1,494 | personParser ::
Parser Person
personParser =
error "todo: Course.Parser#personParser" | 89 | personParser =
error "todo: Course.Parser#personParser" | 57 | true | true | 0 | 5 | 301 | 61 | 52 | 9 | null | null |
weiningl/dataStructure | Queue.hs | bsd-3-clause | -- | Add single item
snoc :: Queue a -> a -> Queue a
snoc (Q f r) x = queue $ Q f (x:r) | 87 | snoc :: Queue a -> a -> Queue a
snoc (Q f r) x = queue $ Q f (x:r) | 66 | snoc (Q f r) x = queue $ Q f (x:r) | 34 | true | true | 0 | 8 | 24 | 55 | 27 | 28 | null | null |
osa1/psc-lua | src/Language/PureScript/Lua/Compiler.hs | mit | compileToLua :: Options -> [Module] -> Either String [(String, String)]
compileToLua = compileToLua' initEnvironment | 116 | compileToLua :: Options -> [Module] -> Either String [(String, String)]
compileToLua = compileToLua' initEnvironment | 116 | compileToLua = compileToLua' initEnvironment | 44 | false | true | 0 | 9 | 13 | 39 | 21 | 18 | null | null |
dmitmel/goiteens-hw-in-haskell | Utils/Cryptography/RSA.hs | apache-2.0 | egcd a b = let (g, y, x) = egcd (b `mod` a) a
in (g, x - ((b `div` a) * y), y) | 89 | egcd a b = let (g, y, x) = egcd (b `mod` a) a
in (g, x - ((b `div` a) * y), y) | 89 | egcd a b = let (g, y, x) = egcd (b `mod` a) a
in (g, x - ((b `div` a) * y), y) | 89 | false | false | 0 | 12 | 34 | 75 | 42 | 33 | null | null |
phi16/RayMarch | RayMarch/Default/Object.hs | gpl-3.0 | halfLambert :: Point -> Color -> Object s
halfLambert l c p v = do
(lu,nu,_,_) <- rayLNRV p v l
return $ c<*>(lu`dot`nu/2+0.5) | 130 | halfLambert :: Point -> Color -> Object s
halfLambert l c p v = do
(lu,nu,_,_) <- rayLNRV p v l
return $ c<*>(lu`dot`nu/2+0.5) | 130 | halfLambert l c p v = do
(lu,nu,_,_) <- rayLNRV p v l
return $ c<*>(lu`dot`nu/2+0.5) | 88 | false | true | 0 | 11 | 27 | 85 | 44 | 41 | null | null |
elliottt/dang | src/Dang/Utils/PP.hs | bsd-3-clause | fsep :: [Doc] -> Doc
fsep ds = PJ.fsep <$> sequence ds | 54 | fsep :: [Doc] -> Doc
fsep ds = PJ.fsep <$> sequence ds | 54 | fsep ds = PJ.fsep <$> sequence ds | 33 | false | true | 2 | 7 | 11 | 36 | 16 | 20 | null | null |
chadbrewbaker/shellcheck | ShellCheck/Analytics.hs | gpl-3.0 | prop_checkLonelyDotDash2 = verifyNot checkLonelyDotDash "./file" | 64 | prop_checkLonelyDotDash2 = verifyNot checkLonelyDotDash "./file" | 64 | prop_checkLonelyDotDash2 = verifyNot checkLonelyDotDash "./file" | 64 | false | false | 0 | 5 | 4 | 11 | 5 | 6 | null | null |
ComputationWithBoundedResources/ara-inference | doc/tpdb_trs/Haskell/basic_haskell/compare_3.hs | mit | primCmpInt (Pos x) (Neg y) = GT | 31 | primCmpInt (Pos x) (Neg y) = GT | 31 | primCmpInt (Pos x) (Neg y) = GT | 31 | false | false | 0 | 6 | 6 | 25 | 11 | 14 | null | null |
jimcrayne/jhc | src/E/Values.hs | mit | substLet' :: [(TVr,E)] -> E -> E
substLet' ds' e = ans where
(hh,ds) = partition (isUnboxed . tvrType . fst) ds'
nas = filter ((/= emptyId) . tvrIdent . fst) ds
tas = filter (sortKindLike . tvrType . fst) nas
ans = case (nas,tas) of
([],_) -> hhh hh $ e
(nas,[]) -> hhh hh $ ELetRec nas e
_ -> let
f = typeSubst' mempty (fromList [ (n,e) | (TVr { tvrIdent = n },e) <- tas])
nas' = [ (v,f e) | (v,e) <- nas]
in hhh hh $ ELetRec nas' (f e)
hhh [] e = e
hhh ((h,v):hh) e = eLet h v (hhh hh e) | 594 | substLet' :: [(TVr,E)] -> E -> E
substLet' ds' e = ans where
(hh,ds) = partition (isUnboxed . tvrType . fst) ds'
nas = filter ((/= emptyId) . tvrIdent . fst) ds
tas = filter (sortKindLike . tvrType . fst) nas
ans = case (nas,tas) of
([],_) -> hhh hh $ e
(nas,[]) -> hhh hh $ ELetRec nas e
_ -> let
f = typeSubst' mempty (fromList [ (n,e) | (TVr { tvrIdent = n },e) <- tas])
nas' = [ (v,f e) | (v,e) <- nas]
in hhh hh $ ELetRec nas' (f e)
hhh [] e = e
hhh ((h,v):hh) e = eLet h v (hhh hh e) | 594 | substLet' ds' e = ans where
(hh,ds) = partition (isUnboxed . tvrType . fst) ds'
nas = filter ((/= emptyId) . tvrIdent . fst) ds
tas = filter (sortKindLike . tvrType . fst) nas
ans = case (nas,tas) of
([],_) -> hhh hh $ e
(nas,[]) -> hhh hh $ ELetRec nas e
_ -> let
f = typeSubst' mempty (fromList [ (n,e) | (TVr { tvrIdent = n },e) <- tas])
nas' = [ (v,f e) | (v,e) <- nas]
in hhh hh $ ELetRec nas' (f e)
hhh [] e = e
hhh ((h,v):hh) e = eLet h v (hhh hh e) | 561 | false | true | 5 | 21 | 215 | 356 | 177 | 179 | null | null |
DougBurke/swish | tests/RDFDatatypeXsdIntegerTest.hs | lgpl-2.1 | testVarModifyProd02 = testVmod3 "testVarModifyProd02"
(getDTMod dmodXsdIntegerProd rdfDatatypeValXsdInteger)
[makeBVI [("b","2"),("c","3")]]
[makeBVI [("a","6"),("b","2"),("c","3")]] | 243 | testVarModifyProd02 = testVmod3 "testVarModifyProd02"
(getDTMod dmodXsdIntegerProd rdfDatatypeValXsdInteger)
[makeBVI [("b","2"),("c","3")]]
[makeBVI [("a","6"),("b","2"),("c","3")]] | 243 | testVarModifyProd02 = testVmod3 "testVarModifyProd02"
(getDTMod dmodXsdIntegerProd rdfDatatypeValXsdInteger)
[makeBVI [("b","2"),("c","3")]]
[makeBVI [("a","6"),("b","2"),("c","3")]] | 243 | false | false | 0 | 9 | 71 | 80 | 47 | 33 | null | null |
avieth/diplomacy | Diplomacy/SVGMap.hs | bsd-3-clause | provinceElement (Normal Clyde) = S.polygon ! A.points "138,214 130,208 129,197 139,189 140,182 148,177 162,181 161,185 154,188 152,194 146,200 144,213" | 151 | provinceElement (Normal Clyde) = S.polygon ! A.points "138,214 130,208 129,197 139,189 140,182 148,177 162,181 161,185 154,188 152,194 146,200 144,213" | 151 | provinceElement (Normal Clyde) = S.polygon ! A.points "138,214 130,208 129,197 139,189 140,182 148,177 162,181 161,185 154,188 152,194 146,200 144,213" | 151 | false | false | 0 | 7 | 18 | 27 | 12 | 15 | null | null |
olsner/ghc | compiler/nativeGen/X86/CodeGen.hs | bsd-3-clause | mangleIndexTree :: DynFlags -> CmmReg -> Int -> CmmExpr
mangleIndexTree dflags reg off
= CmmMachOp (MO_Add width) [CmmReg reg, CmmLit (CmmInt (fromIntegral off) width)]
where width = typeWidth (cmmRegType dflags reg)
-- | The dual to getAnyReg: compute an expression into a register, but
-- we don't mind which one it is. | 331 | mangleIndexTree :: DynFlags -> CmmReg -> Int -> CmmExpr
mangleIndexTree dflags reg off
= CmmMachOp (MO_Add width) [CmmReg reg, CmmLit (CmmInt (fromIntegral off) width)]
where width = typeWidth (cmmRegType dflags reg)
-- | The dual to getAnyReg: compute an expression into a register, but
-- we don't mind which one it is. | 331 | mangleIndexTree dflags reg off
= CmmMachOp (MO_Add width) [CmmReg reg, CmmLit (CmmInt (fromIntegral off) width)]
where width = typeWidth (cmmRegType dflags reg)
-- | The dual to getAnyReg: compute an expression into a register, but
-- we don't mind which one it is. | 275 | false | true | 1 | 11 | 61 | 97 | 45 | 52 | null | null |
nomeata/list-fusion-lab | ListImpls/BaseFrom76.hs | bsd-3-clause | last :: [a] -> a
last [] = errorEmptyList "last" | 84 | last :: [a] -> a
last [] = errorEmptyList "last" | 84 | last [] = errorEmptyList "last" | 48 | false | true | 0 | 6 | 45 | 27 | 13 | 14 | null | null |
mrakgr/futhark | src/Language/Futhark/Attributes.hs | bsd-3-clause | addTupleArrayElemAliases :: TupleArrayElemTypeBase shape asf vn
-> (asf vn -> ast vn)
-> TupleArrayElemTypeBase shape ast vn
addTupleArrayElemAliases (PrimArrayElem bt als u) f =
PrimArrayElem bt (f als) u | 257 | addTupleArrayElemAliases :: TupleArrayElemTypeBase shape asf vn
-> (asf vn -> ast vn)
-> TupleArrayElemTypeBase shape ast vn
addTupleArrayElemAliases (PrimArrayElem bt als u) f =
PrimArrayElem bt (f als) u | 257 | addTupleArrayElemAliases (PrimArrayElem bt als u) f =
PrimArrayElem bt (f als) u | 82 | false | true | 0 | 9 | 80 | 74 | 35 | 39 | null | null |
svenssonjoel/ArrowObsidian | Obsidian/ArrowObsidian/CodeGen.hs | bsd-3-clause | addOffsetDExp offs (Op1 op a) =
Op1 op (addOffsetDExp offs a) | 68 | addOffsetDExp offs (Op1 op a) =
Op1 op (addOffsetDExp offs a) | 68 | addOffsetDExp offs (Op1 op a) =
Op1 op (addOffsetDExp offs a) | 68 | false | false | 0 | 7 | 17 | 32 | 15 | 17 | null | null |
kawu/walenty | src/NLP/Walenty/Expand.hs | bsd-2-clause | expansionP :: Parser Expansion
expansionP = do
typ <- A.takeTill (=='-')
void $ string "-->"
void $ A.endOfLine
eto <- toP
return $ Expansion typ eto
<?> "expansionP" | 178 | expansionP :: Parser Expansion
expansionP = do
typ <- A.takeTill (=='-')
void $ string "-->"
void $ A.endOfLine
eto <- toP
return $ Expansion typ eto
<?> "expansionP" | 178 | expansionP = do
typ <- A.takeTill (=='-')
void $ string "-->"
void $ A.endOfLine
eto <- toP
return $ Expansion typ eto
<?> "expansionP" | 147 | false | true | 3 | 9 | 39 | 77 | 33 | 44 | null | null |
mfilmer/haskBMP | bitmap.hs | gpl-3.0 | infoHeaderBytes = 40 | 20 | infoHeaderBytes = 40 | 20 | infoHeaderBytes = 40 | 20 | false | false | 0 | 4 | 2 | 6 | 3 | 3 | null | null |
jgm/pandoc-types | src/Text/Pandoc/Walk.hs | bsd-3-clause | queryBlock f (Div _ bs) = query f bs | 50 | queryBlock f (Div _ bs) = query f bs | 50 | queryBlock f (Div _ bs) = query f bs | 50 | false | false | 0 | 7 | 22 | 24 | 11 | 13 | null | null |
ocramz/petsc-hs | src/Numerical/PETSc/Internal/PutGet/IS.hs | gpl-3.0 | withDmIsColoring :: DM -> ISColoringType_ -> (ISColoring -> IO a) -> IO a
withDmIsColoring dm ct = bracket (dmCreateColoring dm ct) isColoringDestroy | 149 | withDmIsColoring :: DM -> ISColoringType_ -> (ISColoring -> IO a) -> IO a
withDmIsColoring dm ct = bracket (dmCreateColoring dm ct) isColoringDestroy | 149 | withDmIsColoring dm ct = bracket (dmCreateColoring dm ct) isColoringDestroy | 75 | false | true | 0 | 10 | 21 | 54 | 26 | 28 | null | null |
fcostantini/QuickFuzz | src/Python.hs | gpl-3.0 | gFloat :: Arbitrary a => Bool -> Gen(Expr a)
gFloat b = do i <- arbitrary
a <- arbitrary
if b then return (Float i (show i) a)
else return (Imaginary i (show i) a) | 210 | gFloat :: Arbitrary a => Bool -> Gen(Expr a)
gFloat b = do i <- arbitrary
a <- arbitrary
if b then return (Float i (show i) a)
else return (Imaginary i (show i) a) | 210 | gFloat b = do i <- arbitrary
a <- arbitrary
if b then return (Float i (show i) a)
else return (Imaginary i (show i) a) | 165 | false | true | 0 | 13 | 81 | 102 | 47 | 55 | null | null |
mstksg/netwire-experiments | src/Render/Sprite.hs | gpl-3.0 | maybeDiagonal _ = Nothing | 25 | maybeDiagonal _ = Nothing | 25 | maybeDiagonal _ = Nothing | 25 | false | false | 0 | 4 | 3 | 10 | 4 | 6 | null | null |
marionette-of-u/kp19pp | sample/haskell/Parser.hs | bsd-2-clause | resetTmp s = Stack (stack s) [] (length (stack s)) | 53 | resetTmp s = Stack (stack s) [] (length (stack s)) | 53 | resetTmp s = Stack (stack s) [] (length (stack s)) | 53 | false | false | 0 | 9 | 12 | 36 | 17 | 19 | null | null |
cornell-pl/evolution | SymLens.hs | gpl-3.0 | swap :: SymLens (a,b) (b,a)
swap = SymLens () f f
where f = (\(a,b) _ -> ((b,a), ())) | 87 | swap :: SymLens (a,b) (b,a)
swap = SymLens () f f
where f = (\(a,b) _ -> ((b,a), ())) | 87 | swap = SymLens () f f
where f = (\(a,b) _ -> ((b,a), ())) | 59 | false | true | 0 | 8 | 20 | 75 | 43 | 32 | null | null |
liyanchang/scheme-in-haskell | src/chp6.hs | mit | eqv [(Atom arg1), (Atom arg2)] = return $ Bool $ arg1 == arg2 | 61 | eqv [(Atom arg1), (Atom arg2)] = return $ Bool $ arg1 == arg2 | 61 | eqv [(Atom arg1), (Atom arg2)] = return $ Bool $ arg1 == arg2 | 61 | false | false | 0 | 7 | 12 | 40 | 20 | 20 | null | null |
brendanhay/gogol | gogol-poly/gen/Network/Google/Poly/Types/Product.hs | mpl-2.0 | -- | The type of image error encountered. Optional for older image errors.
ieCode :: Lens' ImageError (Maybe ImageErrorCode)
ieCode = lens _ieCode (\ s a -> s{_ieCode = a}) | 172 | ieCode :: Lens' ImageError (Maybe ImageErrorCode)
ieCode = lens _ieCode (\ s a -> s{_ieCode = a}) | 97 | ieCode = lens _ieCode (\ s a -> s{_ieCode = a}) | 47 | true | true | 2 | 9 | 29 | 55 | 25 | 30 | null | null |
PiJoules/Project-Euler-Haskell | prob9.hs | unlicense | {-
A Pythagorean triplet is a set of three natural numbers, a < b < c, for which,
a^2 + b^2 = c^2
For example, 3^2 + 4^2 = 9 + 16 = 25 = 5^2.
There exists exactly one Pythagorean triplet for which a + b + c = 1000.
Find the product abc.
-}
-- Guess by checking each possible value for a, b, and c
is1000 a b c = (a < b && b < c) && (a+b+c == 1000) && ( (a*a) + (b*b) == (c*c) ) | 380 | is1000 a b c = (a < b && b < c) && (a+b+c == 1000) && ( (a*a) + (b*b) == (c*c) ) | 80 | is1000 a b c = (a < b && b < c) && (a+b+c == 1000) && ( (a*a) + (b*b) == (c*c) ) | 80 | true | false | 0 | 10 | 94 | 85 | 46 | 39 | null | null |
termite2/tsl | Abstract/BFormula.hs | bsd-3-clause | fAbsVars' :: (?spec::Spec) => Formula -> [AbsVar]
fAbsVars' FTrue = [] | 81 | fAbsVars' :: (?spec::Spec) => Formula -> [AbsVar]
fAbsVars' FTrue = [] | 81 | fAbsVars' FTrue = [] | 31 | false | true | 0 | 7 | 21 | 36 | 19 | 17 | null | null |
bitrauser/aoc | src/AOC2015/Day08.hs | bsd-3-clause | decode [] = [] | 14 | decode [] = [] | 14 | decode [] = [] | 14 | false | false | 0 | 6 | 3 | 13 | 6 | 7 | null | null |
randen/cabal | cabal-install/Distribution/Client/ComponentDeps.hs | bsd-3-clause | singleton :: Component -> a -> ComponentDeps a
singleton comp = ComponentDeps . Map.singleton comp | 98 | singleton :: Component -> a -> ComponentDeps a
singleton comp = ComponentDeps . Map.singleton comp | 98 | singleton comp = ComponentDeps . Map.singleton comp | 51 | false | true | 0 | 7 | 14 | 37 | 17 | 20 | null | null |
robdockins/edison | edison-core/src/Data/Edison/Concrete/FingerTree.hs | mit | appendTree4 (Single x) a b c d xs =
x `lcons` a `lcons` b `lcons` c `lcons` d `lcons` xs | 96 | appendTree4 (Single x) a b c d xs =
x `lcons` a `lcons` b `lcons` c `lcons` d `lcons` xs | 96 | appendTree4 (Single x) a b c d xs =
x `lcons` a `lcons` b `lcons` c `lcons` d `lcons` xs | 96 | false | false | 3 | 6 | 27 | 51 | 25 | 26 | null | null |
LATBauerdick/fv.hs | src/Data/Cov.hs | bsd-3-clause | cholInv :: forall a. Cov a -> Cov a
cholInv (Cov {v= a}) = Cov {v= a'} where
n = case A.length a of
6 -> 3
10 -> 4
15 -> 5
_ -> 0 -- error $ "cholInv: not supported for length " <> show (A.length a)
a' = doCholInv a n | 255 | cholInv :: forall a. Cov a -> Cov a
cholInv (Cov {v= a}) = Cov {v= a'} where
n = case A.length a of
6 -> 3
10 -> 4
15 -> 5
_ -> 0 -- error $ "cholInv: not supported for length " <> show (A.length a)
a' = doCholInv a n | 255 | cholInv (Cov {v= a}) = Cov {v= a'} where
n = case A.length a of
6 -> 3
10 -> 4
15 -> 5
_ -> 0 -- error $ "cholInv: not supported for length " <> show (A.length a)
a' = doCholInv a n | 219 | false | true | 0 | 9 | 91 | 100 | 52 | 48 | null | null |
mettekou/ghc | compiler/basicTypes/BasicTypes.hs | bsd-3-clause | isTopLevel NotTopLevel = False | 31 | isTopLevel NotTopLevel = False | 31 | isTopLevel NotTopLevel = False | 31 | false | false | 0 | 5 | 4 | 9 | 4 | 5 | null | null |
mcschroeder/ghc | compiler/main/DynFlags.hs | bsd-3-clause | trustPackage p = exposePackage p >> -- both trust and distrust also expose a package
upd (\s -> s{ trustFlags = TrustPackage p : trustFlags s }) | 146 | trustPackage p = exposePackage p >> -- both trust and distrust also expose a package
upd (\s -> s{ trustFlags = TrustPackage p : trustFlags s }) | 146 | trustPackage p = exposePackage p >> -- both trust and distrust also expose a package
upd (\s -> s{ trustFlags = TrustPackage p : trustFlags s }) | 146 | false | false | 1 | 11 | 28 | 50 | 23 | 27 | null | null |
qnnguyen/howser | test/ArbitraryHTML.hs | bsd-3-clause | someAttributes :: Gen DAttr
someAttributes = fmap (DAttr . M.fromList) $ listOf1 $ do
key <- someValidAttributeToken
val <- someValidAttributeToken
return (key, val) | 177 | someAttributes :: Gen DAttr
someAttributes = fmap (DAttr . M.fromList) $ listOf1 $ do
key <- someValidAttributeToken
val <- someValidAttributeToken
return (key, val) | 177 | someAttributes = fmap (DAttr . M.fromList) $ listOf1 $ do
key <- someValidAttributeToken
val <- someValidAttributeToken
return (key, val) | 149 | false | true | 0 | 10 | 34 | 60 | 29 | 31 | null | null |
marcellussiegburg/autotool | collection/src/Up/Exec.hs | gpl-2.0 | statement exit f s = case s of
Halt -> exit ValUnit
Missing -> rej [ text "soll Anweisung oder Deklaration ersetzt werden" ]
Statement e -> evaluate exit f e
Declaration tn e -> do
v <- evaluate exit f e
assign f tn v
return v | 266 | statement exit f s = case s of
Halt -> exit ValUnit
Missing -> rej [ text "soll Anweisung oder Deklaration ersetzt werden" ]
Statement e -> evaluate exit f e
Declaration tn e -> do
v <- evaluate exit f e
assign f tn v
return v | 266 | statement exit f s = case s of
Halt -> exit ValUnit
Missing -> rej [ text "soll Anweisung oder Deklaration ersetzt werden" ]
Statement e -> evaluate exit f e
Declaration tn e -> do
v <- evaluate exit f e
assign f tn v
return v | 266 | false | false | 0 | 11 | 87 | 98 | 43 | 55 | null | null |
adept/hledger | hledger-lib/Hledger/Utils/Debug.hs | gpl-3.0 | dbg4IO :: (MonadIO m, Show a) => String -> a -> m ()
dbg4IO = ptraceAtIO 4 | 74 | dbg4IO :: (MonadIO m, Show a) => String -> a -> m ()
dbg4IO = ptraceAtIO 4 | 74 | dbg4IO = ptraceAtIO 4 | 21 | false | true | 0 | 9 | 16 | 42 | 21 | 21 | null | null |
tensorflow/haskell | tensorflow-ops/src/TensorFlow/Gradient.hs | apache-2.0 | opGrad "Mul" _ [toT -> x, toT -> y] [dz] =
-- TODO(fmayle): Handle complex numbers.
[ Just $ reshape (sum (dz `CoreOps.mul` y) rx) sx
, Just $ reshape (sum (x `CoreOps.mul` dz) ry) sy ]
where
sx = shape (x :: Tensor Build a)
sy = shape (y :: Tensor Build a)
(rx, ry) = broadcastGradientArgs sx sy | 322 | opGrad "Mul" _ [toT -> x, toT -> y] [dz] =
-- TODO(fmayle): Handle complex numbers.
[ Just $ reshape (sum (dz `CoreOps.mul` y) rx) sx
, Just $ reshape (sum (x `CoreOps.mul` dz) ry) sy ]
where
sx = shape (x :: Tensor Build a)
sy = shape (y :: Tensor Build a)
(rx, ry) = broadcastGradientArgs sx sy | 322 | opGrad "Mul" _ [toT -> x, toT -> y] [dz] =
-- TODO(fmayle): Handle complex numbers.
[ Just $ reshape (sum (dz `CoreOps.mul` y) rx) sx
, Just $ reshape (sum (x `CoreOps.mul` dz) ry) sy ]
where
sx = shape (x :: Tensor Build a)
sy = shape (y :: Tensor Build a)
(rx, ry) = broadcastGradientArgs sx sy | 322 | false | false | 4 | 11 | 85 | 161 | 82 | 79 | null | null |
GaloisInc/galua | lib/macho/src/Data/Macho.hs | mit | getSegmentCommand32 :: MachoReader -> B.ByteString -> MachoHeader -> Get LC_COMMAND
getSegmentCommand32 mr fl mh = do
segname <- takeWhile (/= '\0') . C.unpack <$> getByteString 16
vmaddr <- fromIntegral <$> getWord32 mr
vmsize <- fromIntegral <$> getWord32 mr
fileoff <- fromIntegral <$> getWord32 mr
filesize <- fromIntegral <$> getWord32 mr
maxprot <- getVM_PROT mr
initprot <- getVM_PROT mr
nsects <- fromIntegral <$> getWord32 mr
flags <- getSG_FLAG mr
sects <- sequence (replicate nsects (getSection32 mr fl mh))
return $ LC_SEGMENT MachoSegment
{ seg_segname = segname
, seg_vmaddr = vmaddr
, seg_vmsize = vmsize
, seg_fileoff = fileoff
, seg_filesize = filesize
, seg_maxprot = maxprot
, seg_initprot = initprot
, seg_flags = flags
, seg_sections = sects } | 1,081 | getSegmentCommand32 :: MachoReader -> B.ByteString -> MachoHeader -> Get LC_COMMAND
getSegmentCommand32 mr fl mh = do
segname <- takeWhile (/= '\0') . C.unpack <$> getByteString 16
vmaddr <- fromIntegral <$> getWord32 mr
vmsize <- fromIntegral <$> getWord32 mr
fileoff <- fromIntegral <$> getWord32 mr
filesize <- fromIntegral <$> getWord32 mr
maxprot <- getVM_PROT mr
initprot <- getVM_PROT mr
nsects <- fromIntegral <$> getWord32 mr
flags <- getSG_FLAG mr
sects <- sequence (replicate nsects (getSection32 mr fl mh))
return $ LC_SEGMENT MachoSegment
{ seg_segname = segname
, seg_vmaddr = vmaddr
, seg_vmsize = vmsize
, seg_fileoff = fileoff
, seg_filesize = filesize
, seg_maxprot = maxprot
, seg_initprot = initprot
, seg_flags = flags
, seg_sections = sects } | 1,081 | getSegmentCommand32 mr fl mh = do
segname <- takeWhile (/= '\0') . C.unpack <$> getByteString 16
vmaddr <- fromIntegral <$> getWord32 mr
vmsize <- fromIntegral <$> getWord32 mr
fileoff <- fromIntegral <$> getWord32 mr
filesize <- fromIntegral <$> getWord32 mr
maxprot <- getVM_PROT mr
initprot <- getVM_PROT mr
nsects <- fromIntegral <$> getWord32 mr
flags <- getSG_FLAG mr
sects <- sequence (replicate nsects (getSection32 mr fl mh))
return $ LC_SEGMENT MachoSegment
{ seg_segname = segname
, seg_vmaddr = vmaddr
, seg_vmsize = vmsize
, seg_fileoff = fileoff
, seg_filesize = filesize
, seg_maxprot = maxprot
, seg_initprot = initprot
, seg_flags = flags
, seg_sections = sects } | 997 | false | true | 0 | 13 | 434 | 261 | 127 | 134 | null | null |
kim/amazonka | amazonka-ec2/gen/Network/AWS/EC2/CreateReservedInstancesListing.hs | mpl-2.0 | -- | 'CreateReservedInstancesListing' constructor.
--
-- The fields accessible through corresponding lenses are:
--
-- * 'crilClientToken' @::@ 'Text'
--
-- * 'crilInstanceCount' @::@ 'Int'
--
-- * 'crilPriceSchedules' @::@ ['PriceScheduleSpecification']
--
-- * 'crilReservedInstancesId' @::@ 'Text'
--
createReservedInstancesListing :: Text -- ^ 'crilReservedInstancesId'
-> Int -- ^ 'crilInstanceCount'
-> Text -- ^ 'crilClientToken'
-> CreateReservedInstancesListing
createReservedInstancesListing p1 p2 p3 = CreateReservedInstancesListing
{ _crilReservedInstancesId = p1
, _crilInstanceCount = p2
, _crilClientToken = p3
, _crilPriceSchedules = mempty
} | 790 | createReservedInstancesListing :: Text -- ^ 'crilReservedInstancesId'
-> Int -- ^ 'crilInstanceCount'
-> Text -- ^ 'crilClientToken'
-> CreateReservedInstancesListing
createReservedInstancesListing p1 p2 p3 = CreateReservedInstancesListing
{ _crilReservedInstancesId = p1
, _crilInstanceCount = p2
, _crilClientToken = p3
, _crilPriceSchedules = mempty
} | 486 | createReservedInstancesListing p1 p2 p3 = CreateReservedInstancesListing
{ _crilReservedInstancesId = p1
, _crilInstanceCount = p2
, _crilClientToken = p3
, _crilPriceSchedules = mempty
} | 226 | true | true | 0 | 7 | 210 | 75 | 48 | 27 | null | null |
geekrelief/as3tohaxe | System/Console/ParseArgs.hs | gpl-3.0 | arg_posn :: (Ord a) =>
Arg a -- ^Argument.
-> Bool -- ^True if argument is positional.
arg_posn (Arg { argAbbr = Nothing,
argName = Nothing }) = True | 191 | arg_posn :: (Ord a) =>
Arg a -- ^Argument.
-> Bool
arg_posn (Arg { argAbbr = Nothing,
argName = Nothing }) = True | 152 | arg_posn (Arg { argAbbr = Nothing,
argName = Nothing }) = True | 78 | true | true | 0 | 9 | 70 | 50 | 28 | 22 | null | null |
AlexanderPankiv/ghc | compiler/types/Type.hs | bsd-3-clause | cmpTypeX _ (LitTy l1) (LitTy l2) = compare l1 l2 | 68 | cmpTypeX _ (LitTy l1) (LitTy l2) = compare l1 l2 | 68 | cmpTypeX _ (LitTy l1) (LitTy l2) = compare l1 l2 | 68 | false | false | 2 | 7 | 29 | 33 | 14 | 19 | null | null |
shlomobauer/BuildIT | src/Treepr.hs | apache-2.0 | ptreeb (VBlock a b) = let z = "vcenter " ++ a in
do
putStrLn ""
putStrLn z
ptreel 1 b
-- pretty print esxhost block | 123 | ptreeb (VBlock a b) = let z = "vcenter " ++ a in
do
putStrLn ""
putStrLn z
ptreel 1 b
-- pretty print esxhost block | 123 | ptreeb (VBlock a b) = let z = "vcenter " ++ a in
do
putStrLn ""
putStrLn z
ptreel 1 b
-- pretty print esxhost block | 123 | false | false | 0 | 9 | 33 | 54 | 23 | 31 | null | null |
mbakke/ganeti | src/Ganeti/Constants.hs | bsd-2-clause | dtPlain :: String
dtPlain = Types.diskTemplateToRaw DTPlain | 59 | dtPlain :: String
dtPlain = Types.diskTemplateToRaw DTPlain | 59 | dtPlain = Types.diskTemplateToRaw DTPlain | 41 | false | true | 0 | 6 | 6 | 16 | 8 | 8 | null | null |
yupferris/write-you-a-haskell | chapter5/stlc/Parser.hs | mit | lambda :: Parser Expr
lambda = do
reservedOp "\\"
x <- identifier
reservedOp ":"
t <- type'
reservedOp "."
e <- expr
return (Lam x t e) | 149 | lambda :: Parser Expr
lambda = do
reservedOp "\\"
x <- identifier
reservedOp ":"
t <- type'
reservedOp "."
e <- expr
return (Lam x t e) | 149 | lambda = do
reservedOp "\\"
x <- identifier
reservedOp ":"
t <- type'
reservedOp "."
e <- expr
return (Lam x t e) | 127 | false | true | 0 | 10 | 40 | 75 | 30 | 45 | null | null |
grandpascorpion/canon | Math/NumberTheory/Internals.hs | gpl-3.0 | crMaxRoot :: CR_ -> Integer
crMaxRoot c = foldr (\x -> flip gcd $ snd x) 0 c | 76 | crMaxRoot :: CR_ -> Integer
crMaxRoot c = foldr (\x -> flip gcd $ snd x) 0 c | 76 | crMaxRoot c = foldr (\x -> flip gcd $ snd x) 0 c | 48 | false | true | 0 | 9 | 17 | 49 | 22 | 27 | null | null |
urbanslug/ghc | compiler/types/Type.hs | bsd-3-clause | typeSize (TyConApp _ ts) = 1 + sum (map typeSize ts) | 52 | typeSize (TyConApp _ ts) = 1 + sum (map typeSize ts) | 52 | typeSize (TyConApp _ ts) = 1 + sum (map typeSize ts) | 52 | false | false | 0 | 8 | 10 | 33 | 15 | 18 | null | null |
ababkin/railoscopy | src/Client/UI/Request.hs | mit | addRequestPerch :: API -> Request -> Int -> Perch
addRequestPerch api req n = do
div ! atr "class" "panel panel-default" $ do
div ! atr "class" "panel-heading" $ do
h4 ! atr "class" "panel-title clearfix" $ do
div ! atr "data-toggle" "collapse" ! atr "href" (genHref "collapse" n) $ do
div ! atr "class" "request" $ do
span ! atr "class" (addVerbClass req "label") $ verb req
span ! atr "class" "path text-muted small" $ path req
span ! atr "class" "timestamp pull-right text-muted small" $ timestamp req
div ! atr "id" (genId "collapse" n) ! atr "class" "panel-collapse collapse" $ do
div ! atr "class" "panel-body" $ do
ul ! atr "id" "tab-test" ! atr "class" "nav nav-pills" $ do
li ! atr "class" "active" ! atr "data-toggle" "pill" $ do
a ! atr "href" (genHref "general_info" n) $ "General Info"
li ! atr "data-toggle" "pill" $ do
a ! atr "href" (genHref "rendered_templates" n) $ "Rendered Templates"
li ! atr "data-toggle" "pill" $ do
a ! atr "href" (genHref "sql_queries" n) $ "SQL"
div ! atr "class" "tab-content" $ do
div ! atr "class" "tab-pane active" ! atr "id" (genId "general_info" n) $ generalInfoTable req
div ! atr "class" "tab-pane" ! atr "id" (genId "rendered_templates" n) $ renderedTemplatesTable api req
div ! atr "class" "tab-pane" ! atr "id" (genId "sql_queries" n) $ sqlQueriesTable req
where
genHref s n = "#" ++ genId s n
genId s n = s ++ "_" ++ show n
generalInfoTable req = do
table ! atr "class" "table general" $ do
tbody $ do
tr $ do
td "Method"
td $ verb req
tr $ do
td "Controller"
td $ controller req
tr $ do
td "Action"
td $ action req
tr $ do
td "Path"
td $ path req
tr $ do
td "Status"
td $ statusCode req
renderedTemplatesTable :: API -> Request -> Perch
renderedTemplatesTable api req = do
table ! atr "class" "table templates" $ do
tbody $ do
foldMap (renderPartial api) $ renderedPartials req
where
renderPartial api partial = do
tr $ do
td $ do
this `addEvent` OnClick $ \_ _ -> onServer $ (performActionInVim api) <.> (prPath partial)
span $ prPath partial
td $ prTimestamp partial
sqlQueriesTable req = do
table ! atr "class" "table sql" $ do
tbody $ do
foldMap renderSqlQuery $ sqlQueries req
where
renderSqlQuery query = do
tr $ do
td ! atr "class" "query" $ sqSql query
td $ sqTimestamp query
addVerbClass req classes = classes ++ " " ++ (verbCssClass $ verb req)
verbCssClass request = case verb req of
"GET" -> "get"
"POST" -> "post"
"PUT" -> "put"
"DELETE" -> "delete"
_ -> "unexpected_verb" | 3,127 | addRequestPerch :: API -> Request -> Int -> Perch
addRequestPerch api req n = do
div ! atr "class" "panel panel-default" $ do
div ! atr "class" "panel-heading" $ do
h4 ! atr "class" "panel-title clearfix" $ do
div ! atr "data-toggle" "collapse" ! atr "href" (genHref "collapse" n) $ do
div ! atr "class" "request" $ do
span ! atr "class" (addVerbClass req "label") $ verb req
span ! atr "class" "path text-muted small" $ path req
span ! atr "class" "timestamp pull-right text-muted small" $ timestamp req
div ! atr "id" (genId "collapse" n) ! atr "class" "panel-collapse collapse" $ do
div ! atr "class" "panel-body" $ do
ul ! atr "id" "tab-test" ! atr "class" "nav nav-pills" $ do
li ! atr "class" "active" ! atr "data-toggle" "pill" $ do
a ! atr "href" (genHref "general_info" n) $ "General Info"
li ! atr "data-toggle" "pill" $ do
a ! atr "href" (genHref "rendered_templates" n) $ "Rendered Templates"
li ! atr "data-toggle" "pill" $ do
a ! atr "href" (genHref "sql_queries" n) $ "SQL"
div ! atr "class" "tab-content" $ do
div ! atr "class" "tab-pane active" ! atr "id" (genId "general_info" n) $ generalInfoTable req
div ! atr "class" "tab-pane" ! atr "id" (genId "rendered_templates" n) $ renderedTemplatesTable api req
div ! atr "class" "tab-pane" ! atr "id" (genId "sql_queries" n) $ sqlQueriesTable req
where
genHref s n = "#" ++ genId s n
genId s n = s ++ "_" ++ show n
generalInfoTable req = do
table ! atr "class" "table general" $ do
tbody $ do
tr $ do
td "Method"
td $ verb req
tr $ do
td "Controller"
td $ controller req
tr $ do
td "Action"
td $ action req
tr $ do
td "Path"
td $ path req
tr $ do
td "Status"
td $ statusCode req
renderedTemplatesTable :: API -> Request -> Perch
renderedTemplatesTable api req = do
table ! atr "class" "table templates" $ do
tbody $ do
foldMap (renderPartial api) $ renderedPartials req
where
renderPartial api partial = do
tr $ do
td $ do
this `addEvent` OnClick $ \_ _ -> onServer $ (performActionInVim api) <.> (prPath partial)
span $ prPath partial
td $ prTimestamp partial
sqlQueriesTable req = do
table ! atr "class" "table sql" $ do
tbody $ do
foldMap renderSqlQuery $ sqlQueries req
where
renderSqlQuery query = do
tr $ do
td ! atr "class" "query" $ sqSql query
td $ sqTimestamp query
addVerbClass req classes = classes ++ " " ++ (verbCssClass $ verb req)
verbCssClass request = case verb req of
"GET" -> "get"
"POST" -> "post"
"PUT" -> "put"
"DELETE" -> "delete"
_ -> "unexpected_verb" | 3,127 | addRequestPerch api req n = do
div ! atr "class" "panel panel-default" $ do
div ! atr "class" "panel-heading" $ do
h4 ! atr "class" "panel-title clearfix" $ do
div ! atr "data-toggle" "collapse" ! atr "href" (genHref "collapse" n) $ do
div ! atr "class" "request" $ do
span ! atr "class" (addVerbClass req "label") $ verb req
span ! atr "class" "path text-muted small" $ path req
span ! atr "class" "timestamp pull-right text-muted small" $ timestamp req
div ! atr "id" (genId "collapse" n) ! atr "class" "panel-collapse collapse" $ do
div ! atr "class" "panel-body" $ do
ul ! atr "id" "tab-test" ! atr "class" "nav nav-pills" $ do
li ! atr "class" "active" ! atr "data-toggle" "pill" $ do
a ! atr "href" (genHref "general_info" n) $ "General Info"
li ! atr "data-toggle" "pill" $ do
a ! atr "href" (genHref "rendered_templates" n) $ "Rendered Templates"
li ! atr "data-toggle" "pill" $ do
a ! atr "href" (genHref "sql_queries" n) $ "SQL"
div ! atr "class" "tab-content" $ do
div ! atr "class" "tab-pane active" ! atr "id" (genId "general_info" n) $ generalInfoTable req
div ! atr "class" "tab-pane" ! atr "id" (genId "rendered_templates" n) $ renderedTemplatesTable api req
div ! atr "class" "tab-pane" ! atr "id" (genId "sql_queries" n) $ sqlQueriesTable req
where
genHref s n = "#" ++ genId s n
genId s n = s ++ "_" ++ show n
generalInfoTable req = do
table ! atr "class" "table general" $ do
tbody $ do
tr $ do
td "Method"
td $ verb req
tr $ do
td "Controller"
td $ controller req
tr $ do
td "Action"
td $ action req
tr $ do
td "Path"
td $ path req
tr $ do
td "Status"
td $ statusCode req
renderedTemplatesTable :: API -> Request -> Perch
renderedTemplatesTable api req = do
table ! atr "class" "table templates" $ do
tbody $ do
foldMap (renderPartial api) $ renderedPartials req
where
renderPartial api partial = do
tr $ do
td $ do
this `addEvent` OnClick $ \_ _ -> onServer $ (performActionInVim api) <.> (prPath partial)
span $ prPath partial
td $ prTimestamp partial
sqlQueriesTable req = do
table ! atr "class" "table sql" $ do
tbody $ do
foldMap renderSqlQuery $ sqlQueries req
where
renderSqlQuery query = do
tr $ do
td ! atr "class" "query" $ sqSql query
td $ sqTimestamp query
addVerbClass req classes = classes ++ " " ++ (verbCssClass $ verb req)
verbCssClass request = case verb req of
"GET" -> "get"
"POST" -> "post"
"PUT" -> "put"
"DELETE" -> "delete"
_ -> "unexpected_verb" | 3,077 | false | true | 0 | 26 | 1,130 | 1,024 | 458 | 566 | null | null |
mwahab1/pandoc | src/Text/Pandoc/Writers/LaTeX.hs | gpl-2.0 | fixLineBreaks' :: [Inline] -> [Inline]
fixLineBreaks' ils = case splitBy (== LineBreak) ils of
[] -> []
[xs] -> xs
chunks -> RawInline "tex" "\\vtop{" :
concatMap tohbox chunks ++
[RawInline "tex" "}"]
where tohbox ys = RawInline "tex" "\\hbox{\\strut " : ys ++
[RawInline "tex" "}"]
-- We also change display math to inline math, since display
-- math breaks in simple tables. | 541 | fixLineBreaks' :: [Inline] -> [Inline]
fixLineBreaks' ils = case splitBy (== LineBreak) ils of
[] -> []
[xs] -> xs
chunks -> RawInline "tex" "\\vtop{" :
concatMap tohbox chunks ++
[RawInline "tex" "}"]
where tohbox ys = RawInline "tex" "\\hbox{\\strut " : ys ++
[RawInline "tex" "}"]
-- We also change display math to inline math, since display
-- math breaks in simple tables. | 541 | fixLineBreaks' ils = case splitBy (== LineBreak) ils of
[] -> []
[xs] -> xs
chunks -> RawInline "tex" "\\vtop{" :
concatMap tohbox chunks ++
[RawInline "tex" "}"]
where tohbox ys = RawInline "tex" "\\hbox{\\strut " : ys ++
[RawInline "tex" "}"]
-- We also change display math to inline math, since display
-- math breaks in simple tables. | 502 | false | true | 0 | 10 | 227 | 122 | 62 | 60 | null | null |
erikd/wai | warp/attic/readInt.hs | mit | runQuickCheckTests :: IO ()
runQuickCheckTests = do
QC.quickCheck (prop_read_show_idempotent readInt)
QC.quickCheck (prop_read_show_idempotent readInt64)
QC.quickCheck (prop_read_show_idempotent readInteger)
QC.quickCheck (prop_read_show_idempotent readInt64MH)
QC.quickCheck (prop_read_show_idempotent readIntegerMH)
QC.quickCheck (prop_read_show_idempotent readIntBSL)
QC.quickCheck (prop_read_show_idempotent readInt64BSL) | 453 | runQuickCheckTests :: IO ()
runQuickCheckTests = do
QC.quickCheck (prop_read_show_idempotent readInt)
QC.quickCheck (prop_read_show_idempotent readInt64)
QC.quickCheck (prop_read_show_idempotent readInteger)
QC.quickCheck (prop_read_show_idempotent readInt64MH)
QC.quickCheck (prop_read_show_idempotent readIntegerMH)
QC.quickCheck (prop_read_show_idempotent readIntBSL)
QC.quickCheck (prop_read_show_idempotent readInt64BSL) | 453 | runQuickCheckTests = do
QC.quickCheck (prop_read_show_idempotent readInt)
QC.quickCheck (prop_read_show_idempotent readInt64)
QC.quickCheck (prop_read_show_idempotent readInteger)
QC.quickCheck (prop_read_show_idempotent readInt64MH)
QC.quickCheck (prop_read_show_idempotent readIntegerMH)
QC.quickCheck (prop_read_show_idempotent readIntBSL)
QC.quickCheck (prop_read_show_idempotent readInt64BSL) | 425 | false | true | 0 | 10 | 55 | 120 | 51 | 69 | null | null |
d12frosted/environment | melkor/test/Melkor/BuildPlanSpec.hs | gpl-3.0 | prop_emptyRequirements :: [Provider] -> Property
prop_emptyRequirements providers = monadicIO $ do
plan <- run . runSimpleApp $ buildPlan HS.empty (HS.fromList providers)
assert $ isEmpty plan | 196 | prop_emptyRequirements :: [Provider] -> Property
prop_emptyRequirements providers = monadicIO $ do
plan <- run . runSimpleApp $ buildPlan HS.empty (HS.fromList providers)
assert $ isEmpty plan | 196 | prop_emptyRequirements providers = monadicIO $ do
plan <- run . runSimpleApp $ buildPlan HS.empty (HS.fromList providers)
assert $ isEmpty plan | 147 | false | true | 0 | 13 | 28 | 65 | 31 | 34 | null | null |
SimSaladin/hcalc | examples/verirahat.hs | bsd-3-clause | t1 :: Sheet
t1 = Sheet
[ hcol ":: What?"
[ "ab-lippu"
, "Wombats kalja"
, "Sushi"
, "8mm tequila"
, "Yesterday"
, "Taxi"
, "Aamiainen"
, "Pumpattava octo"
, "Sampe maksaa"
]
, hcol ":: Matti-Sampe" $
map cellDouble [ 2.1
, -2.8
, 9
, -2
, 2.8
, -4.5
, 11.5
, -7.5
]
++ [cellFormula (FDiv (FSum (CR 1 1) (CR 1 8)) (Fnum 2))]
] | 612 | t1 :: Sheet
t1 = Sheet
[ hcol ":: What?"
[ "ab-lippu"
, "Wombats kalja"
, "Sushi"
, "8mm tequila"
, "Yesterday"
, "Taxi"
, "Aamiainen"
, "Pumpattava octo"
, "Sampe maksaa"
]
, hcol ":: Matti-Sampe" $
map cellDouble [ 2.1
, -2.8
, 9
, -2
, 2.8
, -4.5
, 11.5
, -7.5
]
++ [cellFormula (FDiv (FSum (CR 1 1) (CR 1 8)) (Fnum 2))]
] | 612 | t1 = Sheet
[ hcol ":: What?"
[ "ab-lippu"
, "Wombats kalja"
, "Sushi"
, "8mm tequila"
, "Yesterday"
, "Taxi"
, "Aamiainen"
, "Pumpattava octo"
, "Sampe maksaa"
]
, hcol ":: Matti-Sampe" $
map cellDouble [ 2.1
, -2.8
, 9
, -2
, 2.8
, -4.5
, 11.5
, -7.5
]
++ [cellFormula (FDiv (FSum (CR 1 1) (CR 1 8)) (Fnum 2))]
] | 600 | false | true | 0 | 15 | 356 | 144 | 80 | 64 | null | null |
AlexeyRaga/eta | compiler/ETA/CodeGen/LetNoEscape.hs | bsd-3-clause | letNoEscapeBlocks :: [(Label, Instr)] -> Instr -> Instr
letNoEscapeBlocks lneBinds expr = Instr $ do
cp <- ask
InstrState { isOffset = Offset baseOffset
, isCtrlFlow = cf
, isLabelTable = lt } <- get
let firstOffset = baseOffset + 3 -- The 3 is the length of a goto instruction
(offsets, labelOffsets) = unzip . tail $ scanl' (computeOffsets cf cp) (firstOffset, undefined) lneBinds
defOffset = last offsets
defInstr = expr
(defBytes, _, _)
= runInstrWithLabelsBCS defInstr cp (Offset defOffset) cf lt
breakOffset = defOffset + BS.length defBytes
(_, instrs) = unzip lneBinds
addLabels $ map (\(a,b,_) -> (a,b)) labelOffsets
InstrState { isLabelTable = lt' } <- get
writeGoto $ defOffset - baseOffset
cfs <- forM (zip labelOffsets instrs) $ \((_, offset, shouldJump), instr) -> do
writeStackMapFrame
let (bytes', cf', frames') = runInstrWithLabelsBCS instr cp offset cf lt'
write bytes' frames'
when shouldJump $ do
curOffset <- getOffset
writeGoto $ breakOffset - curOffset
return cf'
let (defBytes', defCf', defFrames')
= runInstrWithLabelsBCS defInstr cp (Offset defOffset) cf lt'
writeStackMapFrame
write defBytes' defFrames'
putCtrlFlow' $ CF.merge cf (defCf' : cfs)
writeStackMapFrame
where computeOffsets cf cp (offset, _) (label, instr) =
( offset + bytesLength + lengthJump
, (label, Offset offset, not hasGoto) )
where state@InstrState { isLastGoto, isLastReturn }
= runInstrWithLabels instr cp (Offset offset) cf mempty
(bytes, _, _) = getBCS state
bytesLength = BS.length bytes
hasGoto = ifLastBranch isLastGoto isLastReturn bytes
lengthJump = if hasGoto then 0 else 3 -- op goto <> pack16 $ length ko
writeGoto offset = do
gotoInstr
writeBytes . packI16 $ offset | 1,951 | letNoEscapeBlocks :: [(Label, Instr)] -> Instr -> Instr
letNoEscapeBlocks lneBinds expr = Instr $ do
cp <- ask
InstrState { isOffset = Offset baseOffset
, isCtrlFlow = cf
, isLabelTable = lt } <- get
let firstOffset = baseOffset + 3 -- The 3 is the length of a goto instruction
(offsets, labelOffsets) = unzip . tail $ scanl' (computeOffsets cf cp) (firstOffset, undefined) lneBinds
defOffset = last offsets
defInstr = expr
(defBytes, _, _)
= runInstrWithLabelsBCS defInstr cp (Offset defOffset) cf lt
breakOffset = defOffset + BS.length defBytes
(_, instrs) = unzip lneBinds
addLabels $ map (\(a,b,_) -> (a,b)) labelOffsets
InstrState { isLabelTable = lt' } <- get
writeGoto $ defOffset - baseOffset
cfs <- forM (zip labelOffsets instrs) $ \((_, offset, shouldJump), instr) -> do
writeStackMapFrame
let (bytes', cf', frames') = runInstrWithLabelsBCS instr cp offset cf lt'
write bytes' frames'
when shouldJump $ do
curOffset <- getOffset
writeGoto $ breakOffset - curOffset
return cf'
let (defBytes', defCf', defFrames')
= runInstrWithLabelsBCS defInstr cp (Offset defOffset) cf lt'
writeStackMapFrame
write defBytes' defFrames'
putCtrlFlow' $ CF.merge cf (defCf' : cfs)
writeStackMapFrame
where computeOffsets cf cp (offset, _) (label, instr) =
( offset + bytesLength + lengthJump
, (label, Offset offset, not hasGoto) )
where state@InstrState { isLastGoto, isLastReturn }
= runInstrWithLabels instr cp (Offset offset) cf mempty
(bytes, _, _) = getBCS state
bytesLength = BS.length bytes
hasGoto = ifLastBranch isLastGoto isLastReturn bytes
lengthJump = if hasGoto then 0 else 3 -- op goto <> pack16 $ length ko
writeGoto offset = do
gotoInstr
writeBytes . packI16 $ offset | 1,951 | letNoEscapeBlocks lneBinds expr = Instr $ do
cp <- ask
InstrState { isOffset = Offset baseOffset
, isCtrlFlow = cf
, isLabelTable = lt } <- get
let firstOffset = baseOffset + 3 -- The 3 is the length of a goto instruction
(offsets, labelOffsets) = unzip . tail $ scanl' (computeOffsets cf cp) (firstOffset, undefined) lneBinds
defOffset = last offsets
defInstr = expr
(defBytes, _, _)
= runInstrWithLabelsBCS defInstr cp (Offset defOffset) cf lt
breakOffset = defOffset + BS.length defBytes
(_, instrs) = unzip lneBinds
addLabels $ map (\(a,b,_) -> (a,b)) labelOffsets
InstrState { isLabelTable = lt' } <- get
writeGoto $ defOffset - baseOffset
cfs <- forM (zip labelOffsets instrs) $ \((_, offset, shouldJump), instr) -> do
writeStackMapFrame
let (bytes', cf', frames') = runInstrWithLabelsBCS instr cp offset cf lt'
write bytes' frames'
when shouldJump $ do
curOffset <- getOffset
writeGoto $ breakOffset - curOffset
return cf'
let (defBytes', defCf', defFrames')
= runInstrWithLabelsBCS defInstr cp (Offset defOffset) cf lt'
writeStackMapFrame
write defBytes' defFrames'
putCtrlFlow' $ CF.merge cf (defCf' : cfs)
writeStackMapFrame
where computeOffsets cf cp (offset, _) (label, instr) =
( offset + bytesLength + lengthJump
, (label, Offset offset, not hasGoto) )
where state@InstrState { isLastGoto, isLastReturn }
= runInstrWithLabels instr cp (Offset offset) cf mempty
(bytes, _, _) = getBCS state
bytesLength = BS.length bytes
hasGoto = ifLastBranch isLastGoto isLastReturn bytes
lengthJump = if hasGoto then 0 else 3 -- op goto <> pack16 $ length ko
writeGoto offset = do
gotoInstr
writeBytes . packI16 $ offset | 1,895 | false | true | 2 | 17 | 533 | 607 | 315 | 292 | null | null |
solidsnack/system-uuid | Options.hs | bsd-3-clause | stringPrim = tokenPrim show nextPos
where
nextPos sp _ _ = incSourceLine sp 1 | 112 | stringPrim = tokenPrim show nextPos
where
nextPos sp _ _ = incSourceLine sp 1 | 112 | stringPrim = tokenPrim show nextPos
where
nextPos sp _ _ = incSourceLine sp 1 | 112 | false | false | 0 | 5 | 48 | 31 | 14 | 17 | null | null |
ThibaudDauce/habreaker | src/Lib.hs | bsd-3-clause | checkPassword :: Digest SHA1 -> String -> Bool
checkPassword hash string = (sha1 string) == hash | 96 | checkPassword :: Digest SHA1 -> String -> Bool
checkPassword hash string = (sha1 string) == hash | 96 | checkPassword hash string = (sha1 string) == hash | 49 | false | true | 0 | 7 | 15 | 37 | 18 | 19 | null | null |
uuhan/Idris-dev | src/Idris/REPL.hs | bsd-3-clause | showTotal t@(Partial (Mutual ns)) i
= text "possibly not total due to recursive path:" <$>
align (group (vsep (punctuate comma
(map (\n -> annotate (AnnName n Nothing Nothing Nothing) $
text (show n))
ns)))) | 253 | showTotal t@(Partial (Mutual ns)) i
= text "possibly not total due to recursive path:" <$>
align (group (vsep (punctuate comma
(map (\n -> annotate (AnnName n Nothing Nothing Nothing) $
text (show n))
ns)))) | 253 | showTotal t@(Partial (Mutual ns)) i
= text "possibly not total due to recursive path:" <$>
align (group (vsep (punctuate comma
(map (\n -> annotate (AnnName n Nothing Nothing Nothing) $
text (show n))
ns)))) | 253 | false | false | 0 | 20 | 79 | 100 | 49 | 51 | null | null |
beni55/haste-compiler | libraries/ghc-7.10/base/GHC/Weak.hs | bsd-3-clause | mkWeak :: k -- ^ key
-> v -- ^ value
-> Maybe (IO ()) -- ^ finalizer
-> IO (Weak v) -- ^ returns: a weak pointer object
mkWeak key val (Just finalizer) = IO $ \s ->
case mkWeak# key val finalizer s of { (# s1, w #) -> (# s1, Weak w #) } | 351 | mkWeak :: k -- ^ key
-> v -- ^ value
-> Maybe (IO ()) -- ^ finalizer
-> IO (Weak v)
mkWeak key val (Just finalizer) = IO $ \s ->
case mkWeak# key val finalizer s of { (# s1, w #) -> (# s1, Weak w #) } | 297 | mkWeak key val (Just finalizer) = IO $ \s ->
case mkWeak# key val finalizer s of { (# s1, w #) -> (# s1, Weak w #) } | 119 | true | true | 0 | 11 | 172 | 103 | 54 | 49 | null | null |
SAdams601/ParRegexSearch | test/fst-0.9.0.1/FST/AutomatonInterface.hs | mit | minimize :: Ord a => Automaton a -> Automaton a
minimize automaton = M.minimize automaton | 89 | minimize :: Ord a => Automaton a -> Automaton a
minimize automaton = M.minimize automaton | 89 | minimize automaton = M.minimize automaton | 41 | false | true | 0 | 7 | 14 | 39 | 17 | 22 | null | null |
ComputationWithBoundedResources/ara-inference | doc/tpdb_trs/Haskell/basic_haskell/take_1.hs | mit | esEsOrdering EQ EQ = MyTrue | 27 | esEsOrdering EQ EQ = MyTrue | 27 | esEsOrdering EQ EQ = MyTrue | 27 | false | false | 0 | 5 | 4 | 11 | 5 | 6 | null | null |
hlmerscher/advent-of-code-2015 | src/Day12.hs | bsd-3-clause | parseValue (Object o) = sum $ H.map parseValue o | 48 | parseValue (Object o) = sum $ H.map parseValue o | 48 | parseValue (Object o) = sum $ H.map parseValue o | 48 | false | false | 0 | 7 | 8 | 26 | 12 | 14 | null | null |
adinapoli/xmonad-contrib | XMonad/Hooks/ScreenCorners.hs | bsd-3-clause | createWindowAt SCLowerRight = withDisplay $ \dpy ->
let w = displayWidth dpy (defaultScreen dpy) - 1
h = displayHeight dpy (defaultScreen dpy) - 1
in createWindowAt' (fi w) (fi h) | 196 | createWindowAt SCLowerRight = withDisplay $ \dpy ->
let w = displayWidth dpy (defaultScreen dpy) - 1
h = displayHeight dpy (defaultScreen dpy) - 1
in createWindowAt' (fi w) (fi h) | 196 | createWindowAt SCLowerRight = withDisplay $ \dpy ->
let w = displayWidth dpy (defaultScreen dpy) - 1
h = displayHeight dpy (defaultScreen dpy) - 1
in createWindowAt' (fi w) (fi h) | 196 | false | false | 0 | 14 | 46 | 81 | 39 | 42 | null | null |
azadbolour/boardgame | haskell-server/src/Bolour/Language/Util/WordUtil.hs | agpl-3.0 | computeCombos :: String -> [LetterCombo]
computeCombos bytes = sort <$> computeCombosUnsorted bytes | 99 | computeCombos :: String -> [LetterCombo]
computeCombos bytes = sort <$> computeCombosUnsorted bytes | 99 | computeCombos bytes = sort <$> computeCombosUnsorted bytes | 58 | false | true | 0 | 6 | 11 | 28 | 14 | 14 | null | null |
facebookincubator/duckling | Duckling/Time/BG/Rules.hs | bsd-3-clause | ruleLastTime :: Rule
ruleLastTime = Rule
{ name = "last <time>"
, pattern =
[ regex "((пред(н|ишн))|минал)((ия(т)?)|ата|ото)"
, Predicate isOkWithThisNext
]
, prod = \case
(_:Token Time td:_) -> tt $ predNth (- 1) False td
_ -> Nothing
} | 269 | ruleLastTime :: Rule
ruleLastTime = Rule
{ name = "last <time>"
, pattern =
[ regex "((пред(н|ишн))|минал)((ия(т)?)|ата|ото)"
, Predicate isOkWithThisNext
]
, prod = \case
(_:Token Time td:_) -> tt $ predNth (- 1) False td
_ -> Nothing
} | 269 | ruleLastTime = Rule
{ name = "last <time>"
, pattern =
[ regex "((пред(н|ишн))|минал)((ия(т)?)|ата|ото)"
, Predicate isOkWithThisNext
]
, prod = \case
(_:Token Time td:_) -> tt $ predNth (- 1) False td
_ -> Nothing
} | 248 | false | true | 0 | 14 | 71 | 93 | 49 | 44 | null | null |
mpickering/ghc-exactprint | tests/Test/CommonUtils.hs | bsd-3-clause | -- |Hand edited list of files known to fail, no fix required/possible
knownFailuresFile :: FilePath
knownFailuresFile = configDir </> "knownfailures.txt" | 153 | knownFailuresFile :: FilePath
knownFailuresFile = configDir </> "knownfailures.txt" | 83 | knownFailuresFile = configDir </> "knownfailures.txt" | 53 | true | true | 0 | 5 | 19 | 16 | 9 | 7 | null | null |
agentm/project-m36 | src/lib/ProjectM36/Server/EntryPoints.hs | unlicense | handleExecuteSchemaExpr :: Maybe Timeout -> SessionId -> Connection -> SchemaExpr -> IO (Either RelationalError ())
handleExecuteSchemaExpr ti sessionId conn schemaExpr =
timeoutRelErr ti (executeSchemaExpr sessionId conn schemaExpr) | 235 | handleExecuteSchemaExpr :: Maybe Timeout -> SessionId -> Connection -> SchemaExpr -> IO (Either RelationalError ())
handleExecuteSchemaExpr ti sessionId conn schemaExpr =
timeoutRelErr ti (executeSchemaExpr sessionId conn schemaExpr) | 235 | handleExecuteSchemaExpr ti sessionId conn schemaExpr =
timeoutRelErr ti (executeSchemaExpr sessionId conn schemaExpr) | 119 | false | true | 0 | 12 | 28 | 67 | 32 | 35 | null | null |
naoto-ogawa/h-xproto-mysql | src/DataBase/MySQLX/DateTime.hs | mit | getListDec :: Bit.BitGet [Int]
getListDec = do
e <- Bit.isEmpty
if e
then return []
else do x <- getOneDec
xs <- getListDec
return (x:xs) | 175 | getListDec :: Bit.BitGet [Int]
getListDec = do
e <- Bit.isEmpty
if e
then return []
else do x <- getOneDec
xs <- getListDec
return (x:xs) | 175 | getListDec = do
e <- Bit.isEmpty
if e
then return []
else do x <- getOneDec
xs <- getListDec
return (x:xs) | 144 | false | true | 0 | 12 | 62 | 71 | 34 | 37 | null | null |
rfranek/duckling | Duckling/Time/NB/Rules.hs | bsd-3-clause | ruleTheOrdinalCycleOfTime :: Rule
ruleTheOrdinalCycleOfTime = Rule
{ name = "the <ordinal> <cycle> of <time>"
, pattern =
[ regex "den"
, dimension Ordinal
, dimension TimeGrain
, regex "av|i|fra"
, dimension Time
]
, prod = \tokens -> case tokens of
(_:Token Ordinal od:Token TimeGrain grain:_:Token Time td:_) ->
tt $ cycleNthAfter True grain (TOrdinal.value od - 1) td
_ -> Nothing
} | 438 | ruleTheOrdinalCycleOfTime :: Rule
ruleTheOrdinalCycleOfTime = Rule
{ name = "the <ordinal> <cycle> of <time>"
, pattern =
[ regex "den"
, dimension Ordinal
, dimension TimeGrain
, regex "av|i|fra"
, dimension Time
]
, prod = \tokens -> case tokens of
(_:Token Ordinal od:Token TimeGrain grain:_:Token Time td:_) ->
tt $ cycleNthAfter True grain (TOrdinal.value od - 1) td
_ -> Nothing
} | 438 | ruleTheOrdinalCycleOfTime = Rule
{ name = "the <ordinal> <cycle> of <time>"
, pattern =
[ regex "den"
, dimension Ordinal
, dimension TimeGrain
, regex "av|i|fra"
, dimension Time
]
, prod = \tokens -> case tokens of
(_:Token Ordinal od:Token TimeGrain grain:_:Token Time td:_) ->
tt $ cycleNthAfter True grain (TOrdinal.value od - 1) td
_ -> Nothing
} | 404 | false | true | 0 | 18 | 114 | 149 | 76 | 73 | null | null |
dylex/hsaml2 | SAML2/XML/Signature/Types.hs | apache-2.0 | simpleDigest :: DigestAlgorithm -> DigestMethod
simpleDigest a = DigestMethod (Identified a) [] | 95 | simpleDigest :: DigestAlgorithm -> DigestMethod
simpleDigest a = DigestMethod (Identified a) [] | 95 | simpleDigest a = DigestMethod (Identified a) [] | 47 | false | true | 0 | 7 | 11 | 31 | 15 | 16 | null | null |
rueshyna/gogol | gogol-appengine/gen/Network/Google/Resource/AppEngine/Apps/Operations/List.hs | mpl-2.0 | -- | Creates a value of 'AppsOperationsList' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'aolXgafv'
--
-- * 'aolUploadProtocol'
--
-- * 'aolPp'
--
-- * 'aolAccessToken'
--
-- * 'aolUploadType'
--
-- * 'aolBearerToken'
--
-- * 'aolAppsId'
--
-- * 'aolFilter'
--
-- * 'aolPageToken'
--
-- * 'aolPageSize'
--
-- * 'aolCallback'
appsOperationsList
:: Text -- ^ 'aolAppsId'
-> AppsOperationsList
appsOperationsList pAolAppsId_ =
AppsOperationsList'
{ _aolXgafv = Nothing
, _aolUploadProtocol = Nothing
, _aolPp = True
, _aolAccessToken = Nothing
, _aolUploadType = Nothing
, _aolBearerToken = Nothing
, _aolAppsId = pAolAppsId_
, _aolFilter = Nothing
, _aolPageToken = Nothing
, _aolPageSize = Nothing
, _aolCallback = Nothing
} | 872 | appsOperationsList
:: Text -- ^ 'aolAppsId'
-> AppsOperationsList
appsOperationsList pAolAppsId_ =
AppsOperationsList'
{ _aolXgafv = Nothing
, _aolUploadProtocol = Nothing
, _aolPp = True
, _aolAccessToken = Nothing
, _aolUploadType = Nothing
, _aolBearerToken = Nothing
, _aolAppsId = pAolAppsId_
, _aolFilter = Nothing
, _aolPageToken = Nothing
, _aolPageSize = Nothing
, _aolCallback = Nothing
} | 458 | appsOperationsList pAolAppsId_ =
AppsOperationsList'
{ _aolXgafv = Nothing
, _aolUploadProtocol = Nothing
, _aolPp = True
, _aolAccessToken = Nothing
, _aolUploadType = Nothing
, _aolBearerToken = Nothing
, _aolAppsId = pAolAppsId_
, _aolFilter = Nothing
, _aolPageToken = Nothing
, _aolPageSize = Nothing
, _aolCallback = Nothing
} | 384 | true | true | 0 | 6 | 190 | 112 | 80 | 32 | null | null |
phaazon/OpenGLRaw | src/Graphics/Rendering/OpenGL/Raw/Tokens.hs | bsd-3-clause | gl_AUX2 :: GLenum
gl_AUX2 = 0x040B | 34 | gl_AUX2 :: GLenum
gl_AUX2 = 0x040B | 34 | gl_AUX2 = 0x040B | 16 | false | true | 0 | 4 | 5 | 11 | 6 | 5 | null | null |
pbrisbin/yesod-paginator | test/Yesod/Paginator/PagesSpec.hs | mit | spec :: Spec
spec = do
describe "Page" $ do
let proxyPage :: Proxy Page
proxyPage = Proxy
itPreserves $ functorLaws proxyPage
itPreserves $ foldableLaws proxyPage
itPreserves $ traversableLaws proxyPage
describe "Pages" $ do
let proxyPages :: Proxy Pages
proxyPages = Proxy
itPreserves $ functorLaws proxyPages
itPreserves $ foldableLaws proxyPages
itPreserves $ traversableLaws proxyPages | 488 | spec :: Spec
spec = do
describe "Page" $ do
let proxyPage :: Proxy Page
proxyPage = Proxy
itPreserves $ functorLaws proxyPage
itPreserves $ foldableLaws proxyPage
itPreserves $ traversableLaws proxyPage
describe "Pages" $ do
let proxyPages :: Proxy Pages
proxyPages = Proxy
itPreserves $ functorLaws proxyPages
itPreserves $ foldableLaws proxyPages
itPreserves $ traversableLaws proxyPages | 488 | spec = do
describe "Page" $ do
let proxyPage :: Proxy Page
proxyPage = Proxy
itPreserves $ functorLaws proxyPage
itPreserves $ foldableLaws proxyPage
itPreserves $ traversableLaws proxyPage
describe "Pages" $ do
let proxyPages :: Proxy Pages
proxyPages = Proxy
itPreserves $ functorLaws proxyPages
itPreserves $ foldableLaws proxyPages
itPreserves $ traversableLaws proxyPages | 475 | false | true | 0 | 14 | 152 | 132 | 55 | 77 | null | null |
snowleopard/alga | src/Algebra/Graph/AdjacencyIntMap.hs | mit | -- | Transform a graph by applying a function to each of its vertices. This is
-- similar to @Functor@'s 'fmap' but can be used with non-fully-parametric
-- 'AdjacencyIntMap'.
-- Complexity: /O((n + m) * log(n))/ time.
--
-- @
-- gmap f 'empty' == 'empty'
-- gmap f ('vertex' x) == 'vertex' (f x)
-- gmap f ('edge' x y) == 'edge' (f x) (f y)
-- gmap id == id
-- gmap f . gmap g == gmap (f . g)
-- @
gmap :: (Int -> Int) -> AdjacencyIntMap -> AdjacencyIntMap
gmap f = AM . IntMap.map (IntSet.map f) . IntMap.mapKeysWith IntSet.union f . adjacencyIntMap | 568 | gmap :: (Int -> Int) -> AdjacencyIntMap -> AdjacencyIntMap
gmap f = AM . IntMap.map (IntSet.map f) . IntMap.mapKeysWith IntSet.union f . adjacencyIntMap | 152 | gmap f = AM . IntMap.map (IntSet.map f) . IntMap.mapKeysWith IntSet.union f . adjacencyIntMap | 93 | true | true | 0 | 11 | 124 | 75 | 43 | 32 | null | null |
SKA-ScienceDataProcessor/RC | MS2/lib/OskarCfg/OskarCfg.hs | apache-2.0 | mbKeyCvt key (Just v) = keyCvt key v | 36 | mbKeyCvt key (Just v) = keyCvt key v | 36 | mbKeyCvt key (Just v) = keyCvt key v | 36 | false | false | 0 | 6 | 7 | 25 | 10 | 15 | null | null |
sumeetchhetri/FrameworkBenchmarks | frameworks/Haskell/wizzardo-inline/wizzardo-http-benchmark/src/main/haskell/Main.hs | bsd-3-clause | createJsonHandler :: MonadIO m => m JHandler
createJsonHandler = createHandler $ \_req resp -> Linear.withLinearIO $
let Linear.Builder{..} = Linear.monadBuilder in do
jmsg <- reflect (toStrict $ encode $ jsonObject resp)
[java| { $resp
.setBody($jmsg)
.appendHeader(Header.KV_CONTENT_TYPE_APPLICATION_JSON);
} |]
return (Unrestricted ())
where
-- Don't inline, so the serialization is not cached.
{-# NOINLINE jsonObject #-}
jsonObject _ = object ["message" .= Text.pack "Hello, World!"] | 553 | createJsonHandler :: MonadIO m => m JHandler
createJsonHandler = createHandler $ \_req resp -> Linear.withLinearIO $
let Linear.Builder{..} = Linear.monadBuilder in do
jmsg <- reflect (toStrict $ encode $ jsonObject resp)
[java| { $resp
.setBody($jmsg)
.appendHeader(Header.KV_CONTENT_TYPE_APPLICATION_JSON);
} |]
return (Unrestricted ())
where
-- Don't inline, so the serialization is not cached.
{-# NOINLINE jsonObject #-}
jsonObject _ = object ["message" .= Text.pack "Hello, World!"] | 553 | createJsonHandler = createHandler $ \_req resp -> Linear.withLinearIO $
let Linear.Builder{..} = Linear.monadBuilder in do
jmsg <- reflect (toStrict $ encode $ jsonObject resp)
[java| { $resp
.setBody($jmsg)
.appendHeader(Header.KV_CONTENT_TYPE_APPLICATION_JSON);
} |]
return (Unrestricted ())
where
-- Don't inline, so the serialization is not cached.
{-# NOINLINE jsonObject #-}
jsonObject _ = object ["message" .= Text.pack "Hello, World!"] | 508 | false | true | 0 | 16 | 128 | 134 | 65 | 69 | null | null |
tamarin-prover/tamarin-prover | lib/theory/src/Theory/Model/Fact.hs | gpl-3.0 | newVariables :: [LNFact] -> [LNFact] -> [LNTerm]
newVariables prems concs = map varTerm $ S.toList newvars
where
newvars = S.difference concvars premvars
premvars = S.fromList $ concatMap getFactVariables prems
concvars = S.fromList $ concatMap getFactVariables concs
------------------------------------------------------------------------------
-- Pretty Printing
------------------------------------------------------------------------------
-- | The name of a fact tag, e.g., @factTagName KUFact = "KU"@. | 524 | newVariables :: [LNFact] -> [LNFact] -> [LNTerm]
newVariables prems concs = map varTerm $ S.toList newvars
where
newvars = S.difference concvars premvars
premvars = S.fromList $ concatMap getFactVariables prems
concvars = S.fromList $ concatMap getFactVariables concs
------------------------------------------------------------------------------
-- Pretty Printing
------------------------------------------------------------------------------
-- | The name of a fact tag, e.g., @factTagName KUFact = "KU"@. | 524 | newVariables prems concs = map varTerm $ S.toList newvars
where
newvars = S.difference concvars premvars
premvars = S.fromList $ concatMap getFactVariables prems
concvars = S.fromList $ concatMap getFactVariables concs
------------------------------------------------------------------------------
-- Pretty Printing
------------------------------------------------------------------------------
-- | The name of a fact tag, e.g., @factTagName KUFact = "KU"@. | 475 | false | true | 8 | 9 | 69 | 112 | 51 | 61 | null | null |
bravit/Idris-dev | src/Idris/Elab/Type.hs | bsd-3-clause | buildType :: ElabInfo
-> SyntaxInfo
-> FC
-> FnOpts
-> Name
-> PTerm
-> Idris (Type, Type, PTerm, [(Int, Name)])
buildType info syn fc opts n ty' = do
ctxt <- getContext
i <- getIState
logElab 2 $ show n ++ " pre-type " ++ showTmImpls ty' ++ show (no_imp syn)
ty' <- addUsingConstraints syn fc ty'
ty' <- addUsingImpls syn n fc ty'
let ty = addImpl (imp_methods syn) i ty'
logElab 5 $ show n ++ " type pre-addimpl " ++ showTmImpls ty'
logElab 5 $ "with methods " ++ show (imp_methods syn)
logElab 2 $ show n ++ " type " ++ show (using syn) ++ "\n" ++ showTmImpls ty
((ElabResult tyT' defer is ctxt' newDecls highlights newGName, est), log) <-
tclift $ elaborate (constraintNS info) ctxt (idris_datatypes i) (idris_name i) n (TType (UVal 0)) initEState
(errAt "type of " n Nothing
(erunAux fc (build i info ETyDecl [] n ty)))
displayWarnings est
setContext ctxt'
processTacticDecls info newDecls
sendHighlighting highlights
updateIState $ \i -> i { idris_name = newGName }
let tyT = patToImp tyT'
logElab 3 $ show ty ++ "\nElaborated: " ++ show tyT'
ds <- checkAddDef True False info fc iderr True defer
-- if the type is not complete, note that we'll need to infer
-- things later (for solving metavariables)
when (length ds > length is) -- more deferred than case blocks
$ addTyInferred n
mapM_ (elabCaseBlock info opts) is
ctxt <- getContext
logElab 5 "Rechecking"
logElab 6 (show tyT)
logElab 10 $ "Elaborated to " ++ showEnvDbg [] tyT
(cty, ckind) <- recheckC (constraintNS info) fc id [] tyT
-- record the implicit and inaccessible arguments
i <- getIState
let (inaccData, impls) = unzip $ getUnboundImplicits i cty ty
let inacc = inaccessibleImps 0 cty inaccData
logElab 3 $ show n ++ ": inaccessible arguments: " ++ show inacc ++
" from " ++ show cty ++ "\n" ++ showTmImpls ty
putIState $ i { idris_implicits = addDef n impls (idris_implicits i) }
logElab 3 ("Implicit " ++ show n ++ " " ++ show impls)
addIBC (IBCImp n)
-- Add the names referenced to the call graph, and check we're not
-- referring to anything less visible
-- In particular, a public/export type can not refer to anything
-- private, but can refer to any public/export
let refs = freeNames cty
nvis <- getFromHideList n
case nvis of
Nothing -> return ()
Just acc -> mapM_ (checkVisibility fc n (max Frozen acc) acc) refs
addCalls n refs
addIBC (IBCCG n)
when (Constructor `notElem` opts) $ do
let pnames = getParamsInType i [] impls cty
let fninfo = FnInfo (param_pos 0 pnames cty)
setFnInfo n fninfo
addIBC (IBCFnInfo n fninfo)
-- If we use any types with linear constructor arguments, we'd better
-- make sure they are use-once
tcliftAt fc $ linearCheck ctxt (whnfArgs ctxt [] cty)
return (cty, ckind, ty, inacc)
where
patToImp (Bind n (PVar rig t) sc) = Bind n (Pi rig Nothing t (TType (UVar [] 0))) (patToImp sc)
patToImp (Bind n b sc) = Bind n b (patToImp sc)
patToImp t = t
param_pos i ns (Bind n (Pi _ _ t _) sc)
| n `elem` ns = i : param_pos (i + 1) ns sc
| otherwise = param_pos (i + 1) ns sc
param_pos i ns t = []
-- | Elaborate a top-level type declaration - for example, "foo : Int -> Int". | 3,816 | buildType :: ElabInfo
-> SyntaxInfo
-> FC
-> FnOpts
-> Name
-> PTerm
-> Idris (Type, Type, PTerm, [(Int, Name)])
buildType info syn fc opts n ty' = do
ctxt <- getContext
i <- getIState
logElab 2 $ show n ++ " pre-type " ++ showTmImpls ty' ++ show (no_imp syn)
ty' <- addUsingConstraints syn fc ty'
ty' <- addUsingImpls syn n fc ty'
let ty = addImpl (imp_methods syn) i ty'
logElab 5 $ show n ++ " type pre-addimpl " ++ showTmImpls ty'
logElab 5 $ "with methods " ++ show (imp_methods syn)
logElab 2 $ show n ++ " type " ++ show (using syn) ++ "\n" ++ showTmImpls ty
((ElabResult tyT' defer is ctxt' newDecls highlights newGName, est), log) <-
tclift $ elaborate (constraintNS info) ctxt (idris_datatypes i) (idris_name i) n (TType (UVal 0)) initEState
(errAt "type of " n Nothing
(erunAux fc (build i info ETyDecl [] n ty)))
displayWarnings est
setContext ctxt'
processTacticDecls info newDecls
sendHighlighting highlights
updateIState $ \i -> i { idris_name = newGName }
let tyT = patToImp tyT'
logElab 3 $ show ty ++ "\nElaborated: " ++ show tyT'
ds <- checkAddDef True False info fc iderr True defer
-- if the type is not complete, note that we'll need to infer
-- things later (for solving metavariables)
when (length ds > length is) -- more deferred than case blocks
$ addTyInferred n
mapM_ (elabCaseBlock info opts) is
ctxt <- getContext
logElab 5 "Rechecking"
logElab 6 (show tyT)
logElab 10 $ "Elaborated to " ++ showEnvDbg [] tyT
(cty, ckind) <- recheckC (constraintNS info) fc id [] tyT
-- record the implicit and inaccessible arguments
i <- getIState
let (inaccData, impls) = unzip $ getUnboundImplicits i cty ty
let inacc = inaccessibleImps 0 cty inaccData
logElab 3 $ show n ++ ": inaccessible arguments: " ++ show inacc ++
" from " ++ show cty ++ "\n" ++ showTmImpls ty
putIState $ i { idris_implicits = addDef n impls (idris_implicits i) }
logElab 3 ("Implicit " ++ show n ++ " " ++ show impls)
addIBC (IBCImp n)
-- Add the names referenced to the call graph, and check we're not
-- referring to anything less visible
-- In particular, a public/export type can not refer to anything
-- private, but can refer to any public/export
let refs = freeNames cty
nvis <- getFromHideList n
case nvis of
Nothing -> return ()
Just acc -> mapM_ (checkVisibility fc n (max Frozen acc) acc) refs
addCalls n refs
addIBC (IBCCG n)
when (Constructor `notElem` opts) $ do
let pnames = getParamsInType i [] impls cty
let fninfo = FnInfo (param_pos 0 pnames cty)
setFnInfo n fninfo
addIBC (IBCFnInfo n fninfo)
-- If we use any types with linear constructor arguments, we'd better
-- make sure they are use-once
tcliftAt fc $ linearCheck ctxt (whnfArgs ctxt [] cty)
return (cty, ckind, ty, inacc)
where
patToImp (Bind n (PVar rig t) sc) = Bind n (Pi rig Nothing t (TType (UVar [] 0))) (patToImp sc)
patToImp (Bind n b sc) = Bind n b (patToImp sc)
patToImp t = t
param_pos i ns (Bind n (Pi _ _ t _) sc)
| n `elem` ns = i : param_pos (i + 1) ns sc
| otherwise = param_pos (i + 1) ns sc
param_pos i ns t = []
-- | Elaborate a top-level type declaration - for example, "foo : Int -> Int". | 3,816 | buildType info syn fc opts n ty' = do
ctxt <- getContext
i <- getIState
logElab 2 $ show n ++ " pre-type " ++ showTmImpls ty' ++ show (no_imp syn)
ty' <- addUsingConstraints syn fc ty'
ty' <- addUsingImpls syn n fc ty'
let ty = addImpl (imp_methods syn) i ty'
logElab 5 $ show n ++ " type pre-addimpl " ++ showTmImpls ty'
logElab 5 $ "with methods " ++ show (imp_methods syn)
logElab 2 $ show n ++ " type " ++ show (using syn) ++ "\n" ++ showTmImpls ty
((ElabResult tyT' defer is ctxt' newDecls highlights newGName, est), log) <-
tclift $ elaborate (constraintNS info) ctxt (idris_datatypes i) (idris_name i) n (TType (UVal 0)) initEState
(errAt "type of " n Nothing
(erunAux fc (build i info ETyDecl [] n ty)))
displayWarnings est
setContext ctxt'
processTacticDecls info newDecls
sendHighlighting highlights
updateIState $ \i -> i { idris_name = newGName }
let tyT = patToImp tyT'
logElab 3 $ show ty ++ "\nElaborated: " ++ show tyT'
ds <- checkAddDef True False info fc iderr True defer
-- if the type is not complete, note that we'll need to infer
-- things later (for solving metavariables)
when (length ds > length is) -- more deferred than case blocks
$ addTyInferred n
mapM_ (elabCaseBlock info opts) is
ctxt <- getContext
logElab 5 "Rechecking"
logElab 6 (show tyT)
logElab 10 $ "Elaborated to " ++ showEnvDbg [] tyT
(cty, ckind) <- recheckC (constraintNS info) fc id [] tyT
-- record the implicit and inaccessible arguments
i <- getIState
let (inaccData, impls) = unzip $ getUnboundImplicits i cty ty
let inacc = inaccessibleImps 0 cty inaccData
logElab 3 $ show n ++ ": inaccessible arguments: " ++ show inacc ++
" from " ++ show cty ++ "\n" ++ showTmImpls ty
putIState $ i { idris_implicits = addDef n impls (idris_implicits i) }
logElab 3 ("Implicit " ++ show n ++ " " ++ show impls)
addIBC (IBCImp n)
-- Add the names referenced to the call graph, and check we're not
-- referring to anything less visible
-- In particular, a public/export type can not refer to anything
-- private, but can refer to any public/export
let refs = freeNames cty
nvis <- getFromHideList n
case nvis of
Nothing -> return ()
Just acc -> mapM_ (checkVisibility fc n (max Frozen acc) acc) refs
addCalls n refs
addIBC (IBCCG n)
when (Constructor `notElem` opts) $ do
let pnames = getParamsInType i [] impls cty
let fninfo = FnInfo (param_pos 0 pnames cty)
setFnInfo n fninfo
addIBC (IBCFnInfo n fninfo)
-- If we use any types with linear constructor arguments, we'd better
-- make sure they are use-once
tcliftAt fc $ linearCheck ctxt (whnfArgs ctxt [] cty)
return (cty, ckind, ty, inacc)
where
patToImp (Bind n (PVar rig t) sc) = Bind n (Pi rig Nothing t (TType (UVar [] 0))) (patToImp sc)
patToImp (Bind n b sc) = Bind n b (patToImp sc)
patToImp t = t
param_pos i ns (Bind n (Pi _ _ t _) sc)
| n `elem` ns = i : param_pos (i + 1) ns sc
| otherwise = param_pos (i + 1) ns sc
param_pos i ns t = []
-- | Elaborate a top-level type declaration - for example, "foo : Int -> Int". | 3,643 | false | true | 9 | 24 | 1,308 | 1,212 | 574 | 638 | null | null |
8l/barrelfish | hake/ARMv8.hs | mit | makeDepend = ArchDefaults.makeDepend arch compiler | 50 | makeDepend = ArchDefaults.makeDepend arch compiler | 50 | makeDepend = ArchDefaults.makeDepend arch compiler | 50 | false | false | 0 | 6 | 4 | 13 | 6 | 7 | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.