<div dir="ltr">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.<div><br></div><div>I confess, he's likely waiting for me to actually sit down and give the idea a nice writeup. ;)</div><div><br></div><div>This would be good for many things, especially when it comes to improving the type safety of various custom c-- tricks.</div><div><br></div><div>-Edward</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Dec 20, 2015 at 2:14 PM, Ömer Sinan Ağacan <span dir="ltr"><<a href="mailto:omeragacan@gmail.com" target="_blank">omeragacan@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I have another related question: What about allowing primitive types<br>
in newtypes?<br>
<br>
    λ:4> newtype Blah1 = Blah1 Int<br>
    λ:5> newtype Blah2 = Blah2 Int#<br>
<br>
    <interactive>:5:23: error:<br>
<span class="">        • Expecting a lifted type, but ‘Int#’ is unlifted<br>
</span>        • In the type ‘Int#’<br>
          In the definition of data constructor ‘Blah2’<br>
          In the newtype declaration for ‘Blah2’<br>
<br>
Ideally second definition should be OK, and kind of Blah2 should be #. Is this<br>
too hard to do?<br>
<div class="HOEnZb"><div class="h5"><br>
2015-12-16 17:22 GMT-05:00 Richard Eisenberg <<a href="mailto:eir@cis.upenn.edu">eir@cis.upenn.edu</a>>:<br>
><br>
> On Dec 16, 2015, at 2:06 PM, Ömer Sinan Ağacan <<a href="mailto:omeragacan@gmail.com">omeragacan@gmail.com</a>> wrote:<br>
>><br>
>> In any case, this is not that big deal. When I read the code I thought this<br>
>> should be a trivial change but apparently it's not.<br>
><br>
> 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.<br>
><br>
> Richard<br>
_______________________________________________<br>
ghc-devs mailing list<br>
<a href="mailto:ghc-devs@haskell.org">ghc-devs@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs</a><br>
</div></div></blockquote></div><br></div>