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

Kim-Ee Yeoh a.biurvOir4 at asuhan.com
Sun Jun 28 15:43:59 EDT 2009


Whoops, you're right.

Interestingly, the shadowing warnings vary between 
the 2 examples I gave, i.e. shadowing within 
'function definition' vs 'binding group'.



Felipe Lessa wrote:
> 
> 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.
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
> 
> 

-- 
View this message in context: http://www.nabble.com/%22shadowing%22-keywords-like-%22otherwise%22-tp24239153p24244760.html
Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.



More information about the Haskell-Cafe mailing list