@hackage amazonka-mtl0.1.0.0

MTL-style type-class and deriving-via newtypes for Amazonka

amazonka-mtl

Hackage Stackage Nightly Stackage LTS CI

MTL-style type-class and deriving-via newtypes for Amazonka.

Example

This package allows incorporation of AWS actions into any MTL-style function,

import Amazonka.Data.Text (ToText(..))
import Amazonka.S3.ListObjects
import Amazonka.S3.Types.Object
import Blammo.Logging
import Conduit
import Control.Lens hiding ((.=))
import Control.Monad.AWS as AWS
someAction
  :: ( MonadIO m
     , MonadLogger m
     , MonadAWS m
     , MonadReader env m
     , HasSettings env
     )
  => m ()
someAction = do
  Settings {..} <- view settingsL

  keys <-
    runConduit
      $ paginate (newListObjects settingsBucketName)
      .| concatMapC (^. listObjectsResponse_contents)
      .| concatC
      .| mapC (^. object_key . to toText)
      .| iterMC (\k -> logDebug $ k :# [])
      .| sinkList

  logInfo $ "Bucket contents" :# ["keys" .= keys]

This package also provides a number of options for execution:

  • Through a concrete transformer: Control.Monad.AWS.EnvT
  • Through your own reader env and deriving-via: Control.Monad.AWS.ViaReader

This package also provides mechanisms for mocking AWS in tests:

  • Through a concrete transformer: Control.Monad.AWS.MockT
  • Through your own reader env and deriving-via: Control.Monad.AWS.ViaMock

Please see the documentation on hackage for all the details.

Development & Tests

stack build --fast --pedantic --test --file-watch

CHANGELOG | LICENSE