@@ -7,7 +7,6 @@ import Core.TT
77import Core.Evaluate
88
99import Control.Monad.State
10−import Control.Monad.Trans.State.Lazy(liftCatch)
1110import Data.List
1211import Data.Char
1312
@@ -61,6 +60,11 @@ iLOG str = do i <- get
6160 $ do lift (putStrLn str)
6261 put (i { idris_log = idris_log i ++ str ++ "\n" } )
6362
63+liftCatch :: (m (a,s) -> (e -> m (a,s)) -> m (a,s)) ->
64+ StateT s m a -> (e -> StateT s m a) -> StateT s m a
65+liftCatch catchError m h =
66+ StateT $ \s -> runStateT m s `catchError` \e -> runStateT (h e) s
67+
6468idrisCatch :: Idris a -> (IOError -> Idris a) -> Idris a
6569idrisCatch op handler = liftCatch catch op handler
6670