[Haskell-cafe] "shadowing" keywords like "otherwise"

Felipe Lessa felipe.lessa at gmail.com
Sun Jun 28 07:28:12 EDT 2009


On Sun, Jun 28, 2009 at 12:49:12AM -0700, Kim-Ee Yeoh wrote:
> This isn't really a shadowing/redefinition issue. Here's
> a perfectly legitimate snippet that compiles fine:
>
> f 0 = 0
> f otherwise = 1+otherwise

What?  It is a redefinition issue *as well*, but this kind of
warning isn't active by default

    Prelude> :s -Wall
    Prelude> let f 0 = 0; f otherwise = 1 + otherwise

    <interactive>:1:15:
        Warning: This binding for `otherwise' shadows the existing binding
                   imported from Prelude
                 In the definition of `f'

--
Felipe.


More information about the Haskell-Cafe mailing list