3 ms·
I felt the same for a long time. At first glance something like import Text.Printf main :: IO () main = do age <- readLn print (fo
by Tarean 9y ago
I felt the same for a long time. At first glance something like
import Text.Printf
main :: IO ()
main = do
age <- readLn
print (formatAge age)
formatAge :: Int -> String
formatAge age = printf "What, you are %d years old?!?!?! Wow, you are old" age
might look nice and imperative. But then you realize it is just syntactic sugar for `main = readLn >>= printf ...`, which is incredibly confusing when coming from another language. And then you learn that libraries can just invent their own meanings for `>>=` as long as the type signatures match and all bets are off.
The upshot of this is that the code like the one above is easy to test and could be async or parallelized without issue. The downside is that people usually fail several times before finally getting it.
The haskell book[1] is apparently really helpful with this but it also costs 60$ and is over a thousand pages so it's a pretty large investment in both time and money.
[1]: http://haskellbook.com/ http://haskellbook.com/
- krylon 9y ago> The haskell book[1] is apparently really helpful with this but it also costs 60$ and is over a thousand pages so it's a pretty large investment in both time and money. For a really good book on programming, I'll happily pay 60 bucks. I will put that on my Christmas wish list, and give it another try next year.