[[project @ 2001-11-13 03:28:03 by chak] chak**20011113032803 A little more info about type checking ] { hunk ./ghc/docs/comm/the-beast/typecheck.html 14 + GHC type checks programs in their original Haskell form before the + desugarer converts them into Core code. This complicates the type + checker as it has to handle the much more verbose Haskell AST, but it + improves error messages, as the those message are based on the same + structure that the user sees. +
+ GHC defines the abstract syntax of Haskell programs in HsSyn
+ using a structure that abstracts over the concrete representation of
+ bound occurences of identifiers and patterns. The module TcHsSyn
+ instantiates this structure for the type checker using TcEnv
.TcId
+ to represent identifiers - in fact, a TcId
is currently
+ nothing but just a synonym for a plain
+ Id
.
+
+
+ During type checking type variables are represented by mutable variables
+ - cf. the variable story. Consequently,
+ unification can instantiate type variables by updating those mutable
+ variables. This process of instantiation is (for reasons that elude
+ me) called zonking
+ in GHC's sources. The zonking routines for the various forms of Haskell
+ constructs are responsible for most of the code in the module TcHsSyn
,
+ whereas the routines that actually operate on mutable types are defined
+ in TcMTypes
;
+ this includes routines to create mutable structures and update them as
+ well as routines that check constraints, such as that type variables in
+ function signatures have not been instantiated during type checking.
+ The actual type unification routine is uTys
in the same
+ module.
+
+ All type variables that may be instantiated (those in signatures
+ may not), but haven't been instantiated during type checking, are zonked
+ to ()
, so that after type checking all mutable variables
+ have been eliminated.
hunk ./ghc/docs/comm/the-beast/typecheck.html 133
-Last modified: Wed Aug 8 19:24:09 EST 2001
+Last modified: Tue Nov 13 14:28:44 EST 2001
hunk ./ghc/docs/comm/the-beast/vars.html 77
+
hunk ./ghc/docs/comm/the-beast/vars.html 79
-
+
+
hunk ./ghc/docs/comm/the-beast/vars.html 229 -Last modified: Wed Aug 8 19:23:01 EST 2001 +Last modified: Tue Nov 13 14:11:35 EST 2001 }