[Haskell-cafe] One-shot? (was: Global variables and stuff)

Keean Schupke k.schupke at imperial.ac.uk
Thu Nov 11 06:31:28 EST 2004


Graham Klyne wrote:

> Keean,
>
> As far as I can tell, both your solutions to the "one-shot" problem 
> require that:
>
> (a) the expression to be one-shotted is in the IO monad.  That seems 
> reasonable, since why else does one care (semantically speaking)?
>
> (b) they depend on the host operating system platform (semaphores, 
> process id, environment variables) rather than pure Haskell language 
> features.
>
> Wouldn't it be easier to simply define "once" as a common Haskell 
> library function?
>
> #g
> -- 

Erm, it is a library function (I provided the NamedSem library as an 
attachment)... Are you suggesting it would be nice to be able to do this 
without talking to the OS?

Remember a process is an operating system level identity... The 
boundries of a process are controlled by the OS not the language - 
therefore I think it is entirely appropriate to use it for this.

Also see my proposal for NamedMVars, This would move the concept of this 
solution into a
purely Haskell space, and would not need to communicate with the OS. The 
NamedMVar library could be implemented with a bit of C and Haskell in a 
library module - without changes to
the language spec and the compiler. I guess I was relly looking for 
comments on the
general technique to detemine if it is worth my while writing this 
(NamedMVar) library...

    Keean.


More information about the Haskell-Cafe mailing list