Incoherence
Karl-Filip Faxen
kff@it.kth.se
Thu, 25 Oct 2001 13:25:57 +0200
Hi!
The binding form := must absolutely have a completely monomorphic type.
A while back I posted the result that the MR kills principal types in
Haskell. The problem with the MR is exactly that it introduces types
which may be polymorphic but not overloaded. So if we want to regain
principal types, := must be completely monomorphic.
What we could have is that := is allowed to be polymorphic if and only if
an explicit type signature is given. I do not thing this would hurt
principality, and we could still have Koen's example, but like this:
wrong :: Either String a
wrong := Left (show (fac 100)) -- shared and polymorphic due to signature!
example1 :: Either String Int
example1 :=
do wrong
return 1
example2 :: Either String Char
example2 :=
do wrong
return 'a'
How does that sound?
/kff