[Haskell-cafe] Different semantics in "identical" do statement?

David Menendez dave at zednenem.com
Fri Oct 9 19:25:25 EDT 2009


On Fri, Oct 9, 2009 at 6:47 PM, staafmeister <g.c.stavenga at uu.nl> wrote:
>
> Daniel Peebles wrote:
>>
>> I vaguely remember on IRC someone pointing out that the Parsec monad
>> broke one of the laws. I think return _|_ >> x === _|_ which could be
>> causing your problem. I may be wrong though.
>>
>>
>
> Confirmed, working in the parsec monad
>
> Prelude Text.Parsec> runP (do {x <- return undefined; return 10}) () "" ""
> *** Exception: Prelude.undefined
>
> In the IO Monad
> Prelude Text.Parsec> do {x <- return undefined; return 10}
> 10
>
> Should be fixed.

It looks like the problem is a strict field in the definition of
GenParser (specifically in Reply). From what I can tell, Parsec 3.0.1
should not have this problem.

-- 
Dave Menendez <dave at zednenem.com>
<http://www.eyrie.org/~zednenem/>


More information about the Haskell-Cafe mailing list