comparison src/print.sml @ 3:daa4f1d7a663

Elaborating cons and decls
author Adam Chlipala <adamc@hcoop.net>
date Sat, 26 Jan 2008 15:26:12 -0500
parents 4202f6eda946
children 258261a53842
comparison
equal deleted inserted replaced
2:64f09f7822c3 3:daa4f1d7a663
69 [PD.string s, PD.space 1, d])) 69 [PD.string s, PD.space 1, d]))
70 70
71 val preface = fpreface out 71 val preface = fpreface out
72 val epreface = fpreface err 72 val epreface = fpreface err
73 73
74 fun fprefaces f ls = 74 fun fprefaces f s ls =
75 let
76 val len = foldl (fn ((s, _), best) =>
77 Int.max (size s, best)) 0 ls
78 in
79 fprint f (PD.string s);
80 fprint f PD.newline;
81 app (fn (s, d) =>
82 let
83 val s = CharVector.tabulate (len - size s,
84 fn _ => #" ")
85 ^ s ^ ": "
86 in
87 fpreface f (s, d)
88 end) ls
89 end
90
91 val prefaces = fprefaces out
92 val eprefaces = fprefaces err
93
94 fun fprefaces' f ls =
75 let 95 let
76 val len = foldl (fn ((s, _), best) => 96 val len = foldl (fn ((s, _), best) =>
77 Int.max (size s, best)) 0 ls 97 Int.max (size s, best)) 0 ls
78 in 98 in
79 app (fn (s, d) => 99 app (fn (s, d) =>
84 in 104 in
85 fpreface f (s, d) 105 fpreface f (s, d)
86 end) ls 106 end) ls
87 end 107 end
88 108
89 val prefaces = fprefaces out 109 val prefaces' = fprefaces' out
90 val eprefaces = fprefaces err 110 val eprefaces' = fprefaces' err
91 111
92 end 112 end