Mark Jones:
> Looking at the `size' of types is, of course, a generalization of Simon's
> suggestion that contexts might be allowed to constrain only proper sub-
> expressions of types in the context.  (Proper sub-expressions are, by
> definition, smaller in size.)  However, it is still too strict to allow
> useful things like:  instance Monad m => Functor m where ..., so there is
> still some work to be done ...

I haven't looked at this in great detail, so forgive me if I'm talking
through my hat, as seems quite likely: is it workable to require only
that contexts be non-increasing in size, and that there be no manifest
circularity where the sizes are non-decreasing?  That is, rule out having
both instance Monad m => Functor m and instance Functor m => Monad m.
Or is that not sufficient to ensure termination of CR?


Fergus Henderson writes of:
> the monomorphism restriction (which exists for a similar reason,
> to ensure termination of type inference).

Is this true?  The rationale normally given for it by its advocates
(boo, hiss) seems invariably the "no re-evaluation of CAFs" mantra.

Slainte,
Alex.


Reply via email to