On 28.01.2010, at 10:00, Meikel Brandmeyer wrote:
On Jan 28, 8:56 am, Konrad Hinsen <[email protected]> wrote:
Perhaps m-result in maybe-m should throw an exception if the value
passed in is nil, to enforce this rule.
I would vote for using ::nothing or the like for that purpose and
allow nil as value. I don't think the monad should care what the
payload is.
If you use (maybe-t identity-m) instead of maybe-m, you can actually
specify your own "nothing" value as an optional argument, e.g. (maybe-
t identity-m ::nothing).
The maybe-m monad is a constant monad, so an optional parameter is not
possible. After considering something like ::nothing, I finally
settled for nil as a default "nothing" value because this is the most
convenient choice in most settings. In particular, it makes it
possible to use when forms as convenient generators of maybe-m values.
Konrad.
--
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