Re: [Haskell-cafe] shadowing keywords like otherwise

2009-06-28 Thread Janis Voigtlaender

Vasili I. Galchin wrote:
It seems to me that in the code base somewhere that there is a 
redefine of the keywordotherwise. I haven't read the Haskell 98 
Report but I thought that it was not possible to redefine keywords. ??


otherwise is not a keyword. It is just defined as a normal function
like so:

otherwise = True

Ciao,
Janis.

--
Dr. Janis Voigtlaender
http://wwwtcs.inf.tu-dresden.de/~voigt/
mailto:vo...@tcs.inf.tu-dresden.de

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] shadowing keywords like otherwise

2009-06-28 Thread Janis Voigtlaender

Vasili I. Galchin wrote:
so Janis I have to look where the original author overrode otherwise? 
If so, just great .. a ton of code. ;^(


No, you don't have to look for this. It is in the code snippet you sent:

swishParse :: String - String - SwishStateIO (Maybe RDFGraph)
swishParse fnam inp =
do  { fmt - gets $ format
; case fmt of
N3- swishParseN3 fnam inp
otherwise -
do  { swishError (Unsupported file format: ++(show
fmt)) 4
; return Nothing
}
}

In the case expression you use otherwise as a variable. But you do not
use that variable in that branch. Hence the warning:

Swish/HaskellRDF/SwishCommands.hs:304:12:
Warning: Defined but not used: `otherwise'

This has nothing to do with someone else shadowing the definition of
otherwise.

Ciao,
Janis.

--
Dr. Janis Voigtlaender
http://wwwtcs.inf.tu-dresden.de/~voigt/
mailto:vo...@tcs.inf.tu-dresden.de

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] shadowing keywords like otherwise

2009-06-28 Thread Kim-Ee Yeoh

Hi Vasili,

This isn't really a shadowing/redefinition issue. Here's 
a perfectly legitimate snippet that compiles fine:

f 0 = 0
f otherwise = 1+otherwise

Redefinition is when you have:

g = let otherwise = not in x 


-- Kim-Ee


VasiliIGalchin wrote:
 
 swishParse :: String - String - SwishStateIO (Maybe RDFGraph)
 swishParse fnam inp =
 do  { fmt - gets $ format
 ; case fmt of
 N3- swishParseN3 fnam inp
 otherwise -
 do  { swishError (Unsupported file format: ++(show fmt))
 4
 ; return Nothing
 }
 }
 
 I am receiving a shadow warning:
 
 Swish/HaskellRDF/SwishCommands.hs:304:12:
 Warning: Defined but not used: `otherwise'
 
 It seems to me that in the code base somewhere that there is a redefine
 of
 the keywordotherwise. I haven't read the Haskell 98 Report but I thought
 that it was not possible to redefine keywords. ??
 

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

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] shadowing keywords like otherwise

2009-06-28 Thread Kim-Ee Yeoh

I meant, of course,

g = let otherwise = not in otherwise

Sorry for the noise.

-- Kim-Ee


Kim-Ee Yeoh wrote:
 
 Hi Vasili,
 
 This isn't really a shadowing/redefinition issue. Here's 
 a perfectly legitimate snippet that compiles fine:
 
 f 0 = 0
 f otherwise = 1+otherwise
 
 Redefinition is when you have:
 
 g = let otherwise = not in x 
 
 
 -- Kim-Ee
 
 
 VasiliIGalchin wrote:
 
 swishParse :: String - String - SwishStateIO (Maybe RDFGraph)
 swishParse fnam inp =
 do  { fmt - gets $ format
 ; case fmt of
 N3- swishParseN3 fnam inp
 otherwise -
 do  { swishError (Unsupported file format: ++(show
 fmt)) 4
 ; return Nothing
 }
 }
 
 I am receiving a shadow warning:
 
 Swish/HaskellRDF/SwishCommands.hs:304:12:
 Warning: Defined but not used: `otherwise'
 
 It seems to me that in the code base somewhere that there is a redefine
 of
 the keywordotherwise. I haven't read the Haskell 98 Report but I
 thought
 that it was not possible to redefine keywords. ??
 
 
 

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

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] shadowing keywords like otherwise

2009-06-28 Thread Bulat Ziganshin
Hello Vasili,

Sunday, June 28, 2009, 10:39:37 AM, you wrote:

     ; case fmt of
      N3    - swishParseN3 fnam inp
     otherwise -
     do  { swishError (Unsupported file format: ++(show fmt)) 4
     ; return Nothing
     }
      }

first, otherwise aka True is used in *condition* part of case
statement. here you should use _

second, otherwise isn't a keyword, just a Prelude definition. here,
you assign fmt value to this identifier


-- 
Best regards,
 Bulatmailto:bulat.zigans...@gmail.com

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] shadowing keywords like otherwise

2009-06-28 Thread Felipe Lessa
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@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] shadowing keywords like otherwise

2009-06-28 Thread Brandon S. Allbery KF8NH

On Jun 28, 2009, at 02:39 , Vasili I. Galchin wrote:

; case fmt of
N3- swishParseN3 fnam inp
otherwise -
do  { swishError (Unsupported file format: ++(show  
fmt)) 4

; return Nothing
}
}

I am receiving a shadow warning:

Swish/HaskellRDF/SwishCommands.hs:304:12:
Warning: Defined but not used: `otherwise'


1. otherwise isn't a keyword, it's a function (well, CAF).
2. if you use a variable in a case alternative, that variable is  
created and bound.  I think you wanted to use _ instead of  
otherwise there.


--
brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allb...@kf8nh.com
system administrator [openafs,heimdal,too many hats] allb...@ece.cmu.edu
electrical and computer engineering, carnegie mellon universityKF8NH




PGP.sig
Description: This is a digitally signed message part
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] shadowing keywords like otherwise

2009-06-28 Thread Kim-Ee Yeoh

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@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.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe