[GHC] #10997: Pattern synonym causes Iface error.

GHC ghc-devs at haskell.org
Wed Oct 21 11:51:16 UTC 2015


#10997: Pattern synonym causes Iface error.
-------------------------------------+-------------------------------------
           Reporter:  mpickering     |             Owner:
               Type:  bug            |            Status:  new
           Priority:  normal         |         Milestone:
          Component:  Compiler       |           Version:  7.10.2
           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:
-------------------------------------+-------------------------------------
 From the mailing list..

 Hello,

 We have a pattern synonym as follows

 type family Showable (a :: k) :: Constraint where
   Showable (a :: *) = (Show a)
   Showable a       = ()

 pattern Just' :: () => (Showable a) => a -> (Maybe a)
 pattern Just' a <- (extractJust -> (True, a)) where
   Just' a = Just a

 When we try to use the pattern in a different package, the error was

     [1 of 1] Compiling Bar              ( Bar.hs, .stack-
 work/dist/x86_64-linux/Cabal-1.22.4.0/build/Bar.o )
     /tmp/test/p2/.stack-
 work/install/x86_64-linux/lts-3.5/7.10.2/lib/x86_64-linux-
 ghc-7.10.2/p1-0.1.0.0-I5t4il6dN7vIqsT1XgYsM3/Foo.hi
     Declaration for Just'
     Pattern synonym Just':
       Iface type variable out of scope:  k
     Cannot continue after interface file error

 The error only occurred when Showable was polykinded and we used synonym
 in a different package . Using the synonym in the same package works fine.

 This problem did not happen with the following definition of (non
 polykinded ) Showable

 type family Showable a :: Constraint where
   Showable a = (Show a)

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


More information about the ghc-tickets mailing list