
On Fri, Sep 26, 2008 at 2:37 PM, Claus Reinke
wrote: It seems that the ultimate offender is Control.Applicative, which imports Control.Monad.Instances() for no other reason than to infect its importers. That then propagates all over the place.
Control.Applicative defines Applicative instances for (->) and (,). Doing so requires Functor instances for (->) and (,), which are defined in Control.Monad.Instances.
Wouldn't it be possible just to delay the instance selection? instance Applicative ((->) a) where would become instance Functor ((->)a) => Applicative ((->) a) where But, that code doesn't seem to require the instances? Only I just noticed that Control.Applicative imports Control.Arrow, which imports Control.Monad.Fix, which imports Control.Monad.Instances. We can apply the constraint delay in Control.Monad.Fix, making instance Functor ((->)r) => MonadFix ((->)r) but that requires {-# LANGUAGE UndecidableInstances #-} {-# LANGUAGE FlexibleContexts #-} (the need for the former highlights another language limitation..) Claus
I suppose one solution would be to move the Applicative instances for (->) and (,) to Control.Monad.Instances.
-- Dave Menendez
http://www.eyrie.org/~zednenem/