Re: ST monad and monad tranformers

2009-02-03 Thread Tyson Whitehead
On February 2, 2009 14:50:10 Reid Barton wrote: > On Mon, Feb 02, 2009 at 06:03:15PM +0100, Josef Svenningsson wrote: > > > > I also needed something like this a while ago so I knocked up a really > > simple module and put it on hackage: > > http://hackage.haskell.org/cgi-bin/hackage-scripts/packag

Re: ST monad and monad tranformers

2009-02-02 Thread Josef Svenningsson
On Mon, Feb 2, 2009 at 8:50 PM, Reid Barton wrote: > On Mon, Feb 02, 2009 at 06:03:15PM +0100, Josef Svenningsson wrote: >> Hi Tyson, >> >> I also needed something like this a while ago so I knocked up a really >> simple module and put it on hackage: >> http://hackage.haskell.org/cgi-bin/hackage-s

Re: ST monad and monad tranformers

2009-02-02 Thread Tyson Whitehead
On February 2, 2009 11:26:02 Tyson Whitehead wrote: > The STT type above is a version of ST like the ReaderT, StateT, etc. types. > > newtype STT s m a = STT ( State# s -> m (STTBox s a) ) > data STTBox s a = STTBox {-#UNPACK#-} !(State# s) {-#UNPACK#-} !a > > runSTT :: (Monad m) => (forall s. STT

Re: ST monad and monad tranformers

2009-02-02 Thread Reid Barton
On Mon, Feb 02, 2009 at 06:03:15PM +0100, Josef Svenningsson wrote: > Hi Tyson, > > I also needed something like this a while ago so I knocked up a really > simple module and put it on hackage: > http://hackage.haskell.org/cgi-bin/hackage-scripts/package/STMonadTrans Warning! The STMonadTrans pa

Re: ST monad and monad tranformers

2009-02-02 Thread Josef Svenningsson
Hi Tyson, I also needed something like this a while ago so I knocked up a really simple module and put it on hackage: http://hackage.haskell.org/cgi-bin/hackage-scripts/package/STMonadTrans If you have any suggestions for improvement they are most welcome. Patches even more so. Josef 2009/2/2 T

ST monad and monad tranformers

2009-02-02 Thread Tyson Whitehead
I have a situation in which I believe I need a parameterizable version of the strict ST monad. My computation type is "StateT s' (STT s (ErrorT e m)) a" (i.e., fails or succeeds and has an internal state involving a state thread). The STT type above is a version of ST like the ReaderT, StateT,