patch applied (packages/base): Must import ExitCode for its instance to be re-exported.

Ross Paterson ross at soi.city.ac.uk
Wed Aug 13 10:25:31 EDT 2008


On Wed, Aug 13, 2008 at 03:09:44PM +0100, Malcolm Wallace wrote:
> Ross Paterson <ross at soi.city.ac.uk> wrote:
> 
> > > Wed Aug 13 05:57:10 PDT 2008  Malcolm.Wallace at cs.york.ac.uk
> > >   * Must import ExitCode for its instance to be re-exported.
> > >   The Cabal library depends on "instance Exception ExitCode", and
> > >   expects to import it from Control.Exception, not
> > >   Control.Exception.Base.
> > 
> > But Control.Exception imports Control.Exception.Base.
> > Is this another nhc98 thing?
> 
> I don't know whether it is H'98 behaviour, or something more quirky.

(C.E.B defines instance Exception ExitCode)

>   * C.E imports C.E.B, but does not import System.ExitCode.
>   * Hence, the instance for Exception ExitCode is not imported, since it
>     won't be needed.
>   * When C.E exports the class Exception, it only exports instances of
>     it for any types that are in scope.

That's surely noncompliant with H98.  Section 5.4:

	Instance declarations cannot be explicitly named on import
	or export lists.  All instances in scope within a module are
	always exported and any import brings all instances in from the
	imported module.  Thus, an instance declaration is in scope if
	and only if a chain of import declarations leads to the module
	containing the instance declaration.

So the instance is needed, so that it can be exported.


More information about the Cvs-libraries mailing list