[Haskell-beginners] Re: monad nomad gonad gomad

John Obbele john.obbele at gmail.com
Tue Aug 17 18:26:21 EDT 2010


On Tue, Aug 17, 2010 at 01:59:44PM -0700, prad wrote:
> On Tue, 17 Aug 2010 13:34:01 -0700
> Michael Mossey <mpm at alumni.caltech.edu> wrote:
> 
> > It looks to me like you need to work 
> > through a book like "Real World Haskell" sequentially from the
> > beginning.
> >
> well i'm doing that too, michael. (i remember you made this
> suggestion to me several weeks ago and i have worked my way
> through a few chapters in rw and most of the haskell wiki
> tutorial). 

Well, I may not help you, Prad, but the enormous amount of
questions you've send to this mailing-list have helped me to
re-discover many basic concepts of Haskell ,-)

I am also trying to learn it since last January. So I can add
this piece of advice for you : do not rush things. It seems you
are reading too many different contents on monads lately. That's
strange for someone as lazy as me who cannot digest this much
amount of data in such a short time.

I usually evaluate my time spend on a specific subject as the
number of nights spend between each of my readings and I can say
this: monads have taken me a good month of sleep to figure them
out :)

> what i find interesting is that you say what i'm trying to do here is
> complicated, because it seemed to me it was one of the simpler things
> that i actually understood. now i think i'm in trouble, because
> evidently i haven't understood it too well. :D

No it's not simple. I am not able to read Haskell code which play
with database and files, so your code is already behind my
understanding.

> it seemed to me that in one situation i was trying to get data from a
> function gt which just returns a string:
> gt :: String -> String
> 
> in the other situation, i wanted to get the same data from a file, but
> can't seem to because the file is returning an IO instead of a String
> (in fact it is expecting [String]).

>From what I remember, RWH's authors always advocate to
separate monadic code from basic code. You should pause for a
moment and refactor your code so you do not get caught in this
situation again (situation = trying to read a file as you read a
String).

If I were you, I would break my problem in even smaller chunks
and try to analyze patiently how Haskell could process each
individually.

regards,
/John

P.S.: ah ! and keep posting questions on precise problems you
encounter. I may be interested in them :p


More information about the Beginners mailing list