Skip to content

Commit

Permalink
#415, use the catch safety trick suggested by Simon Peyton Jones
Browse files Browse the repository at this point in the history
  • Loading branch information
ndmitchell committed Feb 13, 2016
1 parent b8bc555 commit 0259696
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Development/Shake/Monad.hs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import Control.Monad.Trans.Reader
import Data.IORef
import Control.Applicative
import Control.Monad
import GHC.Exts(lazy)
import Prelude


Expand All @@ -32,7 +33,7 @@ type Capture a = (a -> IO ()) -> IO ()

-- See https://ghc.haskell.org/trac/ghc/ticket/11555
catchSafe :: IO a -> (SomeException -> IO a) -> IO a
catchSafe a b = join (evaluate a) `catch_` b
catchSafe a b = lazy a `catch_` b

-- | Run and then call a continuation.
runRAW :: ro -> rw -> RAW ro rw a -> Capture (Either SomeException a)
Expand Down

0 comments on commit 0259696

Please sign in to comment.