Implict parameters and monomorphism

Alastair Reid reid@cs.utah.edu
Thu, 3 May 2001 15:26:38 -0600


> You can always use 'case' instead of 'let' for variable bindings.

Except, of course, for top level bindings which is where the
monomorphism restriction is usually most noticable.

> I would remove the monomorphism restriction, [...]

This seems to be a pretty common sentiment but
I don't see anyone pointing out that the 
monomorphism restriction is there for _two_ reasons:

1) The performance issues that are currently getting all the attention.

2) Preventing ambiguity in examples like:

    [(n,s)] = reads t

   where the value of "s" (whose type is String) is determined by the
   type of "n".

   This example comes from the H'98 report, section 4.5.5 "The Monomorphism Restriction".

Unless I missed something, reason (2) prevents us from completely
getting rid of the restriction even if we are willing to ignore (1).
(Though if our only goal was to solve (2), it may be that the rule
could be a lot less restrictive.)

--
Alastair Reid