[Haskell-cafe] background question about IO monad

Luke Palmer lrpalmer at gmail.com
Thu Feb 7 02:38:56 EST 2008


On Feb 7, 2008 7:32 AM, Uwe Hollerbach <uhollerbach at gmail.com> wrote:
> > pure_fn :: Integer -> String
> > pure_fn n = calendarTimeToString (toUTCTime (TOD n 0))
> >
> > make_wicked :: String -> IO String
> > make_wicked str = return str
> >
> > -- use of make_wicked
> > main = (make_wicked (pure_fn 1234567890)) >>= putStrLn
>
> OK, after all that, my original question, in terms of this example:
> "the IO monad is one-way" is equivalent to saying there is no haskell
> function that I could write that would take
>
> > (make_wicked (pure_fn 123456))
>
> and make it into something that could be used in the same way and the
> same places as just plain
>
> > (pure_fn 123456)
>
> ?

Spot on!

Luke


More information about the Haskell-Cafe mailing list