[Haskell-beginners] Re: Is Haskell for me?

Cory Knapp thestonetable at gmail.com
Fri Nov 6 11:52:48 EST 2009

I'm certainly not an expert on Haskell, and my studies over the last 
year have prevented me from really working in Haskell (or any language) 
much, but...

Maurí­cio CA wrote:
> > - how could I program something like this in Haskell: ..
> > generate random population
> Since Haskell is a "pure" language, after you attribute a value
> to a variable they are glued together forever. So, the language
> itself can't have such a thing as a random number. (Here, someone
> with technical knowledge will probably correct me, but you get
> the poing.) Dealing with this (and other "outside world" stuff)
> requires learning how to deal with a special type construct
> called "Monad". It's the major step you will have to as a Haskell
> begginer. It's, though, extremely interesting, and extremely
> powerfull after you understand it.
I don't think you need that deep of an understanding of monads in order 
to write random code. You need a basic understanding of "monads as 
computations", and you need to know how to use do notation, which should 
feel very much like programming in an imperative language.
On the other hand, the rest of the algorithm Luis mentioned is *very* 
natural in Haskell once you learn how to deal with lists.
> > - Although I always liked math, I no longer have the knowledge
> > I used to have several years ago. Is this important to help
> > program in this funcional language?
> No. But if you like math, you're probably going to find links to
> really interesting math while you learn.
I Definitely agree. Being a math student, one of the things I like about 
Haskell is how it's a "down to earth" example of some very high level 
concepts showing up-- without necessarily needing to learn all the math 
that's there. (I spend more time learning the math than the Haskell, but 
that's a result of my biases, not need.)

Now, your other (related) questions:

- Is Haskell suitable to process data like this in a fast way
(aproximate to C++?)

- In order for Haskell to be fast, coding is done in a 'natural' way
or with use of special hidden details of the language?

Idiomatic Haskell won't be as fast as idiomatic C++, but it will blow Python away. Since I assume you'll be working with large data sets, lazy evaluation may actually make your life much easier. If you really are pushing for lightening fast code, you can do some Don Stewart style hacking, or you can link to C using the foreign function interface. I have no experience with either, but I've heard nothing but the best about Haskell/C interaction.


More information about the Beginners mailing list