Kinds of type synonym arguments
Simon Peyton Jones
simonpj at microsoft.com
Mon Dec 21 10:13:34 UTC 2015
newtype T = MkT Int#
Provided T :: # (i.e. unlifted), I don’t think this would be too hard. That is, you can give a new name (via newtype) to an unlifted type like Int#, Float#, Double# etc.
Worth a wiki page and a ticket.
From: ghc-devs [mailto:ghc-devs-bounces at haskell.org] On Behalf Of Edward Kmett
Sent: 21 December 2015 09:10
To: Ömer Sinan Ağacan <omeragacan at gmail.com>
Cc: ghc-devs <ghc-devs at haskell.org>
Subject: Re: Kinds of type synonym arguments
I brought up the subject of allowing newtypes in kind # (or even in any kind that ends in * or # after a chain of ->'s to get more powerful Coercible instances) at ICFP this year and Simon seemed to think it'd be a pretty straightforward modification to the typechecker.
I confess, he's likely waiting for me to actually sit down and give the idea a nice writeup. ;)
This would be good for many things, especially when it comes to improving the type safety of various custom c-- tricks.
On Sun, Dec 20, 2015 at 2:14 PM, Ömer Sinan Ağacan <omeragacan at gmail.com<mailto:omeragacan at gmail.com>> wrote:
I have another related question: What about allowing primitive types
λ:4> newtype Blah1 = Blah1 Int
λ:5> newtype Blah2 = Blah2 Int#
• 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<mailto:eir at cis.upenn.edu>>:
> On Dec 16, 2015, at 2:06 PM, Ömer Sinan Ağacan <omeragacan at gmail.com<mailto: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.
ghc-devs mailing list
ghc-devs at haskell.org<mailto:ghc-devs at haskell.org>
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the ghc-devs