[GHC] #12729: Unlifted newtypes via GADTSyntax

GHC ghc-devs at haskell.org
Mon Oct 17 23:05:56 UTC 2016


#12729: Unlifted newtypes via GADTSyntax
-------------------------------------+-------------------------------------
           Reporter:  monoidal       |             Owner:
               Type:  bug            |            Status:  new
           Priority:  normal         |         Milestone:
          Component:  Compiler       |           Version:  8.0.1
  (Type checker)                     |
           Keywords:                 |  Operating System:  Unknown/Multiple
       Architecture:                 |   Type of failure:  GHC accepts
  Unknown/Multiple                   |  invalid program
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 GHC disallows to define a newtype of an unlifted type (`newtype A = A
 Int#`). However, this restriction is not enforced when the newtype is
 defined using GADT syntax:

 {{{
 newtype A where
   A :: Int# -> A
 }}}

 For example, I can derive Show for A and on my machine `main = print (A
 0#)` segfaults.

 Tested on GHC 8.0.1 and master.

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12729>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list