haskell-platformtemplate-haskellhaskellhaskell-mode

Directed Graph in Haskell


I am now struggling with Haskell. Even, I have some experience with imperative languages, with OOP, but Haskell seems to be different from them. I under-evaluated Haskell, and think learning a new language is not a problem with me. However, after spending a whole week with many new concepts (typeclass, functors, applicative, monoids, monads... reading all 14 chapters from this learnyouahaskell), I noticed that they make me so confused, don't know how to start writing a programme with Haskell. Some experts say that it take you a few months to master Haskell. But I have only two weeks to finish a big project.

1) So my first question is how to learn Haskell

2) When I need to use applicative functors, and when I need to use monads?

3) My project is to handle with directed graph based on many presentations:

I am quite a Haskell newbie, so don't know where I can start with directed graph in Haskell? Do you have any suggestion?


Solution

  • To answer your first question (how to learn Haskell), I'd say that you need to actually code in it. It sounds like you read the many chapters of Learn You A Haskell, but they made your head swim. Go a little slower, and -- more importantly -- follow along, by typing and evaluating the code. You say that you "don't know where to start writing a program in Haskell." The practice of actually writing and executing the examples will be exactly what you need to get a feel for how the code works, and where to start.

    You're probably not quite prepared for the answer to your second question (when to use Monad and when to use Applicative) -- work through LYAH, though, and you'll definitely know when to use each.

    As far as directed graphs specifically, this is a good resource (the Amazon reviews aren't very good, but I think it's a great introduction to the concepts of graphs and abstract data types in Haskell).

    Good luck - Haskell is well worth the struggle!