[Haskell-cafe] Hiding functions
lists at qseep.net
Fri Aug 13 18:34:48 EDT 2004
I'm throwing my own exceptions in my own monad, not the IO one. But
thanks for pointing me to the stuff about dynamic types. I'm going to
be creative and pick some new names.
Bayley, Alistair wrote:
>What is wrong with creating your own catch and throw with different names?
> data MyException = MyException ...
> deriving (Typeable, Show)
> catchMyEx :: IO a -> (MyException -> IO a) -> IO a
> catchMyEx = catchDyn
> throwMyEx :: MyException -> a
> throwMyEx = throwDyn
>>But there might be code that uses 'throw' and doesn't really
>>care which one is used, and it would be nice to just modify
>>the import line and be done with it.
>Can you expand on this? (more example code?) If you want to throw your own
>exceptions, then you must use throwDyn/catchDyn, so you have to use
>something other than catch/throw anyway.
More information about the Haskell-Cafe