Mercurial > urweb
diff src/core_print.sml @ 125:fd98dd10dce7
Corifying (non-mutual) 'val rec'
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Thu, 17 Jul 2008 10:23:04 -0400 |
parents | 3739af9e727a |
children | f0d3402184d1 |
line wrap: on
line diff
--- a/src/core_print.sml Thu Jul 17 10:13:18 2008 -0400 +++ b/src/core_print.sml Thu Jul 17 10:23:04 2008 -0400 @@ -240,7 +240,31 @@ 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 @@ 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, + string "rec", space, - string "as", - space, - string s, - space, - string ":", - space, - p_con env t, - space, - string "=", - space, - p_exp env e] + p_list_sep (box [newline, string "and", space]) (p_vali env) vis] end | DExport n => box [string "export", space,