summaryrefslogtreecommitdiff
path: root/src/core_print.sml
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2008-07-29 13:16:21 -0400
committerGravatar Adam Chlipala <adamc@hcoop.net>2008-07-29 13:16:21 -0400
commit4b511aa7ed5b36cb0a9adb898f881d6db0a89996 (patch)
tree116bd8e11b341df6999ea79432cb4386a48ca9fc /src/core_print.sml
parent4cbbb0bb751dd9e9dae9d6b621e563ee5c7ae1b4 (diff)
Datatypes through corify
Diffstat (limited to 'src/core_print.sml')
-rw-r--r--src/core_print.sml19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/core_print.sml b/src/core_print.sml
index 364f9c06..28080bfa 100644
--- a/src/core_print.sml
+++ b/src/core_print.sml
@@ -290,6 +290,24 @@ fun p_export_kind ck =
Link => string "link"
| Action => string "action"
+fun p_datatype env (x, n, cons) =
+ let
+ val env = E.pushCNamed env x n (KType, ErrorMsg.dummySpan) NONE
+ in
+ box [string "datatype",
+ space,
+ string x,
+ space,
+ string "=",
+ space,
+ p_list_sep (box [space, string "|", space])
+ (fn (x, n, NONE) => if !debug then (string (x ^ "__" ^ Int.toString n))
+ else string x
+ | (x, _, SOME t) => box [if !debug then (string (x ^ "__" ^ Int.toString n))
+ else string x, space, string "of", space, p_con env t])
+ cons]
+ end
+
fun p_decl env (dAll as (d, _) : decl) =
case d of
DCon (x, n, k, c) =>
@@ -313,6 +331,7 @@ fun p_decl env (dAll as (d, _) : decl) =
space,
p_con env c]
end
+ | DDatatype x => p_datatype env x
| DVal vi => box [string "val",
space,
p_vali env vi]