[Haskell-cafe] Type inference

Andreas Rossberg rossberg at ps.uni-sb.de
Thu Feb 9 06:46:32 EST 2006


Brian Hulley wrote:
> Fred Hosch wrote:
>> Is type inferencing in Haskell essentially the same as in SML?

The most significant difference certainly is that type inference has 
been beefed up with type classes in Haskell, which are quite a powerful 
mechanism refining Hindley/Milner inference.

Besides that, Haskell allows some additional programs for which types 
can /not/ be inferred (e.g. the examples Brian was giving), while SML 
does not.

> SML also has a complicated thing called the "value restriction" because 
> it allows mutable references to be altered via side effects. Because 
> Haskell has no side effects, there is no need for a value restriction.

Although there is no "need" for it, Haskell still has it, in minor 
variation. It is commonly known as "The Dreaded Monomorphism 
Restriction" ;).

   - Andreas

-- 
Andreas Rossberg, rossberg at ps.uni-sb.de

Let's get rid of those possible thingies!  -- TB


More information about the Haskell-Cafe mailing list