[reactive] Event's Monad instance and joinE

Svein Ove Aas svein.ove at aas.no
Fri Jul 10 10:47:49 EDT 2009


On Fri, Jul 10, 2009 at 4:39 PM, Chris Lesniewski-Laas<ctl at mit.edu> wrote:
> Hi.  I've been experimenting with using Reactive as the basis of a network
> daemon I'm working on, with the top-level type Event Packet -> Event Packet.
>
> I've run into a difficult-to-debug strictness problem with the Monad instance
> for EventG, at least when used together with makeEvent.  Here's a minimal test
> program that shows the problem:
>
I can't comment on this exact bug, but in general the Monad instance
for Event is semantically broken.

There's a perfectly reasonable joinE function, yes, but as I
understand it combining it with the perfectly reasonable Applicative
instance produces an illegal monad. Thus, in general, you should avoid
the Monad instance and use joinE directly when required.

-- 
Svein Ove Aas


More information about the Reactive mailing list