[Haskell-cafe] closed classes

Duncan Coutts duncan.coutts at worcester.oxford.ac.uk
Fri Aug 6 11:06:11 EDT 2004

On Fri, 2004-08-06 at 15:54, MR K P SCHUPKE wrote:

> 	class OnlyInt a 
> 	instance OnlyInt Int
> 	instance Fail () => OnlyInt x
> Where Fail is a class with no instances, that is not exported!
> If you try and add an instance to OnlyInt the program will fail
> with overlapping instances.

Very nice.

However I think I still need to use allow-overlapping-instances because
[Char] and GConfPrimitiveValue a => [a] still overlap. If closes classes
were a language feature the typechecker would see that the do not
overlap since there is no instance GConfPrimitiveValue Char.


More information about the Haskell-Cafe mailing list