@@ -208,11 +208,11 @@ Context
208
208
209
209
The typing context or environment is the central container around which all
210
210
information during the inference process is stored and queried. In Haskell our
211
- implementation will simply be a newtype wrapper around a Map of ``Var `` to
211
+ implementation will simply be a newtype wrapper around a Map of ``Name `` to
212
212
``Scheme `` types.
213
213
214
214
```haskell
215
- newtype TypeEnv = TypeEnv (Map. Map Var Scheme )
215
+ newtype TypeEnv = TypeEnv (Map. Map Name Scheme )
216
216
```
217
217
218
218
The two primary operations are * extension* and * restriction* which introduce or
@@ -230,7 +230,7 @@ Operations over the context are simply the usual Set operations on the
230
230
underlying map .
231
231
232
232
```haskell
233
- extend :: TypeEnv -> (Var , Scheme ) -> TypeEnv
233
+ extend :: TypeEnv -> (Name , Scheme ) -> TypeEnv
234
234
extend (TypeEnv env) (x, s) = TypeEnv $ Map. insert x s env
235
235
```
236
236
@@ -648,11 +648,11 @@ context.
648
648
Var x -> lookupEnv env x
649
649
```
650
650
651
- The function `` lookupVar `` looks up the local variable reference in typing
651
+ The function `` lookupEnv `` looks up the local variable reference in typing
652
652
environment and if found it instantiates a fresh copy.
653
653
654
654
``` haskell
655
- lookupEnv :: TypeEnv -> Var -> Infer (Subst , Type )
655
+ lookupEnv :: TypeEnv -> Name -> Infer (Subst , Type )
656
656
lookupEnv (TypeEnv env) x = do
657
657
case Map. lookup x env of
658
658
Nothing -> throwError $ UnboundVariable (show x)
0 commit comments