Learning Haskell
Haskell has been on my to-learn list for a long time, I was interested in a different approach to functional programming than LISP, and was ready to give strong typing a chance. I was also tired of building things every month and decided to take my time and focus on input, rather than output.
I took 15-45 minutes every day to read through "Learn You a Haskell for Great Good" ↗ (free to read online). I was taking notes as I go, and pushed them to online repo: szymonkaliski/haskell-playground ↗
First impressions
Setup was extremely simple, I didn't need anything special besides brew install ghc.
vim already supports Haskell, so when compared to Reason (another language I tried out recently), the setup was much easier.
I enjoyed working with ghci REPL similarly to how I like to work with Clojure — in split view with my editor, executing code piece by piece.
"Learn You a Haskell" was a very nice introduction to the language, and as far as I understand it coveres all the basis.
What I enjoyed about the language so far:
- How terse it is — there's a lot of strange symbols
::,(\,>>=, but syntax itself is quite simple, functions usually are very short, but that doesn't come in hand with them being simple to understand (at least from my newbie perspective) - Immutability — I try to write most of my code in a functional and immutable fashion, but having it be enforced by a language, and not a programmer, is a great feature
- Types — I usually prefer non-typed languages, but Haskell's type system is really interesting, and type annotations are very helpful in trying to understand what functions do; I'm still fuzzy on some details, and plan on doing a bit more reading on type classes
What I didn't enjoy that much:
- Nomenclature — "applicative", "functor", "monoid", "monad"..., some of the concepts behind the names seem easy, some seem hard, but trying to understand some explanation filled with those cryptic names can lead to a headache
- There's only a few longer examples in the book, so I haven't actually written that much code yet, but I plan on spending next month exploring some popular libraries (Tidal and Haskell's OpenGL bindings if I get them to work)
Fin.
I doubt if I'll ever get paid to write Haskell, but I'm sure this month wasn't wasted, I learned a few new concepts and looked at things from new perspective which is always a big win.
I'm curious to see how different libraries utilise Haskell type system and how working with bigger pieces of code looks like.