tardis 0.4.4.0 → 0.5.0
raw patch · 4 files changed
+46/−7 lines, 4 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
- Control.Monad.Trans.Tardis: instance Control.Monad.Trans.Class.MonadTrans (Control.Monad.Trans.Tardis.TardisT bw fw)
+ Control.Monad.Trans.Tardis: liftTardisT :: Functor m => m a -> TardisT bw fw m a
Files
- ChangeLog.md +3/−0
- README.md +34/−0
- src/Control/Monad/Trans/Tardis.hs +6/−6
- tardis.cabal +3/−1
+ ChangeLog.md view
@@ -0,0 +1,3 @@+* **0.5.0**:+ 2024-01-15: Removed MonadTrans instance, replaced with liftTardisT+
+ README.md view
@@ -0,0 +1,34 @@+# TardisT++++The State monad allows you+to send information forwards to the future,+or to receive such information from the past.+The Reverse State monad allows you to do the reverse:+send information backwards to the past,+or receive information from the future. ++TardisT is a monad transformer+that provides state operations that allow you+to send information to both the future *and* the past,+as well as receive information from both directions.+It is isomorphic to a StateT on top of a ReverseStateT,+or vice-versa.++See test/Example.hs for an example.++----++This was inspired by Luke Palmer's blog post on+the "reverse state monad".++http://lukepalmer.wordpress.com/2008/08/10/mindfuck-the-reverse-state-monad/++See also:++http://panicsonic.blogspot.com/2007/12/backwards-state-or-power-of-laziness.html++----++(c) 2012 Dan Burton
src/Control/Monad/Trans/Tardis.hs view
@@ -1,4 +1,5 @@ {-# LANGUAGE RecursiveDo #-}+{-# LANGUAGE TupleSections #-} -- | The data definition of a "TardisT" -- as well as its primitive operations,@@ -35,6 +36,7 @@ -- * Other , mapTardisT+ , liftTardisT , noState ) where @@ -99,6 +101,10 @@ execTardis :: Tardis bw fw a -> (bw, fw) -> (bw, fw) execTardis t = runIdentity . execTardisT t +-- | An action in the underlying monad (or just functor, really)+-- can also be used in a Tardis by lifting it in.+liftTardisT :: (Functor m) => m a -> TardisT bw fw m a+liftTardisT m = TardisT $ \s -> fmap (,s) m -- | A function that operates on the internal representation of a Tardis -- can also be used on a Tardis.@@ -131,12 +137,6 @@ instance MonadFix m => Applicative (TardisT bw fw m) where pure = return (<*>) = ap---instance MonadTrans (TardisT bw fw) where- lift m = TardisT $ \s -> do- x <- m- return (x, s) instance MonadFix m => MonadFix (TardisT bw fw m) where mfix f = TardisT $ \s -> do
tardis.cabal view
@@ -1,5 +1,5 @@ name: tardis-version: 0.4.4.0+version: 0.5.0 synopsis: Bidirectional state monad transformer homepage: https://github.com/DanBurton/tardis bug-reports: https://github.com/DanBurton/tardis/issues@@ -10,6 +10,8 @@ category: Control build-type: Simple cabal-version: >=1.10+tested-with: GHC == 9.8.1, GHC == 9.6.3, GHC == 9.4.8+extra-source-files: README.md, ChangeLog.md description: A Tardis is a combination of both a forwards and a backwards