
2 Oct
2010
2 Oct
'10
7:43 a.m.
On Sat, Oct 2, 2010 at 7:52 AM, Russ Abbott
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ï