- -- Getting at the environment
- getEnv, setEnv, updEnv,
+ -- Getting at the environment
+ getEnv, setEnv, updEnv,
- runIOEnv, unsafeInterleaveM,
- tryM, tryAllM, tryMostM, fixM,
+ runIOEnv, unsafeInterleaveM,
+ tryM, tryAllM, tryMostM, fixM,
- -- I/O operations
- IORef, newMutVar, readMutVar, writeMutVar, updMutVar
+ -- I/O operations
+ IORef, newMutVar, readMutVar, writeMutVar, updMutVar
-import Data.IORef ( IORef, newIORef, readIORef, writeIORef, modifyIORef )
-import System.IO.Unsafe ( unsafeInterleaveIO )
-import System.IO ( fixIO )
+import Data.IORef ( IORef, newIORef, readIORef, writeIORef, modifyIORef )
+import Data.Typeable
+import System.IO.Unsafe ( unsafeInterleaveIO )
+import System.IO ( fixIO )
-- Reflect UserError exceptions (only) into IOEnv monad
-- Other exceptions are not caught; they are simply propagated as exns
--
-- The idea is that errors in the program being compiled will give rise
-- to UserErrors. But, say, pattern-match failures in GHC itself should
-- Reflect UserError exceptions (only) into IOEnv monad
-- Other exceptions are not caught; they are simply propagated as exns
--
-- The idea is that errors in the program being compiled will give rise
-- to UserErrors. But, say, pattern-match failures in GHC itself should
-- Catch *all* exceptions
-- This is used when running a Template-Haskell splice, when
-- even a pattern-match failure is a programmer error
tryAllM (IOEnv thing) = IOEnv (\ env -> try (thing env))
-- Catch *all* exceptions
-- This is used when running a Template-Haskell splice, when
-- even a pattern-match failure is a programmer error
tryAllM (IOEnv thing) = IOEnv (\ env -> try (thing env))
-{-# -- SPECIALIZE mapM :: (a -> IOEnv env b) -> [a] -> IOEnv env [b] #-}
-{-# -- SPECIALIZE mapM_ :: (a -> IOEnv env b) -> [a] -> IOEnv env () #-}
-{-# -- SPECIALIZE mapSndM :: (b -> IOEnv env c) -> [(a,b)] -> IOEnv env [(a,c)] #-}
-{-# -- SPECIALIZE sequence :: [IOEnv env a] -> IOEnv env [a] #-}
-{-# -- SPECIALIZE sequence_ :: [IOEnv env a] -> IOEnv env () #-}
-{-# -- SPECIALIZE foldlM :: (a -> b -> IOEnv env a) -> a -> [b] -> IOEnv env a #-}
-{-# -- SPECIALIZE foldrM :: (b -> a -> IOEnv env a) -> a -> [b] -> IOEnv env a #-}
-{-# -- SPECIALIZE mapAndUnzipM :: (a -> IOEnv env (b,c)) -> [a] -> IOEnv env ([b],[c]) #-}
-{-# -- SPECIALIZE mapAndUnzip3M :: (a -> IOEnv env (b,c,d)) -> [a] -> IOEnv env ([b],[c],[d]) #-}
-{-# -- SPECIALIZE zipWithM :: (a -> b -> IOEnv env c) -> [a] -> [b] -> IOEnv env [c] #-}
-{-# -- SPECIALIZE zipWithM_ :: (a -> b -> IOEnv env c) -> [a] -> [b] -> IOEnv env () #-}
-{-# -- SPECIALIZE anyM :: (a -> IOEnv env Bool) -> [a] -> IOEnv env Bool #-}
-{-# -- SPECIALIZE when :: Bool -> IOEnv env a -> IOEnv env () #-}
-{-# -- SPECIALIZE unless :: Bool -> IOEnv env a -> IOEnv env () #-}
+-- {-# SPECIALIZE mapM :: (a -> IOEnv env b) -> [a] -> IOEnv env [b] #-}
+-- {-# SPECIALIZE mapM_ :: (a -> IOEnv env b) -> [a] -> IOEnv env () #-}
+-- {-# SPECIALIZE mapSndM :: (b -> IOEnv env c) -> [(a,b)] -> IOEnv env [(a,c)] #-}
+-- {-# SPECIALIZE sequence :: [IOEnv env a] -> IOEnv env [a] #-}
+-- {-# SPECIALIZE sequence_ :: [IOEnv env a] -> IOEnv env () #-}
+-- {-# SPECIALIZE foldlM :: (a -> b -> IOEnv env a) -> a -> [b] -> IOEnv env a #-}
+-- {-# SPECIALIZE foldrM :: (b -> a -> IOEnv env a) -> a -> [b] -> IOEnv env a #-}
+-- {-# SPECIALIZE mapAndUnzipM :: (a -> IOEnv env (b,c)) -> [a] -> IOEnv env ([b],[c]) #-}
+-- {-# SPECIALIZE mapAndUnzip3M :: (a -> IOEnv env (b,c,d)) -> [a] -> IOEnv env ([b],[c],[d]) #-}
+-- {-# SPECIALIZE zipWithM :: (a -> b -> IOEnv env c) -> [a] -> [b] -> IOEnv env [c] #-}
+-- {-# SPECIALIZE zipWithM_ :: (a -> b -> IOEnv env c) -> [a] -> [b] -> IOEnv env () #-}
+-- {-# SPECIALIZE anyM :: (a -> IOEnv env Bool) -> [a] -> IOEnv env Bool #-}
+-- {-# SPECIALIZE when :: Bool -> IOEnv env a -> IOEnv env () #-}
+-- {-# SPECIALIZE unless :: Bool -> IOEnv env a -> IOEnv env () #-}