[Haskell-cafe] Newbie Question about Error Handling
gerd_m1977 at hotmail.com
Sun Jul 24 16:00:58 EDT 2005
I'm confused by the error handling in Haskell. I've written a program that
uses a combined monad of type:
type MyMonad a = ErrorT MyErrorType (StateT MyStateType IO) a
(MyErrorType is an instance of Error)
Therefore, to handle IO Errors inside of MyMonad I need to write:
foo :: MyMonad a
foo = do ...
inp <- liftIO (getChar
(\e -> if isEOFError e then return '\0'
case inp of
'\?' -> throwError ...
This of course is cumbersome and ugly and I'm sure there is a way to do
better. Helpful advice is welcome!
FREE pop-up blocking with the new MSN Toolbar - get it now!
More information about the Haskell-Cafe