Unlifted data types

Dan Doel dan.doel at gmail.com
Mon Sep 7 20:19:59 UTC 2015


On Mon, Sep 7, 2015 at 4:00 PM, Simon Peyton Jones
<simonpj at microsoft.com> wrote:
> (2) Second, we cannot expect levity polymorphism.  Consider
>    map f (x:xs) = f x : map f xs
> Is the (f x) a thunk or is it evaluated strictly?  Unless you are going to clone the code for map (which levity polymorphism is there to avoid), we can't answer "it depends on the type of (f x)".   So, no, I think levity polymorphism is out.
>
> So I vote against splitting # into two: plain will do just fine.

I don't understand how that last bit follows from the previous stuff
(or, I don't understand the sentence).

Splitting # into two kinds is useful even if functions can't be levity
polymorphic. # contains a bunch of types that aren't represented
uniformly. Int# might be 32 bits while Double# is 64, etc. But
Unlifted would contain only types that are uniformly represented as
pointers, so you could write functions that are polymorphic over types
of kind Unlifted. This is not true for Unboxed/# (unless we implement
C++ style polymorphism-as-code-generation).

----

Also, with regard to the previous mail, it's not true that `suspend`
has to be a special form. All expressions with types of kind * are
'special forms' in the necessary sense.

-- Dan


More information about the ghc-devs mailing list