Lexer: Suggest adding 'let' on unexpected '=' token
authorBen Gamari <bgamari.foss@gmail.com>
Tue, 16 Jun 2015 18:01:22 +0000 (20:01 +0200)
committerBen Gamari <ben@smart-cactus.org>
Tue, 16 Jun 2015 18:01:22 +0000 (20:01 +0200)
commit1ff7f09b3abedb2a6daf384b55ad3d0134f0d174
tree34ad913bdc6f19ab1151d90cfa14e4aedf9ffe58
parentb0d8ba368f031279444c851dbca499d7e272f74c
Lexer: Suggest adding 'let' on unexpected '=' token

Summary:
I've heard numerous fledgling Haskeller's complain about the behavior of
ghci regarding bindings. While most REPLs accept bindings of the form
`x = 42`, GHCi is implicitly a `do` block, meaning that the user must
know to use a `let` to introduce a binding.

Here we suggest to the user that they may need a `let` and give them a
small example in the event that we find an unexpected `=` token.

Reviewers: austin

Reviewed By: austin

Subscribers: thomie, bgamari

Differential Revision: https://phabricator.haskell.org/D980
compiler/parser/Lexer.x
testsuite/tests/ghci/should_run/T9915.stderr
testsuite/tests/parser/should_fail/readFail011.stderr
testsuite/tests/parser/should_fail/readFail034.stderr