[Haskell-cafe] closed classes

MR K P SCHUPKE k.schupke at imperial.ac.uk
Fri Aug 6 10:54:06 EDT 2004


Closed t => ????

You want a closed type?

The parameter to a class is a type...


Actually if you allow undecidable instances you can use the generic
instance to close the class

	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.

	Keean.


More information about the Haskell-Cafe mailing list