Skip to content

Commit ae73485

Browse files
authoredApr 19, 2017
Merge pull request #94 from thomwiggers/master
Use name instead of Var as type for variable names
2 parents 396a999 + 6deb35c commit ae73485

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed
 

‎006_hindley_milner.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -208,11 +208,11 @@ Context
208208

209209
The typing context or environment is the central container around which all
210210
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
212212
``Scheme`` types.
213213

214214
```haskell
215-
newtype TypeEnv = TypeEnv (Map.Map Var Scheme)
215+
newtype TypeEnv = TypeEnv (Map.Map Name Scheme)
216216
```
217217

218218
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
230230
underlying map.
231231

232232
```haskell
233-
extend :: TypeEnv -> (Var, Scheme) -> TypeEnv
233+
extend :: TypeEnv -> (Name, Scheme) -> TypeEnv
234234
extend (TypeEnv env) (x, s) = TypeEnv $ Map.insert x s env
235235
```
236236

@@ -648,11 +648,11 @@ context.
648648
Var x -> lookupEnv env x
649649
```
650650

651-
The function ``lookupVar`` looks up the local variable reference in typing
651+
The function ``lookupEnv`` looks up the local variable reference in typing
652652
environment and if found it instantiates a fresh copy.
653653

654654
```haskell
655-
lookupEnv :: TypeEnv -> Var -> Infer (Subst, Type)
655+
lookupEnv :: TypeEnv -> Name -> Infer (Subst, Type)
656656
lookupEnv (TypeEnv env) x = do
657657
case Map.lookup x env of
658658
Nothing -> throwError $ UnboundVariable (show x)

0 commit comments

Comments
 (0)
Please sign in to comment.