comonads, io
Ashley Yakeley
ashley@semantic.org
Thu, 02 Jan 2003 20:08:20 -0800
In article <20030102225641.GA24187@smtp.alicorna.com>,
Andrew J Bromage <ajb@spamcop.net> wrote:
> comain :: OI a -> ()
> comain w
> = coeval (w .>> show (a,b) =>> stdPutStrLn)
> where
> a = coeval (w .>> () =>> stdGetChar)
> b = coeval (w .>> () =>> stdGetChar)
>
> Even though a and b are identical, they return different values. I see
> two possibilities: Either my intuition is way off, or the OI comonad
> breaks referential transparency.
So is Kieburtz smoking crack, or are we writing OI-style programs
incorrectly? One possibility is that comonads are useful for some
things, but not for doing IO actions safely.
--
Ashley Yakeley, Seattle WA