úÎ!„zX      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVW/AWS Lambda Context classes and related methods.(c) Nike, Inc., 2018BSD33nathan.fairhurst@nike.com, fernando.freire@nike.comstableNone$/45678:@AMX_`fgX      Internal hal helper methods.(c) Nike, Inc., 2018BSD33nathan.fairhurst@nike.com, fernando.freire@nike.comunstableNone/45678:@AMX_`fg à0152346789:;<=>?89:;<=>01523467?NHTTP related machinery for talking to the AWS Lambda Custom Runtime interface.(c) Nike, Inc., 2018BSD33nathan.fairhurst@nike.com, fernando.freire@nike.comstableNone/45678:@AMX_`fgrXhal-Lambda runtime error that we pass back to AWSEFGHIJEFGHIJ\Runtime methods useful when constructing Haskell handlers for the AWS Lambda Custom Runtime.(c) Nike, Inc., 2018BSD33nathan.fairhurst@nike.com, fernando.freire@nike.comstableNone/45678:>@AMX_`fg}ã PhalFor any monad that supports IOcatchReader LambdaContext.ŽUse this if you need caching behavours or are comfortable manipulating monad transformers and want full control over your monadic interface. ÿŒ {-# LANGUAGE NamedFieldPuns, DeriveGeneric #-} module Main where import AWS.Lambda.Context (LambdaContext(..)) import AWS.Lambda.Runtime (mRuntimeWithContext) import Control.Monad.Reader (ReaderT, ask) import Control.Monad.State.Lazy (StateT, runStateT, get, put) import Data.Aeson (FromJSON) import Data.Text (unpack) import System.Environment (getEnv) data Named = { name :: String } deriving Generic instance FromJSON Named myHandler :: Named -> StateT Int (ReaderT LambdaContext IO String) myHandler Named { name } = do LambdaContext { functionName } <- ask greeting <- getEnv "GREETING" greetingCount <- get put $ greetingCount + 1 return $ greeting ++ name ++ " (" ++ show greetingCount ++ ") from " ++ unpack functionName ++ "!" main :: IO () main = runStateT (mRuntimeWithContext myHandler) 0 YhalKHelper for using arbitrary monads with only the LambdaContext in its ReaderQhalPFor 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 Data.Aeson (FromJSON) import Data.Text (unpack) import System.Environment (getEnv) data Named = { name :: String } deriving Generic instance FromJSON Named myHandler :: Named -> ReaderT LambdaContext IO String myHandler Named { name } = do LambdaContext { functionName } <- ask greeting <- getEnv "GREETING" return $ greeting ++ name ++ " from " ++ unpack functionName ++ "!" main :: IO () main = readerTRuntime myHandler RhalAFor functions with IO that can fail in a pure way (or via throw).öUse this for handlers that need any form of side-effect such as reading environment variables or making network requests, and also need the AWS Lambda Context as input. 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 (ioRuntimeWithContext) import Data.Aeson (FromJSON) import Data.Text (unpack) import System.Environment (getEnv) data Named = { name :: String } deriving Generic instance FromJSON Named myHandler :: LambdaContext -> Named -> IO String myHandler (LambdaContext { functionName }) (Named { name }) = do greeting <- getEnv "GREETING" return $ greeting ++ name ++ " from " ++ unpack functionName ++ "!" main :: IO () main = ioRuntimeWithContext myHandler ShalAFor functions with IO that can fail in a pure way (or via throw).ÆUse this for handlers that need any form of side-effect such as reading environment variables or making network requests. However, do not use this runtime if you need stateful (caching) behaviors. ÿØ {-# LANGUAGE NamedFieldPuns, DeriveGeneric #-} module Main where import AWS.Lambda.Runtime (ioRuntime) import Data.Aeson (FromJSON) import System.Environment (getEnv) data Named = { name :: String } deriving Generic instance FromJSON Named myHandler :: Named -> IO String myHandler (Named { name }) = do greeting <- getEnv "GREETING" return $ greeting ++ name main :: IO () main = ioRuntime myHandler Thal'For pure functions that can still fail.ŽUse this for simple handlers that just translate input to output without side-effects, but can fail and need the AWS Lambda Context as input. ÿ¬ {-# LANGUAGE NamedFieldPuns, DeriveGeneric #-} module Main where import AWS.Lambda.Context (LambdaContext(..)) import AWS.Lambda.Runtime (fallibleRuntimeWithContext) import Data.Aeson (FromJSON) import Data.Text (unpack) data Named = { name :: String } deriving Generic instance FromJSON Named myHandler :: LambdaContext -> Named -> Either String String myHandler (LambdaContext { functionName }) (Named { name }) = if name == "World" then Right "Hello, World from " ++ unpack functionName ++ "!" else Left "Can only greet the world." main :: IO () main = fallibleRuntimeWithContext myHandler Uhal'For pure functions that can still fail.eUse this for simple handlers that just translate input to output without side-effects, but can fail. ÿñ {-# LANGUAGE NamedFieldPuns, DeriveGeneric #-} module Main where import AWS.Lambda.Runtime (fallibleRuntime) import Data.Aeson (FromJSON) data Named = { name :: String } deriving Generic instance FromJSON Named myHandler :: Named -> Either String String myHandler (Named { name }) = if name == "World" then Right "Hello, World!" else Left "Can only greet the world." main :: IO () main = fallibleRuntime myHandler VhalLFor pure functions that can never fail that also need access to the context.†Use this for simple handlers that just translate input to output without side-effects, but that need the AWS Lambda Context as input. ÿE {-# LANGUAGE NamedFieldPuns, DeriveGeneric #-} module Main where import AWS.Lambda.Context (LambdaContext(..)) import AWS.Lambda.Runtime (pureRuntimeWithContext) import Data.Aeson (FromJSON) import Data.Text (unpack) data Named = { name :: String } deriving Generic instance FromJSON Named myHandler :: LambdaContext -> Named -> String myHandler (LambdaContext { functionName }) (Named { name }) = "Hello, " ++ name ++ " from " ++ unpack functionName ++ "!" main :: IO () main = pureRuntimeWithContext myHandler Whal'For pure functions that can never fail.VUse this for simple handlers that just translate input to output without side-effects. ÿ‚ {-# LANGUAGE NamedFieldPuns, DeriveGeneric #-} module Main where import AWS.Lambda.Runtime (pureRuntime) import Data.Aeson (FromJSON) data Named = { name :: String } deriving Generic instance FromJSON Named myHandler :: Named -> String myHandler Named { name } = "Hello, " ++ name ++ "!" main :: IO () main = pureRuntime myHandler PQRSTUVWWVUTSRQPNone/45678:@AMX_`fg~ñZ[\]^_`ab       !"#$%&'()*+,-./01234455  6789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXY hal-0.1.5-9VikeysOs1bIUsA17zzCWsAWS.Lambda.ContextAWS.Lambda.InternalAWS.Lambda.RuntimeClientAWS.Lambda.Runtime Paths_hal#envy-2.1.0.0-3GTHJ00xrDuCYblbITfPzx System.Envy defConfigHasLambdaContext withContext LambdaContext functionNamefunctionVersionfunctionMemorySize logGroupName logStreamName awsRequestIdinvokedFunctionArn xRayTraceIddeadline clientContextidentityCognitoIdentity identityIdidentityPoolId ClientContextclientcustom environmentClientApplicationappTitleappVersionNameappVersionCodeappPackageNamegetRemainingTime$fFromJSONClientApplication$fToJSONClientApplication$fFromJSONClientContext$fToJSONClientContext$fFromJSONCognitoIdentity$fToJSONCognitoIdentity$fDefConfigLambdaContext$fHasLambdaContextLambdaContext$fShowClientApplication$fGenericClientApplication$fShowClientContext$fGenericClientContext$fShowCognitoIdentity$fGenericCognitoIdentity$fShowLambdaContext$fGenericLambdaContextDynamicContext StaticContext mkContext$fFromEnvStaticContext$fDefConfigStaticContext$fShowStaticContext$fGenericStaticContext$fShowDynamicContextRuntimeClientConfiggetRuntimeClientConfig getNextEventsendEventSuccesssendEventError sendInitError$fToJSONLambdaError$fExceptionJSONParseException$fShowLambdaError$fGenericLambdaError$fShowJSONParseExceptionmRuntimeWithContextreaderTRuntimeioRuntimeWithContext ioRuntimefallibleRuntimeWithContextfallibleRuntimepureRuntimeWithContext pureRuntime LambdaErrorreaderTRuntimeWithContextversion getBinDir getLibDir getDynLibDir getDataDir getLibexecDir getSysconfDirgetDataFileName