[GHC] #11392: Decide and document how semicolons are supposed to work in GHCi

GHC ghc-devs at haskell.org
Sat Jan 9 17:12:58 UTC 2016


#11392: Decide and document how semicolons are supposed to work in GHCi
-------------------------------------+-------------------------------------
           Reporter:  bgamari        |             Owner:
               Type:  task           |            Status:  new
           Priority:  normal         |         Milestone:  8.2.1
          Component:  GHCi           |           Version:  7.10.3
           Keywords:                 |  Operating System:  Unknown/Multiple
       Architecture:                 |   Type of failure:  None/Unknown
  Unknown/Multiple                   |
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:  #10663
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 Currently there is a fair bit of confusion surrounding the intended
 function of semicolons in GHCi (see #10663 and Phab: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),
    {{{
    λ> 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

    <interactive>: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 :@:

    <interactive>: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.

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11392>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list