[Haskell-cafe] Linking and unsafePerformIO

Jules Bean jules at jellybean.co.uk
Tue Oct 14 11:05:23 EDT 2008


David Roundy wrote:
>>> (Sure this is a weird situation, but I do like to think about worst
>>> cases.)
>> In practice that is fine, with current RTSes and so on.
>>
>> In principle it's not fine. A 'constant' should be constant over all 
>> time, not just constant over a particular library version or sub-version 
>> or a particular program invocation or OS or....
> 
> No, constants don't have to constant over all time.  e.g. it's perfectly
> fine for compilers to implement System.Info, whose sole purpose to provide
> constants that are different in different library versions and OSs.
> 
> http://haskell.org/ghc/docs/latest/html/libraries/base/System-Info.html#v:os

I entirely disagree.

That API is broken. All those things should be in the IO monad.

I might have code which migrates at runtime between different OSes. Of 
course i can't, and even if I did, it would probably return something 
different like 'virtual haskell migration pseudo-OS', but that's not the 
point.

Constants are mathematical and universal, like pi. That is what the 
semantics of haskell say.

However, I don't claim this is terribly important. Or even a very 
interesting debate ;)

Jules





More information about the Haskell-Cafe mailing list