Unlifted data types

Simon Peyton Jones simonpj at microsoft.com
Mon Sep 7 21:55:09 UTC 2015


| I agree that we can't introduce a coercion between 'Force a' and
| 'a', for the reason you mentioned. (there's also a second reason which
| is that 'a ~R Force a' is not well-typed; 'a' and 'Force a' have
| different kinds.)
| 
| I've imagined that we might be able to just continue representing
| Force explicitly in Core, and somehow "compile it away" at STG time,
| but I am definitely fuzzy about how this is supposed to work.  Perhaps
| Force should not actually be a data type, and we should have
| 'force# :: a -> Force a' and 'unforce# :: Force a -> a' (the latter
| of which compiles to a no-op.)

I'm still doubtful.  What is the problem you are trying to solve here?  How does Force help us?

Note that a singleton unboxed tuple (# e #) has the effect of suspending; e.g.
  f x = (# x+1 #)
return immediately, returning a pointer to a thunk for (x+1).  I'm not sure if that is relevant.

Simon



More information about the ghc-devs mailing list