[Haskell-cafe] Linking and unsafePerformIO

David Roundy droundy at darcs.net
Tue Oct 14 11:27:32 EDT 2008


On Tue, Oct 14, 2008 at 04:05:23PM +0100, Jules Bean wrote:
> 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.

Where do the semantics of haskell say this? How does it interact with
fixing bugs (which means changing mathematical and universal constant
functions--since all functions are constants)?

David


More information about the Haskell-Cafe mailing list