[Haskell-cafe] name for monad-like structure?

wren ng thornton wren at freegeek.org
Tue Apr 28 20:08:02 EDT 2009


Michael Vanier wrote:
> Luke Palmer wrote:
> > Michael Vanier wrote:
> > >     Are you sure it supports
> > >     (>>) :: m a -> m b -> m b
> > >
> > >     and not
> > >     mplus :: m a -> m a -> m a ?
> >       
> >     Yeah, you're right.  It's basically a monad where the type a is
> >     fixed to be (), so you just have
> >
> >     (>>) :: m () -> m () -> m ()
> >
> >
> > That's a monoid.
>
> Got it.  Thanks.

If the return is important ---and the structure can be parameterized by 
non-() types, and the binop is actually mplus not (>>)--- then it may 
also be a monoid generated from a semigroup. This is the case when 
there's an (M a) which can't be generated by return and which serves as 
the identity for the binop. Prime examples are monoids similar to Maybe 
which are generated by Nothing, return, and any semigroup on the 
underlying set.

-- 
Live well,
~wren


More information about the Haskell-Cafe mailing list