[Haskell-cafe] Re: [Haskell] Re: Global Variables and IO initializers

Lennart Augustsson lennart at augustsson.net
Mon Nov 8 07:26:35 EST 2004


Keean Schupke wrote:
> Adrian Hey wrote:
> 
>> The first step to solving a problem is to at least recognise
>> that it exists. What is "bizarre" is that so many folk seem
>> to be in denial over this. Perhaps you would like to show
>> me your solution to the "oneShot" problem.
>>  
>>
> Why are you unable to give a concrete real world
> example of why this is necessary then. Even your
> example of real world hardware that must be
> initialised once fails! (What if I start two copies
> of the program?)

Indeed.  With hardware the solution is to do
	hdl <- openDevice
which will succeed the first time and then return
"busy" until closed.  Any access to the device must
use the hdl.  Trying to do without the handle is just
shooting yourself in the foot.  It might look good at
first, but it doesn't scale.

	-- Lennart


More information about the Haskell mailing list