[GHC] #15674: GADT's displayed type is misleading

GHC ghc-devs at haskell.org
Wed Sep 26 10:28:15 UTC 2018


#15674: GADT's displayed type is misleading
-------------------------------------+-------------------------------------
        Reporter:  AntC              |                Owner:  (none)
            Type:  feature request   |               Status:  new
        Priority:  normal            |            Milestone:  8.6.1
       Component:  Compiler          |              Version:  8.6.1-beta1
      Resolution:                    |             Keywords:
Operating System:  Windows           |         Architecture:  x86_64
 Type of failure:  Poor/confusing    |  (amd64)
  error message                      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by AntC):

 Replying to [comment:4 monoidal]:

 Thank you for the tip with defining patterns. It's the only way to reveal
 the differences here:

 {{{#!hs
 data family   DG3  a
 data instance DG3  a   where MkDG3 :: Int -> DG3 [Int]

 data family   DG4  a
 data instance DG4 [a]  where MkDG4 :: Int -> DG4 [Int]

 > :i  PDG3  PDG4

 pattern PDG3 :: () => (a ~ [Int]) => Int -> DG3 a

 pattern PDG4 :: () => (a ~ Int) => Int -> DG4 [a]
 }}}

 > Should we show this and how? I don't know.

 Now we have variable `a` showing. But according to Richard's message, it
 shouldn't be because it's not `forall`'d, neither explicitly nor
 implicitly (sigh). And indeed `:i` for the data constructors doesn't show
 `(a ~ ...)` even with full verbosity.

 My understanding of pattern synonyms is that they're built on top of data
 constructors. Then it seems back-to-front to use pattern synonyms to
 diagnose constructors. This ticket arose from a quest to understand `data`
 and `data instance`s from the ground up. I can't find any firm ground to
 start from, only quicksand.

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


More information about the ghc-tickets mailing list