BSD-3-Clause licensed by winterland1989
Maintained by [email protected]

Module documentation for 0.2.1.0

This version can be pinned in stack with:[email protected]:c9c8948dd56391094456721ec9f217d6f1cc8328c13a9b25ab49c023289de7a6,1061

data-has

Hackage Build Status

A simple extensible product system, a typical usage is to free you from considering how to layer your monad stack, because your can now extend your monad in one layer:

 {-# LANGUAGE FlexibleContexts #-}

 -- in some library code
 ...
 logInAnyReaderHasLogger :: (Has Logger r, MonadReader r m) => LogString -> m ()
 logInAnyReaderHasLogger s = asks getter >>= logWithLogger s

 queryInAnyReaderHasSQL :: (Has SqlBackEnd r, MonadReader r m) => Query -> m a
 queryInAnyReaderHasSQL q = asks getter >>= queryWithSQL q
 ...

 -- now you want to use these effects together
 ...
 logger <- initLogger  ...
 sql <- initSqlBackEnd ...

 (`runReader` (logger, sql)) $ do
       ...
       logInAnyReaderHasLogger ...
       ...
       x <- queryInAnyReaderHasSQL ...
       ...
...
Depends on 1 package(full list with versions):
Used by 1 package in lts-9.21(full list with versions):