[Haskell-cafe] Re: Where do I put the seq?
Antoine Latter
aslatter at gmail.com
Thu Aug 20 14:10:01 EDT 2009
On Thu, Aug 20, 2009 at 1:02 PM, Ketil Malde<ketil at malde.org> wrote:
> David Leimbach <leimy2k at gmail.com> writes:
>
>> I'm pretty certain that forcing a pattern match via case is what disallows
>> the laziness to get out of hand. The case statement, when evaluated, must
>> choose a matched pattern branch, even if it's the only possibility, which
>> ends up boiling down to "seq" anyway doesn't it?
>
> Prelude> case undefined of x -> ()
> ()
>
> So I think you are incorrect: the 'undefined' here isn't evaluated by
> the case.
>
It's doing a case on a pattern match that forces evaluation. Try:
> case undefined of (x:xs) -> ()
Antoine
More information about the Haskell-Cafe
mailing list