<div dir="ltr">Hey,<div><br></div><div>there's this relatively recent thread on finding instances of a type class: </div><div><br></div><div><a href="https://mail.haskell.org/pipermail/ghc-devs/2017-May/014217.html">https://mail.haskell.org/pipermail/ghc-devs/2017-May/014217.html</a></div><div><br></div><div>I'm sorry, but I couldn't find a better archive for ghc-devs.</div><div><br></div><div>Enjoy</div><div>Sebastian</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Dec 3, 2017 at 3:43 AM, Brandon Allbery <span dir="ltr"><<a href="mailto:allbery.b@gmail.com" target="_blank">allbery.b@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">The problem with the API is it's complex and can break between ghc versions.<div>But --show-iface is even more fragile and prone to break between ghc versions.</div><div>The history of the plugins package constitutes a record of both kinds of pain.</div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Dec 2, 2017 at 9:11 PM, Saurabh Nanda <span dir="ltr"><<a href="mailto:saurabhnanda@gmail.com" target="_blank">saurabhnanda@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><span><div>> I would be cautious about using the ghc-api hi file interfaces; hi files
 turn out to interact with a <br>> lot of low-level parts in complex ways 
(even to the extent that they're a large part of why ghc <br>> can't 
parallelize builds itself and attempts to change that have mostly 
failed).<br><br></div></span>Are you cautioning against using the GHC API (as opposed to the --show-iface command line interface)</div><div>or using HI files themselves?<br><br></div>-- Saurabh.<br><br></div><div class="gmail_extra"><div><div class="m_1262739939599772841h5"><br><div class="gmail_quote">On Sun, Dec 3, 2017 at 2:04 AM, Brandon Allbery <span dir="ltr"><<a href="mailto:allbery.b@gmail.com" target="_blank">allbery.b@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">I would be cautious about using the ghc-api hi file interfaces; hi files turn out to interact with a lot of low-level parts in complex ways (even to the extent that they're a large part of why ghc can't parallelize builds itself and attempts to change that have mostly failed).<div><br></div><div>But if you must do this, you *really* want to have <a href="https://ghc.haskell.org/trac/ghc/wiki/Commentary/Compiler" target="_blank">https://ghc.haskell.org/t<wbr>rac/ghc/wiki/Commentary/Compil<wbr>er</a> ready to hand --- and go through it first so you have some idea of how it works; much of it is links to the lower level details (often straight into the source).</div></div><div class="gmail_extra"><br><div class="gmail_quote"><div><div class="m_1262739939599772841m_-1751739993747003071h5">On Sat, Dec 2, 2017 at 10:59 AM, Saurabh Nanda <span dir="ltr"><<a href="mailto:saurabhnanda@gmail.com" target="_blank">saurabhnanda@gmail.com</a>></span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="m_1262739939599772841m_-1751739993747003071h5"><div dir="ltr"><div><div><div><div><div><div><div>(GHC newbie alert -- is this the right mailing list for these kind of questions?)<br><br></div>I"m writing some code to figure out all the instances of particular type-classes and after exploring a lot of options (hlint, haskell-src-exts, annotations, doctests, etc), I realized that the compiler had already figured it out and written it to disk for me! <br><br></div>More digging led me to <a href="https://www.stackage.org/haddock/lts-9.0/ghc-8.0.2/LoadIface.html#v:loadSrcInterface" target="_blank">https://www.stackage.org/haddo<wbr>ck/lts-9.0/ghc-8.0.2/LoadIface<wbr>.html#v:loadSrcInterface</a> after which I got stuck. How does one call this function? Specifically:<br><br></div>* What is SDoc and how to construct a reasonable value for this argument?<br></div>* IsBootInterface would mostly be False, right?<br></div>* What does `Maybe FastString` represent and how does one construct it?<br></div>* Finally how does one evaluate the resulting monadic action to get access to the underlying `ModIface`?<span class="m_1262739939599772841m_-1751739993747003071m_-8472184998299592372HOEnZb"><font color="#888888"><br><br></font></span></div><span class="m_1262739939599772841m_-1751739993747003071m_-8472184998299592372HOEnZb"><font color="#888888">-- Saurabh.<br><br></font></span></div>
<br></div></div><span>______________________________<wbr>_________________<br>
ghc-devs mailing list<br>
<a href="mailto:ghc-devs@haskell.org" target="_blank">ghc-devs@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-bi<wbr>n/mailman/listinfo/ghc-devs</a><br>
<br></span></blockquote></div><span class="m_1262739939599772841m_-1751739993747003071HOEnZb"><font color="#888888"><br><br clear="all"><div><br></div>-- <br><div class="m_1262739939599772841m_-1751739993747003071m_-8472184998299592372gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div>brandon s allbery kf8nh                               sine nomine associates</div><div><a href="mailto:allbery.b@gmail.com" target="_blank">allbery.b@gmail.com</a>                                  <a href="mailto:ballbery@sinenomine.net" target="_blank">ballbery@sinenomine.net</a></div><div>unix, openafs, kerberos, infrastructure, xmonad        <a href="http://sinenomine.net" target="_blank">http://sinenomine.net</a></div></div></div>
</font></span></div>
</blockquote></div><br><br clear="all"><br></div></div><span class="m_1262739939599772841HOEnZb"><font color="#888888">-- <br><div class="m_1262739939599772841m_-1751739993747003071gmail_signature" data-smartmail="gmail_signature"><a href="http://www.saurabhnanda.com" target="_blank">http://www.saurabhnanda.com</a></div>
</font></span></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="m_1262739939599772841gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div>brandon s allbery kf8nh                               sine nomine associates</div><div><a href="mailto:allbery.b@gmail.com" target="_blank">allbery.b@gmail.com</a>                                  <a href="mailto:ballbery@sinenomine.net" target="_blank">ballbery@sinenomine.net</a></div><div>unix, openafs, kerberos, infrastructure, xmonad        <a href="http://sinenomine.net" target="_blank">http://sinenomine.net</a></div></div></div>
</div>
</div></div><br>______________________________<wbr>_________________<br>
ghc-devs mailing list<br>
<a href="mailto:ghc-devs@haskell.org">ghc-devs@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-<wbr>bin/mailman/listinfo/ghc-devs</a><br>
<br></blockquote></div><br></div>