[GHC] #15720: Assign to literals is allowed in ghci

GHC ghc-devs at haskell.org
Mon Oct 8 12:48:17 UTC 2018


#15720: Assign to literals is allowed in ghci
-------------------------------------+-------------------------------------
        Reporter:  sighingnow        |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  GHCi              |              Version:  8.6.1
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  GHC accepts       |  Unknown/Multiple
  invalid program                    |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by RyanGlScott):

 Replying to [comment:2 sighingnow]:
 > Should we enable `-Wunused-pattern-binds` by default ?

 It's enabled by `-Wall`:

 {{{
 $ ghci -Wall
 GHCi, version 8.4.3: http://www.haskell.org/ghc/  :? for help
 Loaded GHCi configuration from /home/ryanglscott/.ghci
 λ> 1 = 2

 <interactive>:1:1: warning: [-Wtype-defaults]
     • Defaulting the following constraints to type ‘Integer’
         (Eq a0) arising from the literal ‘1’ at <interactive>:1:1
         (Num a0) arising from the literal ‘1’ at <interactive>:1:1
     • In the pattern: 1
       In a pattern binding: 1 = 2

 <interactive>:1:1: warning: [-Wunused-pattern-binds]
     This pattern-binding binds no variables: 1 = 2
 }}}

 I'd be hesitant to enable `-Wunused-pattern-binds` by default without a
 clear community consensus for it (perhaps in the form of a GHC proposal).

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


More information about the ghc-tickets mailing list