<div dir="ltr"><div class="gmail_default" style="font-family:monospace,monospace"><div class="gmail_default" style="font-family:monospace,monospace">Hi all,</div><div class="gmail_default" style="font-family:monospace,monospace"><br></div><div class="gmail_default" style="font-family:monospace,monospace">I am stuck on the following problem.</div><div class="gmail_default" style="font-family:monospace,monospace"><br></div><div class="gmail_default" style="font-family:monospace,monospace">Suppose you have two module <br></div><div class="gmail_default" style="font-family:monospace,monospace"><br></div><div class="gmail_default" style="font-family:monospace,monospace">   Lib <br></div><div class="gmail_default" style="font-family:monospace,monospace"><br></div><div class="gmail_default" style="font-family:monospace,monospace">   Client <br></div><div class="gmail_default" style="font-family:monospace,monospace"><br></div><div class="gmail_default" style="font-family:monospace,monospace">where
 Client "imports" Lib. Now, while analyzing the Core of `Client` often I
 need to resolve the name of a `TyThing` defined inside `Lib`. Normally,
 this is easy enough: I simply use <br></div><div class="gmail_default" style="font-family:monospace,monospace"><br></div><div class="gmail_default" style="font-family:monospace,monospace"><a id="gmail-m_7294298460795274837gmail-v:hscTcRcLookupName" class="gmail-m_7294298460795274837gmail-def">   hscTcRcLookupName</a> :: <a href="https://downloads.haskell.org/~ghc/8.2.1/docs/html/libraries/ghc-8.2.1/HscTypes.html#t:HscEnv" target="_blank">HscEnv</a> -> <a href="https://downloads.haskell.org/~ghc/8.2.1/docs/html/libraries/ghc-8.2.1/Name.html#t:Name" target="_blank">Name</a> -> <a href="https://downloads.haskell.org/~ghc/8.2.1/docs/html/libraries/base-4.10.0.0/System-IO.html#t:IO" target="_blank">IO</a> (<a href="https://downloads.haskell.org/~ghc/8.2.1/docs/html/libraries/base-4.10.0.0/Data-Maybe.html#t:Maybe" target="_blank">Maybe</a> <a href="https://downloads.haskell.org/~ghc/8.2.1/docs/html/libraries/ghc-8.2.1/Type.html#t:TyThing" target="_blank">TyThing</a>) </div><div class="gmail_default" style="font-family:monospace,monospace"><br></div><div class="gmail_default" style="font-family:monospace,monospace">defined inside HscMain. <br></div><div class="gmail_default" style="font-family:monospace,monospace"><br></div><div class="gmail_default" style="font-family:monospace,monospace">**THE PROBLEM** However, I find that when the <br></div><div class="gmail_default" style="font-family:monospace,monospace">relevant `Name` corresponds to something generated <br></div><div class="gmail_default" style="font-family:monospace,monospace">by TemplateHaskell (inside `Lib`) then the above `hscTcRcLookupName` fails to return any result! <br></div><div class="gmail_default" style="font-family:monospace,monospace">Even more oddly, suppose the name was</div><div class="gmail_default" style="font-family:monospace,monospace"><br></div><div class="gmail_default" style="font-family:monospace,monospace">   BlogPostId <br></div><div class="gmail_default" style="font-family:monospace,monospace"><br></div><div class="gmail_default" style="font-family:monospace,monospace">If there are TWO `TyThing`s with that name, e.g. <br></div><div class="gmail_default" style="font-family:monospace,monospace">a type synonym defined <br></div><div class="gmail_default" style="font-family:monospace,monospace"><br></div><div class="gmail_default" style="font-family:monospace,monospace">   type BlogPostId = ...</div><div class="gmail_default" style="font-family:monospace,monospace"><br></div><div class="gmail_default" style="font-family:monospace,monospace">and also a data constructor for a data family <br></div><div class="gmail_default" style="font-family:monospace,monospace">instance, then `hscTcRcLookupName` only returns <br></div><div class="gmail_default" style="font-family:monospace,monospace">the type synonym, but refuses to return the data constructor.</div><div class="gmail_default" style="font-family:monospace,monospace"><br></div><div class="gmail_default" style="font-family:monospace,monospace">Does anyone know what may be going on?<br></div><div class="gmail_default" style="font-family:monospace,monospace"><br></div><div class="gmail_default" style="font-family:monospace,monospace">Thanks!</div><div class="gmail_default" style="font-family:monospace,monospace"><br></div><div class="gmail_default" style="font-family:monospace,monospace">- Ranjit Jhala.<div class="gmail-yj6qo"></div><div class="gmail-adL"><br></div></div><div class="gmail_default gmail-adL" style="font-family:monospace,monospace"><br></div><br></div></div>