patch applied (cabal): Revert the other `fmap` to (.)

Malcolm Wallace Malcolm.Wallace at cs.york.ac.uk
Thu May 1 10:51:13 EDT 2008


Ross Paterson <ross at soi.city.ac.uk> wrote:

> >   To avoid needing a non-H'98 instance of Functor for (->).
> 
> I'm puzzled as to why nhc98 lacks this instance in this module,
> given the import chain
> 
> Distribution.Simple.Command
> -> Distribution.ParseUtils
> -> Data.Tree
> -> Control.Applicative
> -> Control.Monad.Instances

nhc98 has a performance hack to avoid dumping large numbers of instance
decls into .hi interface files.  For any given instance, if both the
class and the type are defined in the Prelude, then the instance can be
omitted from the interface file (for any module except the Prelude
itself), under the assumption that it will already be available by
default via the Prelude, which is implicitly imported everywhere anyway.
This assumption is entirely reasonable for H'98.

But non-H'98 modules that add new instances for Prelude types and
classes break the assumption.

There is a workaround: essentially every non-Prelude module that is
intended to define or re-export such non-standard instances, can tell
the compiler to pretend it is building the Prelude, and so should
include all instances in the interface.  The flag is
{-# OPTIONS_NHC98 --prelude #-}.

The awkward part is that you need to add that line to _every_ module in
the chain you gave above.

Regards,
    Malcolm



More information about the cabal-devel mailing list