[Haskell-cafe] wildcards for type variables?

Sebastian Fischer sebf at informatik.uni-kiel.de
Wed Jan 13 08:22:14 EST 2010


On Jan 13, 2010, at 2:16 PM, Antoine Latter wrote:

>> He's looking for the self-documentation aspect of "this argument is
>> completely irrelevant".  Neither rolling a random unused type  
>> variable nor
>> "forall"ing it (my first idea) really accomplishes that.
>>
>
> Isn't that what we have here? a function of type (a -> A -> B) cannot
> use the first argument in any meaningful way.

I think, he wants to document that the type variable 'a' is not used  
in the *type*.

Just like you can document that the second argument of 'const' is  
unused by using a wildcard. You can write

     const x _ = x

instead of

     const x y = x

and it would be nice to write 'const's type as

     a -> _ -> a

rather than

     a -> b -> a

Sebastian

-- 
Underestimating the novelty of the future is a time-honored tradition.
(D.G.)





More information about the Haskell-Cafe mailing list