[Haskell-beginners] fromIntegral

Chaddaï Fouché chaddai.fouche at gmail.com
Sat Oct 2 03:43:33 EDT 2010


On Sat, Oct 2, 2010 at 7:52 AM, Russ Abbott <russ.abbott at gmail.com> wrote:
> It turns out that
>
>    test1 = 1 == 1
>
> will load (and return True), but
>
>   testNull = [ ] == [ ]
>
> won't load. Both 1 and [ ] seem to have similar sorts of type parameters in
> their types. Why are they treated differently?

That's due do the defaulting mechanism which is often considered a
confusing and far from ideal part of Haskell, in real applications it
is better not to rely on it. Explicit signatures on most top-level
function are enough to avoid most of those problems.

Note that testNull would work with the extended default rules used in
ghci for instance.
-- 
Jedaï


More information about the Beginners mailing list