[Haskell-cafe] A Question about IO monad

Marcin Mrotek marcin.jan.mrotek at gmail.com
Sun Mar 1 14:27:15 UTC 2015


But this is exactly the point: there can be no total, generic function of type

f :: Monad m => m a -> a

(though there is for a Comonad ;))

As for Zongzhe Yuan's original question, i thinks it's safe to think
of a value of type (IO a) as a program that, when executed, will
result in a value of type a. This program can be copied, stored in a
variable, passed to another thread, etc. It will only be actually
executed when (perhaps after being combined with other IO programs)
bound to the main program.

Kind regards,
Macin Mrotek


More information about the Haskell-Cafe mailing list