[Haskell-beginners] Is Haskell for me?

Bernhard Lehnert b.lehnert at gmx.de
Fri Nov 6 11:58:23 EST 2009


Hi!

Am Freitag, den 06.11.2009, 13:58 +0000 schrieb Luis P. Mendes:
> - Is Haskell able to read (also write to a point) data from databases
> in a fast and reliable way? (MySql or PostgreSQL)

You might want to check out these links:
http://software.complete.org/software/projects/show/hdbc
http://software.complete.org/static/hdbc-odbc/doc//HDBC-odbc/Database-HDBC-ODBC.html
http://sites.google.com/site/haskell/notes/connecting-to-mysql-with-haskell
http://www.volker-wysk.de/mysql-hs/

> - how could I program something like this in Haskell:
>     .. generate random population
>     .. for each one of the population:
>       .. for time period 1 to ten million:
>         .. evaluate method 1, 2, 3, 4, 5, 6, ....
>       ..evaluate fitness of each one
>     .. generate new population based on results of previous generation

You will have to change your thinking a lot. Forget about "for each one
of the population". Think "Map a function to the list which contains the
population". When I started I thought I knew map from Python - and in
fact I did underestimate "map" all the time in Python.
For time 1 to ten million evaluate a method? No - map "evaluate fitness"
to the list [1..10000000] (Don't worry about big numbers - it's all
lazily evaluated.
"Generate new population based on previous generation"? It's just
recursion and where will you find better recursion than in a functional
language? 


> - Are there graphical packages available to plot results or is it easy
> to connect it to a Python (or C) library?

There are some graphical packages, but if everything else fails: Do fast
computing in Haskell and plot the results using Python.


> - Is code easily reusable in different future projects?  Since it has
> no objects... how can it be done?

You do not reuse objects, you reuse functions - that's why they call it
functional and yes

> Sorry for all these questions, but I really need to know about this
> and that's why I want to read answers from knowledgeable people.

Sorry, I'm a beginner myself and would not actually call myself
"knowledgeable". However, the learning curve is steep and lots of things
that seem to be very complicated are soon very logic!

You'll need some time to get the new ideas. If you got that, it's really
worthwhile!

Greets,
Bernhard



More information about the Beginners mailing list