Decide and document how semicolons are supposed to work in GHCi
Currently there is a fair bit of confusion surrounding the intended function of semicolons in GHCi (see #10663 (closed) and D1726),
-
the users guide doesn't discuss the matter at all
-
sometimes the content after semicolons work as expected
λ> let x=2; y=5 λ> x+y 7
-
other times it is silently ignored (see #10663 (closed)),
λ> import Data.List; 684 λ>
-
other times it works but the parser state is subtly wrong, resulting in (arguably) incorrect line numbers later in the session,
` λ> data Infix a b = a :@: b; infixl 4 :@: λ> a
:3:1: error: Variable not in scope: a `
-
some times the only way to accomplish a given task is with a semicolon,
` Prelude> data Infix a b = a :@: b; infixl 4 :@: -- this is OK, but: Prelude> data Infix a b = a :@: b Prelude> infixl 4 :@:
:12:10: error: The fixity signature for
:@:' lacks an accompanying binding (The fixity signature must be given where
:@:' is declared) `
This inconsistency is surprising and at times frustrating. Let's decide how we want semicolons to work and stick with it.
Trac metadata
Trac field | Value |
---|---|
Version | 7.10.3 |
Type | Task |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | GHCi |
Test case | |
Differential revisions | |
BlockedBy | |
Related | #10663 (closed) |
Blocking | |
CC | |
Operating system | |
Architecture |