Hi everyone,
I use and love Haskell, but I just have this nagging concern, that maybe
someone can help me reason about. If I'm missing something completely
obvious here and making the wrong assumptions, please be gentle. :)
I'm reading the third (bind associativity) law for monads in this f
On Wed, Jun 17, 2009 at 6:08 PM, Jon Strait wrote:
> ...but if there
> were another monad defined like,
>
> data MadMaybe a = Nothing | Perhaps | Just a
MadMaybe violates the second law. It's quite unlike a monad.
--
Dan
___
Haskell-Cafe mailing list
Has
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.
- Jake
___
On Wed, Jun 17, 2009 at 9:08 PM, Jon Strait wrote:
> I use and love Haskell, but I just have this nagging concern, that maybe
> someone can help me reason about. If I'm missing something completely
> obvious here and making the wrong assumptions, please be gentle. :)
>
> I'm reading the third (bi
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 <=<
Hans van Thiel wrote:
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?
I only just started finding places to
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
Jake McArthur wrote:
Generally, you can transform anything of the form:
baz x1 = a =<< b =<< ... =<< z x1
into:
baz = a <=< b <=< ... <=< z
I was just looking through the source for the recently announced Hyena
library and decided to give a more concrete example from a real-world
p
What is enum2 doing in all of this - it appears to be ignored.
2009/6/18 Jake McArthur :
> Jake McArthur wrote:
>>
>> Generally, you can transform anything of the form:
>>
>> baz x1 = a =<< b =<< ... =<< z x1
>>
>> into:
>>
>> baz = a <=< b <=< ... <=< z
>
> I was just looking through the so
Clicking on the source code link reveals that enum2 is used in the where
clause. It's not important to the transformation that Jake was performing.
In essence, <=< is the monadic version of . (function composition) and
as explained, it can be used to do some pointfree-like programming in
the
On Thu, 2009-06-18 at 08:34 -0500, Jake McArthur wrote:
[snip]
> So, `(=<<)` is just like `($)` except for the information carried along
> by the monad.
>
> Anyway, the "obvious" thing to do is to drop the `x` from both sides of
> the definition for `bar`. To do that with `foo` earlier, we had
Hans van Thiel wrote:
Just to show I'm paying attention, there's an arrow missing, right?
(.) ::(b -> c) -> (a -> b) -> (a -> c)
Correct. I noticed that after I sent it but I figured that it would be
noticed.
I also used (>>>) where I meant (>=>) at the bottom. The
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
13 matches
Mail list logo