Specific denotations for pure types

John Meacham john at repetae.net
Fri Mar 20 21:11:59 EDT 2009


On Fri, Mar 20, 2009 at 12:02:15PM -0700, Conal Elliott wrote:
> 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 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

-- 
John Meacham - ⑆repetae.net⑆john⑈


More information about the Haskell-prime mailing list