comparison src/core_print.sml @ 188:8e9f97508f0d

Datatype representation optimization
author Adam Chlipala <adamc@hcoop.net>
date Sun, 03 Aug 2008 19:49:21 -0400
parents 88d46972de53
children 9bbf4d383381
comparison
equal deleted inserted replaced
187:fb6ed259f5bd 188:8e9f97508f0d
171 fun p_pat' par env (p, _) = 171 fun p_pat' par env (p, _) =
172 case p of 172 case p of
173 PWild => string "_" 173 PWild => string "_"
174 | PVar (s, _) => string s 174 | PVar (s, _) => string s
175 | PPrim p => Prim.p_t p 175 | PPrim p => Prim.p_t p
176 | PCon (n, NONE) => p_patCon env n 176 | PCon (_, n, NONE) => p_patCon env n
177 | PCon (n, SOME p) => parenIf par (box [p_patCon env n, 177 | PCon (_,n, SOME p) => parenIf par (box [p_patCon env n,
178 space, 178 space,
179 p_pat' true env p]) 179 p_pat' true env p])
180 | PRecord xps => 180 | PRecord xps =>
181 box [string "{", 181 box [string "{",
182 p_list_sep (box [string ",", space]) (fn (x, p, _) => 182 p_list_sep (box [string ",", space]) (fn (x, p, _) =>
183 box [string x, 183 box [string x,
184 space, 184 space,
197 string (#1 (E.lookupERel env n) ^ "_" ^ Int.toString n) 197 string (#1 (E.lookupERel env n) ^ "_" ^ Int.toString n)
198 else 198 else
199 string (#1 (E.lookupERel env n))) 199 string (#1 (E.lookupERel env n)))
200 handle E.UnboundRel _ => string ("UNBOUND_" ^ Int.toString n)) 200 handle E.UnboundRel _ => string ("UNBOUND_" ^ Int.toString n))
201 | ENamed n => p_enamed env n 201 | ENamed n => p_enamed env n
202 | ECon (pc, NONE) => p_patCon env pc 202 | ECon (_, pc, NONE) => p_patCon env pc
203 | ECon (pc, SOME e) => parenIf par (box [p_patCon env pc, 203 | ECon (_, pc, SOME e) => parenIf par (box [p_patCon env pc,
204 space, 204 space,
205 p_exp' true env e]) 205 p_exp' true env e])
206 | EFfi (m, x) => box [string "FFI(", string m, string ".", string x, string ")"] 206 | EFfi (m, x) => box [string "FFI(", string m, string ".", string x, string ")"]
207 | EFfiApp (m, x, es) => box [string "FFI(", 207 | EFfiApp (m, x, es) => box [string "FFI(",
208 string m, 208 string m,
209 string ".", 209 string ".",
210 string x, 210 string x,