GHCi helps those who help themselves
On September 17, I presented a workshop You can read the workshop description here. at LambdaWorld Seattle LambdaWorld 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;
- using
ScopedTypeVariables
to annotate sub-expressions; - explicit
forall
s; - what “rigid type variables” are;
- using typed holes;
- the
PartialTypeSignatures
andNamedWildCards
extensions; - how and why to use
ghcid
; - combining
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.
Also this week, we’re releasing one of my labors of love: an article explaining how a funny bit of JavaScript is different from the Haskell version, how it can be translated into Haskell, and how maybe neither language has got it quite right yet.