Notice that I worked with Haskell for some time, I developed some of my own opinions on this issue. mhwombat ScopedTypeVariables suggestion was good. These days, this is usually the first thing I type when I start writing the Haskell module. Whenever the code gets a bit complicated, I like having a lot of type signatures to help me understand what I'm doing, and this extension allows me to write those that I couldn't otherwise. It can also significantly improve type errors. It also seems almost necessary when using other type system extensions.
I didn't really appreciate GADT too much until I learned a little about dependent programming languages. Note. I find it amazing how they can serve as evidence objects and how they can be limited by type indices.
GADTa works great with DataKinds , which creates fun-type indexes such as lists and gates. Now I can do things like expressing an indexed list as long as the tree is tall, not driving myself crazy using nested types of a higher order.
So far, I have not studied multiparameter class classes and functional dependencies. However, I came to understand the Edward Kmett reflection library, which uses them in its interface.
I have learned to have a healthy respect for overlapping and incoherent instances, and I mean that I never use them. Overlapping elements are a bit like macro programming with worse error messages, and incoherent ones are insane.
RankNTypes really strong. This is one of those things that are rarely needed, but when necessary, it is really important.
source share