I would be inclined to add type annotations as an extra constructor of the expression representation type.

 data Exp
   = IntExp Integer
   | VarExp Symbol
   | AssignExp Symbol Exp
   | IfExp Exp Exp (Maybe Exp)
   | CallExp Symbol [Exp]
   | LetExp [Dec] Exp

     | Exp `HasType` Ty

This is particularly useful if the source language allows arbitrary type annotations on expressions, because it can cover both the user- supplied annotations, and the compiler-inferred ones. Also, your type inference phase is free to add as many or as few annotations into the AST as it wishes - they are not required everywhere.

Regards,
    Malcolm

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to