Mercurial > urweb
comparison src/cjrize.sml @ 316:04ebfe929a98
Unpolyed a polymorphic function of two arguments
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Thu, 11 Sep 2008 10:14:59 -0400 |
parents | 52d4c60518d4 |
children | e976b187d73a |
comparison
equal
deleted
inserted
replaced
315:e21d0dddda09 | 316:04ebfe929a98 |
---|---|
231 in | 231 in |
232 ((L'.EFfiApp (m, x, es), loc), sm) | 232 ((L'.EFfiApp (m, x, es), loc), sm) |
233 end | 233 end |
234 | L.EApp (e1, e2) => | 234 | L.EApp (e1, e2) => |
235 let | 235 let |
236 val (e1, sm) = cifyExp (e1, sm) | 236 fun unravel (e, args) = |
237 val (e2, sm) = cifyExp (e2, sm) | 237 case e of |
238 in | 238 (L.EApp (e1, e2), _) => unravel (e1, e2 :: args) |
239 ((L'.EApp (e1, e2), loc), sm) | 239 | _ => (e, args) |
240 | |
241 val (f, es) = unravel (e1, [e2]) | |
242 | |
243 val (f, sm) = cifyExp (f, sm) | |
244 val (es, sm) = ListUtil.foldlMap cifyExp sm es | |
245 in | |
246 ((L'.EApp (f, es), loc), sm) | |
240 end | 247 end |
241 | L.EAbs _ => (ErrorMsg.errorAt loc "Anonymous function remains at code generation"; | 248 | L.EAbs _ => (ErrorMsg.errorAt loc "Anonymous function remains at code generation"; |
242 Print.prefaces' [("Function", MonoPrint.p_exp MonoEnv.empty eAll)]; | 249 Print.prefaces' [("Function", MonoPrint.p_exp MonoEnv.empty eAll)]; |
243 (dummye, sm)) | 250 (dummye, sm)) |
244 | 251 |