[Haskell-cafe] A Question about IO

Zongzhe Yuan psyzy3 at nottingham.ac.uk
Sat Feb 28 23:40:08 UTC 2015

i have a question about IO monad.
Sometimes IO do something and return something, i wonder if the return type, for example is IO Int means it will return an int, could i purely fetch the int?
but i fail, i cannot construct a function, i use do notation but i found i must use something to pass the int to another monad.
But i could write a function has the type of Maybe a -> a and it is easily.
Maybe monad and IO monad both instance monad but why i can’t do that?

Zongzhe Yuan

This message and any attachment are intended solely for the addressee
and may contain confidential information. If you have received this
message in error, please send it back to me, and immediately delete it. 

Please do not use, copy or disclose the information contained in this
message or in any attachment.  Any views or opinions expressed by the
author of this email do not necessarily reflect the views of the
University of Nottingham.

This message has been checked for viruses but the contents of an
attachment may still contain software viruses which could damage your
computer system, you are advised to perform your own checks. Email
communications with the University of Nottingham may be monitored as
permitted by UK legislation.

More information about the Haskell-Cafe mailing list