
Actually I stopped bothering long ago about 'understanding monads'.
I think that's a shame, because when I wrote the source code myself to get
from a pure functional approach (passing the "object" from function to
function as an extra argument) to a monadic approach, it was a real eye
opener. Many of the different FP techniques, like partial
http://www.haskell.org/haskellwiki/Partial_application application,
reversed' http://www.haskell.org/haskellwiki/Parameter_order parameter
order, lambas http://www.haskell.org/haskellwiki/Anonymous_function ,
pointfree notation http://haskell.org/haskellwiki/Pointfree etc were
required to do this, which might be one of the reasons it's a bit difficult
for newbies to see how a monad is just pure FP in disguise. After cracking
the code myself, I had so much appreciation for the guys who invented this
stuff, it's really the work of a genius, at least that's the way it felt to
me. And then the math approach to abstract the whole thing into a type
class, so it can be used for many other "single-flow" (or how should I call
that?) computations,... so nice. I can't say that I can write a monad
instance myself yet without peeking in the book, but I think I would
recognize the pattern if I see code that could make use of monads (at least
the simple cases).
Now I'm figuring out arrows, and this gives me a feeling like... euh...
well... it's even more abstract, it encapsulates any kind of computation,
also the ones then can be "split into multiple branches" (okay, I should not
talk about this, I don't really get arrows yet...)
Of course, I'm a kind of guy who likes to understand the inner details
before I'm really pleased... So for Haskell, I still have a long way to go
:)
But you seem to be much further ahead than I am when it comes to *using*
monads, so your approach is probably better. Just get used to the damn
things and accept them (ouch, that feels a lot like religion...)
Cheers,
Peter
-----Original Message-----
From: dav.vire@gmail.com [mailto:dav.vire@gmail.com] On Behalf Of david48
Sent: Monday, October 15, 2007 9:15 AM
To: bf3@telenet.be
Cc: jerzy.karczmarczuk@info.unicaen.fr; haskell-cafe@haskell.org
Subject: Re: [Haskell-cafe] do
On 10/14/07, Peter Verswyvelen
If you want I can dig up my old source code where I converted a random number
generator from a purely functional approach to a monadic approach, but I'm not
sure reading it would help you, it's creating the code yourself that will be useful I
guess.
Actually I stopped bothering long ago about 'understanding monads'. After reading many blog posts, wikis, tutorials, etc, often multiple times, I developped a fuzzy idea of what you can do using monads, and that's enough for me to use monads like IO, STM, State, Parsec, etc. without too much problems. I use haskell to solve many little problems in my job and I'm damned sad that I can't use it for larger projects. I feel I'm still a long way from identifying a situation where I would need to write my own monad, and be able to do it, but by the time such situation arises, I don't think it'd be too much a problem. That being said, I plead guilty of not provinding feeback where I found the doc lacking. I have no excuse.