Mercurial > urweb
comparison src/expl_print.sml @ 124:541282b81454
Explifying (non-mutual) 'val rec'
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Thu, 17 Jul 2008 10:13:18 -0400 |
parents | 813e5a52063d |
children | 80ac94b54e41 |
comparison
equal
deleted
inserted
replaced
123:e3041657d653 | 124:541282b81454 |
---|---|
343 m1x | 343 m1x |
344 in | 344 in |
345 p_list_sep (string ".") string (m1x :: ms @ [x]) | 345 p_list_sep (string ".") string (m1x :: ms @ [x]) |
346 end | 346 end |
347 | 347 |
348 fun p_decl env ((d, _) : decl) = | 348 fun p_vali env (x, n, t, e) = box [p_named x n, |
349 space, | |
350 string ":", | |
351 space, | |
352 p_con env t, | |
353 space, | |
354 string "=", | |
355 space, | |
356 p_exp env e] | |
357 | |
358 fun p_decl env (dAll as (d, _) : decl) = | |
349 case d of | 359 case d of |
350 DCon (x, n, k, c) => box [string "con", | 360 DCon (x, n, k, c) => box [string "con", |
351 space, | 361 space, |
352 p_named x n, | 362 p_named x n, |
353 space, | 363 space, |
356 p_kind k, | 366 p_kind k, |
357 space, | 367 space, |
358 string "=", | 368 string "=", |
359 space, | 369 space, |
360 p_con env c] | 370 p_con env c] |
361 | DVal (x, n, t, e) => box [string "val", | 371 | DVal vi => box [string "val", |
362 space, | 372 space, |
363 p_named x n, | 373 p_vali env vi] |
364 space, | 374 | DValRec vis => |
365 string ":", | 375 let |
366 space, | 376 val env = E.declBinds env dAll |
367 p_con env t, | 377 in |
368 space, | 378 box [string "val", |
369 string "=", | 379 space, |
370 space, | 380 string "rec", |
371 p_exp env e] | 381 space, |
382 p_list_sep (box [newline, string "and", space]) (p_vali env) vis] | |
383 end | |
372 | 384 |
373 | DSgn (x, n, sgn) => box [string "signature", | 385 | DSgn (x, n, sgn) => box [string "signature", |
374 space, | 386 space, |
375 p_named x n, | 387 p_named x n, |
376 space, | 388 space, |