Mercurial > urweb
diff src/core_print.sml @ 163:80192edca30d
Datatypes through corify
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Tue, 29 Jul 2008 13:16:21 -0400 |
parents | 7420fa18d657 |
children | 5d030ee143e2 |
line wrap: on
line diff
--- a/src/core_print.sml Tue Jul 29 12:30:04 2008 -0400 +++ b/src/core_print.sml Tue Jul 29 13:16:21 2008 -0400 @@ -290,6 +290,24 @@ 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 @@ space, p_con env c] end + | DDatatype x => p_datatype env x | DVal vi => box [string "val", space, p_vali env vi]