Back to explicit Coercible instances?
Simon Peyton-Jones
simonpj at microsoft.com
Wed Oct 16 13:49:22 UTC 2013
| > Moreover, I'm very keen to give a simple, precise answer to the
| question
| > if s is coercible to t
| > when is (T s) coercible to (T t)
| > I propose that the answer is given by precisely T's roles. At the
| > moment I don't see why we would want to do anything more complicated.
|
| I’m not sure if „... if the roles allow it“ is any simpler than „if
| there is a Coercible instance for it“, and Haskell programmers might be
| happier if they can think in terms of type class instances without
| learning a new concept.
But it *is* simpler, because given the question
can I say 'deriving instance Coercible A B'?
the answer involves roles. So by adding this instance stuff you have *two* things to explain instead of one.
It might seem that the presence or absence of a 'deriving Coercible' declaration gives you more control, but the *same* control is given by a role annotation.
So I'm still not seeing any added value here, though I am seeing added complexity.
Simon
More information about the ghc-devs
mailing list