@@ -83,7 +83,7 @@ literals = mkPattern' match'
8383 , prettyPrintIL' value
8484 ]
8585 match (App _ val []) = mconcat <$> sequence
86− [ return $ emit "EffApply("
86+ [ return $ emit "Run("
8787 , prettyPrintIL' val
8888 , return $ emit ")"
8989 ]
@@ -93,7 +93,7 @@ literals = mkPattern' match'
9393 , prettyPrintIL' arg
9494 , return $ emit ")"
9595 ]
96− match (App ss (Indexer _ (Var _ fn) (Var _ fnMod)) [Indexer _ (Var _ dict) (Var _ dictMod), x, y])
96+ match (App _ (App _ (App _ (Indexer _ (Var _ fn) (Var _ fnMod)) [Indexer _ (Var _ dict) (Var _ dictMod)]) [x]) [y])
9797 | fnMod == dictMod
9898 , dictMod == C.dataEq || dictMod == C.dataSemiring || dictMod == C.dataRing ||
9999 dictMod == C.dataEuclideanRing || dictMod == C.dataHeytingAlgebra || dictMod == C.dataOrd
@@ -104,7 +104,7 @@ literals = mkPattern' match'
104104 , return $ emit op
105105 , return $ emit $ unbox' t y
106106 ]
107− match (App _ (Indexer _ (Var _ fn) (Var _ fnMod)) [Indexer _ (Var _ dict) (Var _ dictMod), n])
107+ match (App _ (App _ (Indexer _ (Var _ fn) (Var _ fnMod)) [Indexer _ (Var _ dict) (Var _ dictMod)]) [n])
108108 | fnMod == dictMod
109109 , dictMod == C.dataRing
110110 , fn == C.negate
@@ -114,7 +114,7 @@ literals = mkPattern' match'
114114 , return $ emit $ unbox' t n
115115 , return $ emit ")"
116116 ]
117− match (App _ (Indexer _ (Var _ fn) (Var _ fnMod)) [Indexer _ (Var _ dict) (Var _ dictMod), n])
117+ match (App _ (App _ (Indexer _ (Var _ fn) (Var _ fnMod)) [Indexer _ (Var _ dict) (Var _ dictMod)]) [n])
118118 | fnMod == dictMod
119119 , dictMod == C.dataHeytingAlgebra
120120 , fn == properToIL C.not
@@ -124,6 +124,16 @@ literals = mkPattern' match'
124124 , return $ emit $ unbox' t n
125125 , return $ emit ")"
126126 ]
127+ match app@(App{})
128+ | (val, args) <- unApp app []
129+ , length args > 1
130+ = mconcat <$> sequence
131+ [ return $ emit "Apply("
132+ , prettyPrintIL' val
133+ , return $ emit ", "
134+ , intercalate (emit ", ") <$> forM args prettyPrintIL'
135+ , return $ emit ")"
136+ ]
127137 match (App _ val args) = mconcat <$> sequence
128138 [ return $ emit "Apply("
129139 , prettyPrintIL' val
@@ -217,8 +227,8 @@ literals = mkPattern' match'
217227 , return $ emit " "
218228 , prettyPrintIL' sts
219229 ]
220− match (IfElse _ (Binary _ EqualTo cond (BooleanLiteral Nothing True)) thens elses)
221− | (App ss (Indexer _ (Var _ _) (Var _ fnMod)) [Indexer _ (Var _ dict) (Var _ dictMod), x, y]) <- cond
230+ match (IfElse _ (Binary _ EqualTo cond (BooleanLiteral Nothing True)) thens elses)
231+ | (App _ (App _ (App _ (Indexer _ (Var _ _) (Var _ fnMod)) [Indexer _ (Var _ dict) (Var _ dictMod)]) [x]) [y]) <- cond
222232 , fnMod == dictMod
223233 , dictMod == C.dataEq || dictMod == C.dataOrd
224234 , Just _ <- unboxTypeInt dict
@@ -361,6 +371,10 @@ isComplexLiteral ObjectLiteral{} = True
361371isComplexLiteral ArrayLiteral{} = True
362372isComplexLiteral _ = False
363373
374+unApp :: AST -> [AST] -> (AST, [AST])
375+unApp (App _ val [arg]) args = unApp val (arg : args)
376+unApp other args = (other, args)
377+
364378prettyStatements :: (Emit gen) => [AST] -> StateT PrinterState Maybe gen
365379prettyStatements sts = do
366380 ils <- forM sts prettyPrintIL'
@@ -521,7 +535,7 @@ implFooterSource mn foreigns =
521535 mainSource :: Text
522536 mainSource = "\
523537 \func main() {\n\
524− \ EffApply(PS__main())\n\
538+ \ Run(PS__main())\n\
525539 \}\n\n\
526540 \"
527541