comparison src/source_print.sml @ 623:588b9d16b00a

Start of kind polymorphism, up to the point where demo/hello elaborates with updated Basis/Top
author Adam Chlipala <adamc@hcoop.net>
date Sun, 22 Feb 2009 16:10:25 -0500
parents 8998114760c1
children 12b73f3c108e
comparison
equal deleted inserted replaced
622:d64533157f40 623:588b9d16b00a
48 | KWild => string "_" 48 | KWild => string "_"
49 | KTuple ks => box [string "(", 49 | KTuple ks => box [string "(",
50 p_list_sep (box [space, string "*", space]) p_kind ks, 50 p_list_sep (box [space, string "*", space]) p_kind ks,
51 string ")"] 51 string ")"]
52 52
53 | KVar x => string x
54 | KFun (x, k) => box [string x,
55 space,
56 string "-->",
57 space,
58 p_kind k]
59
53 and p_kind k = p_kind' false k 60 and p_kind k = p_kind' false k
54 61
55 fun p_explicitness e = 62 fun p_explicitness e =
56 case e of 63 case e of
57 Explicit => string "::" 64 Explicit => string "::"
154 p_list p_con cs, 161 p_list p_con cs,
155 string ")"] 162 string ")"]
156 | CProj (c, n) => box [p_con c, 163 | CProj (c, n) => box [p_con c,
157 string ".", 164 string ".",
158 string (Int.toString n)] 165 string (Int.toString n)]
166
167 | CKAbs (x, c) => box [string x,
168 space,
169 string "==>",
170 space,
171 p_con c]
172 | TKFun (x, c) => box [string x,
173 space,
174 string "-->",
175 space,
176 p_con c]
159 177
160 and p_con c = p_con' false c 178 and p_con c = p_con' false c
161 179
162 and p_name (all as (c, _)) = 180 and p_name (all as (c, _)) =
163 case c of 181 case c of
271 | ECutMulti (e, c) => parenIf par (box [p_exp' true e, 289 | ECutMulti (e, c) => parenIf par (box [p_exp' true e,
272 space, 290 space,
273 string "---", 291 string "---",
274 space, 292 space,
275 p_con' true c]) 293 p_con' true c])
276 | EFold => string "fold"
277
278 | ECase (e, pes) => parenIf par (box [string "case", 294 | ECase (e, pes) => parenIf par (box [string "case",
279 space, 295 space,
280 p_exp e, 296 p_exp e,
281 space, 297 space,
282 string "of", 298 string "of",
297 string "in", 313 string "in",
298 newline, 314 newline,
299 box [p_exp e], 315 box [p_exp e],
300 newline, 316 newline,
301 string "end"] 317 string "end"]
318
319 | EKAbs (x, e) => box [string x,
320 space,
321 string "-->",
322 space,
323 p_exp e]
302 324
303 and p_exp e = p_exp' false e 325 and p_exp e = p_exp' false e
304 326
305 and p_edecl (d, _) = 327 and p_edecl (d, _) =
306 case d of 328 case d of