
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 think this is sensible, but I'm mildly inclined to plead for a much shorter name: K. I realise it would be completely inappropriate to use convenient names based on combinatory logic in a programming language called Haskell, but frankly, every time I have to type "onstant" I feel like giving someone a "dentity". If, as I am, you are given to constructing types from polynomials type BinarySearchTree = Mu (K () :+: (I :*: K Int :*: I)) readability is helped by short names. The many wonderful closure properties of polynomial functors give lots of standard equipment (traversability, zippers,...) for free. Of course, this is something of a minority sport. But it might be worth thinking about how Constant fits into a bigger picture in order to design its place in the ecosystem. All the best Conor
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
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@haskell.org http://www.haskell.org/mailman/listinfo/libraries
_______________________________________________ Libraries mailing list Libraries@haskell.org http://www.haskell.org/mailman/listinfo/libraries