dummy variables

Keean Schupke k.schupke at imperial.ac.uk
Wed Dec 29 13:17:30 EST 2004


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 at botik.ru> "Serge D. Mechveliani"
><mechvel at botik.ru> 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 at haskell.org
>http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
>  
>



More information about the Glasgow-haskell-users mailing list