-- |
-- Module     : Simulation.Aivika.IO.Exception
-- Copyright  : Copyright (c) 2009-2017, David Sorokin <david.sorokin@gmail.com>
-- License    : BSD3
-- Maintainer : David Sorokin <david.sorokin@gmail.com>
-- Stability  : experimental
-- Tested with: GHC 8.0.1
--
-- It provides with exception handling capabilities,
-- where 'IO' is an instance of 'MonadException'.
--
module Simulation.Aivika.IO.Exception () where

import Control.Exception

import Simulation.Aivika.Trans.Exception

-- | An instance of the type class.
instance MonadException IO where

  {-# INLINE catchComp #-}
  catchComp :: IO a -> (e -> IO a) -> IO a
catchComp = IO a -> (e -> IO a) -> IO a
forall e a. Exception e => IO a -> (e -> IO a) -> IO a
catch

  {-# INLINE finallyComp #-}
  finallyComp :: IO a -> IO b -> IO a
finallyComp = IO a -> IO b -> IO a
forall a b. IO a -> IO b -> IO a
finally

  {-# INLINE throwComp #-}
  throwComp :: e -> IO a
throwComp = e -> IO a
forall a e. Exception e => e -> a
throw