<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:Wingdings;
        panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p
        {mso-style-priority:99;
        mso-margin-top-alt:auto;
        margin-right:0cm;
        mso-margin-bottom-alt:auto;
        margin-left:0cm;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
        {mso-style-priority:34;
        margin-top:0cm;
        margin-right:0cm;
        margin-bottom:0cm;
        margin-left:36.0pt;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
span.EmailStyle19
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
span.EmailStyle21
        {mso-style-type:personal-compose;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri","sans-serif";
        mso-fareast-language:EN-US;}
.MsoPapDefault
        {mso-style-type:export-only;
        margin-top:6.0pt;
        margin-right:0cm;
        margin-bottom:6.0pt;
        margin-left:0cm;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
/* List Definitions */
@list l0
        {mso-list-id:68120491;
        mso-list-template-ids:-1748470296;}
@list l1
        {mso-list-id:220360872;
        mso-list-template-ids:1497400164;}
@list l1:level1
        {mso-level-number-format:bullet;
        mso-level-text:;
        mso-level-tab-stop:36.0pt;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        mso-ansi-font-size:10.0pt;
        font-family:Symbol;}
@list l1:level2
        {mso-level-number-format:bullet;
        mso-level-text:o;
        mso-level-tab-stop:72.0pt;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        mso-ansi-font-size:10.0pt;
        font-family:"Courier New";
        mso-bidi-font-family:"Times New Roman";}
@list l1:level3
        {mso-level-number-format:bullet;
        mso-level-text:;
        mso-level-tab-stop:108.0pt;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        mso-ansi-font-size:10.0pt;
        font-family:Wingdings;}
@list l1:level4
        {mso-level-number-format:bullet;
        mso-level-text:;
        mso-level-tab-stop:144.0pt;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        mso-ansi-font-size:10.0pt;
        font-family:Wingdings;}
@list l1:level5
        {mso-level-number-format:bullet;
        mso-level-text:;
        mso-level-tab-stop:180.0pt;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        mso-ansi-font-size:10.0pt;
        font-family:Wingdings;}
@list l1:level6
        {mso-level-number-format:bullet;
        mso-level-text:;
        mso-level-tab-stop:216.0pt;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        mso-ansi-font-size:10.0pt;
        font-family:Wingdings;}
@list l1:level7
        {mso-level-number-format:bullet;
        mso-level-text:;
        mso-level-tab-stop:252.0pt;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        mso-ansi-font-size:10.0pt;
        font-family:Wingdings;}
@list l1:level8
        {mso-level-number-format:bullet;
        mso-level-text:;
        mso-level-tab-stop:288.0pt;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        mso-ansi-font-size:10.0pt;
        font-family:Wingdings;}
@list l1:level9
        {mso-level-number-format:bullet;
        mso-level-text:;
        mso-level-tab-stop:324.0pt;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        mso-ansi-font-size:10.0pt;
        font-family:Wingdings;}
@list l2
        {mso-list-id:924649900;
        mso-list-template-ids:1620976418;}
@list l3
        {mso-list-id:1605720946;
        mso-list-type:hybrid;
        mso-list-template-ids:-231601408 134807553 134807555 134807557 134807553 134807555 134807557 134807553 134807555 134807557;}
@list l3:level1
        {mso-level-number-format:bullet;
        mso-level-text:;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        font-family:Symbol;}
@list l3:level2
        {mso-level-number-format:bullet;
        mso-level-text:o;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        font-family:"Courier New";}
@list l3:level3
        {mso-level-number-format:bullet;
        mso-level-text:;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        font-family:Wingdings;}
@list l3:level4
        {mso-level-number-format:bullet;
        mso-level-text:;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        font-family:Symbol;}
@list l3:level5
        {mso-level-number-format:bullet;
        mso-level-text:o;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        font-family:"Courier New";}
@list l3:level6
        {mso-level-number-format:bullet;
        mso-level-text:;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        font-family:Wingdings;}
@list l3:level7
        {mso-level-number-format:bullet;
        mso-level-text:;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        font-family:Symbol;}
@list l3:level8
        {mso-level-number-format:bullet;
        mso-level-text:o;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        font-family:"Courier New";}
@list l3:level9
        {mso-level-number-format:bullet;
        mso-level-text:;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        font-family:Wingdings;}
ol
        {margin-bottom:0cm;}
ul
        {margin-bottom:0cm;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-GB" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-family:"Calibri","sans-serif";mso-fareast-language:EN-US">Christopher<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Calibri","sans-serif";mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Calibri","sans-serif";mso-fareast-language:EN-US">You are doing very cool things.  Thank you.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Calibri","sans-serif";mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Calibri","sans-serif";mso-fareast-language:EN-US">What I’m puzzled about is this: the GHC API *<b>is</b>* a programmatic interface to GHC.  Why not just use it?<o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:6.0pt;margin-right:0cm;margin-bottom:6.0pt;margin-left:0cm">
<span style="font-family:"Calibri","sans-serif";mso-fareast-language:EN-US">I can think of some reasons:<o:p></o:p></span></p>
<p class="MsoListParagraph" style="mso-margin-top-alt:6.0pt;margin-right:0cm;margin-bottom:6.0pt;margin-left:36.0pt;text-indent:-18.0pt;mso-list:l3 level1 lfo4">
<![if !supportLists]><span style="font-family:Symbol;mso-fareast-language:EN-US"><span style="mso-list:Ignore">·<span style="font:7.0pt "Times New Roman"">        
</span></span></span><![endif]><span style="font-family:"Calibri","sans-serif";mso-fareast-language:EN-US">It’s not very clear just what’s in the GHC API and what isn’t, since you have access to all of GHC’s internals if you use –package ghc.  And the API isn’t
 very well designed.   (Answer: could you help make it better?)<o:p></o:p></span></p>
<p class="MsoListParagraph" style="mso-margin-top-alt:6.0pt;margin-right:0cm;margin-bottom:6.0pt;margin-left:36.0pt;text-indent:-18.0pt;mso-list:l3 level1 lfo4">
<![if !supportLists]><span style="font-family:Symbol;mso-fareast-language:EN-US"><span style="mso-list:Ignore">·<span style="font:7.0pt "Times New Roman"">        
</span></span></span><![endif]><span style="font-family:"Calibri","sans-serif";mso-fareast-language:EN-US">You want some functionality that is currently in GHCi, rather than in the ‘ghc’ package.  (Answer: maybe we should move that functionality into the ‘ghc’
 package and make it part of the GHC API?)<o:p></o:p></span></p>
<p class="MsoListParagraph" style="mso-margin-top-alt:6.0pt;margin-right:0cm;margin-bottom:6.0pt;margin-left:36.0pt;text-indent:-18.0pt;mso-list:l3 level1 lfo4">
<![if !supportLists]><span style="font-family:Symbol;mso-fareast-language:EN-US"><span style="mso-list:Ignore">·<span style="font:7.0pt "Times New Roman"">        
</span></span></span><![endif]><span style="font-family:"Calibri","sans-serif";mso-fareast-language:EN-US">You have to be writing in Haskell to use the GHC API, whereas you want a separate process you connect to via a socket.  (Answer: Excellent: write a server
 wrapper around the GHC API that offers a JSON interface, or whatever the right vocabulary is.  Sounds as if you have more  or less done this.)<o:p></o:p></span></p>
<p class="MsoListParagraph" style="mso-margin-top-alt:6.0pt;margin-right:0cm;margin-bottom:6.0pt;margin-left:36.0pt;text-indent:-18.0pt;mso-list:l3 level1 lfo4">
<![if !supportLists]><span style="font-family:Symbol;mso-fareast-language:EN-US"><span style="mso-list:Ignore">·<span style="font:7.0pt "Times New Roman"">        
</span></span></span><![endif]><span style="font-family:"Calibri","sans-serif";mso-fareast-language:EN-US">Moreover, the API changes pretty regularly, and you want multi-compiler support.  (No answer: I don’t know how to simultaneously give access to new stuff
 without risking breaking old stuff.)<o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:6.0pt;margin-right:0cm;margin-bottom:6.0pt;margin-left:0cm">
<span style="font-family:"Calibri","sans-serif";mso-fareast-language:EN-US">My meta-point is this: GHC is wide open to people like you building a consensus about how GHC’s basic functionality should be wrapped up and exposed to clients.  (Luite is another person
 who has led in this space, via GHCJS.)   So please do go ahead and lay out the way it *<b>should</b>* be done, think about migration paths, build a consensus etc.  Much better that than do fragile screen-scraping on GHCi’s textual output.<o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:6.0pt;margin-right:0cm;margin-bottom:6.0pt;margin-left:0cm">
<span style="font-family:"Calibri","sans-serif";mso-fareast-language:EN-US">Thanks for what you are doing here.<o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:6.0pt;margin-right:0cm;margin-bottom:6.0pt;margin-left:0cm">
<span style="font-family:"Calibri","sans-serif";mso-fareast-language:EN-US">Simon<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Calibri","sans-serif";mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<div style="border:none;border-left:solid blue 1.5pt;padding:0cm 0cm 0cm 4.0pt">
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri","sans-serif"">From:</span></b><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri","sans-serif""> ghc-devs [mailto:ghc-devs-bounces@haskell.org]
<b>On Behalf Of </b>Christopher Done<br>
<b>Sent:</b> 18 October 2014 16:49<br>
<b>To:</b> ghc-devs@haskell.org<br>
<b>Subject:</b> Making GHCi awesomer?<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div>
<p>Good evening,<o:p></o:p></p>
<p style="margin:0px!important">So I’ve been working on Haskell user-facing tooling in general for<br>
some years. By that I mean the level of Emacs talking with Haskell<br>
tools.<o:p></o:p></p>
<p style="margin:0px!important">I wrote the interactive-haskell-mode (most functionality exists<br>
<a href="https://github.com/haskell/haskell-mode/blob/master/haskell-process.el#L1">in this file</a>).<br>
which launches a GHCi process in a pipe and tries very earnestly to<br>
handle input/output with the process reasonably.<o:p></o:p></p>
<p style="margin:0px!important">For Emacs fanciers: Written in Elisp, there’s a nice command queue<br>
that you put commands onto, they will all be run on a FIFO one-by-one<br>
order, and eventually you’ll get a result back. Initially it was just<br>
me using it, but with the help of Herbert Riedel it’s now a mode on<br>
equal footing with the venerable inferior-haskell-mode all ye Emacs<br>
users know and love. It’s part of haskell-mode and can be enabled by<br>
enabling the interactive-haskell-mode minor mode.<o:p></o:p></p>
<p style="margin:0px!important">For years I’ve been using GHCi as a base and it’s been very reliable<br>
for almost every project I’ve done (the only exceptions are things<br>
like SDL and OpenGL, which are well known to be difficult to load in<br>
GHCi, at least on Linux). I think we’ve built up<br>
<a href="https://github.com/haskell/haskell-mode/wiki/Haskell-Interactive-Mode">a good set of functionality</a><br>
purely based on asking GHCi things and getting it to do things.<o:p></o:p></p>
<p style="margin:0px!important">I literally use GHCi for everything. For type-checking, type info, I<br>
even send “:!cabal build” to it. Everything goes through it. I love my<br>
GHCi.<o:p></o:p></p>
<p style="margin:0px!important">Now, I’m sort of at the end of the line of where I can take GHCi. Here<br>
are the problems as I see them today:<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:6.0pt;margin-right:0cm;margin-bottom:6.0pt;margin-left:0cm;text-indent:-18.0pt;mso-list:l2 level1 lfo1">
<![if !supportLists]><span style="mso-list:Ignore">1.<span style="font:7.0pt "Times New Roman"">     
</span></span><![endif]>There is no programmatic means of communicating with the<br>
process. I can’t send a command and get a result cleanly, I have to<br>
regex match on the prompt, and that is only so reliable. At the<br>
moment we solve this by using \4 (aka ‘END OF TRANSMISSION’). Also<br>
messages (warnings, errors, etc.) need to be parsed which is also<br>
icky, especially in the REPL when e.g. a defaulted Integer warning<br>
will mix with the output. Don’t get me started on handling<br>
multi-line prompts! Hehe.<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:6.0pt;margin-right:0cm;margin-bottom:6.0pt;margin-left:0cm;text-indent:-18.0pt;mso-list:l2 level1 lfo1">
<![if !supportLists]><span style="mso-list:Ignore">2.<span style="font:7.0pt "Times New Roman"">     
</span></span><![endif]>GHCi, as a REPL, does not distinguish between stdout, stderr and<br>
the result of your evaluation. This can be problematic for making a<br>
smooth REPL UI, your results can often (with threading) be<br>
interspersed in unkind ways. I cannot mitigate this with any kind<br>
of GHCi trickery.<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:6.0pt;margin-right:0cm;margin-bottom:6.0pt;margin-left:0cm;text-indent:-18.0pt;mso-list:l2 level1 lfo1">
<![if !supportLists]><span style="mso-list:Ignore">3.<span style="font:7.0pt "Times New Roman"">     
</span></span><![endif]>It forgets information when you reload. (I know this is intentional.)<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:6.0pt;margin-right:0cm;margin-bottom:6.0pt;margin-left:0cm;text-indent:-18.0pt;mso-list:l2 level1 lfo1">
<![if !supportLists]><span style="mso-list:Ignore">4.<span style="font:7.0pt "Times New Roman"">     
</span></span><![endif]>Not enough information is exposed to the user. (Is there ever? ;)<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:6.0pt;margin-right:0cm;margin-bottom:6.0pt;margin-left:0cm;text-indent:-18.0pt;mso-list:l2 level1 lfo1">
<![if !supportLists]><span style="mso-list:Ignore">5.<span style="font:7.0pt "Times New Roman"">     
</span></span><![endif]>There is a time-to-market overhead of contributing to GHCi — if I<br>
want a cool feature, I can write it on a locally compiled version<br>
of GHC. But for the work projects I have, I’m restricted to given<br>
GHC versions, as are other people. They have to wait to get the<br>
good features.<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:6.0pt;margin-right:0cm;margin-bottom:6.0pt;margin-left:0cm;text-indent:-18.0pt;mso-list:l2 level1 lfo1">
<![if !supportLists]><span style="mso-list:Ignore">6.<span style="font:7.0pt "Times New Roman"">     
</span></span><![endif]>This is just a personal point — I’ve like to talk to GHCi over a<br>
socket, so that I can run it on a remote machine. Those familiar<br>
with Common Lisp will be reminded of SLIME and Swank.<o:p></o:p></p>
<p style="margin:0px!important">Examples for point 4 are:<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:6.0pt;margin-right:0cm;margin-bottom:6.0pt;margin-left:0cm;text-indent:-18.0pt;mso-list:l1 level1 lfo2">
<![if !supportLists]><span style="font-size:10.0pt;font-family:Symbol"><span style="mso-list:Ignore">·<span style="font:7.0pt "Times New Roman"">        
</span></span></span><![endif]>Type of sub-expressions.<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:6.0pt;margin-right:0cm;margin-bottom:6.0pt;margin-left:0cm;text-indent:-18.0pt;mso-list:l1 level1 lfo2">
<![if !supportLists]><span style="font-size:10.0pt;font-family:Symbol"><span style="mso-list:Ignore">·<span style="font:7.0pt "Times New Roman"">        
</span></span></span><![endif]>Go to definition of thing at point (includes local scope).<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:6.0pt;margin-right:0cm;margin-bottom:6.0pt;margin-left:0cm;text-indent:-18.0pt;mso-list:l1 level1 lfo2">
<![if !supportLists]><span style="font-size:10.0pt;font-family:Symbol"><span style="mso-list:Ignore">·<span style="font:7.0pt "Times New Roman"">        
</span></span></span><![endif]>Local-scope completion.<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:6.0pt;margin-right:0cm;margin-bottom:6.0pt;margin-left:0cm;text-indent:-18.0pt;mso-list:l1 level1 lfo2">
<![if !supportLists]><span style="font-size:10.0pt;font-family:Symbol"><span style="mso-list:Ignore">·<span style="font:7.0pt "Times New Roman"">        
</span></span></span><![endif]>A hoogle-like query (as seen in Idris recently).<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:6.0pt;margin-right:0cm;margin-bottom:6.0pt;margin-left:0cm;text-indent:-18.0pt;mso-list:l1 level1 lfo2">
<![if !supportLists]><span style="font-size:10.0pt;font-family:Symbol"><span style="mso-list:Ignore">·<span style="font:7.0pt "Times New Roman"">        
</span></span></span><![endif]>Documentation lookup.<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:6.0pt;margin-right:0cm;margin-bottom:6.0pt;margin-left:0cm;text-indent:-18.0pt;mso-list:l1 level1 lfo2">
<![if !supportLists]><span style="font-size:10.0pt;font-family:Symbol"><span style="mso-list:Ignore">·<span style="font:7.0pt "Times New Roman"">        
</span></span></span><![endif]>Suggest imports for symbols.<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:6.0pt;margin-right:0cm;margin-bottom:6.0pt;margin-left:0cm;text-indent:-18.0pt;mso-list:l1 level1 lfo2">
<![if !supportLists]><span style="font-size:10.0pt;font-family:Symbol"><span style="mso-list:Ignore">·<span style="font:7.0pt "Times New Roman"">        
</span></span></span><![endif]>Show core for the current module.<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:6.0pt;margin-right:0cm;margin-bottom:6.0pt;margin-left:0cm;text-indent:-18.0pt;mso-list:l1 level1 lfo2">
<![if !supportLists]><span style="font-size:10.0pt;font-family:Symbol"><span style="mso-list:Ignore">·<span style="font:7.0pt "Times New Roman"">        
</span></span></span><![endif]>Show CMM for the current module, ASM, etc. SLIME can do this.<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:6.0pt;margin-right:0cm;margin-bottom:6.0pt;margin-left:0cm;text-indent:-18.0pt;mso-list:l1 level1 lfo2">
<![if !supportLists]><span style="font-size:10.0pt;font-family:Symbol"><span style="mso-list:Ignore">·<span style="font:7.0pt "Times New Roman"">        
</span></span></span><![endif]>Expand the template-haskell at point.<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:6.0pt;margin-right:0cm;margin-bottom:6.0pt;margin-left:0cm;text-indent:-18.0pt;mso-list:l1 level1 lfo2">
<![if !supportLists]><span style="font-size:10.0pt;font-family:Symbol"><span style="mso-list:Ignore">·<span style="font:7.0pt "Times New Roman"">        
</span></span></span><![endif]>The :i command is amazingly useful, but programmatic access would be<br>
even better.¹<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:6.0pt;margin-right:0cm;margin-bottom:6.0pt;margin-left:0cm;text-indent:-18.0pt;mso-list:l1 level1 lfo2">
<![if !supportLists]><span style="font-size:10.0pt;font-family:Symbol"><span style="mso-list:Ignore">·<span style="font:7.0pt "Times New Roman"">        
</span></span></span><![endif]>Case split anyone?<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:6.0pt;margin-right:0cm;margin-bottom:6.0pt;margin-left:0cm;text-indent:-18.0pt;mso-list:l1 level1 lfo2">
<![if !supportLists]><span style="font-size:10.0pt;font-family:Symbol"><span style="mso-list:Ignore">·<span style="font:7.0pt "Times New Roman"">        
</span></span></span><![endif]>Etc.<o:p></o:p></p>
<p style="margin:0px!important">¹I’ve integrated with it in Emacs so that I can C-c C-i any identifier<br>
and it’ll popup a buffer with the :i result and then within that<br>
buffer I can drill down further with C-c C-i again. It makes for<br>
very natural exploration of a type.<o:p></o:p></p>
<p style="margin:0px!important">You’ve seen some of these features in GHC Mod, in hdevtools, in the FP Haskell<br>
Center, maybe some are in Yi, possibly also in Leksah (?).<o:p></o:p></p>
<p style="margin:0px!important">So in light of point (5), I thought: I’ve used the GHC API before, it<br>
can do interactive evaluation, why not write a project like<br>
“ghc-server” which encodes all these above ideas as a “drop-in”<br>
replacement for GHCi? After all I could work on my own without anybody<br>
getting my way over architecture decisions, etc.<o:p></o:p></p>
<p style="margin:0px!important">And that’s what I did. It’s<br>
<a href="https://github.com/chrisdone/ghc-server">here</a>. Surprisingly, it kind of works. You run it in your directoy like you would do “cabal repl”<br>
and it sets up all the extensions and package dependencies and starts<br>
accepting connections. It will compile across three major GHC<br>
versions. Hurray! Rub our hands together and call it done, right?<br>
Sadly not, the trouble is twofold:<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:6.0pt;margin-right:0cm;margin-bottom:6.0pt;margin-left:0cm;text-indent:-18.0pt;mso-list:l0 level1 lfo3">
<![if !supportLists]><span style="mso-list:Ignore">1.<span style="font:7.0pt "Times New Roman"">     
</span></span><![endif]>The first problem with this is that every three projects will<br>
segfault or panic when trying to load in a project that GHCi will<br>
load in happily. The reasons are mysterious to me and I’ve already<br>
lugged over the GHC API to get to this point, so that kind of thing<br>
happening means that I have to fall back to my old GHCi-based<br>
setup, and is disappointing. People have similar complaints of GHC<br>
Mod & co. “Getting it to work” is a deterrant.<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:6.0pt;margin-right:0cm;margin-bottom:6.0pt;margin-left:0cm;text-indent:-18.0pt;mso-list:l0 level1 lfo3">
<![if !supportLists]><span style="mso-list:Ignore">2.<span style="font:7.0pt "Times New Roman"">     
</span></span><![endif]>While this would be super beneficial for me, and has been a good<br>
learning experience for “what works and what doesn’t”, we end up<br>
with yet another alternative tool, that only a few people are<br>
using.<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:6.0pt;margin-right:0cm;margin-bottom:6.0pt;margin-left:0cm;text-indent:-18.0pt;mso-list:l0 level1 lfo3">
<![if !supportLists]><span style="mso-list:Ignore">3.<span style="font:7.0pt "Times New Roman"">     
</span></span><![endif]>There are just certain behaviours and fixes here and there that<br>
GHCi does that take time to reproduce.<o:p></o:p></p>
<p style="margin:0px!important">So let’s go back to the GHCi question: is there still a development<br>
overhead for adding features to GHCi? Yes, new ideas need acceptance<br>
and people have to wait (potentially a year) for a new feature that<br>
they could be using right now.<o:p></o:p></p>
<p style="margin:0px!important">An alternative method is to do what Herbert did which is to release a<br>
<a href="http://hackage.haskell.org/package/ghci-ng">“ghci-ng”</a> which sports<br>
new shiny features that people (with the right GHC version) will be<br>
able to compile and use as a drop-in for GHCi. It’s the same codebase,<br>
but with more stuff! An example is the “:complete” command, this lets<br>
IDE implementers do completion at least at the REPL level. Remember<br>
the list of features earlier? Why are they not in GHCi?<o:p></o:p></p>
<p style="margin:0px!important">So, of course, this got me thinking that I could instead make<br>
ghc-server be based off of GHCi’s actual codebase. I could rebase upon<br>
the latest GHC release and maintain 2-3 GHC versions backwards. That’s<br>
certainly doable, it would essentially give me “GHCi++”. Good for me,<br>
I just piggy back on the GHCi goodness and then use the GHC API for<br>
additional things as I’m doing now.<o:p></o:p></p>
<p style="margin:0px!important">But is there a way I can get any of this into the official repo? For<br>
example, could I hack on this (perhaps with Herbert) as “ghci-ng”,<br>
provide an alternative JSON communication layer (e.g. via some<br>
—use-json flag) and and socket listener (—listen-on ), a way<br>
to distinguish stdout/stderr (possibly by forking a process, unsure at<br>
this stage), and then any of the above features (point 4) listed. I<br>
make sure that I’m rebasing upon HEAD, as if to say ghci-ng is a kind<br>
of submodule, and then when release time comes we merge back in any<br>
new stuff since the last release. Early adopters can use<br>
ghci-ng, and everyone benefits from official GHC releases.<o:p></o:p></p>
<p style="margin:0px!important">The only snag there is that, personally speaking, it would be better<br>
if ghci-ng would compile on older GHC versions. So if GHC 7.10 is the<br>
latest release, it would still be nice (and it <em>seems</em> pretty<br>
feasible) that GHC 7.8 users could still cabal install it without<br>
issue. People shouldn’t have to wait if they don’t have to.<o:p></o:p></p>
<p style="margin:0px!important">Well, that’s everything. Thoughts? <o:p></o:p></p>
<p style="margin:0px!important">Ciao!<o:p></o:p></p>
<div>
<p class="MsoNormal"><span style="font-size:1.0pt">​<o:p></o:p></span></p>
</div>
</div>
</div>
</div>
</div>
</body>
</html>