forked from bos/filemanip
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
FileManip: migrated to extenible-exceptions
--HG-- extra : convert_revision : 65e5f9c80e000fc9680da857ea7a255f3125b614
- Loading branch information
Sergei Trofimovich
committed
Mar 5, 2010
1 parent
1a7b99a
commit fb34509
Showing
5 changed files
with
53 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
{-# LANGUAGE FlexibleInstances, TypeSynonymInstances #-} | ||
|
||
-- | | ||
-- Module: System.FilePath.Manip | ||
-- Copyright: Sergei Trofimovich | ||
-- License: BSD3 | ||
-- Maintainer: Bryan O'Sullivan <bos@serpentine.com> | ||
-- Stability: unstable | ||
-- Portability: Unix-like systems (requires flexible instances) | ||
|
||
module System.FilePath.Error | ||
( | ||
bracket | ||
, bracket_ | ||
, catch | ||
, handle | ||
, throwIO | ||
, Exception | ||
) where | ||
|
||
import qualified Control.Exception.Extensible as EE | ||
import Prelude hiding (catch) | ||
|
||
-- we can catch any exceptions if we need to | ||
-- type Exception = SomeException | ||
type Exception = EE.IOException | ||
|
||
-- we just pin down 'EE.Exception e' to local Exception | ||
bracket :: IO a -> (a -> IO b) -> (a -> IO c) -> IO c | ||
bracket = EE.bracket | ||
|
||
bracket_ :: IO a -> IO b -> IO c -> IO c | ||
bracket_ = EE.bracket_ | ||
|
||
catch :: IO a -> (Exception -> IO a) -> IO a | ||
catch = EE.catch | ||
|
||
handle :: (Exception -> IO a) -> IO a -> IO a | ||
handle = EE.handle | ||
|
||
throwIO :: (EE.Exception e) => e -> IO a | ||
throwIO = EE.throwIO |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters