[Haskell-cafe] IO (Either a Error) question
Eugene Dzhurinsky
bofh at redwerk.com
Sun May 2 04:50:48 EDT 2010
On Sat, May 01, 2010 at 02:42:26PM -0700, Ryan Ingram wrote:
> Check out ErrorT in Control.Monad.Error
>
> > :t ErrorT
> ErrorT :: m (Either e a) -> ErrorT e m a
At this point I am lost. I'm not sure that I do understand this type
transformation correctly. So we have some sort of monadic type m, error type e
and resut of type a. If m = IO, e - Error, a - String, than
ErrorT :: IO (Either Error String) -> ErrorT Error IO String
I can think that can be written as
ErrorT :: IO (Either Error String) -> ErrorT Error (IO String)
Am I correct?
> So, if you can make your Error type an instance of this class, you can do this:
> runCalc = runErrorT (ErrorT (func1 p) >>= ErrorT . func2)
Sorry, I don't understand how does it work. Can you please explain the type
transformations involved here?
Thank you in advance!
--
Eugene N Dzhurinsky
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
Url : http://www.haskell.org/pipermail/haskell-cafe/attachments/20100502/356f388b/attachment.bin
More information about the Haskell-Cafe
mailing list