[Haskell-cafe] IO (Either a Error) question

Miguel Mitrofanov miguelimo38 at yandex.ru
Sun May 2 04:57:30 EDT 2010


> 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?

No, you're not. Similar to function application, type application is  
also left-associative, so it can (but shouldn't) be written as

ErrorT :: IO ((Either Error) String) -> ((ErrorT Error) IO) String

In reality, ErrorT (or EitherT, for that matters) is just a disguise  
(meaning, newtype):

newtype ErrorT e m a = ErrorT {runErrorT :: m (Eigher e a)}


More information about the Haskell-Cafe mailing list