FixIO/ Tackling Awkward Squad

Ronald Legere [email protected]
Fri, 16 Feb 2001 08:19:07 -0800 (PST)


--- Simon Peyton-Jones <[email protected]> wrote:

 
> fixIO m = do { v <- newEmptyMVar
> 		 ; result <- m (unsafePerformIO (takeMVar v))
> 		 ; putMVar v result
> 		 ; return result }
> 
> Of course, this just begs the question of what
> exactly 
> unsafePerformIO might mean, and we can only really
> answer that
> when we give an operational semantics to the
> functional part
> of the language as well as the imperative part.

Ok, I do see how fixIO works.. thanks! 
I see what you mean about needing an operational
semantics for the functional part too.

 Actually I was hoping to use fixIO to help explain
unsafeInterleaveIO, but I fixIO dont work that way:).
I can easily do unsafeInterleaveIO in terms of
unsafePerformIO, so perhaps that leaves me in the
quandry of needed operational semantics for the whole
language, so perhaps I better give up on that sticky
bit, for the moment.

  This all started when I was trying to understand
what was going on in the SOE implementation of Fran.
They use getChannelContents (?) which just does more
magic that I could deal with. Maybe I will go back to
plan B: try to implement fran like system without lazy
event lists, since I cant think of anyway to construct
them without magic :)

  Cheers!

__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail - only $35 
a year!  http://personal.mail.yahoo.com/