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
%
......@@ -9,8 +9,6 @@
\begin{code}
{-# OPTIONS -fno-implicit-prelude #-}
#include "config.h"
module PrelIOBase where
import PrelST
......@@ -519,10 +517,13 @@ data IOErrorType
| TimeExpired | UnsatisfiedConstraints
| UnsupportedOperation
| EOF
#if defined(cygwin32_TARGET_OS) || defined(mingw32_TARGET_OS)
| ComError Int -- HRESULT
#endif
deriving (Eq)
| DynIOError Dynamic -- cheap&cheerful extensible IO error type.
instance Eq IOErrorType where
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
showsPrec _ e =
......@@ -546,11 +547,7 @@ instance Show IOErrorType where
UnsatisfiedConstraints -> "unsatisified constraints" -- ultra-precise!
UnsupportedOperation -> "unsupported operation"
EOF -> "end of file"
#if defined(cygwin32_TARGET_OS) || defined(mingw32_TARGET_OS)
ComError _ -> "COM error"
#endif
DynIOError{} -> "unknown IO error"
userError :: String -> IOError
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