[Haskell-cafe] Haskell spec vs FlexibleInstances
anthony_clayden at clear.net.nz
Tue Feb 18 20:53:31 UTC 2014
> Doug McIlroy <doug <at> cs.dartmouth.edu> writes:
> What potential evil motivates the prohibition of repeated type
> parameters in an instance declaration?
I guess the first reason would be to catch accidental duplicate names of
But as to "potential evils", the only point of such an instance:
instance C a a where ...
would be to have another instance:
instance C a b where ...
So we're into overlapping instances. (And discriminating on type equality -
- which only works if the types are grounded. See the HList paper, section
9 'By chance or design?')
Overlapping instances like that will probably need FunDeps. So the more
recent (and probably more blessed) approach is to use the Closed type
families/branched instances doo-hicky upcoming with GHC 7.8.
More information about the Haskell-Cafe