summaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2015-06-16 20:04:02 +0200
committerBen Gamari <ben@smart-cactus.org>2015-06-16 20:04:02 +0200
commit0d6c97ba1267a53825809f3c99364f7aa38f0847 (patch)
tree909024bee2d533ffa1130e96a89b574846d097cc /testsuite
parentdf63736341d8b92c0f7f0012bf88929e32a1403f (diff)
parent1ff7f09b3abedb2a6daf384b55ad3d0134f0d174 (diff)
downloadhaskell-0d6c97ba1267a53825809f3c99364f7aa38f0847.tar.gz
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
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/tests/ghci/should_run/T9915.stderr5
-rw-r--r--testsuite/tests/parser/should_fail/readFail011.stderr5
-rw-r--r--testsuite/tests/parser/should_fail/readFail034.stderr5
3 files changed, 12 insertions, 3 deletions
diff --git a/testsuite/tests/ghci/should_run/T9915.stderr b/testsuite/tests/ghci/should_run/T9915.stderr
index de2c5cb286..333f17ac81 100644
--- a/testsuite/tests/ghci/should_run/T9915.stderr
+++ b/testsuite/tests/ghci/should_run/T9915.stderr
@@ -1,2 +1,5 @@
-<interactive>:3:9: parse error on input ‘=’
+<interactive>:3:9: error:
+ parse error on input ‘=’
+ Perhaps you need a 'let' in a 'do' block?
+ e.g. 'let x = 5' instead of 'x = 5'
diff --git a/testsuite/tests/parser/should_fail/readFail011.stderr b/testsuite/tests/parser/should_fail/readFail011.stderr
index 5c5504ba9a..25accd2a19 100644
--- a/testsuite/tests/parser/should_fail/readFail011.stderr
+++ b/testsuite/tests/parser/should_fail/readFail011.stderr
@@ -1,2 +1,5 @@
-readFail011.hs:7:10: parse error on input ‘=’
+readFail011.hs:7:10: error:
+ parse error on input ‘=’
+ Perhaps you need a 'let' in a 'do' block?
+ e.g. 'let x = 5' instead of 'x = 5'
diff --git a/testsuite/tests/parser/should_fail/readFail034.stderr b/testsuite/tests/parser/should_fail/readFail034.stderr
index 027d0ca13f..75156c9ae4 100644
--- a/testsuite/tests/parser/should_fail/readFail034.stderr
+++ b/testsuite/tests/parser/should_fail/readFail034.stderr
@@ -1,2 +1,5 @@
-readFail034.hs:4:6: parse error on input ‘=’
+readFail034.hs:4:6: error:
+ parse error on input ‘=’
+ Perhaps you need a 'let' in a 'do' block?
+ e.g. 'let x = 5' instead of 'x = 5'