summaryrefslogtreecommitdiff
path: root/src/Compile.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Compile.hs')
-rw-r--r--src/Compile.hs7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/Compile.hs b/src/Compile.hs
index 1355841..53269d6 100644
--- a/src/Compile.hs
+++ b/src/Compile.hs
@@ -749,10 +749,13 @@ compile' env = \case
-- EAccum _ n a b e -> error "TODO" -- EAccum n (compile' a) (compile' b) (compile' e)
EError _ t s -> do
- name <- emitStruct t
-- using 'show' here is wrong, but it's good enough for me.
emit $ SVerbatim $ "fprintf(stderr, \"ERROR: %s\\n\", " ++ show s ++ "); exit(1);"
- return $ CEStruct name []
+ case t of
+ STScal _ -> return (CELit "0")
+ _ -> do
+ name <- emitStruct t
+ return $ CEStruct name []
EZero{} -> error "Compile: monoid operations should have been eliminated"
EPlus{} -> error "Compile: monoid operations should have been eliminated"