But IO actions *are* pure values. What side effects do they have? None! You can do whatever you want with them with no harmful effects in any Haskell expression. They only special thing about them is that they have a run function that is not itself provided in Haskell. The run function is actually not legal to expose in pure Haskell. Even if it were exposed, *that function* would be the impure thing, not the IO actions you apply it to. (This is why GHC has unsafePerformIO and not UnsafeIO).
- Jake On Aug 6, 2013 5:29 AM, "J. Stutterheim" <j.stutterh...@me.com> wrote: > That argument makes sense, although I find it a bit counter-intuitive > still. If I saw the function `pure` for the first time, my first impression > (however wrong it may be) would be that it takes a pure value (regardless > of context) and does something with it. Applying `pure` to an IO operation > goes against that intuition. > > Looking at the type of `return :: a -> m a", there are several slightly > more intuitive (to me) options in this discussion already: > > lift: the value `a` is lifted into the monad `m` > pack: the value `a` is packed into the monad `m` > wrap: the value `a` is wrapped in the monad `m` > inject: the value `a` is injected into the monad `m` > promote: the value `a` is promoted to a monad `m a` > > > On 6 Aug 2013, at 10:16, Tobias Dammers <tdamm...@gmail.com> wrote: > > > It is a pure value in the context of the outer monad (the one you wrap > it in). I'd say pure is still appropriate. > > > > On Aug 6, 2013 10:14 AM, "Tom Ellis" < > tom-lists-haskell-cafe-2...@jaguarpaw.co.uk> wrote: > > On Tue, Aug 06, 2013 at 10:03:04AM +0200, J. Stutterheim wrote: > > > `putStrLn "Hi"` is not a pure value... > > > > Why not? > > > > _______________________________________________ > > Haskell-Cafe mailing list > > Haskell-Cafe@haskell.org > > http://www.haskell.org/mailman/listinfo/haskell-cafe > > _______________________________________________ > > Haskell-Cafe mailing list > > Haskell-Cafe@haskell.org > > http://www.haskell.org/mailman/listinfo/haskell-cafe > > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe@haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > >
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe