|Version 2 (modified by john@…, 10 years ago) (diff)|
closed classes are ones for which no more instances may be defined. these can be used to produce better error messages and to refine types.
allow the closed keyword right after class.
class closed ... where ...
this will mean that even if the class is exported no one may declare more instances for it
specify it in the export list
module Foo(closed Foo(..)) where
- compilers based on jhc's class system can take very good advantage of such declarations when optimizing.
- This sort of thing is often needed when doing phantom type and type class tricks.
- this is available in helium in order to increase the accuracy of error messages to good effect.
- syntax is similar to 'class alias' and 'class overlapping' proposals
- a new language construct