+:: Scheme = Forall [String] Type
+:: Gamma :== 'Map'.Map String Scheme
+:: Constraints :== [(Type, Type)]
+:: Infer a :== RWST Gamma Constraints [String] (Either SemError) a
+:: SemError
+ = ParseError Pos String
+ | UnifyError Pos Type Type
+ | FieldSelectorError Pos Type FieldSelector
+ | OperatorError Pos Op2 Type
+ | UndeclaredVariableError Pos String
+ | ArgumentMisMatchError Pos String
+ | Error String
+
+variableStream :: [String]
+variableStream = map toString [1..]
+
+sem :: AST -> SemOutput
+sem (AST fd) = Right (AST fd, 'Map'.newMap)
+
+instance toString Scheme where
+ toString (Forall x t) =
+ concat ["Forall ": map ((+++) "\n") x] +++ toString t
+
+instance toString Gamma where
+ toString mp =
+ concat [concat [k, ": ", toString v, "\n"]\\(k, v)<-'Map'.toList mp]
+
+instance toString SemError where
+ toString se = "SemError: "
+
+uni :: Type Type -> Infer ()
+uni t1 t2 = tell [(t1, t2)]