ajb-2 wrote:
>
> One thing that may help is that if you can prove that fmap is sane:
> fmap (f . g) = fmap f . fmap g
>
I get stuck after expanding the rhs into:
((return . f) <=< id) . ((return . g) <=< id)
ajb-2 wrote:
>
> then the naturality of return is precisely its free theorem, a
ajb-2 wrote:
>
> If you wanted to prove that bind is natural, you would need to define
> bind, no?
>
Yup: bind f = f <=< id -- whence you can say (>>=) = flip bind
My point is that (as far as I can see) you cannot prove the properties of
bind
by only assuming identity and associativity
ajb-2 wrote:
>
> Define:
> f >=> g = \x -> f x >>= g
>
So you're either not taking (>=>) as primitive or you're stating the
additional
property that there exists (>>=) such that f >=> g === (>>= g) . f
(from which you can easily show that (f . g) >=> h === (f >=> h) . g ).
A presentatio
Wolfgang Jeltsch-2 wrote:
>
> No, I think, it’s the Prelude’s fault to define (==) as “floating point
> equality”.
>
My bad, I meant IEEE (==) when I said it was "our" fault. I concur that the
Prelude is at fault for using the (==) symbol for FP equality. Even if you
don't
demand from (==) to
I'm not sure whether this is the right branch of the thread for this post.
Maybe it belongs to a different thread altogether.
But here goes:
Maybe most of our gripes with floating point arithmetic (besides broken
implementations) is that we expect it to behave like Real arithmetic, and
when it do
> My favorite presentation of the monad laws is associativity of Kliesli
> composition:
> (a1 >=> a2) x = a1 x >>= a2 -- predefined in 6.8 control.monad
> -- The laws
> return >=> a= a
> a >=> return= a
> a >=> (b >=> c) = (a >=> b) >=> c
If you use this presentation you also nee