
On Fri, Mar 20, 2009 at 6:11 PM, John Meacham
I just learned on #haskell that Int has implementation/machine-dependent semantics. I'd always assumed that pure (non-imperative) types have specific denotational models, so that for instance the denotation of something of type Int is either bottom or a (smallish) integer. Since precise & simple denotation is at the heart of how I think about programming, and Haskell is my favorite language, I'm startled and disappointed. I knew we didn't have a denotational semantics for Haskell, but I'd previously assumed it was just a matter of working out the
On Fri, Mar 20, 2009 at 12:02:15PM -0700, Conal Elliott wrote: details.
in jhc and ghc at least, they are expressed directly in haskell as standard data types with a single unboxed component.
data Int = I Bits32_
Where Bits32_ is a direct unboxed representation of a 32 bit quantity. The data declaration behaves just like any other haskell data declaration and hence follows the same lazy semantics. Of course, this may not help as you perhaps need to define the meaning of the unboxed value inside the Int box, but it at least seperates the 'lazy' aspect of Int from its underlying representation and primitives.
John
Oh -- not one version of Int for 32-bit execution and another version for 64-bit execution? Seen on #haskell today: <mux> > maxBound :: Int
<lambdabot> 9223372036854775807
- Conal