Kinds of type synonym arguments

Ömer Sinan Ağacan omeragacan at gmail.com
Sun Dec 20 19:14:48 UTC 2015


I have another related question: What about allowing primitive types
in newtypes?

    λ:4> newtype Blah1 = Blah1 Int
    λ:5> newtype Blah2 = Blah2 Int#

    <interactive>:5:23: error:
        • Expecting a lifted type, but ‘Int#’ is unlifted
        • In the type ‘Int#’
          In the definition of data constructor ‘Blah2’
          In the newtype declaration for ‘Blah2’

Ideally second definition should be OK, and kind of Blah2 should be #. Is this
too hard to do?

2015-12-16 17:22 GMT-05:00 Richard Eisenberg <eir at cis.upenn.edu>:
>
> On Dec 16, 2015, at 2:06 PM, Ömer Sinan Ağacan <omeragacan at gmail.com> wrote:
>>
>> In any case, this is not that big deal. When I read the code I thought this
>> should be a trivial change but apparently it's not.
>
> No, it's not. Your example (`f :: (Int#, b) -> b`) still has an unboxed thing in a boxed tuple. Boxed tuples simply can't (currently) hold unboxed things. And changing that is far from trivial. It's not the polymorphism that's the problem -- it's the unboxed thing in a boxed tuple.
>
> Richard


More information about the ghc-devs mailing list