diff options
author | Adam Chlipala <adamc@hcoop.net> | 2008-09-11 10:14:59 -0400 |
---|---|---|
committer | Adam Chlipala <adamc@hcoop.net> | 2008-09-11 10:14:59 -0400 |
commit | b404fdb16497e263484383464234f3ddf1d62150 (patch) | |
tree | c8ffe0ed690301c79e9a40ece3de7727355e87b4 /src/cjrize.sml | |
parent | 7bc788c67ed9331773355ceeae4ace7923a6e914 (diff) |
Unpolyed a polymorphic function of two arguments
Diffstat (limited to 'src/cjrize.sml')
-rw-r--r-- | src/cjrize.sml | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/cjrize.sml b/src/cjrize.sml index d6d7ba5e..9e426751 100644 --- a/src/cjrize.sml +++ b/src/cjrize.sml @@ -233,10 +233,17 @@ fun cifyExp (eAll as (e, loc), sm) = end | L.EApp (e1, e2) => let - val (e1, sm) = cifyExp (e1, sm) - val (e2, sm) = cifyExp (e2, sm) + fun unravel (e, args) = + case e of + (L.EApp (e1, e2), _) => unravel (e1, e2 :: args) + | _ => (e, args) + + val (f, es) = unravel (e1, [e2]) + + val (f, sm) = cifyExp (f, sm) + val (es, sm) = ListUtil.foldlMap cifyExp sm es in - ((L'.EApp (e1, e2), loc), sm) + ((L'.EApp (f, es), loc), sm) end | L.EAbs _ => (ErrorMsg.errorAt loc "Anonymous function remains at code generation"; Print.prefaces' [("Function", MonoPrint.p_exp MonoEnv.empty eAll)]; |