ref: 31a31e35a8e5794334744e1b00b1702115bba92a
parent: d590c0ffeda4c86318032a6f0bf573029cebfb39
author: Lennart Augustsson <lennart.augustsson@epicgames.com>
date: Sun Oct 15 18:49:38 EDT 2023
More comments
--- a/src/MicroHs/TypeCheck.hs
+++ b/src/MicroHs/TypeCheck.hs
@@ -28,26 +28,34 @@
a -- bindings
--Xderiving (Show)
-data TypeExport = TypeExport Ident Entry [ValueExport]
+data TypeExport = TypeExport
+ Ident -- unqualified name
+ Entry -- symbol table entry
+ [ValueExport] -- associated values, i.e., constructors, selectors, methods
--Xderiving (Show)
-data ValueExport = ValueExport Ident Entry
+data ValueExport = ValueExport
+ Ident -- unqualified name
+ Entry -- symbol table entry
--Xderiving (Show)
type FixDef = (Ident, Fixity)
type SynDef = (Ident, EType)
-data Entry = Entry Expr EType
+-- Symbol table entry for symbol i.
+data Entry = Entry
+ Expr -- convert (EVar i) to this expression; sometimes just (EVar i)
+ EType -- type/kind of identifier
--Xderiving(Show)
entryType :: Entry -> EType
entryType (Entry _ t) = t
-type ValueTable = M.Map [Entry]
-type TypeTable = M.Map [Entry]
-type KindTable = M.Map [Entry]
-type SynTable = M.Map EType
-type FixTable = M.Map Fixity
+type ValueTable = M.Map [Entry] -- type of value identifiers, used during type checking values
+type TypeTable = M.Map [Entry] -- kind of type identifiers, used during kind checking types
+type KindTable = M.Map [Entry] -- sort of kind identifiers, used during sort checking kinds
+type SynTable = M.Map EType -- body of type synonyms
+type FixTable = M.Map Fixity -- precedence and associativity of operators
type Sigma = EType
--type Tau = EType
--
⑨