On Nov 23, 1:15 pm, Konrad Hinsen <[EMAIL PROTECTED]> wrote:
> On 21.11.2008, at 20:10, Adam Jones wrote:
>
> >> The file contains the macro definitions, the definitions of three
> >> popular monads (maybe, list, state), and some illustrations of their
> >> use. Comments are welcome!
>
> > Since they support mzero and mplus, aren't these equivalent to
> > Haskell's MonadPlus? (i.e. they're a little more than *just* monads)
>
> You can define :plus and :zero if they are appropriate for a monad.  
> If they are defined,  you can use them. None of the predefined monad  
> machinery will use them at the moment, but I plan to implement  
> conditions, which work only if :zero is defined.
>
> In Haskell there are two different types of monads because of the  
> type system, but the Clojure implementation doesn't use the type  
> system at all, so :plus and :zero are simply used by convention.
>
> > I've been kicking around the idea of re-implementing Haskell
> > typeclasses on top of multimethods. Now that I think more about it,
> > this probably wouldn't be much work.
>
> You need to find a way to store the type information with the data.  
> That is easy if you limit yourself to a specific data structure, say  
> a map with a key reserved for type information. But if you want to be  
> able to use typeclasses for general Clojure data (e.g. make sequences  
> an instance of Monad), I don't see a simple way to do it.

That's the problem I've been thinking on. I'm looking for a decently
sane way to build on the multimethod dispatch system here instead of
explicitly relying on types. The concept probably doesn't work very
well without a guaranteed unique method of identifying an object, like
a data type.

-Adam

>
> Konrad.
--~--~---------~--~----~------------~-------~--~----~
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
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