Proposal: unify constant functors
Brent Yorgey
byorgey at seas.upenn.edu
Mon Apr 30 14:38:14 CEST 2012
On Mon, Apr 30, 2012 at 01:33:39AM -0400, wren ng thornton wrote:
> Hello all,
>
> I recently (re)noticed the following duplication:
>
> base:Control.Applicative
> newtype Const a b = Const { getConst :: a }
> instance Functor (Const m) where...
> instance Monoid m => Applicative (Const m) where...
>
> transformers:Data.Functor.Constant
> newtype Constant a b = Constant { getConstant :: a }
> instance Functor (Constant a) where...
> instance Foldable (Constant a) where...
> instance Traversable (Constant a) where...
> instance (Monoid a) => Applicative (Constant a) where...
>
> I don't see any reason for this redundancy. I propose we:
>
> (1) add the Foldable and Traversable instances to base, and
> (2) deprecate transformers:Data.Functor.Constant
Why do it this way? For backwards compatibility? It seems to me it
would be much more consistent to remove the one in
Control.Applicative and have all the fundamental functor combinators
in one place.
-Brent
More information about the Libraries
mailing list