Mercurial > urweb
comparison 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 |
comparison
equal
deleted
inserted
replaced
162:06a98129b23f | 163:80192edca30d |
---|---|
288 fun p_export_kind ck = | 288 fun p_export_kind ck = |
289 case ck of | 289 case ck of |
290 Link => string "link" | 290 Link => string "link" |
291 | Action => string "action" | 291 | Action => string "action" |
292 | 292 |
293 fun p_datatype env (x, n, cons) = | |
294 let | |
295 val env = E.pushCNamed env x n (KType, ErrorMsg.dummySpan) NONE | |
296 in | |
297 box [string "datatype", | |
298 space, | |
299 string x, | |
300 space, | |
301 string "=", | |
302 space, | |
303 p_list_sep (box [space, string "|", space]) | |
304 (fn (x, n, NONE) => if !debug then (string (x ^ "__" ^ Int.toString n)) | |
305 else string x | |
306 | (x, _, SOME t) => box [if !debug then (string (x ^ "__" ^ Int.toString n)) | |
307 else string x, space, string "of", space, p_con env t]) | |
308 cons] | |
309 end | |
310 | |
293 fun p_decl env (dAll as (d, _) : decl) = | 311 fun p_decl env (dAll as (d, _) : decl) = |
294 case d of | 312 case d of |
295 DCon (x, n, k, c) => | 313 DCon (x, n, k, c) => |
296 let | 314 let |
297 val xp = if !debug then | 315 val xp = if !debug then |
311 space, | 329 space, |
312 string "=", | 330 string "=", |
313 space, | 331 space, |
314 p_con env c] | 332 p_con env c] |
315 end | 333 end |
334 | DDatatype x => p_datatype env x | |
316 | DVal vi => box [string "val", | 335 | DVal vi => box [string "val", |
317 space, | 336 space, |
318 p_vali env vi] | 337 p_vali env vi] |
319 | DValRec vis => | 338 | DValRec vis => |
320 let | 339 let |