<div dir="ltr">Like many programming language environments, GHC offers a handy `-e` option for evaluating an expression, then returning to the shell.<div><br></div><div>







<p class=""><font face="courier new, monospace">$ ghc -e '2 + 2'</font></p>
<p class=""><font face="courier new, monospace">4</font></p></div><div><br></div><div>One would expect the interpreter, GHCi, to offer a similar flag, but it surprisingly rejects it.<div><br></div><div>







<p class=""><font face="courier new, monospace">ghci -e '2 + 2'</font></p>
<p class=""><font face="courier new, monospace">ghc: on the commandline: cannot use `--interactive' with `-e'</font></p>
<p class=""><font face="courier new, monospace">Usage: For basic information, try the `--help' option.</font></p><p class=""><br></p><p class="">I think this behavior is quite unintuitive--when I pass `-e <exp>` to ghci, or pass `--interactive -e <exp>` to ghc, I expect the expression to be evaluated as the leading expression in an interactive interpreter session.<br>
</p><p class=""><br></p><p class="">Could we please tweak ghc like this to make it slightly more intuitive when these flags are used together?</p><div>-- <br><div></div>Cheers,<div><br></div><div>Andrew Pennebaker</div><div>
<a href="http://www.yellosoft.us" target="_blank">www.yellosoft.us</a></div>
</div></div></div></div>