GHCi: Behave nicely on `-e`, like `ghc` and other programs

Alexander Berntsen alexander at plaimi.net
Thu Jul 24 08:38:45 UTC 2014


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

On 24/07/14 01:29, Andrew Pennebaker wrote:
> Like many programming language environments, GHC offers a handy 
> `-e` option for evaluating an expression, then returning to the 
> shell.
> 
> $ ghc -e '2 + 2'
> 
> 4
> 
> One would expect the interpreter, GHCi, to offer a similar flag, 
> but it surprisingly rejects it.
> 
> ghci -e '2 + 2'
> 
> ghc: on the commandline: cannot use `--interactive' with `-e'
> 
> Usage: For basic information, try the `--help' option.
> 
> 
> 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.
> 
> 
> Could we please tweak ghc like this to make it slightly more 
> intuitive when these flags are used together?
Good idea! I'll look into it.

But did you mean to post this to the ghc-devs list? I've CC'd them
with your entire email intact.

Also, in case I forget all about this or fail, you should add a ticket
to our Trac system[0]. That way, this won't get lost.

Thanks!


[0]  <https://ghc.haskell.org/trac/ghc/>
- -- 
Alexander
alexander at plaimi.net
https://secure.plaimi.net/~alexander
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iF4EAREIAAYFAlPQxhUACgkQRtClrXBQc7XylgEAqbDrspchvHllACPf9lwrFTbN
YenIDCggXbj98NJR5/8BAJUxpkej6T6QV4G+jk9R61nbUOEASEJ+0GBcHLBXpAsw
=3/+R
-----END PGP SIGNATURE-----


More information about the ghc-devs mailing list