Monads as a Haskell construct is what the previously mentioned laws 
describe. Monads in category theory are defined in a category X as a triple 
(T, n, m) where T is a functor and m and n certan natural transformations 
such that certan diagrams commute. In that sense, I am not sure that even 
Haskell's implementation is perfectly clean.

There's a lot of nitpicking to be done, but, that's not the point, and we 
are digressing a bit. The point is that in Fluokitten, you are expected to 
work within the certain monad as you agree, and since there is no type 
checking on the value that a function returns, it is the responsibility of 
the developer to make sure that it makes sense as in Clojure generally. It 
is fairly easy to do by passing a parameter to f that pure can use, if f 
implementation needs to be agnostic to the actual monad that it will be 
called from.

There are other approaches, so the programmer can make a choice that is the 
best fit for the problem at hand.
 
Even in the example that you gave from your library, what stops the 
programmer to shoot himself in the foot by doing basically the same thing 
that we are talking about here:

(defn f [g] (comp atom g g))

(require '[monads.maybe :as m])

(def mc (>>= (return 3) (f inc)))

(run-monad m/m mc)

What is the result if f is broken (in the context of the monad m/m in this 
case)? I didn't try it, so I may be wrong, but I doubt that the Clojure 
compiler complains about that one. 

On Wednesday, July 3, 2013 4:11:31 PM UTC+2, Ben wrote:
>
> On Wed, Jul 3, 2013 at 7:07 AM, Ben Wolfson <wol...@gmail.com<javascript:>
> > wrote:
>
>> However, I think this, regarding the second law, is telling: "The second 
>> does not too, since it says what happens when you bind with (pure m) not 
>> (pure n)"
>>
>> *all* the laws only say what happen when you stay within the same monad, 
>> because the types the laws give to >>= and return *require* that.
>>
>
> Addendum, if you're going to say that the various monad laws don't apply 
> because the types differ, then you are, whether you like it or not, not 
> talking about monads; monads are what the laws describe.
>
> -- 
> Ben Wolfson
> "Human kind has used its intelligence to vary the flavour of drinks, which 
> may be sweet, aromatic, fermented or spirit-based. ... Family and social 
> life also offer numerous other occasions to consume drinks for pleasure." 
> [Larousse, "Drink" entry]
>
>  

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to