[Haskell] threading mutable state through callbacks

Vincenzo Ciancia vincenzo_mlRE.MOVE at yahoo.it
Tue Oct 12 18:46:27 EDT 2004

On Wednesday 13 October 2004 00:00, Adrian Hey wrote:
> Unfortunately, in this case the whole point of what people are trying
> to do with unsafePerformIO is to allow these things to be visible at
> the top level :-)

Sometimes I get too much involved in what I think about, and forget the 
original goal :) A little _too_ naive, it seems, I apologize. So it's 
like the original idea, that using these toplevel IO bindings one has 
to impose an order of evaluation over all program bindings, which 
surely is against the current meaning of haskell programs, e.g. if I 

conf <- readMyConfFile
init = fn conf

people would agree that the correct meaning is to first evaluate all of 
the IO bindings and then the rest of the program:

x1 <- a1
xn <- an

v1 = expr1
vn = exprn

main = action

should be equivalent to

main = do
 x1 <- a1
 xn <- an
 let v1 = expr1
     vn = exprn in

This would not change the meaning of a standard haskell program I think 
(but I am not an expert as you see). Am I wrong? Could this be done 
with a preprocessor? Why not? 


More information about the Haskell mailing list