Is there a way to place some impure code inside pure functions?
问题 IO , just like Maybe , is just an instance of Monad . On the other hand we have all data constructors for Maybe ( Just and Nothing ), but no constructors for IO . Reader and Writer do not export constructors too, they have functions, which return instance of this type ( reader and writer ) and more importantly runReader and runWriter , which unwrap computation result from Monad. Is there a way to unwrap IO Monad? I would like to have pure function which do some impure IO computations under