Commit 4b258941 by Mark Cohen

compiler: remove references to predicated types for now

parent 439f1069
Showing with 5 additions and 6 deletions
structure TyScheme: sig
type tyScheme = {sigmas: string list, rhos: (string * Ty.ty) list, tau: Ty.ty}
type tyScheme = {sigmas: string list, tau: Ty.ty}
val generalize: Ty.ty -> tyScheme
......@@ -10,7 +10,7 @@ structure TyScheme: sig
end = struct
type tyScheme = {sigmas: string list, rhos: (string * Ty.ty) list, tau: Ty.ty}
type tyScheme = {sigmas: string list, tau: Ty.ty}
local open Ty in
fun freeVars' (Unit | Bool | Int) = []
......@@ -28,16 +28,15 @@ end = struct
val freeVars = dedup o freeVars'
fun generalize ty =
{sigmas = freeVars ty, rhos = [], tau = ty}
{sigmas = freeVars ty, tau = ty}
fun instantiate {sigmas = sigmas, rhos = _, tau = ty} =
fun instantiate {sigmas = sigmas, tau = ty} =
foldl (fn (a, inner) => Unify.subst (Ty.freshTyVar ()) a inner) ty sigmas
local open Utils in
fun untyScheme {sigmas = sigmas, rhos = rhos, tau = ty} =
fun untyScheme {sigmas = sigmas, tau = ty} =
cat (
(map (fn a => cat ["\\/", a, "."]) sigmas) @
(map (fn (x, t) => (paren o spc) [x, "::", Ty.unty t]) rhos) @
[Ty.unty ty]
)
end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment