Commit cbaf5d63 authored by sof's avatar sof
Browse files

[project @ 2001-10-11 22:27:04 by sof]

- removed Win32-only IOErrorType.ComError
- added IOErrorType.(DynIOError Dynamic.Dynamic)

  Propagating dynamically-typed exceptions as Exception.DynException
  isn't always the right thing to do
  [ why? You cannot catch them with IO.catch & you don't get the
    'infrastructure' that IOError offers, so you're forced to
    reinvent that wheel for each dynamic exception.
  ]
- removed IOExts.isComError  :: IOError -> Bool
- added IOExts.isDynIOError  :: IOError -> Bool
- added IOExts.getDynIOError :: IOError -> Dynamic.Dynamic
- documented IOExts changes.
parent b5bab055
% ------------------------------------------------------------------------------ % ------------------------------------------------------------------------------
% $Id: PrelIOBase.lhs,v 1.42 2001/06/01 13:06:01 sewardj Exp $ % $Id: PrelIOBase.lhs,v 1.43 2001/10/11 22:27:04 sof Exp $
% %
% (c) The University of Glasgow, 1994-2001 % (c) The University of Glasgow, 1994-2001
% %
...@@ -9,8 +9,6 @@ ...@@ -9,8 +9,6 @@
\begin{code} \begin{code}
{-# OPTIONS -fno-implicit-prelude #-} {-# OPTIONS -fno-implicit-prelude #-}
#include "config.h"
module PrelIOBase where module PrelIOBase where
import PrelST import PrelST
...@@ -519,10 +517,13 @@ data IOErrorType ...@@ -519,10 +517,13 @@ data IOErrorType
| TimeExpired | UnsatisfiedConstraints | TimeExpired | UnsatisfiedConstraints
| UnsupportedOperation | UnsupportedOperation
| EOF | EOF
#if defined(cygwin32_TARGET_OS) || defined(mingw32_TARGET_OS) | DynIOError Dynamic -- cheap&cheerful extensible IO error type.
| ComError Int -- HRESULT
#endif instance Eq IOErrorType where
deriving (Eq) x == y =
case x of
DynIOError{} -> False -- from a strictness POV, compatible with a derived Eq inst?
_ -> getTag# x ==# getTag# y
instance Show IOErrorType where instance Show IOErrorType where
showsPrec _ e = showsPrec _ e =
...@@ -546,11 +547,7 @@ instance Show IOErrorType where ...@@ -546,11 +547,7 @@ instance Show IOErrorType where
UnsatisfiedConstraints -> "unsatisified constraints" -- ultra-precise! UnsatisfiedConstraints -> "unsatisified constraints" -- ultra-precise!
UnsupportedOperation -> "unsupported operation" UnsupportedOperation -> "unsupported operation"
EOF -> "end of file" EOF -> "end of file"
#if defined(cygwin32_TARGET_OS) || defined(mingw32_TARGET_OS) DynIOError{} -> "unknown IO error"
ComError _ -> "COM error"
#endif
userError :: String -> IOError userError :: String -> IOError
userError str = UserError str userError str = UserError str
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment