blob: 37f6f93ce47d68117b162635cf2e44382254139e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
{-# LANGUAGE ScopedTypeVariables #-}
module ControlMaybe where
-- import GHC.IO.Exception (IOException(..))
import Control.Exception as Exception (IOException(..),catch)
withJust (Just x) f = f x
withJust Nothing f = return ()
whenJust acn f = do
x <- acn
withJust x f
catchIO_ :: IO a -> IO a -> IO a
catchIO_ a h = Exception.catch a (\(_ :: IOException) -> h)
handleIO_ = flip catchIO_
|