The data-has package

[Tags:benchmark, bsd3, library]

Simple extensible product


[Skip to Readme]

Properties

Versions 0.1.0.0, 0.2.0.0, 0.2.1.0, 0.3.0.0
Change log CHANGELOG
Dependencies base (<5), base-compat (>=0.9), transformers [details]
License BSD3
Author winterland1989
Maintainer winterland1989@gmail.com
Category Data
Home page https://github.com/winterland1989/data-has
Source repository head: git clone git://github.com/winterland1989/data-has.git
Uploaded Thu Aug 17 10:47:56 UTC 2017 by winterland
Distributions LTSHaskell:0.2.1.0, NixOS:0.2.1.0, Stackage:0.3.0.0, Tumbleweed:0.2.1.0
Downloads 186 total (44 in the last 30 days)
Votes
0 []
Status Docs available [build log]
Last success reported on 2017-08-17 [all 1 reports]
Hackage Matrix CI

Modules

[Index]

Downloads

Maintainer's Corner

For package maintainers and hackage trustees

Readme for data-has

Readme for data-has-0.3.0.0

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 ...
       ...
...