#14978 closed bug (fixed)

GADTs don't seem to unpack properly

Reported by: dfeuer Owned by:
Priority: normal Milestone: 8.6.1
Component: Compiler Version: 8.2.2
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Runtime performance bug Test Case: simplCore/should_compile/T14978
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:

Description

Consider this simple code:

type family Foo a b

data Goof a b where
  Goof :: !(Foo a b :~: Int) -> Goof a b

(:~:) has just one constructor (Refl) with no arguments, so I'd expect it to unpack to a void representation:

GoofConstr :: Foo a b ~N# Int => Goof a b
WGoof :: Foo a b :~: Int -> Goof a b
WGoof eq = case eq of Refl -> GoofConstr

But it doesn't seem to unpack at all.

Change History (6)

comment:1 Changed 20 months ago by Simon Peyton Jones <simonpj@…>

In 9187d5fb/ghc:

Allow unpacking of single-data-con GADTs

Trac #14978 pointed out that single-constructor GADTs should be
unpackable without trouble.

Acutally I realise that even existentials should be unpackable
too, but that's a bit more work, so it's not part of this patch.

See Note [Unpacking GADTs and existentials] in MkId.

comment:2 Changed 20 months ago by simonpj

Test Case: simplCore/should_compile/T14978

Fixed.

comment:3 Changed 20 months ago by dfeuer

Thanks!

comment:4 Changed 20 months ago by dfeuer

Do we want a new ticket to track existentials?

comment:5 Changed 20 months ago by simonpj

Do we want a new ticket to track existentials?

It's #10016

comment:6 Changed 17 months ago by bgamari

Resolution: fixed
Status: newclosed

It looks like this is resolved.

Note: See TracTickets for help on using tickets.