[Haskell-beginners] Combining IO and Either function to "EitherT e IO a"

Nathan Hüsken nathan.huesken at posteo.de
Wed Mar 5 13:53:22 UTC 2014


Hey,

I have a function

|func1 :: IO String
|

and another:

|func2 :: String -> Either String String
|

and I want to combine them, giving the output of the first as the input
as the second.

|func3 :: IO (Either String String)
func3 = do
  tmp <- func1
  return (func2 tmp)
|

Ok, possible. But I rather would like a result of type "EitherT String
IO String".
So how can I combine these function in a smart way, to get the needed
result?

Thanks!
Nathan

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20140305/3626d577/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 490 bytes
Desc: OpenPGP digital signature
URL: <http://www.haskell.org/pipermail/beginners/attachments/20140305/3626d577/attachment.sig>


More information about the Beginners mailing list