[Haskell-cafe] Confusion on the third monad law when using lambda
abstractions
Sjoerd Visscher
sjoerd at w3future.com
Thu Jun 18 08:49:55 EDT 2009
I had seen it before, and a bit of Googling turned up this:
The monad laws can be written as
return >=> g == g
g >=> return == g
(g >=> h) >=> k == g>=> (h >=> k)
So, functions of type a -> m b are the arrows of a category with
(>=>) as composition,
and return as identity.
http://sites.google.com/site/haskell/category-theory/thekleislicategory
Although I think I saw them somewhere else.
Sjoerd
On Jun 18, 2009, at 1:23 PM, Hans van Thiel wrote:
>
> On Wed, 2009-06-17 at 21:26 -0500, Jake McArthur wrote:
>> Jon Strait wrote:
>>> I'm reading the third (bind associativity) law for monads in this
>>> form:
>>>
>>> m >>= (\x -> k x >>= h) = (m >>= k) >>= h
>>
>> Arguably, that law would be better stated as:
>>
>> (h <=< k) <=< m = h <=< (k <=< m)
>>
>> This wouldn't be so unintuitive.
> Hi,
> The only place I've ever seen Kleisli composition, or its flip, used
> is
> in demonstrating the monad laws. Yet it is so elegant and, even having
> its own name, it must have some practical use. Do you, or anybody
> else,
> have some pointers?
>
> Best Regards,
>
> Hans van Thiel
>>
>> - Jake
>>
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
--
Sjoerd Visscher
sjoerd at w3future.com
More information about the Haskell-Cafe
mailing list