Liberalising IncoherentInstances

Axel Simon Axel.Simon at
Tue Jul 30 13:04:00 CEST 2013

On Jul 30, 2013, at 12:18 , AntC <anthony_clayden at> wrote:

>> Axel Simon <Axel.Simon <at>> writes:
>> ...
>> In recent years I acquired the view that 
>> type inferences should have some sort of semantic completeness property 
>> ...
> If you want 'semantic completeness', don't use IncoherentInstances.

This is saying that any non-sensical language extension should be added to ghc since people don't have to use them. I'm trying to say what I don't like about this particular extension.

> (As several have said, it's not a popular extension;
> more of a 'necessary evil' to use with caution.
> That's why it's a good suggestion to limit it's 'reach'
> to particular instances.)

Types and, in particular class instances, creep into many places. It will be quite difficult to limit the "reach". 
Adding a module to a project that declares a new instance can change the behavior of the whole program. That is bad enough, but we shouldn't willingly extend these unfortunate effects to language extensions.

> The price to pay for avoiding IncoherentInstances might be:
> - adding extra instances to avoid partial overlap
> - adding type annotations

I'm just wondering if those few use-cases where they are useful can be dealt with by ensuring that the AST of the instance declarations are identical. Then this would address my concern and those of the proponents of the proposal.


More information about the Glasgow-haskell-users mailing list