From cbaf5d63b56a3c4ad52ba2715b211f52995a2417 Mon Sep 17 00:00:00 2001 From: sof Date: Thu, 11 Oct 2001 22:27:05 +0000 Subject: [PATCH] [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. --- ghc/lib/std/PrelIOBase.lhs | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/ghc/lib/std/PrelIOBase.lhs b/ghc/lib/std/PrelIOBase.lhs index 9f36163..3179a5e 100644 --- a/ghc/lib/std/PrelIOBase.lhs +++ b/ghc/lib/std/PrelIOBase.lhs @@ -1,5 +1,5 @@ % ------------------------------------------------------------------------------ -% $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 -- 1.7.10.4