[Haskell-cafe] Why isn't pattern matching lazy by default?

Peter Verswyvelen bf3 at telenet.be
Wed Sep 19 08:34:52 EDT 2007


C.M.Brown wrote:
>> f ~(x:xs) = x + 2
>> f ~[] = 42
>>
>> Then f [] would give a complie error:
>>  Irrefutable pattern failed for pattern (x : xs)
>>     
>
> Sorry, that should be *runtime* error!
>
> Chris.
>   
It seems GHC does give a warning at compile-time about it, so you did 
get it right the first time :-)

Thanks for the info,
Peter


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20070919/91f5851f/attachment.htm


More information about the Haskell-Cafe mailing list