I started learning Haskell for the same reason that Peaker described.
From what I understand so far, Haskell is a very high level language which lets you do more with less.
One of the examples that come often is quicksort which you can write in like 3 lines:
But the thing is you still have to understand a lot of stuff before being able to use it correctly.
I think one of the most difficult (and interesting) topic would be monads, there are tons of tutorials online if you're interested on reading on it.
It's not a quicksort. It's a quasi-quicksort, which is actually not quick due to memory allocations.
Here's how quicksort looks like in haskell:
import Data.Vector.Generic
import qualified Data.Vector.Generic.Mutable as M
iqsort :: (Vector v a, Ord a) => v a -> v a
iqsort = modify go where
go xs | len < 2 = return ()
| otherwise = do
p <- xs `M.read` (len `div` 2)
m <- M.unstablePartition (< p) xs
go $ M.slice 0 m xs
go $ M.slice (m+1) (len-m-1) xs
where len = M.length xs
One of the examples that come often is quicksort which you can write in like 3 lines:
quicksort (p:xs) = (quicksort lesser) ++ [p] ++ (quicksort greater) where lesser = filter (< p) xs greater = filter (>= p) xs
But the thing is you still have to understand a lot of stuff before being able to use it correctly. I think one of the most difficult (and interesting) topic would be monads, there are tons of tutorials online if you're interested on reading on it.