packages feed

monad-control-aligned 0.0.1 → 0.0.1.1

raw patch · 4 files changed

+37/−21 lines, 4 filesdep ~transformers-compatPVP ok

version bump matches the API change (PVP)

Dependency ranges changed: transformers-compat

API changes (from Hackage documentation)

Files

CHANGELOG view
@@ -1,3 +1,27 @@+1.0.2.3++* Correct spelling mistake. Courtesy of Edward Betts.++* Support transformers-compat-0.6.+++1.0.2.2++* Added some good documentation. Courtesy of Franz Thoma.+++1.0.2.1++* Refer to Michael Snoyman's excellent tutorial on monad-control.+++1.0.2.0++* Improve documentation by including type equalities in the Haddock documentation.++* Add helpers to define MonadTransControl for stack of two:+  RunDefault2, defaultLiftWith2, defaultRestoreT2+ 1.0.1.0  * Added the functions:
Control/Monad/Trans/Control/Aligned.hs view
@@ -255,13 +255,13 @@     {-# INLINABLE restoreT #-}  instance Monoid w => MonadTransControl (RWST r w s) ((,,) w s) where-    liftWith f = RWST $ \r s -> (,s,mempty) <$> (f $ \t -> (\(a,s,w) -> (w,s,a)) <$> runRWST t r s)+    liftWith f = RWST $ \r s -> (,s,mempty) <$> (f $ \t -> (\(a,s',w) -> (w,s',a)) <$> runRWST t r s)     restoreT mSt = RWST $ \_ _ -> (\(w,s,a) -> (a,s,w)) <$> mSt     {-# INLINABLE liftWith #-}     {-# INLINABLE restoreT #-}  instance Monoid w => MonadTransControl (Strict.RWST r w s) ((,,) w s) where-    liftWith f = Strict.RWST $ \r s -> (,s,mempty) <$> (f $ \t -> (\(a,s,w) -> (w,s,a)) <$> Strict.runRWST t r s)+    liftWith f = Strict.RWST $ \r s -> (,s,mempty) <$> (f $ \t -> (\(a,s',w) -> (w,s',a)) <$> Strict.runRWST t r s)     restoreT mSt = Strict.RWST $ \_ _ -> (\(w,s,a) -> (a,s,w)) <$> mSt     {-# INLINABLE liftWith #-}     {-# INLINABLE restoreT #-}
README.markdown view
@@ -1,20 +1,12 @@-[![Hackage](https://img.shields.io/hackage/v/monad-control.svg)](https://hackage.haskell.org/package/monad-control)-[![Build Status](https://travis-ci.org/basvandijk/monad-control.svg)](https://travis-ci.org/basvandijk/monad-control)--This package defines the type class `MonadControlIO`, a subset of-`MonadIO` into which generic control operations such as `catch` can be-lifted from `IO`.  Instances are based on monad transformers in-`MonadTransControl`, which includes all standard monad transformers in-the `transformers` library except `ContT`.+# monad-control-aligned -Note that this package is a rewrite of Anders Kaseorg's `monad-peel`-library.  The main difference is that this package provides CPS style-operators and exploits the `RankNTypes` language extension to simplify-most definitions.+An alternative edition of monad-control that forces all state data types to: -The package includes a copy of the `monad-peel` testsuite written by-Anders Kaseorg The tests can be performed by using `cabal test`.+- be exposed at the `Constraint` level+- be aligned s.t. the state is of kind `* -> *`, wherein the subject data type is indeed the monadic value `a` in `m a`;+  this opposes the `StateT` and `WriterT` definitions, whos' state types are in the form of `(a, s)`; opposing curried+  type application indeed. Our edition enforces instances in the form of `(,) s` - thus leaving the last applied type polymorphic,+  achieving our goal of `* -> *` _aligned_ [tm] state type. -[This `criterion`](https://github.com/basvandijk/bench-monad-peel-control)-based benchmark shows that `monad-control` is on average about 2.5-times faster than `monad-peel`.+This just allows us to use extractable-singleton to _run_ our state type - useful for obtaining the subject data while+running in a lifted context - basically exactly the same as what monad-unlift does.
monad-control-aligned.cabal view
@@ -1,5 +1,5 @@ Name:                monad-control-aligned-Version:             0.0.1+Version:             0.0.1.1 Synopsis:            Just like monad-control, except less efficient, and the monadic state terms are all * -> * License:             BSD3 License-file:        LICENSE@@ -34,7 +34,7 @@   Build-depends: base                 >= 4.5   && < 5                , stm                  >= 2.3   && < 3                , transformers         >= 0.2   && < 0.6-               , transformers-compat  >= 0.3   && < 0.6+               , transformers-compat  >= 0.3   && < 0.7                , transformers-base    >= 0.4.4 && < 0.5    Ghc-options: -Wall