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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
supermario/stack | src/main/Main.hs | bsd-3-clause | -- | List the dependencies
listDependenciesCmd :: Text -> GlobalOpts -> IO ()
listDependenciesCmd sep go = withBuildConfig go (listDependencies sep')
where sep' = T.replace "\\t" "\t" (T.replace "\\n" "\n" sep)
-- | Query build information | 242 | listDependenciesCmd :: Text -> GlobalOpts -> IO ()
listDependenciesCmd sep go = withBuildConfig go (listDependencies sep')
where sep' = T.replace "\\t" "\t" (T.replace "\\n" "\n" sep)
-- | Query build information | 215 | listDependenciesCmd sep go = withBuildConfig go (listDependencies sep')
where sep' = T.replace "\\t" "\t" (T.replace "\\n" "\n" sep)
-- | Query build information | 164 | true | true | 0 | 8 | 38 | 71 | 35 | 36 | null | null |
charlesrosenbauer/Bzo-Compiler | src/Tokens.hs | gpl-3.0 | showTk (TkFlt _ x) = "F:" ++ show x | 45 | showTk (TkFlt _ x) = "F:" ++ show x | 45 | showTk (TkFlt _ x) = "F:" ++ show x | 45 | false | false | 0 | 6 | 18 | 25 | 11 | 14 | null | null |
ghcjs/jsaddle-dom | src/JSDOM/Generated/SVGAngle.hs | mit | -- | <https://developer.mozilla.org/en-US/docs/Web/API/SVGAngle.value Mozilla SVGAngle.value documentation>
getValue :: (MonadDOM m) => SVGAngle -> m Float
getValue self
= liftDOM (realToFrac <$> ((self ^. js "value") >>= valToNumber)) | 238 | getValue :: (MonadDOM m) => SVGAngle -> m Float
getValue self
= liftDOM (realToFrac <$> ((self ^. js "value") >>= valToNumber)) | 129 | getValue self
= liftDOM (realToFrac <$> ((self ^. js "value") >>= valToNumber)) | 81 | true | true | 0 | 12 | 29 | 58 | 30 | 28 | null | null |
thewoolleyman/haskellbook | 10/10/haskell-club/ch10exercises.hs | unlicense | myOr' (x:xs) = x || myOr' xs | 28 | myOr' (x:xs) = x || myOr' xs | 28 | myOr' (x:xs) = x || myOr' xs | 28 | false | false | 0 | 7 | 6 | 23 | 11 | 12 | null | null |
jfischoff/hs-mitsuba | src/Mitsuba/Element/Class.hs | bsd-3-clause | allAttribute :: Element -> Element
allAttribute = set (elementChildrenL . mapped . childItemTypeL) defaultAttribute | 115 | allAttribute :: Element -> Element
allAttribute = set (elementChildrenL . mapped . childItemTypeL) defaultAttribute | 115 | allAttribute = set (elementChildrenL . mapped . childItemTypeL) defaultAttribute | 80 | false | true | 0 | 8 | 13 | 38 | 17 | 21 | null | null |
fredcy/elm-format | parser/src/Reporting/Report.hs | bsd-3-clause | toJson :: [Json.Pair] -> Report -> (Maybe R.Region, [Json.Pair])
toJson extraFields (Report title subregion pre post) =
let
fields =
[ "tag" .= title
, "overview" .= pre
, "details" .= post
]
in
(subregion, fields ++ extraFields) | 265 | toJson :: [Json.Pair] -> Report -> (Maybe R.Region, [Json.Pair])
toJson extraFields (Report title subregion pre post) =
let
fields =
[ "tag" .= title
, "overview" .= pre
, "details" .= post
]
in
(subregion, fields ++ extraFields) | 265 | toJson extraFields (Report title subregion pre post) =
let
fields =
[ "tag" .= title
, "overview" .= pre
, "details" .= post
]
in
(subregion, fields ++ extraFields) | 200 | false | true | 0 | 11 | 73 | 105 | 54 | 51 | null | null |
forked-upstream-packages-for-ghcjs/ghc | compiler/typecheck/TcType.hs | bsd-3-clause | pprUserTypeCtxt (TySynCtxt c) = ptext (sLit "the RHS of the type synonym") <+> quotes (ppr c) | 97 | pprUserTypeCtxt (TySynCtxt c) = ptext (sLit "the RHS of the type synonym") <+> quotes (ppr c) | 97 | pprUserTypeCtxt (TySynCtxt c) = ptext (sLit "the RHS of the type synonym") <+> quotes (ppr c) | 97 | false | false | 0 | 8 | 19 | 37 | 17 | 20 | null | null |
haroldcarr/learn-haskell-coq-ml-etc | haskell/book/2021-05-06-Algebra_Driven_Design-Sandy_Maguire/src/Lib.hs | unlicense | quad :: Tile -> Tile -> Tile -> Tile -> Tile
quad = undefined | 62 | quad :: Tile -> Tile -> Tile -> Tile -> Tile
quad = undefined | 62 | quad = undefined | 17 | false | true | 0 | 8 | 14 | 27 | 14 | 13 | null | null |
osa1/hslua | src/Foreign/Lua/Core/Functions.hs | mit | -- | Pushes a new C closure onto the stack.
--
-- When a C function is created, it is possible to associate some values with
-- it, thus creating a C closure (see
-- <https://www.lua.org/manual/5.1/manual.html#3.4 §3.4>); these values are then
-- accessible to the function whenever it is called. To associate values with a
-- C function, first these values should be pushed onto the stack (when there
-- are multiple values, the first value is pushed first). Then lua_pushcclosure
-- is called to create and push the C function onto the stack, with the argument
-- @n@ telling how many values should be associated with the function.
-- lua_pushcclosure also pops these values from the stack.
--
-- The maximum value for @n@ is 255.
--
-- See also:
-- <https://www.lua.org/manual/5.3/manual.html#lua_pushcclosure lua_pushcclosure>.
pushcclosure :: CFunction -> NumArgs -> Lua ()
pushcclosure f n = liftLua $ \l -> lua_pushcclosure l f n | 936 | pushcclosure :: CFunction -> NumArgs -> Lua ()
pushcclosure f n = liftLua $ \l -> lua_pushcclosure l f n | 104 | pushcclosure f n = liftLua $ \l -> lua_pushcclosure l f n | 57 | true | true | 0 | 8 | 153 | 61 | 38 | 23 | null | null |
xie-dongping/modelicaparser | src/Language/Modelica/Parser/Lexer.hs | bsd-3-clause | ------------------------------------------------------------------
commaList :: Parser a -> Parser [a]
commaList = followedBy comma | 132 | commaList :: Parser a -> Parser [a]
commaList = followedBy comma | 64 | commaList = followedBy comma | 28 | true | true | 0 | 8 | 12 | 33 | 15 | 18 | null | null |
kaizhang/igraph | Data/IGraph/Internal.hs | bsd-3-clause | numberOfEdges :: Graph d a -> Int
numberOfEdges (G g) = graphEdgeNumber g | 73 | numberOfEdges :: Graph d a -> Int
numberOfEdges (G g) = graphEdgeNumber g | 73 | numberOfEdges (G g) = graphEdgeNumber g | 39 | false | true | 0 | 7 | 12 | 32 | 15 | 17 | null | null |
zaxtax/hakaru | haskell/Tests/Disintegrate.hs | bsd-3-clause | testDisintegrateEasyRoad
:: [Cond (HPair 'HReal 'HReal) (HPair 'HProb 'HProb)]
testDisintegrateEasyRoad = disintegrate easyRoad | 131 | testDisintegrateEasyRoad
:: [Cond (HPair 'HReal 'HReal) (HPair 'HProb 'HProb)]
testDisintegrateEasyRoad = disintegrate easyRoad | 131 | testDisintegrateEasyRoad = disintegrate easyRoad | 48 | false | true | 1 | 8 | 16 | 45 | 23 | 22 | null | null |
kmilner/tamarin-prover | lib/theory/src/Theory/Text/Parser/Token.hs | gpl-3.0 | -- | Between angular brackets.
angled :: Parser a -> Parser a
angled = T.angles spthy | 85 | angled :: Parser a -> Parser a
angled = T.angles spthy | 54 | angled = T.angles spthy | 23 | true | true | 0 | 6 | 15 | 27 | 13 | 14 | null | null |
garetxe/cabal | cabal-install/Distribution/Client/Dependency/Modular/Preference.hs | bsd-3-clause | -- | Compare instances by their version numbers.
preferLatestOrdering :: I -> I -> Ordering
preferLatestOrdering (I v1 _) (I v2 _) = compare v1 v2 | 146 | preferLatestOrdering :: I -> I -> Ordering
preferLatestOrdering (I v1 _) (I v2 _) = compare v1 v2 | 97 | preferLatestOrdering (I v1 _) (I v2 _) = compare v1 v2 | 54 | true | true | 0 | 7 | 25 | 46 | 23 | 23 | null | null |
allanderek/ipclib | Ipc/Main.hs | gpl-2.0 | ipcOptions :: [ OptDescr ( CliOpt () ) ]
ipcOptions = baseCliOptions | 68 | ipcOptions :: [ OptDescr ( CliOpt () ) ]
ipcOptions = baseCliOptions | 68 | ipcOptions = baseCliOptions | 27 | false | true | 0 | 9 | 11 | 25 | 13 | 12 | null | null |
oldmanmike/ghc | compiler/codeGen/StgCmmPrim.hs | bsd-3-clause | doWriteSmallPtrArrayOp :: CmmExpr
-> CmmExpr
-> CmmExpr
-> FCode ()
doWriteSmallPtrArrayOp addr idx val = do
dflags <- getDynFlags
let ty = cmmExprType dflags val
mkBasicIndexedWrite (smallArrPtrsHdrSize dflags) Nothing addr ty idx val
emit (setInfo addr (CmmLit (CmmLabel mkSMAP_DIRTY_infoLabel)))
------------------------------------------------------------------------------
-- Atomic read-modify-write
-- | Emit an atomic modification to a byte array element. The result
-- reg contains that previous value of the element. Implies a full
-- memory barrier. | 647 | doWriteSmallPtrArrayOp :: CmmExpr
-> CmmExpr
-> CmmExpr
-> FCode ()
doWriteSmallPtrArrayOp addr idx val = do
dflags <- getDynFlags
let ty = cmmExprType dflags val
mkBasicIndexedWrite (smallArrPtrsHdrSize dflags) Nothing addr ty idx val
emit (setInfo addr (CmmLit (CmmLabel mkSMAP_DIRTY_infoLabel)))
------------------------------------------------------------------------------
-- Atomic read-modify-write
-- | Emit an atomic modification to a byte array element. The result
-- reg contains that previous value of the element. Implies a full
-- memory barrier. | 647 | doWriteSmallPtrArrayOp addr idx val = do
dflags <- getDynFlags
let ty = cmmExprType dflags val
mkBasicIndexedWrite (smallArrPtrsHdrSize dflags) Nothing addr ty idx val
emit (setInfo addr (CmmLit (CmmLabel mkSMAP_DIRTY_infoLabel)))
------------------------------------------------------------------------------
-- Atomic read-modify-write
-- | Emit an atomic modification to a byte array element. The result
-- reg contains that previous value of the element. Implies a full
-- memory barrier. | 510 | false | true | 0 | 13 | 157 | 109 | 53 | 56 | null | null |
stites/composition | src/MoreReaderT.hs | bsd-3-clause | isValid :: String -> Bool
isValid v = '!' `elem` v | 50 | isValid :: String -> Bool
isValid v = '!' `elem` v | 50 | isValid v = '!' `elem` v | 24 | false | true | 0 | 5 | 10 | 24 | 13 | 11 | null | null |
NorfairKing/eden | src/Generate.hs | gpl-2.0 | generateSolution :: Problem -> Language -> EdenGenerate ()
generateSolution p l = do
dir <- solutionDir p l
liftIO $ createDirectoryIfMissing True dir | 158 | generateSolution :: Problem -> Language -> EdenGenerate ()
generateSolution p l = do
dir <- solutionDir p l
liftIO $ createDirectoryIfMissing True dir | 158 | generateSolution p l = do
dir <- solutionDir p l
liftIO $ createDirectoryIfMissing True dir | 99 | false | true | 0 | 8 | 30 | 53 | 24 | 29 | null | null |
orezpraw/gitit2 | Network/Gitit2.hs | gpl-2.0 | isDiscussPage :: Page -> Bool
isDiscussPage (Page xs) = case reverse xs of
(x:_) -> "@" `T.isPrefixOf` x
_ -> False | 181 | isDiscussPage :: Page -> Bool
isDiscussPage (Page xs) = case reverse xs of
(x:_) -> "@" `T.isPrefixOf` x
_ -> False | 181 | isDiscussPage (Page xs) = case reverse xs of
(x:_) -> "@" `T.isPrefixOf` x
_ -> False | 151 | false | true | 0 | 9 | 86 | 64 | 31 | 33 | null | null |
gibiansky/jupyter-haskell | src/Jupyter/Install/Internal.hs | mit | -- | Given a directory, populate it with all necessary files to run @jupyter kernelspec install@.
--
-- Currently created files include:
-- * @kernel.js@: (optional) Javascript to include in the notebook frontend.
-- * @logo-64x64.png@: (optional) Small logo PNG to include in the notebook frontend UI.
-- * @kernel.json@: (required) JSON file containing kernel invocation command and other metadata.
--
-- The passed in directory is created and should not exist; if it already exists, it will be
-- deleted.
prepareKernelspecDirectory :: Kernelspec -> FilePath -> IO ()
prepareKernelspecDirectory kernelspec dir = do
-- Make sure the directory doesn't already exist. If we didn't delete the directory, then later
-- kernelspec installs may inherit files created by previous kernelspec installs.
exists <- doesDirectoryExist dir
when exists $ removeDirectoryRecursive dir
createDirectoryIfMissing True dir
copyKernelspecFiles kernelspec
generateKernelJSON kernelspec
where
-- Copy files indicated by the Kernelspec data type into the directory.
copyKernelspecFiles :: Kernelspec -> IO ()
copyKernelspecFiles Kernelspec { .. } = do
whenJust kernelspecJsFile $ \file -> copyFile file $ dir ++ "/kernel.js"
whenJust kernelspecLogoFile $ \file -> copyFile file $ dir ++ "/logo-64x64.png"
-- Generate the kernel.json data structure from the Kernelspec datatype.
generateKernelJSON :: Kernelspec -> IO ()
generateKernelJSON Kernelspec { .. } = do
exePath <- getExecutablePath
withFile (dir ++ "/kernel.json") WriteMode $
flip LBS.hPutStr $
encode $
object
[ "argv" .= kernelspecCommand exePath "{connection_file}"
, "display_name" .= kernelspecDisplayName
, "language" .= kernelspecLanguage
, "env" .= kernelspecEnv
]
whenJust :: Maybe a -> (a -> IO ()) -> IO ()
whenJust Nothing _ = return ()
whenJust (Just a) f = f a
-- | Install a kernelspec using @jupyter kernelspec install@.
--
-- Throws a 'JupyterKernelspecException' on failure. | 2,115 | prepareKernelspecDirectory :: Kernelspec -> FilePath -> IO ()
prepareKernelspecDirectory kernelspec dir = do
-- Make sure the directory doesn't already exist. If we didn't delete the directory, then later
-- kernelspec installs may inherit files created by previous kernelspec installs.
exists <- doesDirectoryExist dir
when exists $ removeDirectoryRecursive dir
createDirectoryIfMissing True dir
copyKernelspecFiles kernelspec
generateKernelJSON kernelspec
where
-- Copy files indicated by the Kernelspec data type into the directory.
copyKernelspecFiles :: Kernelspec -> IO ()
copyKernelspecFiles Kernelspec { .. } = do
whenJust kernelspecJsFile $ \file -> copyFile file $ dir ++ "/kernel.js"
whenJust kernelspecLogoFile $ \file -> copyFile file $ dir ++ "/logo-64x64.png"
-- Generate the kernel.json data structure from the Kernelspec datatype.
generateKernelJSON :: Kernelspec -> IO ()
generateKernelJSON Kernelspec { .. } = do
exePath <- getExecutablePath
withFile (dir ++ "/kernel.json") WriteMode $
flip LBS.hPutStr $
encode $
object
[ "argv" .= kernelspecCommand exePath "{connection_file}"
, "display_name" .= kernelspecDisplayName
, "language" .= kernelspecLanguage
, "env" .= kernelspecEnv
]
whenJust :: Maybe a -> (a -> IO ()) -> IO ()
whenJust Nothing _ = return ()
whenJust (Just a) f = f a
-- | Install a kernelspec using @jupyter kernelspec install@.
--
-- Throws a 'JupyterKernelspecException' on failure. | 1,603 | prepareKernelspecDirectory kernelspec dir = do
-- Make sure the directory doesn't already exist. If we didn't delete the directory, then later
-- kernelspec installs may inherit files created by previous kernelspec installs.
exists <- doesDirectoryExist dir
when exists $ removeDirectoryRecursive dir
createDirectoryIfMissing True dir
copyKernelspecFiles kernelspec
generateKernelJSON kernelspec
where
-- Copy files indicated by the Kernelspec data type into the directory.
copyKernelspecFiles :: Kernelspec -> IO ()
copyKernelspecFiles Kernelspec { .. } = do
whenJust kernelspecJsFile $ \file -> copyFile file $ dir ++ "/kernel.js"
whenJust kernelspecLogoFile $ \file -> copyFile file $ dir ++ "/logo-64x64.png"
-- Generate the kernel.json data structure from the Kernelspec datatype.
generateKernelJSON :: Kernelspec -> IO ()
generateKernelJSON Kernelspec { .. } = do
exePath <- getExecutablePath
withFile (dir ++ "/kernel.json") WriteMode $
flip LBS.hPutStr $
encode $
object
[ "argv" .= kernelspecCommand exePath "{connection_file}"
, "display_name" .= kernelspecDisplayName
, "language" .= kernelspecLanguage
, "env" .= kernelspecEnv
]
whenJust :: Maybe a -> (a -> IO ()) -> IO ()
whenJust Nothing _ = return ()
whenJust (Just a) f = f a
-- | Install a kernelspec using @jupyter kernelspec install@.
--
-- Throws a 'JupyterKernelspecException' on failure. | 1,541 | true | true | 15 | 11 | 466 | 322 | 166 | 156 | null | null |
josefs/sbv | Data/SBV/Core/Symbolic.hs | bsd-3-clause | eqSArr :: SArr -> SArr -> SVal
eqSArr (SArr _ a) (SArr _ b) = SVal KBool $ Right $ cache c
where c st = do ai <- uncacheAI a st
bi <- uncacheAI b st
newExpr st KBool (SBVApp (ArrEq ai bi) [])
---------------------------------------------------------------------------------
-- * Cached values
---------------------------------------------------------------------------------
-- | We implement a peculiar caching mechanism, applicable to the use case in
-- implementation of SBV's. Whenever we do a state based computation, we do
-- not want to keep on evaluating it in the then-current state. That will
-- produce essentially a semantically equivalent value. Thus, we want to run
-- it only once, and reuse that result, capturing the sharing at the Haskell
-- level. This is similar to the "type-safe observable sharing" work, but also
-- takes into the account of how symbolic simulation executes.
--
-- See Andy Gill's type-safe obervable sharing trick for the inspiration behind
-- this technique: <http://ittc.ku.edu/~andygill/paper.php?label=DSLExtract09>
--
-- Note that this is *not* a general memo utility! | 1,155 | eqSArr :: SArr -> SArr -> SVal
eqSArr (SArr _ a) (SArr _ b) = SVal KBool $ Right $ cache c
where c st = do ai <- uncacheAI a st
bi <- uncacheAI b st
newExpr st KBool (SBVApp (ArrEq ai bi) [])
---------------------------------------------------------------------------------
-- * Cached values
---------------------------------------------------------------------------------
-- | We implement a peculiar caching mechanism, applicable to the use case in
-- implementation of SBV's. Whenever we do a state based computation, we do
-- not want to keep on evaluating it in the then-current state. That will
-- produce essentially a semantically equivalent value. Thus, we want to run
-- it only once, and reuse that result, capturing the sharing at the Haskell
-- level. This is similar to the "type-safe observable sharing" work, but also
-- takes into the account of how symbolic simulation executes.
--
-- See Andy Gill's type-safe obervable sharing trick for the inspiration behind
-- this technique: <http://ittc.ku.edu/~andygill/paper.php?label=DSLExtract09>
--
-- Note that this is *not* a general memo utility! | 1,155 | eqSArr (SArr _ a) (SArr _ b) = SVal KBool $ Right $ cache c
where c st = do ai <- uncacheAI a st
bi <- uncacheAI b st
newExpr st KBool (SBVApp (ArrEq ai bi) [])
---------------------------------------------------------------------------------
-- * Cached values
---------------------------------------------------------------------------------
-- | We implement a peculiar caching mechanism, applicable to the use case in
-- implementation of SBV's. Whenever we do a state based computation, we do
-- not want to keep on evaluating it in the then-current state. That will
-- produce essentially a semantically equivalent value. Thus, we want to run
-- it only once, and reuse that result, capturing the sharing at the Haskell
-- level. This is similar to the "type-safe observable sharing" work, but also
-- takes into the account of how symbolic simulation executes.
--
-- See Andy Gill's type-safe obervable sharing trick for the inspiration behind
-- this technique: <http://ittc.ku.edu/~andygill/paper.php?label=DSLExtract09>
--
-- Note that this is *not* a general memo utility! | 1,124 | false | true | 1 | 12 | 209 | 141 | 70 | 71 | null | null |
achirkin/ghcjs-webgl | src/JavaScript/WebGL/Const.hs | mit | gl_LUMINANCE_ALPHA :: GLenum
gl_LUMINANCE_ALPHA = 0x190A | 56 | gl_LUMINANCE_ALPHA :: GLenum
gl_LUMINANCE_ALPHA = 0x190A | 56 | gl_LUMINANCE_ALPHA = 0x190A | 27 | false | true | 0 | 4 | 5 | 11 | 6 | 5 | null | null |
secret-adventure/pipes-frp | Control/Proxy/FRP.hs | bsd-3-clause | behaveIO :: IO a -> Event a -> Behavior a
behaveIO startAction e = Behavior $ do
start <- startAction
tvar <- newTVarIO start
let toTVar () = runIdentityP $ forever $ do
x <- request ()
lift $ atomically $ writeTVar tvar x
a <- async $ runProxy $ runEvent e >-> toTVar
link a
return (readTVar tvar)
-- | Creates a behavior using the given value as a seed. | 404 | behaveIO :: IO a -> Event a -> Behavior a
behaveIO startAction e = Behavior $ do
start <- startAction
tvar <- newTVarIO start
let toTVar () = runIdentityP $ forever $ do
x <- request ()
lift $ atomically $ writeTVar tvar x
a <- async $ runProxy $ runEvent e >-> toTVar
link a
return (readTVar tvar)
-- | Creates a behavior using the given value as a seed. | 404 | behaveIO startAction e = Behavior $ do
start <- startAction
tvar <- newTVarIO start
let toTVar () = runIdentityP $ forever $ do
x <- request ()
lift $ atomically $ writeTVar tvar x
a <- async $ runProxy $ runEvent e >-> toTVar
link a
return (readTVar tvar)
-- | Creates a behavior using the given value as a seed. | 362 | false | true | 0 | 16 | 119 | 145 | 64 | 81 | null | null |
gcampax/ghc | compiler/basicTypes/BasicTypes.hs | bsd-3-clause | hasNoOneShotInfo NoOneShotInfo = True | 37 | hasNoOneShotInfo NoOneShotInfo = True | 37 | hasNoOneShotInfo NoOneShotInfo = True | 37 | false | false | 0 | 4 | 3 | 10 | 4 | 6 | null | null |
jwiegley/ghc-release | compiler/nativeGen/RegAlloc/Liveness.hs | gpl-3.0 | mapBlockTop
:: (LiveBasicBlock instr -> LiveBasicBlock instr)
-> LiveCmmDecl statics instr -> LiveCmmDecl statics instr
mapBlockTop f cmm
= evalState (mapBlockTopM (\x -> return $ f x) cmm) () | 217 | mapBlockTop
:: (LiveBasicBlock instr -> LiveBasicBlock instr)
-> LiveCmmDecl statics instr -> LiveCmmDecl statics instr
mapBlockTop f cmm
= evalState (mapBlockTopM (\x -> return $ f x) cmm) () | 216 | mapBlockTop f cmm
= evalState (mapBlockTopM (\x -> return $ f x) cmm) () | 80 | false | true | 0 | 11 | 53 | 81 | 38 | 43 | null | null |
deynekalex/Money-Haskell-Project- | src/Utils.hs | gpl-2.0 | getItemList :: Query ItemList [Item]
getItemList = do
ItemList ns <- ask
return ns | 90 | getItemList :: Query ItemList [Item]
getItemList = do
ItemList ns <- ask
return ns | 90 | getItemList = do
ItemList ns <- ask
return ns | 53 | false | true | 1 | 9 | 21 | 40 | 16 | 24 | null | null |
nblythe/MUB-Search | Polynomial.hs | mit | int2Monomial :: Integer -> Monomial
int2Monomial x = genericIndex int2Monomial_ x | 81 | int2Monomial :: Integer -> Monomial
int2Monomial x = genericIndex int2Monomial_ x | 81 | int2Monomial x = genericIndex int2Monomial_ x | 45 | false | true | 0 | 5 | 10 | 23 | 11 | 12 | null | null |
timtylin/scholdoc-texmath | extra/texmath.hs | gpl-2.0 | main :: IO ()
main = do
progname <- getProgName
let cgi = progname == "texmath-cgi"
if cgi
then runCGI
else runCommandLine | 138 | main :: IO ()
main = do
progname <- getProgName
let cgi = progname == "texmath-cgi"
if cgi
then runCGI
else runCommandLine | 138 | main = do
progname <- getProgName
let cgi = progname == "texmath-cgi"
if cgi
then runCGI
else runCommandLine | 124 | false | true | 0 | 10 | 37 | 53 | 24 | 29 | null | null |
vikraman/ghc | libraries/template-haskell/Language/Haskell/TH/Ppr.hs | bsd-3-clause | ppr_dec _ (NewtypeD ctxt t xs ksig c decs)
= ppr_newtype empty ctxt t (sep (map ppr xs)) ksig c decs | 102 | ppr_dec _ (NewtypeD ctxt t xs ksig c decs)
= ppr_newtype empty ctxt t (sep (map ppr xs)) ksig c decs | 102 | ppr_dec _ (NewtypeD ctxt t xs ksig c decs)
= ppr_newtype empty ctxt t (sep (map ppr xs)) ksig c decs | 102 | false | false | 0 | 9 | 22 | 56 | 27 | 29 | null | null |
vTurbine/ghc | compiler/types/InstEnv.hs | bsd-3-clause | pprInstances :: [ClsInst] -> SDoc
pprInstances ispecs = vcat (map pprInstance ispecs) | 85 | pprInstances :: [ClsInst] -> SDoc
pprInstances ispecs = vcat (map pprInstance ispecs) | 85 | pprInstances ispecs = vcat (map pprInstance ispecs) | 51 | false | true | 0 | 7 | 11 | 32 | 16 | 16 | null | null |
google-research/dex-lang | src/lib/Parser.hs | bsd-3-clause | instanceDef :: Bool -> Parser (UDecl VoidS VoidS)
instanceDef isNamed = do
name <- case isNamed of
False -> keyWord InstanceKW $> NothingB
True -> keyWord NamedInstanceKW *> (JustB . fromString <$> anyName) <* sym ":"
argBinders <- concat <$> many
(argInParens [parensExplicitArg, parensImplicitArg, parensIfaceArg] <?> "instance arg")
className <- upperName
params <- many leafExpr
methods <- onePerLine instanceMethod
return $ UInstance (fromString className) (toNestParsed argBinders) params methods name | 532 | instanceDef :: Bool -> Parser (UDecl VoidS VoidS)
instanceDef isNamed = do
name <- case isNamed of
False -> keyWord InstanceKW $> NothingB
True -> keyWord NamedInstanceKW *> (JustB . fromString <$> anyName) <* sym ":"
argBinders <- concat <$> many
(argInParens [parensExplicitArg, parensImplicitArg, parensIfaceArg] <?> "instance arg")
className <- upperName
params <- many leafExpr
methods <- onePerLine instanceMethod
return $ UInstance (fromString className) (toNestParsed argBinders) params methods name | 532 | instanceDef isNamed = do
name <- case isNamed of
False -> keyWord InstanceKW $> NothingB
True -> keyWord NamedInstanceKW *> (JustB . fromString <$> anyName) <* sym ":"
argBinders <- concat <$> many
(argInParens [parensExplicitArg, parensImplicitArg, parensIfaceArg] <?> "instance arg")
className <- upperName
params <- many leafExpr
methods <- onePerLine instanceMethod
return $ UInstance (fromString className) (toNestParsed argBinders) params methods name | 482 | false | true | 0 | 16 | 93 | 179 | 83 | 96 | null | null |
AndrasKovacs/trie-vector | Data/TrieVector/ArrayPrimWrap.hs | mit | read = readSmallArray# | 22 | read = readSmallArray# | 22 | read = readSmallArray# | 22 | false | false | 0 | 4 | 2 | 6 | 3 | 3 | null | null |
lambdageek/insomnia | src/Insomnia/Typecheck/Env.hs | bsd-3-clause | formatErr :: (Pretty a) => a -> F.Doc
formatErr = format . ppDefault | 68 | formatErr :: (Pretty a) => a -> F.Doc
formatErr = format . ppDefault | 68 | formatErr = format . ppDefault | 30 | false | true | 1 | 9 | 12 | 38 | 17 | 21 | null | null |
HIPERFIT/language-c-quote | Language/C/Parser/Monad.hs | bsd-3-clause | useExts :: ExtensionsInt -> P Bool
useExts ext = gets $ \s ->
extensions s .&. ext /= 0 | 91 | useExts :: ExtensionsInt -> P Bool
useExts ext = gets $ \s ->
extensions s .&. ext /= 0 | 91 | useExts ext = gets $ \s ->
extensions s .&. ext /= 0 | 56 | false | true | 0 | 9 | 22 | 41 | 20 | 21 | null | null |
spacekitteh/smcghc | compiler/nativeGen/PPC/CodeGen.hs | bsd-3-clause | iselExpr64 (CmmMachOp (MO_Add _) [e1,e2]) = do
ChildCode64 code1 r1lo <- iselExpr64 e1
ChildCode64 code2 r2lo <- iselExpr64 e2
(rlo,rhi) <- getNewRegPairNat II32
let
r1hi = getHiVRegFromLo r1lo
r2hi = getHiVRegFromLo r2lo
code = code1 `appOL`
code2 `appOL`
toOL [ ADDC rlo r1lo r2lo,
ADDE rhi r1hi r2hi ]
return (ChildCode64 code rlo) | 429 | iselExpr64 (CmmMachOp (MO_Add _) [e1,e2]) = do
ChildCode64 code1 r1lo <- iselExpr64 e1
ChildCode64 code2 r2lo <- iselExpr64 e2
(rlo,rhi) <- getNewRegPairNat II32
let
r1hi = getHiVRegFromLo r1lo
r2hi = getHiVRegFromLo r2lo
code = code1 `appOL`
code2 `appOL`
toOL [ ADDC rlo r1lo r2lo,
ADDE rhi r1hi r2hi ]
return (ChildCode64 code rlo) | 429 | iselExpr64 (CmmMachOp (MO_Add _) [e1,e2]) = do
ChildCode64 code1 r1lo <- iselExpr64 e1
ChildCode64 code2 r2lo <- iselExpr64 e2
(rlo,rhi) <- getNewRegPairNat II32
let
r1hi = getHiVRegFromLo r1lo
r2hi = getHiVRegFromLo r2lo
code = code1 `appOL`
code2 `appOL`
toOL [ ADDC rlo r1lo r2lo,
ADDE rhi r1hi r2hi ]
return (ChildCode64 code rlo) | 429 | false | false | 0 | 13 | 147 | 149 | 72 | 77 | null | null |
karamellpelle/grid | source/OpenGL/ES2/Values.hs | gpl-3.0 | gl_TEXTURE27 :: GLenum
gl_TEXTURE27 = 0x84DB | 63 | gl_TEXTURE27 :: GLenum
gl_TEXTURE27 = 0x84DB | 63 | gl_TEXTURE27 = 0x84DB | 40 | false | true | 0 | 4 | 24 | 11 | 6 | 5 | null | null |
tchagnon/cs636-raytracer | a4/Math.hs | apache-2.0 | -- Raise Vec3f to Vec4f with w=0
direction4f :: Vec3f -> Vec4f
direction4f (Vec3f x y z) = Vec4f x y z 0 | 104 | direction4f :: Vec3f -> Vec4f
direction4f (Vec3f x y z) = Vec4f x y z 0 | 71 | direction4f (Vec3f x y z) = Vec4f x y z 0 | 41 | true | true | 0 | 7 | 22 | 38 | 19 | 19 | null | null |
lukexi/glfw-pal | src/Graphics/UI/GLFW/Pal.hs | bsd-2-clause | createWindow :: String -> Int -> Int -> IO (Window, Window, Events)
createWindow = createWindow' False | 102 | createWindow :: String -> Int -> Int -> IO (Window, Window, Events)
createWindow = createWindow' False | 102 | createWindow = createWindow' False | 34 | false | true | 0 | 9 | 15 | 38 | 20 | 18 | null | null |
goldfirere/glambda | src/Language/Glambda/Type.hs | bsd-3-clause | pretty_ty :: Prec -> Ty -> Doc
pretty_ty prec (Arr arg res) = maybeParens (prec >= arrowPrec) $
hsep [ pretty_ty arrowLeftPrec arg
, text "->"
, pretty_ty arrowRightPrec res ] | 278 | pretty_ty :: Prec -> Ty -> Doc
pretty_ty prec (Arr arg res) = maybeParens (prec >= arrowPrec) $
hsep [ pretty_ty arrowLeftPrec arg
, text "->"
, pretty_ty arrowRightPrec res ] | 278 | pretty_ty prec (Arr arg res) = maybeParens (prec >= arrowPrec) $
hsep [ pretty_ty arrowLeftPrec arg
, text "->"
, pretty_ty arrowRightPrec res ] | 247 | false | true | 0 | 8 | 133 | 71 | 35 | 36 | null | null |
jthornber/language-c-ejt | src/Language/C/Analysis/ConstEval.hs | bsd-3-clause | intOp :: CBinaryOp -> Integer -> Integer -> Integer
intOp CAddOp i1 i2 = i1 + i2 | 80 | intOp :: CBinaryOp -> Integer -> Integer -> Integer
intOp CAddOp i1 i2 = i1 + i2 | 80 | intOp CAddOp i1 i2 = i1 + i2 | 28 | false | true | 0 | 7 | 16 | 34 | 17 | 17 | null | null |
DeTeam/bitoinc-haskell-server | src/Oinc/API/Routes.hs | mit | addUser :: Connection -> ActionM ()
addUser conn = do
-- Automatic decode into Maybe NewUserSchema
maybeUser <- fmap decode body
case maybeUser of
Nothing -> status status500 >> json errorMessage
Just user -> do
liftIO $ insertNewUser conn user
json successMessage | 291 | addUser :: Connection -> ActionM ()
addUser conn = do
-- Automatic decode into Maybe NewUserSchema
maybeUser <- fmap decode body
case maybeUser of
Nothing -> status status500 >> json errorMessage
Just user -> do
liftIO $ insertNewUser conn user
json successMessage | 291 | addUser conn = do
-- Automatic decode into Maybe NewUserSchema
maybeUser <- fmap decode body
case maybeUser of
Nothing -> status status500 >> json errorMessage
Just user -> do
liftIO $ insertNewUser conn user
json successMessage | 255 | false | true | 0 | 13 | 68 | 86 | 38 | 48 | null | null |
adept/hledger | hledger-lib/Hledger/Reports/MultiBalanceReport.hs | gpl-3.0 | calculateReportMatrix :: ReportSpec -> Journal -> PriceOracle
-> HashMap ClippedAccountName Account
-> [(DateSpan, [Posting])]
-> HashMap ClippedAccountName (Map DateSpan Account)
calculateReportMatrix rspec@ReportSpec{_rsReportOpts=ropts} j priceoracle startbals colps = -- PARTIAL:
-- Ensure all columns have entries, including those with starting balances
HM.mapWithKey rowbals allchanges
where
-- The valued row amounts to be displayed: per-period changes,
-- zero-based cumulative totals, or
-- starting-balance-based historical balances.
rowbals name changes = dbg5 "rowbals" $ case balanceaccum_ ropts of
PerPeriod -> changeamts
Cumulative -> cumulative
Historical -> historical
where
-- changes to report on: usually just the changes itself, but use the
-- differences in the historical amount for ValueChangeReports.
changeamts = case balancecalc_ ropts of
CalcChange -> M.mapWithKey avalue changes
CalcBudget -> M.mapWithKey avalue changes
CalcValueChange -> periodChanges valuedStart historical
CalcGain -> periodChanges valuedStart historical
cumulative = cumulativeSum avalue nullacct changeamts
historical = cumulativeSum avalue startingBalance changes
startingBalance = HM.lookupDefault nullacct name startbals
valuedStart = avalue (DateSpan Nothing historicalDate) startingBalance
-- In each column, get each account's balance changes
colacctchanges = dbg5 "colacctchanges" $ map (second $ acctChanges rspec j) colps :: [(DateSpan, HashMap ClippedAccountName Account)]
-- Transpose it to get each account's balance changes across all columns
acctchanges = dbg5 "acctchanges" $ transposeMap colacctchanges :: HashMap AccountName (Map DateSpan Account)
-- Fill out the matrix with zeros in empty cells
allchanges = ((<>zeros) <$> acctchanges) <> (zeros <$ startbals)
avalue = acctApplyBoth . mixedAmountApplyValuationAfterSumFromOptsWith ropts j priceoracle
acctApplyBoth f a = a{aibalance = f $ aibalance a, aebalance = f $ aebalance a}
historicalDate = minimumMay $ mapMaybe spanStart colspans
zeros = M.fromList [(span, nullacct) | span <- colspans]
colspans = map fst colps
-- | Lay out a set of postings grouped by date span into a regular matrix with rows
-- given by AccountName and columns by DateSpan, then generate a MultiBalanceReport
-- from the columns. | 2,573 | calculateReportMatrix :: ReportSpec -> Journal -> PriceOracle
-> HashMap ClippedAccountName Account
-> [(DateSpan, [Posting])]
-> HashMap ClippedAccountName (Map DateSpan Account)
calculateReportMatrix rspec@ReportSpec{_rsReportOpts=ropts} j priceoracle startbals colps = -- PARTIAL:
-- Ensure all columns have entries, including those with starting balances
HM.mapWithKey rowbals allchanges
where
-- The valued row amounts to be displayed: per-period changes,
-- zero-based cumulative totals, or
-- starting-balance-based historical balances.
rowbals name changes = dbg5 "rowbals" $ case balanceaccum_ ropts of
PerPeriod -> changeamts
Cumulative -> cumulative
Historical -> historical
where
-- changes to report on: usually just the changes itself, but use the
-- differences in the historical amount for ValueChangeReports.
changeamts = case balancecalc_ ropts of
CalcChange -> M.mapWithKey avalue changes
CalcBudget -> M.mapWithKey avalue changes
CalcValueChange -> periodChanges valuedStart historical
CalcGain -> periodChanges valuedStart historical
cumulative = cumulativeSum avalue nullacct changeamts
historical = cumulativeSum avalue startingBalance changes
startingBalance = HM.lookupDefault nullacct name startbals
valuedStart = avalue (DateSpan Nothing historicalDate) startingBalance
-- In each column, get each account's balance changes
colacctchanges = dbg5 "colacctchanges" $ map (second $ acctChanges rspec j) colps :: [(DateSpan, HashMap ClippedAccountName Account)]
-- Transpose it to get each account's balance changes across all columns
acctchanges = dbg5 "acctchanges" $ transposeMap colacctchanges :: HashMap AccountName (Map DateSpan Account)
-- Fill out the matrix with zeros in empty cells
allchanges = ((<>zeros) <$> acctchanges) <> (zeros <$ startbals)
avalue = acctApplyBoth . mixedAmountApplyValuationAfterSumFromOptsWith ropts j priceoracle
acctApplyBoth f a = a{aibalance = f $ aibalance a, aebalance = f $ aebalance a}
historicalDate = minimumMay $ mapMaybe spanStart colspans
zeros = M.fromList [(span, nullacct) | span <- colspans]
colspans = map fst colps
-- | Lay out a set of postings grouped by date span into a regular matrix with rows
-- given by AccountName and columns by DateSpan, then generate a MultiBalanceReport
-- from the columns. | 2,573 | calculateReportMatrix rspec@ReportSpec{_rsReportOpts=ropts} j priceoracle startbals colps = -- PARTIAL:
-- Ensure all columns have entries, including those with starting balances
HM.mapWithKey rowbals allchanges
where
-- The valued row amounts to be displayed: per-period changes,
-- zero-based cumulative totals, or
-- starting-balance-based historical balances.
rowbals name changes = dbg5 "rowbals" $ case balanceaccum_ ropts of
PerPeriod -> changeamts
Cumulative -> cumulative
Historical -> historical
where
-- changes to report on: usually just the changes itself, but use the
-- differences in the historical amount for ValueChangeReports.
changeamts = case balancecalc_ ropts of
CalcChange -> M.mapWithKey avalue changes
CalcBudget -> M.mapWithKey avalue changes
CalcValueChange -> periodChanges valuedStart historical
CalcGain -> periodChanges valuedStart historical
cumulative = cumulativeSum avalue nullacct changeamts
historical = cumulativeSum avalue startingBalance changes
startingBalance = HM.lookupDefault nullacct name startbals
valuedStart = avalue (DateSpan Nothing historicalDate) startingBalance
-- In each column, get each account's balance changes
colacctchanges = dbg5 "colacctchanges" $ map (second $ acctChanges rspec j) colps :: [(DateSpan, HashMap ClippedAccountName Account)]
-- Transpose it to get each account's balance changes across all columns
acctchanges = dbg5 "acctchanges" $ transposeMap colacctchanges :: HashMap AccountName (Map DateSpan Account)
-- Fill out the matrix with zeros in empty cells
allchanges = ((<>zeros) <$> acctchanges) <> (zeros <$ startbals)
avalue = acctApplyBoth . mixedAmountApplyValuationAfterSumFromOptsWith ropts j priceoracle
acctApplyBoth f a = a{aibalance = f $ aibalance a, aebalance = f $ aebalance a}
historicalDate = minimumMay $ mapMaybe spanStart colspans
zeros = M.fromList [(span, nullacct) | span <- colspans]
colspans = map fst colps
-- | Lay out a set of postings grouped by date span into a regular matrix with rows
-- given by AccountName and columns by DateSpan, then generate a MultiBalanceReport
-- from the columns. | 2,327 | false | true | 14 | 13 | 597 | 328 | 194 | 134 | null | null |
xmonad/xmonad-contrib | XMonad/Layout/Magnifier.hs | bsd-3-clause | fit :: Rectangle -> Rectangle -> Rectangle
fit (Rectangle sx sy sw sh) (Rectangle x y w h) = Rectangle x' y' w' h'
where x' = max sx (x - max 0 (x + fi w - sx - fi sw))
y' = max sy (y - max 0 (y + fi h - sy - fi sh))
w' = min sw w
h' = min sh h | 278 | fit :: Rectangle -> Rectangle -> Rectangle
fit (Rectangle sx sy sw sh) (Rectangle x y w h) = Rectangle x' y' w' h'
where x' = max sx (x - max 0 (x + fi w - sx - fi sw))
y' = max sy (y - max 0 (y + fi h - sy - fi sh))
w' = min sw w
h' = min sh h | 278 | fit (Rectangle sx sy sw sh) (Rectangle x y w h) = Rectangle x' y' w' h'
where x' = max sx (x - max 0 (x + fi w - sx - fi sw))
y' = max sy (y - max 0 (y + fi h - sy - fi sh))
w' = min sw w
h' = min sh h | 235 | false | true | 3 | 13 | 102 | 171 | 82 | 89 | null | null |
kolmodin/cabal | cabal-install/Distribution/Client/Setup.hs | bsd-3-clause | -- ------------------------------------------------------------
-- * GetOpt Utils
-- ------------------------------------------------------------
reqArgFlag :: ArgPlaceHolder ->
MkOptDescr (b -> Flag String) (Flag String -> b -> b) b
reqArgFlag ad = reqArg ad (succeedReadE Flag) flagToList | 305 | reqArgFlag :: ArgPlaceHolder ->
MkOptDescr (b -> Flag String) (Flag String -> b -> b) b
reqArgFlag ad = reqArg ad (succeedReadE Flag) flagToList | 158 | reqArgFlag ad = reqArg ad (succeedReadE Flag) flagToList | 56 | true | true | 0 | 9 | 46 | 65 | 33 | 32 | null | null |
felixgb/system-f-omega-lt | app/Main.hs | bsd-3-clause | getMain :: TyCtx -> ThrowsError Type
getMain ctx = case Map.lookup "main" ctx of
(Just main) -> return main
Nothing -> throwError NoMain | 144 | getMain :: TyCtx -> ThrowsError Type
getMain ctx = case Map.lookup "main" ctx of
(Just main) -> return main
Nothing -> throwError NoMain | 144 | getMain ctx = case Map.lookup "main" ctx of
(Just main) -> return main
Nothing -> throwError NoMain | 107 | false | true | 0 | 9 | 30 | 56 | 26 | 30 | null | null |
alanz/htelehash | src/Network/TeleHash/Ext/Chat.hs | bsd-3-clause | chat_get :: Maybe String -> TeleHash (Maybe Chat)
chat_get mid = do
logT $ "chat_get:mid=" ++ show mid
sw <- get
mcid <- case mid of
Just sid -> do
-- if there's an id, validate and optionally parse out originator
case parseChatId sid of
Nothing -> do
logT $ "invalid chatid:" ++ sid
return Nothing
Just cid -> do
logT $ "chat_get:got cid" ++ show cid
case ciOriginator cid of
Just hn -> do
_hc <- hn_get hn -- make sure we know about the hn
return $ Just (cid { ciOriginator = Just hn })
Nothing -> return $ Just (cid { ciOriginator = Just (swId sw)})
Nothing -> do
epVal <- randomHEX 8
return $ Just (ChatId epVal (Just (swId sw)))
logT $ "chat_get:mcid=" ++ show mcid
case mcid of
Nothing -> return Nothing
Just cid -> do
case Map.lookup cid (swIndexChat sw) of
Just chat -> return (Just chat)
Nothing -> do
logT $ "chat_get:making new chat"
hubc <- chan_new (swId sw) "chat" Nothing
logT $ "chat_get:hub=" ++ showChan hubc
randWord32 <- randomWord32
let chat = Chat
{ ecEp = ciEndpoint cid
, ecId = cid
, ecIdHash = thash (chatIdToString cid)
, ecOrigin = gfromJust "chat_get" (ciOriginator cid)
, ecRHash = CH ""
, ecLocal = ciOriginator cid == Just (swId sw)
, ecSeed = CH $ word32AsHexString randWord32
, ecSeq = 1000
, ecRoster = Map.empty
, ecConn = Map.empty
, ecLog = Map.empty
, ecMsgs = []
, ecJoin = Nothing
, ecSent = Nothing
, ecAfter = Nothing
, ecHub = chUid hubc
}
-- an admin channel for distribution and thtp requests
chatr <- chatr_new chat (chUid hubc)
let hub = hubc { chArg = CArgChatR (ecrId chatr) }
putChan hub
note <- chan_note hub Nothing
let note2 = packet_set_str note "glob" ("/chat/" ++ (unCH $ ecIdHash chat) ++ "/")
logT $ "chat_get:chat,glob:" ++ show (ecId chat,packet_get_str note2 "glob")
logT $ "chat_get:glob full:" ++ show (note2)
thtp_glob Nothing note2
putChat chat
-- any other hashname and we try to initialize
if not (ecLocal chat)
then do
chat_cache (ecId chat) (ecOrigin chat) Nothing
else return ()
return (Just chat)
{-
chat_t chat_get(switch_t s, char *id)
{
chat_t chat;
packet_t note;
hn_t origin = NULL;
int at;
char buf[128];
chat = xht_get(s->index,id);
if(chat) return chat;
// if there's an id, validate and optionally parse out originator
if(id)
{
at = chat_eplen(id);
if(at < 0) return NULL;
if(at > 0)
{
id[at] = 0;
origin = hn_gethex(s->index,id+(at+1));
if(!origin) return NULL;
}
}
chat = malloc(sizeof (struct chat_struct));
memset(chat,0,sizeof (struct chat_struct));
if(!id)
{
crypt_rand((unsigned char*)buf,4);
util_hex((unsigned char*)buf,4,(unsigned char*)chat->ep);
}else{
memcpy(chat->ep,id,strlen(id)+1);
}
chat->origin = origin ? origin : s->id;
if(chat->origin == s->id) chat->local = 1;
sprintf(chat->id,"%s@%s",chat->ep,chat->origin->hexname);
util_murmur((unsigned char*)chat->id,strlen(chat->id),chat->idhash);
chat->s = s;
chat->roster = packet_new();
packet_json(chat->roster,(unsigned char*)"{}",2);
chat->log = xht_new(101);
chat->conn = xht_new(7);
chat->seq = 1000;
crypt_rand((unsigned char*)&(chat->seed),4);
// an admin channel for distribution and thtp requests
chat->hub = chan_new(s, s->id, "chat", 0);
chat->hub->arg = chatr_new(chat); // stub so we know it's the hub chat channel
note = chan_note(chat->hub,NULL);
packet_set_printf(note,"glob","/chat/%s/",chat->idhash);
DEBUG_PRINTF("chat %s glob %s",chat->id,packet_get_str(note,"glob"));
thtp_glob(s,0,note);
xht_set(s->index,chat->id,chat);
// any other hashname and we try to initialize
if(!chat->local) chat_cache(chat,chat->origin->hexname,NULL);
return chat;
}
-}
-- --------------------------------------------------------------------- | 4,433 | chat_get :: Maybe String -> TeleHash (Maybe Chat)
chat_get mid = do
logT $ "chat_get:mid=" ++ show mid
sw <- get
mcid <- case mid of
Just sid -> do
-- if there's an id, validate and optionally parse out originator
case parseChatId sid of
Nothing -> do
logT $ "invalid chatid:" ++ sid
return Nothing
Just cid -> do
logT $ "chat_get:got cid" ++ show cid
case ciOriginator cid of
Just hn -> do
_hc <- hn_get hn -- make sure we know about the hn
return $ Just (cid { ciOriginator = Just hn })
Nothing -> return $ Just (cid { ciOriginator = Just (swId sw)})
Nothing -> do
epVal <- randomHEX 8
return $ Just (ChatId epVal (Just (swId sw)))
logT $ "chat_get:mcid=" ++ show mcid
case mcid of
Nothing -> return Nothing
Just cid -> do
case Map.lookup cid (swIndexChat sw) of
Just chat -> return (Just chat)
Nothing -> do
logT $ "chat_get:making new chat"
hubc <- chan_new (swId sw) "chat" Nothing
logT $ "chat_get:hub=" ++ showChan hubc
randWord32 <- randomWord32
let chat = Chat
{ ecEp = ciEndpoint cid
, ecId = cid
, ecIdHash = thash (chatIdToString cid)
, ecOrigin = gfromJust "chat_get" (ciOriginator cid)
, ecRHash = CH ""
, ecLocal = ciOriginator cid == Just (swId sw)
, ecSeed = CH $ word32AsHexString randWord32
, ecSeq = 1000
, ecRoster = Map.empty
, ecConn = Map.empty
, ecLog = Map.empty
, ecMsgs = []
, ecJoin = Nothing
, ecSent = Nothing
, ecAfter = Nothing
, ecHub = chUid hubc
}
-- an admin channel for distribution and thtp requests
chatr <- chatr_new chat (chUid hubc)
let hub = hubc { chArg = CArgChatR (ecrId chatr) }
putChan hub
note <- chan_note hub Nothing
let note2 = packet_set_str note "glob" ("/chat/" ++ (unCH $ ecIdHash chat) ++ "/")
logT $ "chat_get:chat,glob:" ++ show (ecId chat,packet_get_str note2 "glob")
logT $ "chat_get:glob full:" ++ show (note2)
thtp_glob Nothing note2
putChat chat
-- any other hashname and we try to initialize
if not (ecLocal chat)
then do
chat_cache (ecId chat) (ecOrigin chat) Nothing
else return ()
return (Just chat)
{-
chat_t chat_get(switch_t s, char *id)
{
chat_t chat;
packet_t note;
hn_t origin = NULL;
int at;
char buf[128];
chat = xht_get(s->index,id);
if(chat) return chat;
// if there's an id, validate and optionally parse out originator
if(id)
{
at = chat_eplen(id);
if(at < 0) return NULL;
if(at > 0)
{
id[at] = 0;
origin = hn_gethex(s->index,id+(at+1));
if(!origin) return NULL;
}
}
chat = malloc(sizeof (struct chat_struct));
memset(chat,0,sizeof (struct chat_struct));
if(!id)
{
crypt_rand((unsigned char*)buf,4);
util_hex((unsigned char*)buf,4,(unsigned char*)chat->ep);
}else{
memcpy(chat->ep,id,strlen(id)+1);
}
chat->origin = origin ? origin : s->id;
if(chat->origin == s->id) chat->local = 1;
sprintf(chat->id,"%s@%s",chat->ep,chat->origin->hexname);
util_murmur((unsigned char*)chat->id,strlen(chat->id),chat->idhash);
chat->s = s;
chat->roster = packet_new();
packet_json(chat->roster,(unsigned char*)"{}",2);
chat->log = xht_new(101);
chat->conn = xht_new(7);
chat->seq = 1000;
crypt_rand((unsigned char*)&(chat->seed),4);
// an admin channel for distribution and thtp requests
chat->hub = chan_new(s, s->id, "chat", 0);
chat->hub->arg = chatr_new(chat); // stub so we know it's the hub chat channel
note = chan_note(chat->hub,NULL);
packet_set_printf(note,"glob","/chat/%s/",chat->idhash);
DEBUG_PRINTF("chat %s glob %s",chat->id,packet_get_str(note,"glob"));
thtp_glob(s,0,note);
xht_set(s->index,chat->id,chat);
// any other hashname and we try to initialize
if(!chat->local) chat_cache(chat,chat->origin->hexname,NULL);
return chat;
}
-}
-- --------------------------------------------------------------------- | 4,433 | chat_get mid = do
logT $ "chat_get:mid=" ++ show mid
sw <- get
mcid <- case mid of
Just sid -> do
-- if there's an id, validate and optionally parse out originator
case parseChatId sid of
Nothing -> do
logT $ "invalid chatid:" ++ sid
return Nothing
Just cid -> do
logT $ "chat_get:got cid" ++ show cid
case ciOriginator cid of
Just hn -> do
_hc <- hn_get hn -- make sure we know about the hn
return $ Just (cid { ciOriginator = Just hn })
Nothing -> return $ Just (cid { ciOriginator = Just (swId sw)})
Nothing -> do
epVal <- randomHEX 8
return $ Just (ChatId epVal (Just (swId sw)))
logT $ "chat_get:mcid=" ++ show mcid
case mcid of
Nothing -> return Nothing
Just cid -> do
case Map.lookup cid (swIndexChat sw) of
Just chat -> return (Just chat)
Nothing -> do
logT $ "chat_get:making new chat"
hubc <- chan_new (swId sw) "chat" Nothing
logT $ "chat_get:hub=" ++ showChan hubc
randWord32 <- randomWord32
let chat = Chat
{ ecEp = ciEndpoint cid
, ecId = cid
, ecIdHash = thash (chatIdToString cid)
, ecOrigin = gfromJust "chat_get" (ciOriginator cid)
, ecRHash = CH ""
, ecLocal = ciOriginator cid == Just (swId sw)
, ecSeed = CH $ word32AsHexString randWord32
, ecSeq = 1000
, ecRoster = Map.empty
, ecConn = Map.empty
, ecLog = Map.empty
, ecMsgs = []
, ecJoin = Nothing
, ecSent = Nothing
, ecAfter = Nothing
, ecHub = chUid hubc
}
-- an admin channel for distribution and thtp requests
chatr <- chatr_new chat (chUid hubc)
let hub = hubc { chArg = CArgChatR (ecrId chatr) }
putChan hub
note <- chan_note hub Nothing
let note2 = packet_set_str note "glob" ("/chat/" ++ (unCH $ ecIdHash chat) ++ "/")
logT $ "chat_get:chat,glob:" ++ show (ecId chat,packet_get_str note2 "glob")
logT $ "chat_get:glob full:" ++ show (note2)
thtp_glob Nothing note2
putChat chat
-- any other hashname and we try to initialize
if not (ecLocal chat)
then do
chat_cache (ecId chat) (ecOrigin chat) Nothing
else return ()
return (Just chat)
{-
chat_t chat_get(switch_t s, char *id)
{
chat_t chat;
packet_t note;
hn_t origin = NULL;
int at;
char buf[128];
chat = xht_get(s->index,id);
if(chat) return chat;
// if there's an id, validate and optionally parse out originator
if(id)
{
at = chat_eplen(id);
if(at < 0) return NULL;
if(at > 0)
{
id[at] = 0;
origin = hn_gethex(s->index,id+(at+1));
if(!origin) return NULL;
}
}
chat = malloc(sizeof (struct chat_struct));
memset(chat,0,sizeof (struct chat_struct));
if(!id)
{
crypt_rand((unsigned char*)buf,4);
util_hex((unsigned char*)buf,4,(unsigned char*)chat->ep);
}else{
memcpy(chat->ep,id,strlen(id)+1);
}
chat->origin = origin ? origin : s->id;
if(chat->origin == s->id) chat->local = 1;
sprintf(chat->id,"%s@%s",chat->ep,chat->origin->hexname);
util_murmur((unsigned char*)chat->id,strlen(chat->id),chat->idhash);
chat->s = s;
chat->roster = packet_new();
packet_json(chat->roster,(unsigned char*)"{}",2);
chat->log = xht_new(101);
chat->conn = xht_new(7);
chat->seq = 1000;
crypt_rand((unsigned char*)&(chat->seed),4);
// an admin channel for distribution and thtp requests
chat->hub = chan_new(s, s->id, "chat", 0);
chat->hub->arg = chatr_new(chat); // stub so we know it's the hub chat channel
note = chan_note(chat->hub,NULL);
packet_set_printf(note,"glob","/chat/%s/",chat->idhash);
DEBUG_PRINTF("chat %s glob %s",chat->id,packet_get_str(note,"glob"));
thtp_glob(s,0,note);
xht_set(s->index,chat->id,chat);
// any other hashname and we try to initialize
if(!chat->local) chat_cache(chat,chat->origin->hexname,NULL);
return chat;
}
-}
-- --------------------------------------------------------------------- | 4,383 | false | true | 0 | 28 | 1,369 | 780 | 376 | 404 | null | null |
mcschroeder/ghc | compiler/main/DynFlags.hs | bsd-3-clause | wORD_SIZE_IN_BITS :: DynFlags -> Int
wORD_SIZE_IN_BITS dflags = wORD_SIZE dflags * 8 | 84 | wORD_SIZE_IN_BITS :: DynFlags -> Int
wORD_SIZE_IN_BITS dflags = wORD_SIZE dflags * 8 | 84 | wORD_SIZE_IN_BITS dflags = wORD_SIZE dflags * 8 | 47 | false | true | 0 | 6 | 11 | 25 | 12 | 13 | null | null |
gregsymons/learn-you-a-haskell | chapter-3.hs | apache-2.0 | head' (h:_) = h | 15 | head' (h:_) = h | 15 | head' (h:_) = h | 15 | false | false | 0 | 6 | 3 | 17 | 8 | 9 | null | null |
MaxGabriel/yesod | yesod/Yesod/Default/Config2.hs | mit | applyEnvValue :: Bool -- ^ require an environment variable to be present?
-> H.HashMap Text Text -> Value -> Value
applyEnvValue requireEnv' env =
goV
where
goV (Object o) = Object $ goV <$> o
goV (Array a) = Array (goV <$> a)
goV (String t1) = fromMaybe (String t1) $ do
t2 <- T.stripPrefix "_env:" t1
let (name, t3) = T.break (== ':') t2
mdef = fmap parseValue $ T.stripPrefix ":" t3
Just $ case H.lookup name env of
Just val ->
-- If the default value parses as a String, we treat the
-- environment variable as a raw value and do not parse it.
-- This means that things like numeric passwords just work.
-- However, for originally numerical or boolean values (e.g.,
-- port numbers), we still perform a normal YAML parse.
--
-- For details, see:
-- https://github.com/yesodweb/yesod/issues/1061
case mdef of
Just (String _) -> String val
_ -> parseValue val
Nothing ->
case mdef of
Just val | not requireEnv' -> val
_ -> Null
goV v = v
parseValue val = fromMaybe (String val) $ Y.decode $ encodeUtf8 val | 1,348 | applyEnvValue :: Bool -- ^ require an environment variable to be present?
-> H.HashMap Text Text -> Value -> Value
applyEnvValue requireEnv' env =
goV
where
goV (Object o) = Object $ goV <$> o
goV (Array a) = Array (goV <$> a)
goV (String t1) = fromMaybe (String t1) $ do
t2 <- T.stripPrefix "_env:" t1
let (name, t3) = T.break (== ':') t2
mdef = fmap parseValue $ T.stripPrefix ":" t3
Just $ case H.lookup name env of
Just val ->
-- If the default value parses as a String, we treat the
-- environment variable as a raw value and do not parse it.
-- This means that things like numeric passwords just work.
-- However, for originally numerical or boolean values (e.g.,
-- port numbers), we still perform a normal YAML parse.
--
-- For details, see:
-- https://github.com/yesodweb/yesod/issues/1061
case mdef of
Just (String _) -> String val
_ -> parseValue val
Nothing ->
case mdef of
Just val | not requireEnv' -> val
_ -> Null
goV v = v
parseValue val = fromMaybe (String val) $ Y.decode $ encodeUtf8 val | 1,348 | applyEnvValue requireEnv' env =
goV
where
goV (Object o) = Object $ goV <$> o
goV (Array a) = Array (goV <$> a)
goV (String t1) = fromMaybe (String t1) $ do
t2 <- T.stripPrefix "_env:" t1
let (name, t3) = T.break (== ':') t2
mdef = fmap parseValue $ T.stripPrefix ":" t3
Just $ case H.lookup name env of
Just val ->
-- If the default value parses as a String, we treat the
-- environment variable as a raw value and do not parse it.
-- This means that things like numeric passwords just work.
-- However, for originally numerical or boolean values (e.g.,
-- port numbers), we still perform a normal YAML parse.
--
-- For details, see:
-- https://github.com/yesodweb/yesod/issues/1061
case mdef of
Just (String _) -> String val
_ -> parseValue val
Nothing ->
case mdef of
Just val | not requireEnv' -> val
_ -> Null
goV v = v
parseValue val = fromMaybe (String val) $ Y.decode $ encodeUtf8 val | 1,219 | false | true | 0 | 18 | 526 | 310 | 151 | 159 | null | null |
kim/amazonka | amazonka-route53/gen/Network/AWS/Route53/Types.hs | mpl-2.0 | -- | The value for a 'Tag'.
tagValue :: Lens' Tag (Maybe Text)
tagValue = lens _tagValue (\s a -> s { _tagValue = a }) | 118 | tagValue :: Lens' Tag (Maybe Text)
tagValue = lens _tagValue (\s a -> s { _tagValue = a }) | 90 | tagValue = lens _tagValue (\s a -> s { _tagValue = a }) | 55 | true | true | 0 | 9 | 25 | 46 | 25 | 21 | null | null |
triplepointfive/soten | test/Codec/Soten/PostProcess/FixInfacingNormalsTest.hs | mit | vertices = V.fromList [V3 1 0 0, V3 0 1 0, V3 0 0 1, V3 (-1) 0 0, V3 0 (-1) 0, V3 0 0 (-1)] | 91 | vertices = V.fromList [V3 1 0 0, V3 0 1 0, V3 0 0 1, V3 (-1) 0 0, V3 0 (-1) 0, V3 0 0 (-1)] | 91 | vertices = V.fromList [V3 1 0 0, V3 0 1 0, V3 0 0 1, V3 (-1) 0 0, V3 0 (-1) 0, V3 0 0 (-1)] | 91 | false | false | 1 | 8 | 26 | 89 | 44 | 45 | null | null |
mcschroeder/ghc | compiler/nativeGen/Dwarf/Types.hs | bsd-3-clause | pprSetUnwind plat g (_, uw)
= pprByte dW_CFA_val_expression $$
pprLEBWord (fromIntegral (dwarfGlobalRegNo plat g)) $$
pprUnwindExpr True uw | 150 | pprSetUnwind plat g (_, uw)
= pprByte dW_CFA_val_expression $$
pprLEBWord (fromIntegral (dwarfGlobalRegNo plat g)) $$
pprUnwindExpr True uw | 150 | pprSetUnwind plat g (_, uw)
= pprByte dW_CFA_val_expression $$
pprLEBWord (fromIntegral (dwarfGlobalRegNo plat g)) $$
pprUnwindExpr True uw | 150 | false | false | 0 | 9 | 28 | 56 | 25 | 31 | null | null |
brendanhay/gogol | gogol-videointelligence/gen/Network/Google/VideoIntelligence/Types/Product.hs | mpl-2.0 | -- | Left X coordinate.
gooLeft :: Lens' GoogleCloudVideointelligenceV1beta2_NormalizedBoundingBox (Maybe Double)
gooLeft
= lens _gooLeft (\ s a -> s{_gooLeft = a}) .
mapping _Coerce | 190 | gooLeft :: Lens' GoogleCloudVideointelligenceV1beta2_NormalizedBoundingBox (Maybe Double)
gooLeft
= lens _gooLeft (\ s a -> s{_gooLeft = a}) .
mapping _Coerce | 166 | gooLeft
= lens _gooLeft (\ s a -> s{_gooLeft = a}) .
mapping _Coerce | 76 | true | true | 0 | 10 | 32 | 55 | 28 | 27 | null | null |
achernyak/stack | src/Stack/BuildPlan.hs | bsd-3-clause | compareBuildPlanCheck _ _ = LT | 74 | compareBuildPlanCheck _ _ = LT | 74 | compareBuildPlanCheck _ _ = LT | 74 | false | false | 0 | 5 | 48 | 11 | 5 | 6 | null | null |
SoftwareHeritage/swh-web-ui | swh/web/tests/resources/contents/code/extensions/test.hs | agpl-3.0 | pingUDPPort :: Socket -> SockAddr -> IO ()
pingUDPPort s a = sendTo s (Strict.singleton 0) a >> return () | 105 | pingUDPPort :: Socket -> SockAddr -> IO ()
pingUDPPort s a = sendTo s (Strict.singleton 0) a >> return () | 105 | pingUDPPort s a = sendTo s (Strict.singleton 0) a >> return () | 62 | false | true | 0 | 9 | 19 | 57 | 26 | 31 | null | null |
fffej/HS-Poker | LookupPatternMatch.hs | bsd-3-clause | getValueFromProduct 20295 = 5796 | 32 | getValueFromProduct 20295 = 5796 | 32 | getValueFromProduct 20295 = 5796 | 32 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
ku-fpg/diagrams-canvas | examples/Arrowtest.hs | bsd-3-clause | example :: Diagram B R2
example = connect' arrow1 "1" "2"
. connect' arrow2 "4" "3"
. connect' arrow3 "1" "6"
. connectOutside' arrow4 "4" "8"
. connect' arrow5 "9" "5"
. connectOutside' arrow6 "8" "9"
. connectOutside' arrow7 "8" "7"
$ cGrid
where
-- The arrows
arrow1 = with & arrowHead .~ dart
& arrowTail .~ quill & shaftStyle %~ lw thick . lc black
& arrowShaft .~ shaft0 & headStyle %~ fc blue
& tailStyle %~ fc red & tailLength .~ large
arrow2 = with & arrowHead .~ dart & headLength .~ large
& arrowTail .~ dart' & tailLength .~ large
& shaftStyle %~ lw thin & arrowShaft .~ shaft1
arrow3 = with & arrowHead .~ thorn & headLength .~ large
& arrowShaft .~ quartercircle & arrowTail .~ noTail
& gaps .~ normal
arrow4 = with & arrowHead .~ dart & arrowTail .~ dart'
& arrowShaft .~ shaft2 & headStyle %~ fc teal
& tailStyle %~ fc teal & shaftStyle %~ lw thick . lc teal
arrow5 = with & arrowTail .~ spike' & tailLength .~ large
& arrowShaft .~ semicircle & arrowHead .~ spike
& headLength .~ large & headStyle %~ fc darkorange
& tailStyle %~ fc darkorange
& shaftStyle %~ lw veryThick . lc navy
arrow6 = with & arrowHead .~ tri & arrowTail .~ tri'
& headLength .~ large
& headStyle %~ fc black . opacity 0.5
& tailStyle %~ fc black . opacity 0.5
& shaftStyle %~ dashingN [0.01,0.02,0.03,0.01] 0
arrow7 = arrow6 & arrowHead .~ tri & arrowTail .~ tri' | 1,786 | example :: Diagram B R2
example = connect' arrow1 "1" "2"
. connect' arrow2 "4" "3"
. connect' arrow3 "1" "6"
. connectOutside' arrow4 "4" "8"
. connect' arrow5 "9" "5"
. connectOutside' arrow6 "8" "9"
. connectOutside' arrow7 "8" "7"
$ cGrid
where
-- The arrows
arrow1 = with & arrowHead .~ dart
& arrowTail .~ quill & shaftStyle %~ lw thick . lc black
& arrowShaft .~ shaft0 & headStyle %~ fc blue
& tailStyle %~ fc red & tailLength .~ large
arrow2 = with & arrowHead .~ dart & headLength .~ large
& arrowTail .~ dart' & tailLength .~ large
& shaftStyle %~ lw thin & arrowShaft .~ shaft1
arrow3 = with & arrowHead .~ thorn & headLength .~ large
& arrowShaft .~ quartercircle & arrowTail .~ noTail
& gaps .~ normal
arrow4 = with & arrowHead .~ dart & arrowTail .~ dart'
& arrowShaft .~ shaft2 & headStyle %~ fc teal
& tailStyle %~ fc teal & shaftStyle %~ lw thick . lc teal
arrow5 = with & arrowTail .~ spike' & tailLength .~ large
& arrowShaft .~ semicircle & arrowHead .~ spike
& headLength .~ large & headStyle %~ fc darkorange
& tailStyle %~ fc darkorange
& shaftStyle %~ lw veryThick . lc navy
arrow6 = with & arrowHead .~ tri & arrowTail .~ tri'
& headLength .~ large
& headStyle %~ fc black . opacity 0.5
& tailStyle %~ fc black . opacity 0.5
& shaftStyle %~ dashingN [0.01,0.02,0.03,0.01] 0
arrow7 = arrow6 & arrowHead .~ tri & arrowTail .~ tri' | 1,786 | example = connect' arrow1 "1" "2"
. connect' arrow2 "4" "3"
. connect' arrow3 "1" "6"
. connectOutside' arrow4 "4" "8"
. connect' arrow5 "9" "5"
. connectOutside' arrow6 "8" "9"
. connectOutside' arrow7 "8" "7"
$ cGrid
where
-- The arrows
arrow1 = with & arrowHead .~ dart
& arrowTail .~ quill & shaftStyle %~ lw thick . lc black
& arrowShaft .~ shaft0 & headStyle %~ fc blue
& tailStyle %~ fc red & tailLength .~ large
arrow2 = with & arrowHead .~ dart & headLength .~ large
& arrowTail .~ dart' & tailLength .~ large
& shaftStyle %~ lw thin & arrowShaft .~ shaft1
arrow3 = with & arrowHead .~ thorn & headLength .~ large
& arrowShaft .~ quartercircle & arrowTail .~ noTail
& gaps .~ normal
arrow4 = with & arrowHead .~ dart & arrowTail .~ dart'
& arrowShaft .~ shaft2 & headStyle %~ fc teal
& tailStyle %~ fc teal & shaftStyle %~ lw thick . lc teal
arrow5 = with & arrowTail .~ spike' & tailLength .~ large
& arrowShaft .~ semicircle & arrowHead .~ spike
& headLength .~ large & headStyle %~ fc darkorange
& tailStyle %~ fc darkorange
& shaftStyle %~ lw veryThick . lc navy
arrow6 = with & arrowHead .~ tri & arrowTail .~ tri'
& headLength .~ large
& headStyle %~ fc black . opacity 0.5
& tailStyle %~ fc black . opacity 0.5
& shaftStyle %~ dashingN [0.01,0.02,0.03,0.01] 0
arrow7 = arrow6 & arrowHead .~ tri & arrowTail .~ tri' | 1,762 | false | true | 6 | 89 | 688 | 549 | 263 | 286 | null | null |
mariefarrell/Hets | CASL/QuickCheck.hs | gpl-2.0 | ternaryOr (Result d1 Nothing) b2 =
Result d1 (Just ()) >> b2 >> Result [] Nothing | 83 | ternaryOr (Result d1 Nothing) b2 =
Result d1 (Just ()) >> b2 >> Result [] Nothing | 83 | ternaryOr (Result d1 Nothing) b2 =
Result d1 (Just ()) >> b2 >> Result [] Nothing | 83 | false | false | 0 | 10 | 17 | 47 | 22 | 25 | null | null |
badp/ganeti | src/Ganeti/Constants.hs | gpl-2.0 | idiskParamsTypes :: Map String VType
idiskParamsTypes =
Map.fromList [(idiskSize, VTypeSize),
(idiskSpindles, VTypeInt),
(idiskMode, VTypeString),
(idiskAdopt, VTypeString),
(idiskVg, VTypeString),
(idiskMetavg, VTypeString),
(idiskProvider, VTypeString),
(idiskName, VTypeMaybeString)] | 400 | idiskParamsTypes :: Map String VType
idiskParamsTypes =
Map.fromList [(idiskSize, VTypeSize),
(idiskSpindles, VTypeInt),
(idiskMode, VTypeString),
(idiskAdopt, VTypeString),
(idiskVg, VTypeString),
(idiskMetavg, VTypeString),
(idiskProvider, VTypeString),
(idiskName, VTypeMaybeString)] | 400 | idiskParamsTypes =
Map.fromList [(idiskSize, VTypeSize),
(idiskSpindles, VTypeInt),
(idiskMode, VTypeString),
(idiskAdopt, VTypeString),
(idiskVg, VTypeString),
(idiskMetavg, VTypeString),
(idiskProvider, VTypeString),
(idiskName, VTypeMaybeString)] | 363 | false | true | 0 | 7 | 137 | 93 | 58 | 35 | null | null |
melted/llvm-pretty | src/Text/LLVM/AST.hs | bsd-3-clause | stmtInstr (Effect i _) = i | 28 | stmtInstr (Effect i _) = i | 28 | stmtInstr (Effect i _) = i | 28 | false | false | 0 | 6 | 7 | 18 | 8 | 10 | null | null |
rueshyna/gogol | gogol-resourceviews/gen/Network/Google/ResourceViews/Types/Product.hs | mpl-2.0 | -- | The name of the resource view.
rvName :: Lens' ResourceView (Maybe Text)
rvName = lens _rvName (\ s a -> s{_rvName = a}) | 125 | rvName :: Lens' ResourceView (Maybe Text)
rvName = lens _rvName (\ s a -> s{_rvName = a}) | 89 | rvName = lens _rvName (\ s a -> s{_rvName = a}) | 47 | true | true | 0 | 9 | 24 | 46 | 25 | 21 | null | null |
loadimpact/http2-test | hs-src/Rede/SpdyProtocol/Framing/ChunkProducer.hs | bsd-3-clause | chunkProducerHelper :: Monad m => LB.ByteString
-> m B.ByteString -- Generator
-> Maybe Int -- Length to read
-> m (LB.ByteString, LB.ByteString) -- To yield, left-overs...
chunkProducerHelper pieces gen Nothing =
let
lazy = pieces
length_lazy = LB.length lazy
perfunctory_classif = perfunctoryClassify lazy
total_length = lengthFromPerfunct perfunctory_classif
in if length_lazy >= 8 then
chunkProducerHelper pieces gen (Just total_length)
else do
new_piece <- gen
new_lazy <- return $ LB.append lazy (LB.fromChunks [new_piece])
chunkProducerHelper new_lazy gen Nothing | 778 | chunkProducerHelper :: Monad m => LB.ByteString
-> m B.ByteString -- Generator
-> Maybe Int -- Length to read
-> m (LB.ByteString, LB.ByteString)
chunkProducerHelper pieces gen Nothing =
let
lazy = pieces
length_lazy = LB.length lazy
perfunctory_classif = perfunctoryClassify lazy
total_length = lengthFromPerfunct perfunctory_classif
in if length_lazy >= 8 then
chunkProducerHelper pieces gen (Just total_length)
else do
new_piece <- gen
new_lazy <- return $ LB.append lazy (LB.fromChunks [new_piece])
chunkProducerHelper new_lazy gen Nothing | 750 | chunkProducerHelper pieces gen Nothing =
let
lazy = pieces
length_lazy = LB.length lazy
perfunctory_classif = perfunctoryClassify lazy
total_length = lengthFromPerfunct perfunctory_classif
in if length_lazy >= 8 then
chunkProducerHelper pieces gen (Just total_length)
else do
new_piece <- gen
new_lazy <- return $ LB.append lazy (LB.fromChunks [new_piece])
chunkProducerHelper new_lazy gen Nothing | 491 | true | true | 0 | 15 | 282 | 171 | 84 | 87 | null | null |
z0isch/ten-twenty-five | Game.hs | mit | getAvgRoundPercents :: [GameSave] -> [RoundPercent]
getAvgRoundPercents gs = map avgRPercents $ L.transpose rMakes
where rMakes = map getRoundMakes gs
avgRPercents :: [RoundMake] -> RoundPercent
avgRPercents rms = RoundPercent (100 * fromIntegral (sum $ map roundMakeMakes rms) / fromIntegral (sum $ map roundMakeAttempts rms)) $ roundMakeDistance $ head rms | 376 | getAvgRoundPercents :: [GameSave] -> [RoundPercent]
getAvgRoundPercents gs = map avgRPercents $ L.transpose rMakes
where rMakes = map getRoundMakes gs
avgRPercents :: [RoundMake] -> RoundPercent
avgRPercents rms = RoundPercent (100 * fromIntegral (sum $ map roundMakeMakes rms) / fromIntegral (sum $ map roundMakeAttempts rms)) $ roundMakeDistance $ head rms | 376 | getAvgRoundPercents gs = map avgRPercents $ L.transpose rMakes
where rMakes = map getRoundMakes gs
avgRPercents :: [RoundMake] -> RoundPercent
avgRPercents rms = RoundPercent (100 * fromIntegral (sum $ map roundMakeMakes rms) / fromIntegral (sum $ map roundMakeAttempts rms)) $ roundMakeDistance $ head rms | 324 | false | true | 1 | 14 | 65 | 138 | 63 | 75 | null | null |
green-haskell/ghc | compiler/typecheck/TcType.hs | bsd-3-clause | tcSplitTyConApp_maybe (FunTy arg res) = Just (funTyCon, [arg,res]) | 68 | tcSplitTyConApp_maybe (FunTy arg res) = Just (funTyCon, [arg,res]) | 68 | tcSplitTyConApp_maybe (FunTy arg res) = Just (funTyCon, [arg,res]) | 68 | false | false | 0 | 7 | 9 | 33 | 17 | 16 | null | null |
konn/omaketex | omaketex.hs | bsd-3-clause | gitmessage False = "" | 21 | gitmessage False = "" | 21 | gitmessage False = "" | 21 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
florianpilz/autotool | src/Prolog/Eval.hs | gpl-2.0 | cleanup vs sub =
M.filterWithKey ( \ v _ -> S.notMember v vs ) sub | 71 | cleanup vs sub =
M.filterWithKey ( \ v _ -> S.notMember v vs ) sub | 71 | cleanup vs sub =
M.filterWithKey ( \ v _ -> S.notMember v vs ) sub | 71 | false | false | 0 | 9 | 19 | 35 | 17 | 18 | null | null |
kojiromike/Idris-dev | src/Idris/Core/CaseTree.hs | bsd-3-clause | prune :: Bool -- ^ Convert single branches to projections (only useful at runtime)
-> SC -> SC
prune proj (Case up n alts) = case alts' of
[] -> ImpossibleCase
-- Projection transformations prevent us from seeing some uses of ctor fields
-- because they delete information about which ctor is being used.
-- Consider:
-- f (X x) = ... x ...
-- vs.
-- f x = ... x!0 ...
--
-- Hence, we disable this step.
-- TODO: re-enable this in toIR
--
-- as@[ConCase cn i args sc]
-- | proj -> mkProj n 0 args (prune proj sc)
-- mkProj n i xs sc = foldr (\x -> projRep x n i) sc xs
-- If none of the args are used in the sc, however, we can just replace it
-- with sc
as@[ConCase cn i args sc]
| proj -> let sc' = prune proj sc in
if any (isUsed sc') args
then Case up n [ConCase cn i args sc']
else sc'
[SucCase cn sc]
| proj
-> projRep cn n (-1) $ prune proj sc
[ConstCase _ sc]
-> prune proj sc
-- Bit of a hack here! The default case will always be 0, make sure
-- it gets caught first.
[s@(SucCase _ _), DefaultCase dc]
-> Case up n [ConstCase (BI 0) dc, s]
as -> Case up n as
where
alts' = filter (not . erased) $ map pruneAlt alts
pruneAlt (ConCase cn i ns sc) = ConCase cn i ns (prune proj sc)
pruneAlt (FnCase cn ns sc) = FnCase cn ns (prune proj sc)
pruneAlt (ConstCase c sc) = ConstCase c (prune proj sc)
pruneAlt (SucCase n sc) = SucCase n (prune proj sc)
pruneAlt (DefaultCase sc) = DefaultCase (prune proj sc)
erased (DefaultCase (STerm Erased)) = True
erased (DefaultCase ImpossibleCase) = True
erased _ = False
projRep :: Name -> Name -> Int -> SC -> SC
projRep arg n i (Case up x alts) | x == arg
= ProjCase (Proj (P Bound n Erased) i) $ map (projRepAlt arg n i) alts
projRep arg n i (Case up x alts)
= Case up x (map (projRepAlt arg n i) alts)
projRep arg n i (ProjCase t alts)
= ProjCase (projRepTm arg n i t) $ map (projRepAlt arg n i) alts
projRep arg n i (STerm t) = STerm (projRepTm arg n i t)
projRep arg n i c = c
projRepAlt arg n i (ConCase cn t args rhs)
= ConCase cn t args (projRep arg n i rhs)
projRepAlt arg n i (FnCase cn args rhs)
= FnCase cn args (projRep arg n i rhs)
projRepAlt arg n i (ConstCase t rhs)
= ConstCase t (projRep arg n i rhs)
projRepAlt arg n i (SucCase sn rhs)
= SucCase sn (projRep arg n i rhs)
projRepAlt arg n i (DefaultCase rhs)
= DefaultCase (projRep arg n i rhs)
projRepTm arg n i t = subst arg (Proj (P Bound n Erased) i) t | 2,754 | prune :: Bool -- ^ Convert single branches to projections (only useful at runtime)
-> SC -> SC
prune proj (Case up n alts) = case alts' of
[] -> ImpossibleCase
-- Projection transformations prevent us from seeing some uses of ctor fields
-- because they delete information about which ctor is being used.
-- Consider:
-- f (X x) = ... x ...
-- vs.
-- f x = ... x!0 ...
--
-- Hence, we disable this step.
-- TODO: re-enable this in toIR
--
-- as@[ConCase cn i args sc]
-- | proj -> mkProj n 0 args (prune proj sc)
-- mkProj n i xs sc = foldr (\x -> projRep x n i) sc xs
-- If none of the args are used in the sc, however, we can just replace it
-- with sc
as@[ConCase cn i args sc]
| proj -> let sc' = prune proj sc in
if any (isUsed sc') args
then Case up n [ConCase cn i args sc']
else sc'
[SucCase cn sc]
| proj
-> projRep cn n (-1) $ prune proj sc
[ConstCase _ sc]
-> prune proj sc
-- Bit of a hack here! The default case will always be 0, make sure
-- it gets caught first.
[s@(SucCase _ _), DefaultCase dc]
-> Case up n [ConstCase (BI 0) dc, s]
as -> Case up n as
where
alts' = filter (not . erased) $ map pruneAlt alts
pruneAlt (ConCase cn i ns sc) = ConCase cn i ns (prune proj sc)
pruneAlt (FnCase cn ns sc) = FnCase cn ns (prune proj sc)
pruneAlt (ConstCase c sc) = ConstCase c (prune proj sc)
pruneAlt (SucCase n sc) = SucCase n (prune proj sc)
pruneAlt (DefaultCase sc) = DefaultCase (prune proj sc)
erased (DefaultCase (STerm Erased)) = True
erased (DefaultCase ImpossibleCase) = True
erased _ = False
projRep :: Name -> Name -> Int -> SC -> SC
projRep arg n i (Case up x alts) | x == arg
= ProjCase (Proj (P Bound n Erased) i) $ map (projRepAlt arg n i) alts
projRep arg n i (Case up x alts)
= Case up x (map (projRepAlt arg n i) alts)
projRep arg n i (ProjCase t alts)
= ProjCase (projRepTm arg n i t) $ map (projRepAlt arg n i) alts
projRep arg n i (STerm t) = STerm (projRepTm arg n i t)
projRep arg n i c = c
projRepAlt arg n i (ConCase cn t args rhs)
= ConCase cn t args (projRep arg n i rhs)
projRepAlt arg n i (FnCase cn args rhs)
= FnCase cn args (projRep arg n i rhs)
projRepAlt arg n i (ConstCase t rhs)
= ConstCase t (projRep arg n i rhs)
projRepAlt arg n i (SucCase sn rhs)
= SucCase sn (projRep arg n i rhs)
projRepAlt arg n i (DefaultCase rhs)
= DefaultCase (projRep arg n i rhs)
projRepTm arg n i t = subst arg (Proj (P Bound n Erased) i) t | 2,754 | prune proj (Case up n alts) = case alts' of
[] -> ImpossibleCase
-- Projection transformations prevent us from seeing some uses of ctor fields
-- because they delete information about which ctor is being used.
-- Consider:
-- f (X x) = ... x ...
-- vs.
-- f x = ... x!0 ...
--
-- Hence, we disable this step.
-- TODO: re-enable this in toIR
--
-- as@[ConCase cn i args sc]
-- | proj -> mkProj n 0 args (prune proj sc)
-- mkProj n i xs sc = foldr (\x -> projRep x n i) sc xs
-- If none of the args are used in the sc, however, we can just replace it
-- with sc
as@[ConCase cn i args sc]
| proj -> let sc' = prune proj sc in
if any (isUsed sc') args
then Case up n [ConCase cn i args sc']
else sc'
[SucCase cn sc]
| proj
-> projRep cn n (-1) $ prune proj sc
[ConstCase _ sc]
-> prune proj sc
-- Bit of a hack here! The default case will always be 0, make sure
-- it gets caught first.
[s@(SucCase _ _), DefaultCase dc]
-> Case up n [ConstCase (BI 0) dc, s]
as -> Case up n as
where
alts' = filter (not . erased) $ map pruneAlt alts
pruneAlt (ConCase cn i ns sc) = ConCase cn i ns (prune proj sc)
pruneAlt (FnCase cn ns sc) = FnCase cn ns (prune proj sc)
pruneAlt (ConstCase c sc) = ConstCase c (prune proj sc)
pruneAlt (SucCase n sc) = SucCase n (prune proj sc)
pruneAlt (DefaultCase sc) = DefaultCase (prune proj sc)
erased (DefaultCase (STerm Erased)) = True
erased (DefaultCase ImpossibleCase) = True
erased _ = False
projRep :: Name -> Name -> Int -> SC -> SC
projRep arg n i (Case up x alts) | x == arg
= ProjCase (Proj (P Bound n Erased) i) $ map (projRepAlt arg n i) alts
projRep arg n i (Case up x alts)
= Case up x (map (projRepAlt arg n i) alts)
projRep arg n i (ProjCase t alts)
= ProjCase (projRepTm arg n i t) $ map (projRepAlt arg n i) alts
projRep arg n i (STerm t) = STerm (projRepTm arg n i t)
projRep arg n i c = c
projRepAlt arg n i (ConCase cn t args rhs)
= ConCase cn t args (projRep arg n i rhs)
projRepAlt arg n i (FnCase cn args rhs)
= FnCase cn args (projRep arg n i rhs)
projRepAlt arg n i (ConstCase t rhs)
= ConstCase t (projRep arg n i rhs)
projRepAlt arg n i (SucCase sn rhs)
= SucCase sn (projRep arg n i rhs)
projRepAlt arg n i (DefaultCase rhs)
= DefaultCase (projRep arg n i rhs)
projRepTm arg n i t = subst arg (Proj (P Bound n Erased) i) t | 2,653 | false | true | 1 | 14 | 888 | 1,043 | 489 | 554 | null | null |
badp/ganeti | src/Ganeti/HTools/Loader.hs | gpl-2.0 | longestDomain (x:xs) =
foldr (\ suffix accu -> if all (isSuffixOf suffix) xs
then suffix
else accu)
"" $ filter (isPrefixOf ".") (tails x) | 206 | longestDomain (x:xs) =
foldr (\ suffix accu -> if all (isSuffixOf suffix) xs
then suffix
else accu)
"" $ filter (isPrefixOf ".") (tails x) | 206 | longestDomain (x:xs) =
foldr (\ suffix accu -> if all (isSuffixOf suffix) xs
then suffix
else accu)
"" $ filter (isPrefixOf ".") (tails x) | 206 | false | false | 0 | 12 | 91 | 71 | 36 | 35 | null | null |
pascalpoizat/vecahaskell | src/Models/Events.hs | apache-2.0 | liftToTIOEvent (Send a) = TSend a | 33 | liftToTIOEvent (Send a) = TSend a | 33 | liftToTIOEvent (Send a) = TSend a | 33 | false | false | 0 | 7 | 5 | 18 | 8 | 10 | null | null |
ComputationWithBoundedResources/ara-inference | doc/tpdb_trs/Haskell/basic_haskell/CARET_1.hs | mit | primMulInt (Neg x) (Pos y) = Neg (primMulNat x y) | 49 | primMulInt (Neg x) (Pos y) = Neg (primMulNat x y) | 49 | primMulInt (Neg x) (Pos y) = Neg (primMulNat x y) | 49 | false | false | 0 | 7 | 9 | 34 | 16 | 18 | null | null |
ribag/ganeti-experiments | src/Ganeti/Locking/Locks.hs | gpl-2.0 | lockName NAL = "node-alloc/NAL" | 31 | lockName NAL = "node-alloc/NAL" | 31 | lockName NAL = "node-alloc/NAL" | 31 | false | false | 1 | 5 | 3 | 13 | 4 | 9 | null | null |
sos22/ppres | ppres/driver/Classifier.hs | gpl-2.0 | boolOr _ (BooleanConst True) = BooleanConst True | 48 | boolOr _ (BooleanConst True) = BooleanConst True | 48 | boolOr _ (BooleanConst True) = BooleanConst True | 48 | false | false | 0 | 7 | 6 | 20 | 9 | 11 | null | null |
unknownloner/aoc2016 | src/Days/Day1.hs | mit | rotate :: Char -> Dir -> Dir
rotate 'R' W = N | 45 | rotate :: Char -> Dir -> Dir
rotate 'R' W = N | 45 | rotate 'R' W = N | 16 | false | true | 0 | 6 | 11 | 24 | 12 | 12 | null | null |
nevrenato/Hets_Fork | SoftFOL/ProveDarwin.hs | gpl-2.0 | runDarwin
:: ProverBinary
-> SoftFOLProverState
{- ^ logical part containing the input Sign and axioms and possibly
goals that have been proved earlier as additional axioms -}
-> GenericConfig ProofTree -- ^ configuration to use
-> Bool -- ^ True means save TPTP file
-> String -- ^ name of the theory in the DevGraph
-> AS_Anno.Named SPTerm -- ^ goal to prove
-> IO (ATPRetval, GenericConfig ProofTree)
-- ^ (retval, configuration with proof status and complete output)
runDarwin b sps cfg saveTPTP thName nGoal = do
let bin = darwinExe b
options = extraOpts cfg
tl = maybe "10" show $ timeLimit cfg
tOut = toOpt ++ tl
extraOptions = unwords $ case b of
EProver -> eproverOpts ++ tl
Leo -> "-t " ++ tl
Darwin -> darOpt ++ tOut
DarwinFD -> darOpt ++ " " ++ fdOpt ++ tOut
EDarwin -> darOpt ++ " " ++ fdOpt ++ eqOpt ++ tOut
: options
tmpFileName = thName ++ '_' : AS_Anno.senAttr nGoal
prob <- showTPTPProblem thName sps nGoal
$ options ++ ["Requested prover: " ++ bin]
(exitCode, out, tUsed) <-
runDarwinProcess bin saveTPTP extraOptions tmpFileName prob
let ctime = timeToTimeOfDay $ secondsToDiffTime $ toInteger tUsed
(err, retval) = case () of
_ | szsProved exitCode -> (ATPSuccess, provedStatus)
_ | szsDisproved exitCode -> (ATPSuccess, disProvedStatus)
_ | szsTimeout exitCode ->
(ATPTLimitExceeded, defaultProofStatus)
_ | szsStopped exitCode ->
(ATPBatchStopped, defaultProofStatus)
_ -> (ATPError exitCode, defaultProofStatus)
defaultProofStatus =
(openProofStatus
(AS_Anno.senAttr nGoal) bin emptyProofTree)
{ usedTime = ctime
, tacticScript = TacticScript $ show ATPTacticScript
{tsTimeLimit = configTimeLimit cfg,
tsExtraOpts = options} }
disProvedStatus = defaultProofStatus {goalStatus = Disproved}
provedStatus = defaultProofStatus
{ goalName = AS_Anno.senAttr nGoal
, goalStatus = Proved True
, usedAxioms = getAxioms sps
, usedProver = bin
, usedTime = timeToTimeOfDay $ secondsToDiffTime $ toInteger tUsed
}
return (err, cfg {proofStatus = retval,
resultOutput = out,
timeUsed = ctime }) | 2,504 | runDarwin
:: ProverBinary
-> SoftFOLProverState
{- ^ logical part containing the input Sign and axioms and possibly
goals that have been proved earlier as additional axioms -}
-> GenericConfig ProofTree -- ^ configuration to use
-> Bool -- ^ True means save TPTP file
-> String -- ^ name of the theory in the DevGraph
-> AS_Anno.Named SPTerm -- ^ goal to prove
-> IO (ATPRetval, GenericConfig ProofTree)
runDarwin b sps cfg saveTPTP thName nGoal = do
let bin = darwinExe b
options = extraOpts cfg
tl = maybe "10" show $ timeLimit cfg
tOut = toOpt ++ tl
extraOptions = unwords $ case b of
EProver -> eproverOpts ++ tl
Leo -> "-t " ++ tl
Darwin -> darOpt ++ tOut
DarwinFD -> darOpt ++ " " ++ fdOpt ++ tOut
EDarwin -> darOpt ++ " " ++ fdOpt ++ eqOpt ++ tOut
: options
tmpFileName = thName ++ '_' : AS_Anno.senAttr nGoal
prob <- showTPTPProblem thName sps nGoal
$ options ++ ["Requested prover: " ++ bin]
(exitCode, out, tUsed) <-
runDarwinProcess bin saveTPTP extraOptions tmpFileName prob
let ctime = timeToTimeOfDay $ secondsToDiffTime $ toInteger tUsed
(err, retval) = case () of
_ | szsProved exitCode -> (ATPSuccess, provedStatus)
_ | szsDisproved exitCode -> (ATPSuccess, disProvedStatus)
_ | szsTimeout exitCode ->
(ATPTLimitExceeded, defaultProofStatus)
_ | szsStopped exitCode ->
(ATPBatchStopped, defaultProofStatus)
_ -> (ATPError exitCode, defaultProofStatus)
defaultProofStatus =
(openProofStatus
(AS_Anno.senAttr nGoal) bin emptyProofTree)
{ usedTime = ctime
, tacticScript = TacticScript $ show ATPTacticScript
{tsTimeLimit = configTimeLimit cfg,
tsExtraOpts = options} }
disProvedStatus = defaultProofStatus {goalStatus = Disproved}
provedStatus = defaultProofStatus
{ goalName = AS_Anno.senAttr nGoal
, goalStatus = Proved True
, usedAxioms = getAxioms sps
, usedProver = bin
, usedTime = timeToTimeOfDay $ secondsToDiffTime $ toInteger tUsed
}
return (err, cfg {proofStatus = retval,
resultOutput = out,
timeUsed = ctime }) | 2,432 | runDarwin b sps cfg saveTPTP thName nGoal = do
let bin = darwinExe b
options = extraOpts cfg
tl = maybe "10" show $ timeLimit cfg
tOut = toOpt ++ tl
extraOptions = unwords $ case b of
EProver -> eproverOpts ++ tl
Leo -> "-t " ++ tl
Darwin -> darOpt ++ tOut
DarwinFD -> darOpt ++ " " ++ fdOpt ++ tOut
EDarwin -> darOpt ++ " " ++ fdOpt ++ eqOpt ++ tOut
: options
tmpFileName = thName ++ '_' : AS_Anno.senAttr nGoal
prob <- showTPTPProblem thName sps nGoal
$ options ++ ["Requested prover: " ++ bin]
(exitCode, out, tUsed) <-
runDarwinProcess bin saveTPTP extraOptions tmpFileName prob
let ctime = timeToTimeOfDay $ secondsToDiffTime $ toInteger tUsed
(err, retval) = case () of
_ | szsProved exitCode -> (ATPSuccess, provedStatus)
_ | szsDisproved exitCode -> (ATPSuccess, disProvedStatus)
_ | szsTimeout exitCode ->
(ATPTLimitExceeded, defaultProofStatus)
_ | szsStopped exitCode ->
(ATPBatchStopped, defaultProofStatus)
_ -> (ATPError exitCode, defaultProofStatus)
defaultProofStatus =
(openProofStatus
(AS_Anno.senAttr nGoal) bin emptyProofTree)
{ usedTime = ctime
, tacticScript = TacticScript $ show ATPTacticScript
{tsTimeLimit = configTimeLimit cfg,
tsExtraOpts = options} }
disProvedStatus = defaultProofStatus {goalStatus = Disproved}
provedStatus = defaultProofStatus
{ goalName = AS_Anno.senAttr nGoal
, goalStatus = Proved True
, usedAxioms = getAxioms sps
, usedProver = bin
, usedTime = timeToTimeOfDay $ secondsToDiffTime $ toInteger tUsed
}
return (err, cfg {proofStatus = retval,
resultOutput = out,
timeUsed = ctime }) | 2,010 | true | true | 0 | 19 | 811 | 588 | 304 | 284 | null | null |
DanielSchuessler/hstri | Latexable.hs | gpl-3.0 | (&) :: (Latexable a, Latexable a1) => a -> a1 -> [Char]
x & y = toLatex x ++"&"++toLatex y | 91 | (&) :: (Latexable a, Latexable a1) => a -> a1 -> [Char]
x & y = toLatex x ++"&"++toLatex y | 91 | x & y = toLatex x ++"&"++toLatex y | 34 | false | true | 0 | 11 | 20 | 63 | 31 | 32 | null | null |
copton/hgdbmi | src/Gdbmi/Semantics.hs | bsd-3-clause | responseStopReason :: [Result] -> Maybe StopReason -- {{{2
responseStopReason rs = do
reason <- find (("reason"==) . resVariable) rs >>= asConst . resValue
case reason of
"breakpoint-hit" ->
BreakpointHit
<$> get rs tryRead "disp"
<*> get rs tryRead "bkptno"
"end-stepping-range" -> Just EndSteppingRange
"function-finished" -> Just FunctionFinished
_ -> Nothing | 408 | responseStopReason :: [Result] -> Maybe StopReason
responseStopReason rs = do
reason <- find (("reason"==) . resVariable) rs >>= asConst . resValue
case reason of
"breakpoint-hit" ->
BreakpointHit
<$> get rs tryRead "disp"
<*> get rs tryRead "bkptno"
"end-stepping-range" -> Just EndSteppingRange
"function-finished" -> Just FunctionFinished
_ -> Nothing | 399 | responseStopReason rs = do
reason <- find (("reason"==) . resVariable) rs >>= asConst . resValue
case reason of
"breakpoint-hit" ->
BreakpointHit
<$> get rs tryRead "disp"
<*> get rs tryRead "bkptno"
"end-stepping-range" -> Just EndSteppingRange
"function-finished" -> Just FunctionFinished
_ -> Nothing | 348 | true | true | 0 | 14 | 95 | 120 | 57 | 63 | null | null |
fibsifan/pandoc | src/Text/Pandoc/Readers/Markdown.hs | gpl-2.0 | htmlBlock :: MarkdownParser (F Blocks)
htmlBlock = do
guardEnabled Ext_raw_html
try (do
(TagOpen t attrs) <- lookAhead $ fst <$> htmlTag isBlockTag
(guard (t `elem` ["pre","style","script"]) >>
(return . B.rawBlock "html") <$> rawVerbatimBlock)
<|> (do guardEnabled Ext_markdown_attribute
oldMarkdownAttribute <- stateMarkdownAttribute <$> getState
markdownAttribute <-
case lookup "markdown" attrs of
Just "0" -> False <$ updateState (\st -> st{
stateMarkdownAttribute = False })
Just _ -> True <$ updateState (\st -> st{
stateMarkdownAttribute = True })
Nothing -> return oldMarkdownAttribute
res <- if markdownAttribute
then rawHtmlBlocks
else htmlBlock'
updateState $ \st -> st{ stateMarkdownAttribute =
oldMarkdownAttribute }
return res)
<|> (guardEnabled Ext_markdown_in_html_blocks >> rawHtmlBlocks))
<|> htmlBlock' | 1,213 | htmlBlock :: MarkdownParser (F Blocks)
htmlBlock = do
guardEnabled Ext_raw_html
try (do
(TagOpen t attrs) <- lookAhead $ fst <$> htmlTag isBlockTag
(guard (t `elem` ["pre","style","script"]) >>
(return . B.rawBlock "html") <$> rawVerbatimBlock)
<|> (do guardEnabled Ext_markdown_attribute
oldMarkdownAttribute <- stateMarkdownAttribute <$> getState
markdownAttribute <-
case lookup "markdown" attrs of
Just "0" -> False <$ updateState (\st -> st{
stateMarkdownAttribute = False })
Just _ -> True <$ updateState (\st -> st{
stateMarkdownAttribute = True })
Nothing -> return oldMarkdownAttribute
res <- if markdownAttribute
then rawHtmlBlocks
else htmlBlock'
updateState $ \st -> st{ stateMarkdownAttribute =
oldMarkdownAttribute }
return res)
<|> (guardEnabled Ext_markdown_in_html_blocks >> rawHtmlBlocks))
<|> htmlBlock' | 1,213 | htmlBlock = do
guardEnabled Ext_raw_html
try (do
(TagOpen t attrs) <- lookAhead $ fst <$> htmlTag isBlockTag
(guard (t `elem` ["pre","style","script"]) >>
(return . B.rawBlock "html") <$> rawVerbatimBlock)
<|> (do guardEnabled Ext_markdown_attribute
oldMarkdownAttribute <- stateMarkdownAttribute <$> getState
markdownAttribute <-
case lookup "markdown" attrs of
Just "0" -> False <$ updateState (\st -> st{
stateMarkdownAttribute = False })
Just _ -> True <$ updateState (\st -> st{
stateMarkdownAttribute = True })
Nothing -> return oldMarkdownAttribute
res <- if markdownAttribute
then rawHtmlBlocks
else htmlBlock'
updateState $ \st -> st{ stateMarkdownAttribute =
oldMarkdownAttribute }
return res)
<|> (guardEnabled Ext_markdown_in_html_blocks >> rawHtmlBlocks))
<|> htmlBlock' | 1,174 | false | true | 2 | 26 | 495 | 287 | 140 | 147 | null | null |
AlexeyRaga/eta | compiler/ETA/CodeGen/Prim.hs | bsd-3-clause | mkRtsPrimOp LabelThreadOp = (concGroup, "labelThread") | 64 | mkRtsPrimOp LabelThreadOp = (concGroup, "labelThread") | 64 | mkRtsPrimOp LabelThreadOp = (concGroup, "labelThread") | 64 | false | false | 0 | 5 | 14 | 15 | 8 | 7 | null | null |
ulricha/algebra-sql | src/Database/Algebra/Table/Render/Dot.hs | bsd-3-clause | renderColor DCSienna = P.text "sienna" | 44 | renderColor DCSienna = P.text "sienna" | 44 | renderColor DCSienna = P.text "sienna" | 44 | false | false | 0 | 6 | 10 | 14 | 6 | 8 | null | null |
mumuki/mulang | src/Language/Mulang/Ast/Operator.hs | gpl-3.0 | isNotLike :: Operator -> Bool
isNotLike NotEqual = True | 57 | isNotLike :: Operator -> Bool
isNotLike NotEqual = True | 57 | isNotLike NotEqual = True | 27 | false | true | 0 | 5 | 10 | 18 | 9 | 9 | null | null |
dmjio/aeson | src/Data/Aeson/TH.hs | bsd-3-clause | -- Generate a list of fresh names with a common prefix, and numbered suffixes.
newNameList :: String -> Int -> Q [Name]
newNameList prefix len = mapM newName [prefix ++ show n | n <- [1..len]] | 192 | newNameList :: String -> Int -> Q [Name]
newNameList prefix len = mapM newName [prefix ++ show n | n <- [1..len]] | 113 | newNameList prefix len = mapM newName [prefix ++ show n | n <- [1..len]] | 72 | true | true | 0 | 9 | 35 | 59 | 30 | 29 | null | null |
butchhoward/xhaskell | factorial_gamma.hs | mit | actorial :: Integer -> Integer
-- Point-free style analytic solution
factorial = round . exp . lnGamma . fromIntegral . (+1) | 126 | factorial :: Integer -> Integer
factorial = round . exp . lnGamma . fromIntegral . (+1) | 87 | factorial = round . exp . lnGamma . fromIntegral . (+1) | 55 | true | true | 0 | 8 | 22 | 36 | 20 | 16 | null | null |
AlexanderPankiv/ghc | compiler/prelude/PrelNames.hs | bsd-3-clause | typeSymbolKindConNameKey = mkPreludeTyConUnique 165 | 52 | typeSymbolKindConNameKey = mkPreludeTyConUnique 165 | 52 | typeSymbolKindConNameKey = mkPreludeTyConUnique 165 | 52 | false | false | 0 | 5 | 4 | 9 | 4 | 5 | null | null |
bravit/Idris-dev | src/Idris/IBC.hs | bsd-3-clause | processDefs :: Archive -> Idris ()
processDefs ar = do
ds <- getEntry [] "ibc_defs" ar
mapM_ (\ (n, d) -> do
d' <- updateDef d
case d' of
TyDecl _ _ -> return ()
_ -> do
logIBC 1 $ "SOLVING " ++ show n
solveDeferred emptyFC n
updateIState (\i -> i { tt_ctxt = addCtxtDef n d' (tt_ctxt i) })) ds
where
updateDef (CaseOp c t args o s cd) = do
o' <- mapM updateOrig o
cd' <- updateCD cd
return $ CaseOp c t args o' s cd'
updateDef t = return t
updateOrig (Left t) = liftM Left (update t)
updateOrig (Right (l, r)) = do
l' <- update l
r' <- update r
return $ Right (l', r')
updateCD (CaseDefs (cs, c) (rs, r)) = do
c' <- updateSC c
r' <- updateSC r
return $ CaseDefs (cs, c') (rs, r')
updateSC (Case t n alts) = do
alts' <- mapM updateAlt alts
return (Case t n alts')
updateSC (ProjCase t alts) = do
alts' <- mapM updateAlt alts
return (ProjCase t alts')
updateSC (STerm t) = do
t' <- update t
return (STerm t')
updateSC c = return c
updateAlt (ConCase n i ns t) = do
t' <- updateSC t
return (ConCase n i ns t')
updateAlt (FnCase n ns t) = do
t' <- updateSC t
return (FnCase n ns t')
updateAlt (ConstCase c t) = do
t' <- updateSC t
return (ConstCase c t')
updateAlt (SucCase n t) = do
t' <- updateSC t
return (SucCase n t')
updateAlt (DefaultCase t) = do
t' <- updateSC t
return (DefaultCase t')
-- We get a lot of repetition in sub terms and can save a fair chunk
-- of memory if we make sure they're shared. addTT looks for a term
-- and returns it if it exists already, while also keeping stats of
-- how many times a subterm is repeated.
update t = do
tm <- addTT t
case tm of
Nothing -> update' t
Just t' -> return t'
update' (P t n ty) = do
n' <- getSymbol n
return $ P t n' ty
update' (App s f a) = liftM2 (App s) (update' f) (update' a)
update' (Bind n b sc) = do
b' <- updateB b
sc' <- update sc
return $ Bind n b' sc'
where
updateB (Let t v) = liftM2 Let (update' t) (update' v)
updateB b = do
ty' <- update' (binderTy b)
return (b { binderTy = ty' })
update' (Proj t i) = do
t' <- update' t
return $ Proj t' i
update' t = return t | 2,919 | processDefs :: Archive -> Idris ()
processDefs ar = do
ds <- getEntry [] "ibc_defs" ar
mapM_ (\ (n, d) -> do
d' <- updateDef d
case d' of
TyDecl _ _ -> return ()
_ -> do
logIBC 1 $ "SOLVING " ++ show n
solveDeferred emptyFC n
updateIState (\i -> i { tt_ctxt = addCtxtDef n d' (tt_ctxt i) })) ds
where
updateDef (CaseOp c t args o s cd) = do
o' <- mapM updateOrig o
cd' <- updateCD cd
return $ CaseOp c t args o' s cd'
updateDef t = return t
updateOrig (Left t) = liftM Left (update t)
updateOrig (Right (l, r)) = do
l' <- update l
r' <- update r
return $ Right (l', r')
updateCD (CaseDefs (cs, c) (rs, r)) = do
c' <- updateSC c
r' <- updateSC r
return $ CaseDefs (cs, c') (rs, r')
updateSC (Case t n alts) = do
alts' <- mapM updateAlt alts
return (Case t n alts')
updateSC (ProjCase t alts) = do
alts' <- mapM updateAlt alts
return (ProjCase t alts')
updateSC (STerm t) = do
t' <- update t
return (STerm t')
updateSC c = return c
updateAlt (ConCase n i ns t) = do
t' <- updateSC t
return (ConCase n i ns t')
updateAlt (FnCase n ns t) = do
t' <- updateSC t
return (FnCase n ns t')
updateAlt (ConstCase c t) = do
t' <- updateSC t
return (ConstCase c t')
updateAlt (SucCase n t) = do
t' <- updateSC t
return (SucCase n t')
updateAlt (DefaultCase t) = do
t' <- updateSC t
return (DefaultCase t')
-- We get a lot of repetition in sub terms and can save a fair chunk
-- of memory if we make sure they're shared. addTT looks for a term
-- and returns it if it exists already, while also keeping stats of
-- how many times a subterm is repeated.
update t = do
tm <- addTT t
case tm of
Nothing -> update' t
Just t' -> return t'
update' (P t n ty) = do
n' <- getSymbol n
return $ P t n' ty
update' (App s f a) = liftM2 (App s) (update' f) (update' a)
update' (Bind n b sc) = do
b' <- updateB b
sc' <- update sc
return $ Bind n b' sc'
where
updateB (Let t v) = liftM2 Let (update' t) (update' v)
updateB b = do
ty' <- update' (binderTy b)
return (b { binderTy = ty' })
update' (Proj t i) = do
t' <- update' t
return $ Proj t' i
update' t = return t | 2,919 | processDefs ar = do
ds <- getEntry [] "ibc_defs" ar
mapM_ (\ (n, d) -> do
d' <- updateDef d
case d' of
TyDecl _ _ -> return ()
_ -> do
logIBC 1 $ "SOLVING " ++ show n
solveDeferred emptyFC n
updateIState (\i -> i { tt_ctxt = addCtxtDef n d' (tt_ctxt i) })) ds
where
updateDef (CaseOp c t args o s cd) = do
o' <- mapM updateOrig o
cd' <- updateCD cd
return $ CaseOp c t args o' s cd'
updateDef t = return t
updateOrig (Left t) = liftM Left (update t)
updateOrig (Right (l, r)) = do
l' <- update l
r' <- update r
return $ Right (l', r')
updateCD (CaseDefs (cs, c) (rs, r)) = do
c' <- updateSC c
r' <- updateSC r
return $ CaseDefs (cs, c') (rs, r')
updateSC (Case t n alts) = do
alts' <- mapM updateAlt alts
return (Case t n alts')
updateSC (ProjCase t alts) = do
alts' <- mapM updateAlt alts
return (ProjCase t alts')
updateSC (STerm t) = do
t' <- update t
return (STerm t')
updateSC c = return c
updateAlt (ConCase n i ns t) = do
t' <- updateSC t
return (ConCase n i ns t')
updateAlt (FnCase n ns t) = do
t' <- updateSC t
return (FnCase n ns t')
updateAlt (ConstCase c t) = do
t' <- updateSC t
return (ConstCase c t')
updateAlt (SucCase n t) = do
t' <- updateSC t
return (SucCase n t')
updateAlt (DefaultCase t) = do
t' <- updateSC t
return (DefaultCase t')
-- We get a lot of repetition in sub terms and can save a fair chunk
-- of memory if we make sure they're shared. addTT looks for a term
-- and returns it if it exists already, while also keeping stats of
-- how many times a subterm is repeated.
update t = do
tm <- addTT t
case tm of
Nothing -> update' t
Just t' -> return t'
update' (P t n ty) = do
n' <- getSymbol n
return $ P t n' ty
update' (App s f a) = liftM2 (App s) (update' f) (update' a)
update' (Bind n b sc) = do
b' <- updateB b
sc' <- update sc
return $ Bind n b' sc'
where
updateB (Let t v) = liftM2 Let (update' t) (update' v)
updateB b = do
ty' <- update' (binderTy b)
return (b { binderTy = ty' })
update' (Proj t i) = do
t' <- update' t
return $ Proj t' i
update' t = return t | 2,884 | false | true | 19 | 19 | 1,321 | 1,006 | 474 | 532 | null | null |
gbataille/pandoc | src/Text/Pandoc/Writers/HTML.hs | gpl-2.0 | -- title beginning with fig: indicates that the image is a figure
blockToHtml opts (Para [Image txt (s,'f':'i':'g':':':tit)]) = do
img <- inlineToHtml opts (Image txt (s,tit))
let tocapt = if writerHtml5 opts
then H5.figcaption
else H.p ! A.class_ "caption"
capt <- if null txt
then return mempty
else tocapt `fmap` inlineListToHtml opts txt
return $ if writerHtml5 opts
then H5.figure $ mconcat
[nl opts, img, capt, nl opts]
else H.div ! A.class_ "figure" $ mconcat
[nl opts, img, nl opts, capt, nl opts] | 643 | blockToHtml opts (Para [Image txt (s,'f':'i':'g':':':tit)]) = do
img <- inlineToHtml opts (Image txt (s,tit))
let tocapt = if writerHtml5 opts
then H5.figcaption
else H.p ! A.class_ "caption"
capt <- if null txt
then return mempty
else tocapt `fmap` inlineListToHtml opts txt
return $ if writerHtml5 opts
then H5.figure $ mconcat
[nl opts, img, capt, nl opts]
else H.div ! A.class_ "figure" $ mconcat
[nl opts, img, nl opts, capt, nl opts] | 577 | blockToHtml opts (Para [Image txt (s,'f':'i':'g':':':tit)]) = do
img <- inlineToHtml opts (Image txt (s,tit))
let tocapt = if writerHtml5 opts
then H5.figcaption
else H.p ! A.class_ "caption"
capt <- if null txt
then return mempty
else tocapt `fmap` inlineListToHtml opts txt
return $ if writerHtml5 opts
then H5.figure $ mconcat
[nl opts, img, capt, nl opts]
else H.div ! A.class_ "figure" $ mconcat
[nl opts, img, nl opts, capt, nl opts] | 577 | true | false | 0 | 14 | 221 | 226 | 114 | 112 | null | null |
karamellpelle/grid | source/Game/Memory/Helpers.hs | gpl-3.0 | --------------------------------------------------------------------------------
--
memoryCamera :: MemoryWorld -> Camera
memoryCamera =
gridCamera . memoryGrid | 169 | memoryCamera :: MemoryWorld -> Camera
memoryCamera =
gridCamera . memoryGrid | 82 | memoryCamera =
gridCamera . memoryGrid | 44 | true | true | 0 | 5 | 20 | 21 | 12 | 9 | null | null |
jaapweel/piffle | src/CIr.hs | gpl-2.0 | tBinop Ne =
C.Ne | 20 | tBinop Ne =
C.Ne | 20 | tBinop Ne =
C.Ne | 20 | false | false | 1 | 6 | 7 | 15 | 5 | 10 | null | null |
ambiata/highlighting-kate | Text/Highlighting/Kate/Syntax/Javadoc.hs | gpl-2.0 | regex_'28'21'7c'5c'3f'29 = compileRegex True "(!|\\?)" | 54 | regex_'28'21'7c'5c'3f'29 = compileRegex True "(!|\\?)" | 54 | regex_'28'21'7c'5c'3f'29 = compileRegex True "(!|\\?)" | 54 | false | false | 0 | 5 | 4 | 11 | 5 | 6 | null | null |
leshchevds/ganeti | src/Ganeti/WConfd/Core.hs | bsd-2-clause | -- | Opportunistically allocate locks for a given owner.
opportunisticLockUnion :: ClientId
-> [(GanetiLocks, L.OwnerState)]
-> WConfdMonad [GanetiLocks]
opportunisticLockUnion cid req =
modifyLockWaiting $ LW.opportunisticLockUnion cid req | 288 | opportunisticLockUnion :: ClientId
-> [(GanetiLocks, L.OwnerState)]
-> WConfdMonad [GanetiLocks]
opportunisticLockUnion cid req =
modifyLockWaiting $ LW.opportunisticLockUnion cid req | 231 | opportunisticLockUnion cid req =
modifyLockWaiting $ LW.opportunisticLockUnion cid req | 88 | true | true | 0 | 9 | 74 | 53 | 28 | 25 | null | null |
jstolarek/slicer | lib/Language/Slicer/Eval.hs | gpl-3.0 | -- | Evaluates an expression and forces the result before returning it. Ensures
-- strict semantics.
evalM' :: Exp -> EvalM Outcome
evalM' e = do v <- evalM e
v `seq` return v | 190 | evalM' :: Exp -> EvalM Outcome
evalM' e = do v <- evalM e
v `seq` return v | 88 | evalM' e = do v <- evalM e
v `seq` return v | 57 | true | true | 0 | 9 | 48 | 50 | 23 | 27 | null | null |
ekmett/transformers | Control/Monad/Trans/RWS/Lazy.hs | bsd-3-clause | -- | Lift a @catchError@ operation to the new monad.
liftCatch :: (m (a,s,w) -> (e -> m (a,s,w)) -> m (a,s,w)) ->
RWST l w s m a -> (e -> RWST l w s m a) -> RWST l w s m a
liftCatch catchError m h =
RWST $ \r s -> runRWST m r s `catchError` \e -> runRWST (h e) r s | 272 | liftCatch :: (m (a,s,w) -> (e -> m (a,s,w)) -> m (a,s,w)) ->
RWST l w s m a -> (e -> RWST l w s m a) -> RWST l w s m a
liftCatch catchError m h =
RWST $ \r s -> runRWST m r s `catchError` \e -> runRWST (h e) r s | 219 | liftCatch catchError m h =
RWST $ \r s -> runRWST m r s `catchError` \e -> runRWST (h e) r s | 96 | true | true | 0 | 12 | 74 | 167 | 88 | 79 | null | null |
technogeeky/cyclotomic | src/Data/Complex/Cyclotomic.hs | gpl-3.0 | pqPairs n = map (\(p,k) -> (p,p^k)) (factorise n) | 49 | pqPairs n = map (\(p,k) -> (p,p^k)) (factorise n) | 49 | pqPairs n = map (\(p,k) -> (p,p^k)) (factorise n) | 49 | false | false | 0 | 9 | 8 | 44 | 24 | 20 | null | null |
kim/amazonka | amazonka-dynamodb/gen/Network/AWS/DynamoDB/UpdateItem.hs | mpl-2.0 | -- | There is a newer parameter available. Use /UpdateExpression/ instead. Note
-- that if you use /AttributeUpdates/ and /UpdateExpression/ at the same time,
-- DynamoDB will return a /ValidationException/ exception.
--
-- This parameter can be used for modifying top-level attributes; however, it
-- does not support individual list or map elements.
--
-- The names of attributes to be modified, the action to perform on each, and
-- the new value for each. If you are updating an attribute that is an index key
-- attribute for any indexes on that table, the attribute type must match the
-- index key type defined in the /AttributesDefinition/ of the table description.
-- You can use /UpdateItem/ to update any nonkey attributes.
--
-- Attribute values cannot be null. String and Binary type attributes must have
-- lengths greater than zero. Set type attributes must not be empty. Requests
-- with empty values will be rejected with a /ValidationException/ exception.
--
-- Each /AttributeUpdates/ element consists of an attribute name to modify, along
-- with the following:
--
-- /Value/ - The new value, if applicable, for this attribute.
--
-- /Action/ - A value that specifies how to perform the update. This action is
-- only valid for an existing attribute whose data type is Number or is a set;
-- do not use 'ADD' for other data types.
--
-- If an item with the specified primary key is found in the table, the
-- following values perform the following actions:
--
-- 'PUT' - Adds the specified attribute to the item. If the attribute already
-- exists, it is replaced by the new value.
--
-- 'DELETE' - Removes the attribute and its value, if no value is specified for 'DELETE'. The data type of the specified value must match the existing value's
-- data type.
--
-- If a set of values is specified, then those values are subtracted from the
-- old set. For example, if the attribute value was the set '[a,b,c]' and the 'DELETE' action specifies '[a,c]', then the final attribute value is '[b]'. Specifying an
-- empty set is an error.
--
-- 'ADD' - Adds the specified value to the item, if the attribute does not
-- already exist. If the attribute does exist, then the behavior of 'ADD' depends
-- on the data type of the attribute:
--
-- If the existing attribute is a number, and if /Value/ is also a number, then /Value/ is mathematically added to the existing attribute. If /Value/ is a
-- negative number, then it is subtracted from the existing attribute.
--
-- If you use 'ADD' to increment or decrement a number value for an item that
-- doesn't exist before the update, DynamoDB uses 0 as the initial value.
--
-- Similarly, if you use 'ADD' for an existing item to increment or decrement an
-- attribute value that doesn't exist before the update, DynamoDB uses '0' as the
-- initial value. For example, suppose that the item you want to update doesn't
-- have an attribute named /itemcount/, but you decide to 'ADD' the number '3' to this
-- attribute anyway. DynamoDB will create the /itemcount/ attribute, set its
-- initial value to '0', and finally add '3' to it. The result will be a new /itemcount/ attribute, with a value of '3'.
--
-- If the existing data type is a set, and if /Value/ is also a set, then /Value/
-- is appended to the existing set. For example, if the attribute value is the
-- set '[1,2]', and the 'ADD' action specified '[3]', then the final attribute value
-- is '[1,2,3]'. An error occurs if an 'ADD' action is specified for a set attribute
-- and the attribute type specified does not match the existing set type.
--
-- Both sets must have the same primitive data type. For example, if the
-- existing data type is a set of strings, /Value/ must also be a set of strings.
--
-- If no item with the specified key is found in the table, the following
-- values perform the following actions:
--
-- 'PUT' - Causes DynamoDB to create a new item with the specified primary key,
-- and then adds the attribute.
--
-- 'DELETE' - Nothing happens, because attributes cannot be deleted from a
-- nonexistent item. The operation succeeds, but DynamoDB does not create a new
-- item.
--
-- 'ADD' - Causes DynamoDB to create an item with the supplied primary key and
-- number (or set of numbers) for the attribute value. The only data types
-- allowed are Number and Number Set.
--
-- If you provide any attributes that are part of an index key, then the
-- data types for those attributes must match those of the schema in the table's
-- attribute definition.
uiAttributeUpdates :: Lens' UpdateItem (HashMap Text AttributeValueUpdate)
uiAttributeUpdates =
lens _uiAttributeUpdates (\s a -> s { _uiAttributeUpdates = a })
. _Map | 4,688 | uiAttributeUpdates :: Lens' UpdateItem (HashMap Text AttributeValueUpdate)
uiAttributeUpdates =
lens _uiAttributeUpdates (\s a -> s { _uiAttributeUpdates = a })
. _Map | 179 | uiAttributeUpdates =
lens _uiAttributeUpdates (\s a -> s { _uiAttributeUpdates = a })
. _Map | 104 | true | true | 0 | 10 | 847 | 133 | 109 | 24 | null | null |
mrBliss/haddock | haddock-api/src/Haddock/Backends/Xhtml/Decl.hs | bsd-2-clause | ppLPatSig :: Bool -> LinksInfo -> SrcSpan -> DocForDecl DocName ->
Located DocName ->
(HsExplicitFlag, LHsTyVarBndrs DocName) ->
LHsContext DocName -> LHsContext DocName ->
LHsType DocName ->
[(DocName, Fixity)] ->
Splice -> Unicode -> Qualification -> Html
ppLPatSig summary links loc (doc, _argDocs) (L _ name) (expl, qtvs) lprov lreq typ fixities splice unicode qual
| summary = pref1
| otherwise = topDeclElem links loc splice [name] (pref1 <+> ppFixities fixities qual)
+++ docSection Nothing qual doc
where
pref1 = hsep [ keyword "pattern"
, ppBinder summary occname
, dcolon unicode
, ppLTyVarBndrs expl qtvs unicode qual
, cxt
, ppLType unicode qual typ
]
cxt = case (ppLContextMaybe lprov unicode qual, ppLContextMaybe lreq unicode qual) of
(Nothing, Nothing) -> noHtml
(Nothing, Just req) -> parens noHtml <+> darr <+> req <+> darr
(Just prov, Nothing) -> prov <+> darr
(Just prov, Just req) -> prov <+> darr <+> req <+> darr
darr = darrow unicode
occname = nameOccName . getName $ name | 1,254 | ppLPatSig :: Bool -> LinksInfo -> SrcSpan -> DocForDecl DocName ->
Located DocName ->
(HsExplicitFlag, LHsTyVarBndrs DocName) ->
LHsContext DocName -> LHsContext DocName ->
LHsType DocName ->
[(DocName, Fixity)] ->
Splice -> Unicode -> Qualification -> Html
ppLPatSig summary links loc (doc, _argDocs) (L _ name) (expl, qtvs) lprov lreq typ fixities splice unicode qual
| summary = pref1
| otherwise = topDeclElem links loc splice [name] (pref1 <+> ppFixities fixities qual)
+++ docSection Nothing qual doc
where
pref1 = hsep [ keyword "pattern"
, ppBinder summary occname
, dcolon unicode
, ppLTyVarBndrs expl qtvs unicode qual
, cxt
, ppLType unicode qual typ
]
cxt = case (ppLContextMaybe lprov unicode qual, ppLContextMaybe lreq unicode qual) of
(Nothing, Nothing) -> noHtml
(Nothing, Just req) -> parens noHtml <+> darr <+> req <+> darr
(Just prov, Nothing) -> prov <+> darr
(Just prov, Just req) -> prov <+> darr <+> req <+> darr
darr = darrow unicode
occname = nameOccName . getName $ name | 1,254 | ppLPatSig summary links loc (doc, _argDocs) (L _ name) (expl, qtvs) lprov lreq typ fixities splice unicode qual
| summary = pref1
| otherwise = topDeclElem links loc splice [name] (pref1 <+> ppFixities fixities qual)
+++ docSection Nothing qual doc
where
pref1 = hsep [ keyword "pattern"
, ppBinder summary occname
, dcolon unicode
, ppLTyVarBndrs expl qtvs unicode qual
, cxt
, ppLType unicode qual typ
]
cxt = case (ppLContextMaybe lprov unicode qual, ppLContextMaybe lreq unicode qual) of
(Nothing, Nothing) -> noHtml
(Nothing, Just req) -> parens noHtml <+> darr <+> req <+> darr
(Just prov, Nothing) -> prov <+> darr
(Just prov, Just req) -> prov <+> darr <+> req <+> darr
darr = darrow unicode
occname = nameOccName . getName $ name | 918 | false | true | 4 | 17 | 420 | 375 | 191 | 184 | null | null |
diegomachadosoares/hcomp | Parser.hs | gpl-3.0 | formsN :: Parser [String]
formsN =
do return ([]) | 53 | formsN :: Parser [String]
formsN =
do return ([]) | 53 | formsN =
do return ([]) | 27 | false | true | 1 | 10 | 12 | 32 | 14 | 18 | null | null |
c19/Exercism-Haskell | list-ops/src/ListOps.hs | mit | xs ++ ys = foldr (:) ys xs | 26 | xs ++ ys = foldr (:) ys xs | 26 | xs ++ ys = foldr (:) ys xs | 26 | false | false | 2 | 5 | 7 | 20 | 10 | 10 | null | null |
tonyfloatersu/solution-haskell-craft-of-FP | Chapter13.hs | mit | -- Checking types
-- ^^^^^^^^^^^^^^
-- Non-type-correct definitions are included as comments.
example1 = fromEnum 'c' + 3 | 123 | example1 = fromEnum 'c' + 3 | 27 | example1 = fromEnum 'c' + 3 | 27 | true | false | 3 | 5 | 19 | 21 | 9 | 12 | null | null |
jmgimeno/haskell-playground | src/FourFours/solutions.hs | unlicense | solutions :: ((Tree -> Tree -> Ordering) -> [Tree] -> Tree) -> [(Int, Tree)]
solutions p = sortBy (comparing fst) $ singleSolutions where
singleSolutions = assocs $ fromListWith preferred evaluated
preferred a b = p (comparing size) [a, b] | 245 | solutions :: ((Tree -> Tree -> Ordering) -> [Tree] -> Tree) -> [(Int, Tree)]
solutions p = sortBy (comparing fst) $ singleSolutions where
singleSolutions = assocs $ fromListWith preferred evaluated
preferred a b = p (comparing size) [a, b] | 245 | solutions p = sortBy (comparing fst) $ singleSolutions where
singleSolutions = assocs $ fromListWith preferred evaluated
preferred a b = p (comparing size) [a, b] | 168 | false | true | 0 | 10 | 44 | 107 | 57 | 50 | null | null |
pqwy/google-web-apis | Web/Google/GCal.hs | bsd-3-clause | qMaxresults = integralQuery "max-results" | 43 | qMaxresults = integralQuery "max-results" | 43 | qMaxresults = integralQuery "max-results" | 43 | false | false | 0 | 5 | 5 | 9 | 4 | 5 | null | null |
ghcjs/jsaddle-dom | src/JSDOM/Generated/HTMLTextAreaElement.hs | mit | -- | <https://developer.mozilla.org/en-US/docs/Web/API/HTMLTextAreaElement.dirName Mozilla HTMLTextAreaElement.dirName documentation>
setDirName ::
(MonadDOM m, ToJSString val) => HTMLTextAreaElement -> val -> m ()
setDirName self val = liftDOM (self ^. jss "dirName" (toJSVal val)) | 294 | setDirName ::
(MonadDOM m, ToJSString val) => HTMLTextAreaElement -> val -> m ()
setDirName self val = liftDOM (self ^. jss "dirName" (toJSVal val)) | 159 | setDirName self val = liftDOM (self ^. jss "dirName" (toJSVal val)) | 67 | true | true | 0 | 10 | 41 | 70 | 34 | 36 | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.