[rearrange IO code some, clean up error messages. make exitFailure a primitive.
John Meacham <john@repetae.net>**20060222022456] hunk ./C/FromGrin.hs 82
-    return (expr $ functionCall (name "jhc_error") [string s],ev)
+    if null s
+      then return (expr $ functionCall (name "jhc_exit") [constant $ number 255],ev)
+       else return (expr $ functionCall (name "jhc_error") [string s],ev)
hunk ./E/PrimOpt.hs 59
+        primopt (PrimPrim "exitFailure__") [w] rt  = return $ EError "" rt
hunk ./E/Show.hs 166
+        f (EError "" t) = do
+            ty <- showE t
+            return $ atom $ angles (text "exitFailure"  <>  UC.coloncolon <> unparse ty)
hunk ./Grin/Show.hs 61
+prettyExp vl (Error "" _) = vl <> prim "exitFailure"
hunk ./lib/Jhc/IO.hs 12
+    exitFailure,
+    strictReturn,
hunk ./lib/Jhc/IO.hs 39
-    c_exit 255
-    return undefined
+    exitFailure
hunk ./lib/Jhc/IO.hs 87
+
hunk ./lib/Jhc/IO.hs 101
+-- throws away first argument. but causes second argument to artificially depend on it.
+foreign import primitive worldDep__ :: forall b. World__ -> b -> b
+
+-- | this will return a value making it artificially depend on the state of the world. any uses of this value are guarenteed not to float before this point in the IO monad.
+strictReturn :: a -> IO a
+strictReturn a = IO $ \_ w -> JustIO w (worldDep__ w a)
hunk ./lib/Jhc/IO.hs 109
+-- | this is wrapped around 'main' when compiling programs. it catches any exceptions and prints them to the screen and dies appropriatly.
hunk ./lib/Jhc/IO.hs 112
-    catch main  (\e -> do
-        putStr "\nError..\n"
+    catch main $ \e -> do
+        putStrLn "\nUncaught Exception:"
hunk ./lib/Jhc/IO.hs 115
-        return (error "runMain"))
+        exitFailure
hunk ./lib/Jhc/IO.hs 118
+-- | this is wrapped around arbitrary showable expressions when used as the main entry point
hunk ./lib/Jhc/IO.hs 122
+exitFailure :: IO a
+exitFailure = IO $ \_ w -> exitFailure__ w
+
+foreign import primitive exitFailure__ :: World__ -> IOResult a
+
+
+
+
hunk ./lib/Prelude.hs 839
-    c_exit 255
-    return undefined
+    exitFailure
hunk ./lib/Prelude.hs 842
-
-
-
-
---foreign import primitive exit :: Int -> World__ -> IOResult ()
-foreign import ccall "exit" c_exit :: Int -> IO ()
-
hunk ./lib/System.hs 10
+import Jhc.IO(exitFailure)
hunk ./lib/System.hs 29
-exitFailure = exitWith $ ExitFailure 255