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

Alexander Dunlap alexander.dunlap at gmail.com
Fri Oct 9 19:41:15 EDT 2009


On Fri, Oct 9, 2009 at 4:25 PM, David Menendez <dave at zednenem.com> wrote:
> 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/>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>

It works with Parsec 3.0.1 for me.

Alex


More information about the Haskell-Cafe mailing list