GHCi helps those who help themselves
On September 17, I presented a workshopYou can read the workshop description here. at LambdaWorld SeattleLambdaWorld Seattle is a wonderful conference at a great venue. about talking to your compiler. My goal was to make the relationship with GHC seem more like a dialogue, in which you the programmer can ask for help that GHC attempts to provide.
In truth, we were mostly working with an interpreter: GHCi. GHCi provides the type inference and type checking abilities of GHC but in an environment that makes dialoguing more effective. It can provide rapid feedback and has some commands and tools built for it and on top of it that can really help you understand what you’re doing.
Topics covered (with links to the corresponding Type Classes articles):
- querying types, type defaults, and the order of type arguments;
- using visible type applications in the REPL;
- how to read GHCi’s warning and “error” messages;
ScopedTypeVariablesto annotate sub-expressions;
- what “rigid type variables” are;
- using typed holes;
- how and why to use
ScopedTypeVariables, typed holes, and partial type signatures to help you understand new things, such as a new library.
We haven’t written the pages yet for everything that I covered, but we’re working on finishing those up as quickly as possible. While most of these pages will have video supplements to demonstrate techniques (and explain GHCi’s messages), we are also considering turning the workshop into a short course.