[Haskell-cafe] Re: Global Variables and IO initializers
Ben Rudiak-Gould
Benjamin.Rudiak-Gould at cl.cam.ac.uk
Wed Nov 24 19:14:20 EST 2004
Benjamin Franksen wrote:
> label1 = unique Uniq1
> label2 = unique Uniq2
> global1 = functionalNewMVar label1 True
> global2 = functionalNewMVar label1 (117::Int)
No dice. Your example inadvertently shows why: you used label1 when
creating both global1 and global2, and now I can write
coerce :: Bool -> Int
coerce x = putMVar global1 x >> takeMVar global2
(provided I've emptied them first).
-- Ben
More information about the Haskell-Cafe
mailing list