
How can I catch this exception and translate it into an error within my monad? The exception is going to ghci and is not being caught in the monad. I'm interested in catching it and failing the monad gracefully. Exception: <interactive>: connect: does not exist (Connection refused) Types follow... type EngineState = ErrorT String (StateT World IO) type EngineResult = IO (Either String (), World) connect :: [Prop] -> HostName -> Int -> EngineState () connect env h p = do w <- get let secs = timeout_seconds w (Right h) <- liftIO $ timeout secs $ connect_ h p trace "Connection established" ... connect_ :: HostName -> Int -> IO Handle connect_ h p = connectTo h $ PortNumber $ fromIntegral p timeout :: forall a.Int -> IO a -> IO (Either String a) timeout seconds action = ... Thanks, Joel -- http://wagerlabs.com/