[Haskell-cafe] On the verge of ... giving up!

Felipe Lessa felipe.lessa at gmail.com
Sun Oct 14 10:58:47 EDT 2007


On 10/14/07, Vimal <j.vimal at gmail.com> wrote:
> IO isnt the only problem. Monads + how to define your own Monads etc.
> Since Monad's arent just for IO, where else could it be used? (e.g.
> Stateful functions), but is that it? Is it possible for me to come
> up with an instance of a Monad to solve _my_ problem? Thats the kind
> of question I would like to answer :)

The approach I used to fully understand monads was the same as I used
to fully understand Python's metaclasses: don't try to get into its
inner until you need. I mean, don't try to find a problem to come up
with a monad. Instead, someday you will going to solving a problem and
you'll have the idea of making "instance Monad" of it. Meanwhile
you'll get used to the language and see lots of other already-built
monads. Well, worked for me.

The beautiful thing about monads and metaclasses is that they are
extremely simple after you understand them. That's also why monads are
called Warm, fuzzy things, AFAICT =). But both don't fit everywhere,
and it requires some experience to see that.

-- 
Felipe.


More information about the Haskell-Cafe mailing list