<div dir="ltr">Hello,<br clear="all"><div><br></div><div>We have a pattern synonym as follows</div><div><br></div><div><div>type family Showable (a :: k) :: Constraint where</div><div> Showable (a :: *) = (Show a)</div><div> Showable a = ()</div></div><div><br></div><div>pattern Just' :: () => (Showable a) => a -> (Maybe a)<br></div><div><div>pattern Just' a <- (extractJust -> (True, a)) where</div><div> Just' a = Just a</div></div><div><br></div><div>When we try to use the pattern in a different package, the error was</div><div><br></div><div><div> [1 of 1] Compiling Bar ( Bar.hs, .stack-work/dist/x86_64-linux/Cabal-1.22.4.0/build/Bar.o )</div><div> /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</div><div> Declaration for Just'</div><div> Pattern synonym Just':</div><div> Iface type variable out of scope: k</div><div> Cannot continue after interface file error</div></div><div><br></div><div>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. </div><div><br></div><div>This problem did not happen with the following definition of (non polykinded ) Showable</div><div><br></div><div><div>type family Showable a :: Constraint where</div><div> Showable a = (Show a)</div></div><div><br></div><div>We have attached the sample packages which simulate the exact scenario described above.</div><div><br></div>-- <br><div class="gmail_signature">Yours truly,<br>Sreenidhi Nair</div>
</div>