I realized that learning functional programming has given more tools to elegantly and concisely compose my programs that are correct. I noticed this when I was reviewing my old algorithms book. The algorithms that they provided are written in a somewhat ugly way where you have to do a lot of imperative pointer manipulation and there is an excessive use of sentinel values. For example, you have to compare pointer addresses in the book to determine the left child of binary tree node. Rather than doing this, you can simply use pattern-matching.
I noticed that you can rewrite these algorithms in a much more elegant, type-safe and easier to understand way using tools from Haskell such as GADTs and Monads. Seeing this elegance, it has actually got me obsessed to learn more about Haskell.
I was trying to learn more of Haskell’s advanced features, but there doesn’t seem to have a definitive of guide for it. I was wondering what are some advanced features I should learn from Haskell. Namely, I am interested in learning different ways to make my code more type-safe and more cononical ways to compose my programs.
In terms of my background in functional programming, I have written professional OCaml for over a year and I have used many of the advanced features of the language, such as GADTs and developed my own ppxs.