Discussion:
December monads
Konrad Hinsen
2008-12-20 16:05:32 UTC
Permalink
My monad code needed a small fix to work with the December 17
release. I have replaced the original file with the corrected one at

http://groups.google.com/group/clojure/web/monads.clj

Konrad.
r
2008-12-20 18:20:33 UTC
Permalink
Hi,

Although I am not a big fan of monads (I can't help the feeling this
abstraction is more difficult than the problem to solve) this starts
looking like a nice framework that should probably go into
clojure-contrib (perhaps with policy of not using this mechanism in
other clojure-contrib libs).

Thanks,
-r.

On Sat, Dec 20, 2008 at 4:05 PM, Konrad Hinsen
Post by Konrad Hinsen
My monad code needed a small fix to work with the December 17
release. I have replaced the original file with the corrected one at
http://groups.google.com/group/clojure/web/monads.clj
Konrad.
jim
2008-12-20 21:50:49 UTC
Permalink
I also think this would be a great addition to clojure-contrib.

Because of the way most monad tutorials are written, monads seem to be
pretty hard to get your head around. Also, many of the reasons for
the standard monads in Haskell don't exist in impure functional
languages like Clojure. So there's less motivation to understand
them. But I found that once I understood them, they are a powerful
addition to my conceptual toolbox.

Jim
Post by r
Hi,
Although I am not a big fan of monads (I can't help the feeling this
abstraction is more difficult than the problem to solve) this starts
looking like a nice framework that should probably go into
clojure-contrib (perhaps with policy of not using this mechanism in
other clojure-contrib libs).
Konrad Hinsen
2008-12-22 07:51:34 UTC
Permalink
Post by jim
I also think this would be a great addition to clojure-contrib.
Me too. But who decides what goes into clojure-contrib? Rich?
Post by jim
Because of the way most monad tutorials are written, monads seem to be
pretty hard to get your head around. Also, many of the reasons for
the standard monads in Haskell don't exist in impure functional
languages like Clojure. So there's less motivation to understand
them. But I found that once I understood them, they are a powerful
addition to my conceptual toolbox.
I agree. I see monads as the functional equivalent to aspect-oriented
programming: a way to implement separation of concerns.

I also think that some aspects of monads are clearer in Clojure than
they are in Haskell. Haskell's way to implement monads as data types
has some practical advantages, but it also obscures the algorithmic
nature of monads a bit. Moreover, it makes some things impossible,
for example executing a single piece of code under different monads
(easy in Clojure by having the monad as a variable), which is quite
handy sometimes, e.g. for debugging. I also prefer monad transformers
implemented as functions to monad transformers implemented as pretty
complicated abstract data types with boilerplate code to get data in
and out. In the long run, we should have a monad tutorial for
Clojure, rather then let everyone learn Haskell first.

Konrad.
lpetit
2008-12-23 12:29:11 UTC
Permalink
[ ... ] In the long run, we should have a monad tutorial for  
Clojure, rather then let everyone learn Haskell first.
+1 on this !
Konrad.
jim
2008-12-23 15:18:50 UTC
Permalink
Definitely agree on the monad transformers. Haskell code can be very
succinct, but it requires a particular perspective. I'm working
towards a monad tutorial for Clojure using the intro I put in my
monads implementation as a starting point. I've got quite a bit of
work before I get to that point, though.

Jim
I also think that some aspects of monads are clearer in Clojure than  
they are in Haskell. Haskell's way to implement monads as data types  
has some practical advantages, but it also obscures the algorithmic  
nature of monads a bit. Moreover, it makes some things impossible,  
for example executing a single piece of code under different monads  
(easy in Clojure by having the monad as a variable), which is quite  
handy sometimes, e.g. for debugging. I also prefer monad transformers  
implemented as functions to monad transformers implemented as pretty  
complicated abstract data types with boilerplate code to get data in  
and out. In the long run, we should have a monad tutorial for  
Clojure, rather then let everyone learn Haskell first.
Continue reading on narkive:
Loading...