summaryrefslogtreecommitdiff
path: root/src/core_print.sml
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2008-07-17 10:23:04 -0400
committerGravatar Adam Chlipala <adamc@hcoop.net>2008-07-17 10:23:04 -0400
commite3313edc92a73932ff57b1c803fe7e408283406f (patch)
tree285b8ca2c5c71dfb0c48b0b8e56727cf37592129 /src/core_print.sml
parent1e03bdf0b6f423870abcf5e54ae7f2bdf08e3e49 (diff)
Corifying (non-mutual) 'val rec'
Diffstat (limited to 'src/core_print.sml')
-rw-r--r--src/core_print.sml52
1 files changed, 32 insertions, 20 deletions
diff --git a/src/core_print.sml b/src/core_print.sml
index 60ad619f..3436d313 100644
--- a/src/core_print.sml
+++ b/src/core_print.sml
@@ -240,7 +240,31 @@ fun p_exp' par env (e, _) =
and p_exp env = p_exp' false env
-fun p_decl env ((d, _) : decl) =
+fun p_vali env (x, n, t, e, s) =
+ let
+ val xp = if !debug then
+ box [string x,
+ string "__",
+ string (Int.toString n)]
+ else
+ string x
+ in
+ box [xp,
+ space,
+ string "as",
+ space,
+ string s,
+ space,
+ string ":",
+ space,
+ p_con env t,
+ space,
+ string "=",
+ space,
+ p_exp env e]
+ end
+
+fun p_decl env (dAll as (d, _) : decl) =
case d of
DCon (x, n, k, c) =>
let
@@ -263,30 +287,18 @@ fun p_decl env ((d, _) : decl) =
space,
p_con env c]
end
- | DVal (x, n, t, e, s) =>
+ | DVal vi => box [string "val",
+ space,
+ p_vali env vi]
+ | DValRec vis =>
let
- val xp = if !debug then
- box [string x,
- string "__",
- string (Int.toString n)]
- else
- string x
+ val env = E.declBinds env dAll
in
box [string "val",
space,
- xp,
- space,
- string "as",
- space,
- string s,
- space,
- string ":",
- space,
- p_con env t,
- space,
- string "=",
+ string "rec",
space,
- p_exp env e]
+ p_list_sep (box [newline, string "and", space]) (p_vali env) vis]
end
| DExport n => box [string "export",
space,