[GHC] #14938: Pattern matching on GADT does not refine type family parameters

GHC ghc-devs at haskell.org
Mon Mar 19 16:39:59 UTC 2018


#14938: Pattern matching on GADT does not refine type family parameters
-------------------------------------+-------------------------------------
        Reporter:  kcsongor          |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler (Type    |              Version:  8.2.2
  checker)                           |             Keywords:  GADTs,
      Resolution:                    |  TypeFamilies, TypeInType
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  GHC rejects       |  Unknown/Multiple
  valid program                      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by kcsongor):

 Replying to [comment:1 goldfire]:
 > But if you have a type-level `Refl` here, then `x` and `y` really will
 be the same. The equation you want is `R x x Refl = Refl`, like in those
 other dependently typed languages.

 In the end I did end up using that equation, but my original idea was to
 try and avoid non-linear patterns, and passing in an explicit proof seemed
 like a sensible idea. For example, Idris lets me write

 {{{#!idris
 r : x -> y -> x = y -> x = y
 r x y Refl = Refl
 }}}

 (But of course non-linear patterns are not supported)

 Is there something obvious I missed that would explain why this form of
 matching should not accepted?

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


More information about the ghc-tickets mailing list