[Haskell-cafe] ANNOUNCE: tardis

Dan Burton danburton.email at gmail.com
Tue Aug 7 08:04:13 CEST 2012


I'm pleased to announce that I've uploaded the *tardis* package to hackage.

http://hackage.haskell.org/package/tardis-0.2.0.0

*TardisT* is a monad transformer that combines the (regular, "forwards")
State monad
with the "backwards State monad", allowing you to communicate on two
channels of state:
one is "backwards travelling" state, while the other is "forwards
travelling" state.
Its primitives are comparable to the State monad's "get" and "put", but the
names
disambiguate which channel they operate on:

getPast    :: Monad m =>       TardisT bw fw m fw
getFuture  :: Monad m =>       TardisT bw fw m bw

sendPast   :: Monad m => bw -> TardisT bw fw m ()

sendFuture :: Monad m => fw -> TardisT bw fw m ()

These primitives allow you to write some very amusing timey-wimey code,
but it only works in the presence of sufficient laziness.
If you run into an infinite loop, try adding laziness annotations
everywhere,
and make sure that what you are trying to do is not a time paradox.

I've provided both *transformers* and *mtl* style modules:
Control.Monad.Trans.Tardis contains the transformer,
while Control.Monad.Tardis.Class contains the MonadTardis class,
and Control.Monad.Tardis re-exports both as well as the TardisT instance
for MonadTardis.

See the readme on github for more details:

https://github.com/DanBurton/tardis#readme

As a side note, since the code base is relatively small, it can also serve
as a simple demonstration of how to use a cabal flag
in conjunction with CPP to selectively include swaths of code
(see Control/Monad/Tardis.hs and tardis.cabal).

I'm not entirely sold on the naming conventions for the package (including
the package name),
and am open to suggestions.

-- Dan Burton
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20120807/07d060b3/attachment.htm>


More information about the Haskell-Cafe mailing list