
I've stumbled upon a structure that is like a weaker version of a monad, one that supports return and >> but not >>=. Has anyone seen this before, and if so, does it have a standard name? Mike

Michael Vanier wrote:
I've stumbled upon a structure that is like a weaker version of a monad, one that supports return and >> but not >>=. Has anyone seen this before, and if so, does it have a standard name?
Mike
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Are you sure it supports (>>) :: m a -> m b -> m b and not mplus :: m a -> m a -> m a ? -- Tony Morris http://tmorris.net/

Tony Morris wrote:
Michael Vanier wrote:
I've stumbled upon a structure that is like a weaker version of a monad, one that supports return and >> but not >>=. Has anyone seen this before, and if so, does it have a standard name?
Mike
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
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 () Mike

On Tue, Apr 28, 2009 at 5:33 PM, Michael Vanier
Tony Morris wrote:
Michael Vanier wrote:
I've stumbled upon a structure that is like a weaker version of a monad, one that supports return and >> but not >>=. Has anyone seen this before, and if so, does it have a standard name?
Mike
_______________________________________________ Haskell-Cafe mailing listHaskell-Cafe@haskell.orghttp://www.haskell.org/mailman/listinfo/haskell-cafe
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. Luke

Luke Palmer wrote:
On Tue, Apr 28, 2009 at 5:33 PM, Michael Vanier
mailto:mvanier42@gmail.com> wrote: Tony Morris wrote:
Michael Vanier wrote:
I've stumbled upon a structure that is like a weaker version of a monad, one that supports return and >> but not >>=. Has anyone seen this before, and if so, does it have a standard name?
Mike
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org mailto:Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
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.
Luke
Got it. Thanks. Mike

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

I suspect your structure doesn't exist. A Kleisli algebra (a -> m b) has a full subalgebra (() -> m ()), but (() -> m b) is not an algebra (it is not closed). I'm guessing that the largest proper subset of (a -> m b) is just (() -> m ()). Dan Tony Morris wrote:
Michael Vanier wrote:
I've stumbled upon a structure that is like a weaker version of a monad, one that supports return and >> but not >>=. Has anyone seen this before, and if so, does it have a standard name?
Mike
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Are you sure it supports (>>) :: m a -> m b -> m b
and not mplus :: m a -> m a -> m a ?

On Tue, Apr 28, 2009 at 3:54 PM, Michael Vanier
I've stumbled upon a structure that is like a weaker version of a monad, one that supports return and >> but not >>=. Has anyone seen this before, and if so, does it have a standard name?
That's similar to Applicative, which supports fmap (via Functor), return (named pure) and ap (named <*>), and hence >> (named *>).

On Tue, Apr 28, 2009 at 4:54 PM, Michael Vanier
I've stumbled upon a structure that is like a weaker version of a monad, one that supports return and >> but not >>=. Has anyone seen this before, and if so, does it have a standard name?
That is a strange structure. The type parameter is hardly doing anything: whenever you compose two of them together, you have no choice but to ignore the left one. Let's call your structure S. It's likely that S a is isomorphic to a pair (m, a), where m is some monoid. I would see if you can restate your problem in terms of a monoid. Luke
participants (6)
-
Bryan O'Sullivan
-
Dan Weston
-
Luke Palmer
-
Michael Vanier
-
Tony Morris
-
wren ng thornton