Functor => Pointed => Applicative => Monad
fischer at nii.ac.jp
Tue Nov 30 13:45:42 CET 2010
On Mon, 2010-11-29 at 18:36 +0000, Ross Paterson wrote:
> On Mon, Nov 29, 2010 at 12:46:28PM -0500, David Menendez wrote:
> > On Mon, Nov 29, 2010 at 11:26 AM, Isaac Dupree
> > > Is it useful to have Pointed non-Functors?
> > Is Pointed useful at all? The last time this discussion came up, I
> > asked for algorithms which were generic over pointed functors (in the
> > same way that traverse is generic over applicative functors) and no
> > one could think of any.
> fromFoldable :: (Foldable f, Pointed g, Monoid (g a)) => f a -> g a
> fromFoldable = foldMap pure
One instance `g` of `Pointed` where this is useful is the type
constructor for difference lists (aka functional lists) which does
provide singleton and monoid operations but no map function without
converting to ordinary lists.
With regard to laws one could still 'require' laws for the interaction
of `Functor` and `Pointed` if both instances are defined.
More information about the Libraries