[Haskell-cafe] How to expose if a constraint is satisfiable

Li-yao Xia lysxia at gmail.com
Tue May 8 11:49:50 UTC 2018


On 05/07/2018 11:45 PM, Clinton Mead wrote:
> Hi Li-yao
> 
> I understand this issue, but I think what your describing doesn't relate 
> to what I'm talking about uniquely.
> 
> For example:
> 
> instance {-# OVERLAPPABLE #-} Num x => C x where ...
> instance {-# OVERLAPPING #-} C Int where ...
> 
> is completely legal, and the instance used depends on context.
> 
> This is an issue with overlapping instances, but already GHC allows it. 
> I don't think what I'm proposing is any worse to what's already legal.
> 
No instance for the C type class above will be picked until x is equal 
to some applied type constructor; it will be more challenging to break 
coherence with that than using what you're proposing.

It seems difficult to make a clear point because the whole topic of 
coherence with Haskell type classes is already a minefield.

Li-yao


More information about the Haskell-Cafe mailing list