<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">On 10/03/14 22:22, Andrey Chudnov
      wrote:<br>
    </div>
    <blockquote cite="mid:531E2D0F.7000201@gmail.com" type="cite">
      <meta content="text/html; charset=ISO-8859-1"
        http-equiv="Content-Type">
      If we go down that road, it's not cabal-repl that would need to be
      extended. AFAIK, it's just a wrapper around GHCi that calls that
      latter with package info extracted from the cabal file and,
      optionally, the sandbox. So, really, it's GHCi that would need to
      be extended. I think, something as simple as adding an option to
      output JSON (or some other structured format with wide support in
      editors) instead of plain text would go a long way to allow
      editors to consume it's output: they could just pipe commands via
      stdin and read the JSON output via stdout, parse it and display
      the info in the buffer. Depending on how GHCi looks inside and how
      amenable it is to such modifications, it might actually be a
      doable summer project. Am I missing any technical gotchas?<br>
    </blockquote>
    <br>
    Regarding the data format, ghc-mod uses the GHC API to get the
    de-sugared and type-checked representation of a module, e.g.<br>
    <br>
<a class="moz-txt-link-freetext" href="https://github.com/kazu-yamamoto/ghc-mod/blob/master/Language/Haskell/GhcMod/Gap.hs#L326-L337">https://github.com/kazu-yamamoto/ghc-mod/blob/master/Language/Haskell/GhcMod/Gap.hs#L326-L337</a><br>
    <br>
    Or, my tool ghc-imported-from needs to get the "guts" from the GHC
    API to get the global reader environment:<br>
    <br>
<a class="moz-txt-link-freetext" href="https://github.com/carlohamalainen/ghc-imported-from/blob/master/Language/Haskell/GhcImportedFrom.hs#L343-L373">https://github.com/carlohamalainen/ghc-imported-from/blob/master/Language/Haskell/GhcImportedFrom.hs#L343-L373</a><br>
    <br>
    So my feeling is that we'd need to pass Haskell values back and
    forth, not just JSON.<br>
    <br>
    Personally I would love it if GHCi was extended in the way that you
    are suggesting, as it would make my tool much faster. Ditto for
    ghc-mod.<br>
    <br>
    <pre class="moz-signature" cols="72">-- 
Carlo Hamalainen
<a class="moz-txt-link-freetext" href="http://carlo-hamalainen.net">http://carlo-hamalainen.net</a></pre>
  </body>
</html>