[Haskell-cafe] What is MonadPlus good for?

Remi Turk rturk at science.uva.nl
Sun Feb 13 17:25:07 EST 2005


On Sun, Feb 13, 2005 at 10:33:06PM +0100, Tomasz Zielonka wrote:
> On Sun, Feb 13, 2005 at 10:25:49PM +0100, Remi Turk wrote:
> > > BTW, I have an implementation of STM based entirely on old concurrency
> > > primitives, which means that it will work in older GHC and probably in
> > > other Haskell compilers. I am going to put it on my web site, when I get
> > > one.
> > 
> > Cool :)
> > Is it actually race/deadlock/othergeneralnastiness-free?
> 
> It should be, but there may be bugs of course.
> I know there are some possible space leaks, but that's also fixable.
> 
> > (as the paper claims that e.g. mergeIO :: [IO a] -> IO a is
> > unimplementable in anything built on mutexes and condition
> > variables.)
> 
> My STM monad is not IO, it has the same restrictions as STM in the
> paper. The paper doesn't claim you can't implement mergeSTM :: [STM a]
> -> STM a mergeSTM = msum

Ugh, I should've read what I copied...
*nitpick* in the paper merge is defined using foldr1, which
errors when given an empty list, as opposed to msum, which merely
retries.

> Also, the STM in GHC 6.4 is written in C. Do you think that Haskell's 
> IO monad lacks some things needed to write this thing? I can tell you
> there are some problems with types, but they can be solved in a more or
> less standard way.
> 
> Best regards
> Tomasz

I don't, though I'm probably not qualified to vote ;)

Groeten,
Remi

P.S. And don't forget to post a link when you put it online.

-- 
Nobody can be exactly like me. Even I have trouble doing it.


More information about the Haskell-Cafe mailing list