3 ms·
Learning functional programming is not trivial, especially if you come from the imperative paradigm. Haskell was my first language and I still struggled not to
by klrr 13y ago
Learning functional programming is not trivial, especially if you come from the imperative paradigm. Haskell was my first language and I still struggled not to think procedurally in the beginning , and the type-checker refused almost all of my programs. But after a while you start to get less and less type errors, and soon types will be your friend and guide you when writing programs.
I have to say though; static types itself doesn't prevent bugs, they only prevent common errors. But if you got an expressive type system like Haskell (or OCaml etc.) you can write well-typed programs. A great example is Yesod[0], which is a web framework completely designed around being well-typed.
0. http://www.yesodweb.com/ http://www.yesodweb.com/
EDIT: Okey, "well-typed" may not be the right term. TAPL calls every program that pass the type-checker well-typed so what I meant is programming written type-safe.
- dllthomas 13y agoIt's a matter of using the types to express meaningful constraints, so that well-typed is more likely to mean correct.