
What I meant: is this reasonable for future Haskell to make a variable _foo equivalent to `_' ? In this case, one can use _foo as a self-commenting dummy variable: let (x, _newEqs, _newVars) = f a (y, _newEqs, newVars ) = f b in x:y:newVars These _foo help to recall the type of f (suppose f is in another file, so that one needs to search and recall). This makes it easier to read/understand the program. ----------------- Serge Mechveliani mechvel@botik.ru On Wed, Dec 29, 2004 at 06:17:30PM +0000, Keean Schupke wrote:
Except for GHC, where a variable staring with an '_' will not report a warning if it is unused in the body of a funtion:
let _ = x in y -- no warning let result = x in y -- waring about result being unused let _result = x in y -- no warning, but variable can still be used.
Keean.
Duncan Coutts wrote:
In message <20041229115341.A431@botik.ru> "Serge D. Mechveliani"
writes: Dear Haskellers, dear GHC team,
Is a variable `_x' equivalent to `_'
No, '_x' is a perfectly ordinary variable. The only special "dummy variable" (a pattern that matches anything but does not bind a varialbe) is '_'.
Does really Haskell mean this? It this reasonable? How to set self-commenting dummy variables?
You can use them as dummy variables by never using them in an expression context, only in pattern/binding context. As you noted they should be unique withing each scope.
Duncan _______________________________________________ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
participants (1)
-
Serge D. Mechveliani