Opened 3 years ago

Closed 3 years ago

#12024 closed feature request (fixed)

GHC leaks GHC.Prim.~# into type

Reported by: Iceland_jack Owned by:
Priority: normal Milestone: 8.2.1
Component: Compiler (Type checker) Version: 7.10.3
Keywords: PatternSynonyms Cc: mpickering
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case: T12024
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:


data A a where
  X :: A [xxx]

pattern X' = X

the inferred type of which is

>>> :info X'
pattern X' :: () => t GHC.Prim.~# [xxx] => A t

Casts use unlifted equality as I understand it, but lifted would present a nicer UI:

pattern X' :: () => t ~> [xxx] => A t
pattern X' = X

In my own code this means I get the following monster

pattern MkArr :: () => (GetTy a, GetTy b, GetTy t,
                        a GHC.Prim.~# 'Sca ('Number 'I32), b GHC.Prim.~# 'Sca a1,
                        t GHC.Prim.~# 'Arr a1, GetSca a1) => Exp a -> Id -> Exp b -> Exp t

Change History (6)

comment:1 Changed 3 years ago by Iceland_jack

Cc: mpickering added

comment:2 Changed 3 years ago by Iceland_jack

Keywords: PatternSynonyms added

comment:3 Changed 3 years ago by simonpj

:info uses IfaceType.pprIfaceType which is currently less clever than TyCoRep.pprType (look for Opt_PrintEqualityRelations in the latter).

This will be fixed by #11660.

Last edited 3 years ago by simonpj (previous) (diff)

comment:4 Changed 3 years ago by bgamari

Status: newpatch
Test Case: T12024

This has been fixed with #11660. Testcase in Phab:D2702.

comment:5 Changed 3 years ago by Ben Gamari <ben@…>

In 926469f/ghc:

testsuite: Add test for #12024

Test Plan: Validate

Reviewers: austin

Subscribers: thomie

Differential Revision:

GHC Trac Issues: #12024

comment:6 Changed 3 years ago by bgamari

Milestone: 8.2.1
Resolution: fixed
Status: patchclosed
Note: See TracTickets for help on using tickets.