[Haskell-cafe] Shouldnt this be lazy too?

Vimal j.vimal at gmail.com
Mon Sep 24 12:54:05 EDT 2007


Wow, half an hour, about 7 replies :) I dont know which one to quote!

Okay. So, why is GHC finding it difficult to conclude that
length is always > 0? Suppose I define length like:

length [] = 0
length (x:xs) = 1 + length xs

Hmm, well, I think the fact that we, as humans, expecting GHC
to infer length (any list) > 0 is pretty unfair :)

What I had in mind was, when GHC was able to do so many things like
pattern matching, data type inference, why not this!

Nice! Now I dont know what to say :)


More information about the Haskell-Cafe mailing list