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

Thu May 1 04:00:06 PDT 2008 Malcolm.Wallace@cs.york.ac.uk * Revert the other `fmap` to (.) To avoid needing a non-H'98 instance of Functor for (->). M ./Distribution/Simple/Command.hs -1 +1 View patch online: http://darcs.haskell.org/cabal/_darcs/patches/20080501110006-6871e-3c8af0e15...

On Thu, May 01, 2008 at 04:01:31AM -0700, Malcolm Wallace wrote:
Thu May 1 04:00:06 PDT 2008 Malcolm.Wallace@cs.york.ac.uk * Revert the other `fmap` to (.) To avoid needing a non-H'98 instance of Functor for (->).
M ./Distribution/Simple/Command.hs -1 +1
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

Ross Paterson
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

On Thu, May 01, 2008 at 03:51:13PM +0100, Malcolm Wallace wrote:
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.
I don't think it is reasonable. There is nothing in H98 that forbids defining instances for Prelude types and classes, as long as they don't get into modules defined in the H98 Report. Open world and all that.
participants (2)
-
Malcolm Wallace
-
Ross Paterson