Ah... thanks everyone, now I no longer have that creepy feeling that
reality went weird.

I now see why m-result looks so "pointless" -- it's maybe like when
I'm writing code which uses mapcat a lot and the base case is a
disturbing-looking [nil] rather than just plain nil. It's not really
pointless; you just gotta package values to send them through the
machinery.

And an m-result is just a kind of minimal description of a monadic
function, one that doesn't mess with its arguments and is easily
undoable.

Ok, monads are an interesting and strange place to put an
abstraction...


All the best,
Tayssir


On Jan 28, 8:57 am, Michał Marczyk <[email protected]> wrote:
> That's one place where the Haskell version is perhaps clearer, since
> Haskell's return x will never evaluate to Nothing... See [1] if you'd
> like to read about it.
>
> The behaviour you describe is a quirk of c.c.monads' maybe-m
> implementation which does not allow nil as a monadic value, since it's
> being used as m-zero instead. You could say that the implicit
> universal quantifier binding 'value' in the monadic law you cite has
> to be taken, in the context of maybe-m, to be restricted to non-nil
> values:
>
> \forall value . (not (nil? value)) => ...
>
> (And for a pure monadic experience, one could argue you should not
> even use m-result with a nil argument... The fact that nothing
> prevents you from doing so if you want to adds to the flexibility of
> maybe-m and so is seen to be ultimately beneficial.)
>
> Hope this helps somewhat,
> Michal
>
> [1]http://en.wikipedia.org/wiki/Monad_(functional_programming)

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to