Hoogle Search

Within LTS Haskell 24.33 (ghc-9.10.3)

Note that Stackage only displays results for the latest LTS and Nightly snapshot. Learn more.

  1. readerTRuntime :: (FromJSON event, ToJSON result) => (event -> ReaderT LambdaContext IO result) -> IO ()

    hal AWS.Lambda.Runtime

    For functions that can read the lambda context and use IO within the same monad. Use this for handlers that need any form of side-effect such as reading environment variables or making network requests, and prefer to access the AWS Lambda Context in the same monad. However, do not use this runtime if you need stateful (caching) behaviors.

    {-# LANGUAGE NamedFieldPuns, DeriveGeneric #-}
    
    module Main where
    
    import AWS.Lambda.Context (LambdaContext(..))
    import AWS.Lambda.Runtime (readerTRuntime)
    import Control.Monad.Reader (ReaderT, ask)
    import Control.Monad.Trans (liftIO)
    import Data.Aeson (FromJSON)
    import Data.Text (unpack)
    import System.Environment (getEnv)
    import GHC.Generics (Generic)
    
    data Named = Named {
    name :: String
    } deriving Generic
    instance FromJSON Named
    
    myHandler :: Named -> ReaderT LambdaContext IO String
    myHandler Named { name } = do
    LambdaContext { functionName } <- ask
    greeting <- liftIO $ getEnv "GREETING"
    return $ greeting ++ name ++ " from " ++ unpack functionName ++ "!"
    
    main :: IO ()
    main = readerTRuntime myHandler
    

  2. readerTRuntime :: ToJSON result => (Value -> ReaderT LambdaContext IO result) -> IO ()

    hal AWS.Lambda.Runtime.Value

    For functions that can read the lambda context and use IO within the same monad. Use this for handlers that need any form of side-effect such as reading environment variables or making network requests, and prefer to access the AWS Lambda Context in the same monad. However, do not use this runtime if you need stateful (caching) behaviors.

    {-# LANGUAGE NamedFieldPuns, DeriveGeneric #-}
    
    module Main where
    
    import AWS.Lambda.Context (LambdaContext(..))
    import AWS.Lambda.Runtime (readerTRuntime)
    import Control.Monad.Reader (ReaderT, ask)
    import Control.Monad.Trans (liftIO)
    import Data.Aeson (Value, FromJSON, parseJSON)
    import Data.Aeson.Types (parseMaybe)
    import Data.Text (unpack)
    import System.Environment (getEnv)
    import GHC.Generics (Generic)
    
    data Named = Named {
    name :: String
    } deriving Generic
    instance FromJSON Named
    
    myHandler :: Value -> ReaderT LambdaContext IO String
    myHandler jsonAst =
    case parseMaybe parseJSON jsonAst of
    Nothing -> return $ "My name is HAL, what's yours?"
    Just Named { name } -> do
    LambdaContext { functionName } <- ask
    greeting <- liftIO $ getEnv "GREETING"
    return $ greeting ++ name ++ " from " ++ unpack functionName ++ "!"
    
    main :: IO ()
    main = readerTRuntime myHandler
    

  3. readStderr :: forall (i :: StreamMode) (o :: StreamMode) (lp :: Lifecycle) (ls :: Lifecycle) f (es :: [Effect]) (ff :: (Type -> Type) -> Type -> Type) (c :: (Type -> Type) -> Constraint) . (Free c ff, f ~ Eff ff es, Subprocess ('SubprocMode i o 'Piped lp ls) :> es) => f ByteString

    heftia-effects Control.Monad.Hefty.Concurrent.Subprocess

    No documentation available.

  4. readStderr'_ :: forall (i :: StreamMode) (o :: StreamMode) (lp :: Lifecycle) (ls :: Lifecycle) f (es :: [Effect]) (ff :: (Type -> Type) -> Type -> Type) (c :: (Type -> Type) -> Constraint) . (Free c ff, f ~ Eff ff es, In (Subprocess ('SubprocMode i o 'Piped lp ls)) es) => f ByteString

    heftia-effects Control.Monad.Hefty.Concurrent.Subprocess

    No documentation available.

  5. readStdout :: forall (i :: StreamMode) (e :: StreamMode) (lp :: Lifecycle) (ls :: Lifecycle) f (es :: [Effect]) (ff :: (Type -> Type) -> Type -> Type) (c :: (Type -> Type) -> Constraint) . (Free c ff, f ~ Eff ff es, Subprocess ('SubprocMode i 'Piped e lp ls) :> es) => f ByteString

    heftia-effects Control.Monad.Hefty.Concurrent.Subprocess

    No documentation available.

  6. readStdout'_ :: forall (i :: StreamMode) (e :: StreamMode) (lp :: Lifecycle) (ls :: Lifecycle) f (es :: [Effect]) (ff :: (Type -> Type) -> Type -> Type) (c :: (Type -> Type) -> Constraint) . (Free c ff, f ~ Eff ff es, In (Subprocess ('SubprocMode i 'Piped e lp ls)) es) => f ByteString

    heftia-effects Control.Monad.Hefty.Concurrent.Subprocess

    No documentation available.

  7. readConfig :: FromJSON a => FilePath -> IO (Config a)

    hie-bios HIE.Bios.Config

    No documentation available.

  8. readProcessWithCwd :: LogAction IO (WithSeverity Log) -> FilePath -> FilePath -> [String] -> String -> IO (CradleLoadResult String)

    hie-bios HIE.Bios.Cradle

    Wrapper around readCreateProcess that sets the working directory and clears the environment, suitable for invoking cabal/stack and raw ghc commands.

  9. readProcessWithOutputs :: Outputs -> LogAction IO (WithSeverity Log) -> FilePath -> CreateProcess -> IO (ExitCode, [String], [String], [(OutputName, Maybe [String])])

    hie-bios HIE.Bios.Cradle

    Call a given process with temp files for the process to write to. * The process can discover the temp files paths by reading the environment. * The contents of the temp files are returned by this function, if any. * The logging function is called every time the process emits anything to stdout or stderr. it can be used to report progress of the process to a user. * The process is executed in the given directory.

  10. readProcessWithCwd :: LogAction IO (WithSeverity Log) -> FilePath -> FilePath -> [String] -> String -> IO (CradleLoadResult String)

    hie-bios HIE.Bios.Process

    Wrapper around readCreateProcess that sets the working directory and clears the environment, suitable for invoking cabal/stack and raw ghc commands.

Page 312 of many | Previous | Next