[Haskell-cafe] [Alternative] some/many narrative

Brent Yorgey byorgey at seas.upenn.edu
Thu Dec 15 16:05:40 CET 2011


On Thu, Dec 15, 2011 at 07:29:20PM +1300, Chris Wong wrote:
> > Okay, so how about the following as a user narrative for some and many?
> >
> > ...
> 
> I was in the middle of writing my own version of Applicative when I
> stumbled on this intense debate. Here's what I wrote for the
> documentation:
> 
> class (Applicative f, Monoid f) => Alternative f where

Note that 'Monoid f' does not make sense, since the kinds do not
match. Perhaps what you mean is  (forall a. Monoid (f a)) but that is
(currently) impossible to express.  One could, of course, make a new
typeclass

  class Monoid1 f where
    mempty1 :: f a
    mappend1 :: f a -> f a -> f a

-Brent



More information about the Haskell-Cafe mailing list