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

2009-04-28 Thread 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?


Mike


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


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

2009-04-28 Thread Tony Morris
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/


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


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

2009-04-28 Thread Bryan O'Sullivan
On Tue, Apr 28, 2009 at 3:54 PM, Michael Vanier mvanie...@gmail.com 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?


 That's similar to Applicative, which supports fmap (via Functor), return
(named pure) and ap (named *), and hence  (named *).
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


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

2009-04-28 Thread Luke Palmer
On Tue, Apr 28, 2009 at 4:54 PM, Michael Vanier mvanie...@gmail.com 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?


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
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


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

2009-04-28 Thread 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 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


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


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

2009-04-28 Thread Dan Weston

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 ?



___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


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

2009-04-28 Thread Luke Palmer
On Tue, Apr 28, 2009 at 5:33 PM, Michael Vanier mvanie...@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 
 listhaskell-c...@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
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


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

2009-04-28 Thread Michael Vanier

Luke Palmer wrote:
On Tue, Apr 28, 2009 at 5:33 PM, Michael Vanier mvanie...@gmail.com 
mailto:mvanie...@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


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


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

2009-04-28 Thread wren ng thornton

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
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe