[GHC] #14851: "Pattern match has inaccessible right hand side" with TypeRep

GHC ghc-devs at haskell.org
Sun Feb 25 17:24:27 UTC 2018


#14851: "Pattern match has inaccessible right hand side" with TypeRep
-------------------------------------+-------------------------------------
           Reporter:  goldfire       |             Owner:  (none)
               Type:  bug            |            Status:  new
           Priority:  normal         |         Milestone:
          Component:  Compiler       |           Version:  8.5
           Keywords:                 |  Operating System:  Unknown/Multiple
       Architecture:                 |   Type of failure:  None/Unknown
  Unknown/Multiple                   |
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 When I say

 {{{#!hs
 {-# LANGUAGE PatternSynonyms, ViewPatterns #-}

 module Bug where

 import Type.Reflection

 pattern X arg <- (checkFun -> arg)

 checkFun :: TypeRep fun -> a
 checkFun = undefined

 f x = case (x, True) of
           (X _, _) -> 5
           _        -> 6

 g x = case x of
           (X _) -> 5
           _     -> 6
 }}}

 I get

 {{{
 Bug.hs:13:11: warning: [-Woverlapping-patterns]
     Pattern match has inaccessible right hand side
     In a case alternative: (X _, _) -> ...
    |
 13 |           (X _, _) -> 5
    |           ^^^^^^^^^^^^^
 }}}

 I'm troubled by two things:

 1. There's nothing inaccessible about my right-hand side.
 2. This happens only for `f`, not `g`. If there's no tuple, there's no
 problem.

 Note that this problems requires `TypeRep`. Even another polykinded tycon
 (like `Proxy`) didn't trigger the problem.

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


More information about the ghc-tickets mailing list