comparison src/mono_print.sml @ 164:6847741e1f5f

Datatypes through monoize
author Adam Chlipala <adamc@hcoop.net>
date Tue, 29 Jul 2008 13:32:07 -0400
parents f0d3402184d1
children 25b169416ea8
comparison
equal deleted inserted replaced
163:80192edca30d 164:6847741e1f5f
160 string "=", 160 string "=",
161 space, 161 space,
162 p_exp env e] 162 p_exp env e]
163 end 163 end
164 164
165 fun p_datatype env (x, n, cons) =
166 let
167 val env = E.pushTNamed env x n NONE
168 in
169 box [string "datatype",
170 space,
171 string x,
172 space,
173 string "=",
174 space,
175 p_list_sep (box [space, string "|", space])
176 (fn (x, n, NONE) => if !debug then (string (x ^ "__" ^ Int.toString n))
177 else string x
178 | (x, _, SOME t) => box [if !debug then (string (x ^ "__" ^ Int.toString n))
179 else string x, space, string "of", space, p_typ env t])
180 cons]
181 end
182
165 fun p_decl env (dAll as (d, _) : decl) = 183 fun p_decl env (dAll as (d, _) : decl) =
166 case d of 184 case d of
167 DVal vi => box [string "val", 185 DDatatype x => p_datatype env x
186 | DVal vi => box [string "val",
168 space, 187 space,
169 p_vali env vi] 188 p_vali env vi]
170 | DValRec vis => 189 | DValRec vis =>
171 let 190 let
172 val env = E.declBinds env dAll 191 val env = E.declBinds env dAll