John Peterson defends the DMR:
> read :: Read a => String -> a
> read s = let [(r,s')] = reads s in r

> This *won't compile* if you don't treat the let binding definition
> monomorphicly.  Without monomorphism, the types of r and s' are

> r  :: Read a => a
> s' :: Read a => String

> This leads to an ambiguity error for s'.

This is true, but one could get around this by giving a type signature
for the pattern binding -- _if_ there were a syntax for doing so, and
if one could write monomorphic type variables in signatures.

Now, not necessarily an ideal solution, but as Jeff Lewis implies, I
think this is really a type system artifact, not any sort of underlying
problem.  Surely it's possible to relax the prohibition against
ambiguously overloaded types in these cases where they "don't matter"?
(I'm not sure if it's sufficient to require that they don't appear
at the top level.)

Slainte,
Alex.


Reply via email to