Proposal: unify constant functors
wren ng thornton
wren at freegeek.org
Mon Apr 30 07:33:39 CEST 2012
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
This will cause breakage to any orphan instances of Foldable/Traversable
for Const, but that seems fine by me. Eventually we'll want to remove
transformers:Data.Functor.Constant (or have it re-export the Const stuff
from base:Control.Applicative); but that can be handled later.
Deadline: 14 May 2012.
--
Live well,
~wren
More information about the Libraries
mailing list