Proposal: unify constant functors
Ben Moseley
ben_moseley at mac.com
Tue May 1 21:13:13 CEST 2012
+1 for the Brent / Ross approach.
--Ben
On 1 May 2012, at 19:43, Edward Kmett wrote:
> +1 for going Brent and Ross's way, (removing Const from Control.Applicative and moving Data.Functor.Constant into base) but overall happy with the idea no matter how we do it.
>
> I prefer the separate module approach because there are many other similar functors that we may want to migrate into base over time, and it wouldn't make sense to have one of them hiding in Control.Applicative.
>
> -Edward
>
> On Mon, Apr 30, 2012 at 8:38 AM, Brent Yorgey <byorgey at seas.upenn.edu> wrote:
> 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
>
> _______________________________________________
> Libraries mailing list
> Libraries at haskell.org
> http://www.haskell.org/mailman/listinfo/libraries
>
> _______________________________________________
> Libraries mailing list
> Libraries at haskell.org
> http://www.haskell.org/mailman/listinfo/libraries
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/libraries/attachments/20120501/810216e0/attachment.htm>
More information about the Libraries
mailing list