Skip to content

add -Wname-shadowing and -Wunused-pattern-binds to the default warnings for ghci

In ghc 8.4.3

ghci -ignore-dot-ghci 
GHCi, version 8.4.3: http://www.haskell.org/ghc/  :? for help
Prelude> let 2 + 2 = 5
Prelude> 2 + 2
5

Users get no warning about the preceding or

or for

2 = 3

thus suggest that -Wname-shadowing and -Wunused-pattern-binds be added to the default warnings for ghci

 ghci -ignore-dot-ghci -Wname-shadowing -Wunused-pattern-binds
GHCi, version 8.4.3: http://www.haskell.org/ghc/  :? for help
Prelude> let 2 + 2 = 5

<interactive>:1:7: warning: [-Wname-shadowing]
    This binding for ‘+’ shadows the existing binding
      imported from ‘Prelude’ (and originally defined in ‘GHC.Num’)
Prelude> 2 = 3

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

I noticed the second and when googling to see if it had been reported I came across the following which documented the first: https://code.likeagirl.io/2-2-5-and-why-compiler-warnings-are-good-eaadef327146

Edited by george.colpitts
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information