comparison src/core_print.sml @ 125:fd98dd10dce7

Corifying (non-mutual) 'val rec'
author Adam Chlipala <adamc@hcoop.net>
date Thu, 17 Jul 2008 10:23:04 -0400
parents 3739af9e727a
children f0d3402184d1
comparison
equal deleted inserted replaced
124:541282b81454 125:fd98dd10dce7
238 p_exp env e]) es, 238 p_exp env e]) es,
239 string ")"] 239 string ")"]
240 240
241 and p_exp env = p_exp' false env 241 and p_exp env = p_exp' false env
242 242
243 fun p_decl env ((d, _) : decl) = 243 fun p_vali env (x, n, t, e, s) =
244 let
245 val xp = if !debug then
246 box [string x,
247 string "__",
248 string (Int.toString n)]
249 else
250 string x
251 in
252 box [xp,
253 space,
254 string "as",
255 space,
256 string s,
257 space,
258 string ":",
259 space,
260 p_con env t,
261 space,
262 string "=",
263 space,
264 p_exp env e]
265 end
266
267 fun p_decl env (dAll as (d, _) : decl) =
244 case d of 268 case d of
245 DCon (x, n, k, c) => 269 DCon (x, n, k, c) =>
246 let 270 let
247 val xp = if !debug then 271 val xp = if !debug then
248 box [string x, 272 box [string x,
261 space, 285 space,
262 string "=", 286 string "=",
263 space, 287 space,
264 p_con env c] 288 p_con env c]
265 end 289 end
266 | DVal (x, n, t, e, s) => 290 | DVal vi => box [string "val",
291 space,
292 p_vali env vi]
293 | DValRec vis =>
267 let 294 let
268 val xp = if !debug then 295 val env = E.declBinds env dAll
269 box [string x,
270 string "__",
271 string (Int.toString n)]
272 else
273 string x
274 in 296 in
275 box [string "val", 297 box [string "val",
276 space, 298 space,
277 xp, 299 string "rec",
278 space, 300 space,
279 string "as", 301 p_list_sep (box [newline, string "and", space]) (p_vali env) vis]
280 space,
281 string s,
282 space,
283 string ":",
284 space,
285 p_con env t,
286 space,
287 string "=",
288 space,
289 p_exp env e]
290 end 302 end
291 | DExport n => box [string "export", 303 | DExport n => box [string "export",
292 space, 304 space,
293 p_enamed env n] 305 p_enamed env n]
294 306