Top Level TWI's again was Re: [Haskell] Re: Parameterized Show

Keean Schupke k.schupke at imperial.ac.uk
Tue Nov 23 08:52:56 EST 2004


Okay - but then you can keep state in haskell by using a driver thread
and channels like in the example I posted. I guess I should have said
it is best practice to check the real state rather than a (possibly wrong)
copy.

    Keean.

Benjamin Franksen wrote:

>On Tuesday 23 November 2004 10:39, Keean Schupke wrote:
>  
>
>>Adrian Hey wrote:
>>    
>>
>>>This is one situation, but certainly not the only possible one. You have
>>>the same problem with interfacing to any unique stateful resource (or
>>>even if you have a multiple but finite supply of these resources).
>>>      
>>>
>>No you don't... Most devices have registers, those registers contain
>>values, you can inspect those values to see if the device has been
>>initialised. You can then write a guard on the initialisation that really
>>checks if the device has (or hasn't) been initialised rather than rely
>>on some
>>'shadow' copies in RAM.
>>    
>>
>
>Alas, unfortunately not every device is designed in this way (I can give 
>examples if you want). Adrian is right in that there is not only badly 
>designed C libraries but also badly designed hardware!
>
>Ben
>  
>



More information about the Haskell mailing list