[Haskell-cafe] wildcards for type variables?

Evan Laforge qdunkan at gmail.com
Wed Jan 13 12:54:52 EST 2010


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

Yeah, that's the idea, sorry if I wasn't clear.

In the case of const, I might write

const :: a -> _b -> a

To document that 'b' intentionally appears only once, but this is only
my convention and I've never seen anyone else use it.  In the case of
'const' it's pretty obvious and unnecessary, but in a longer signature
it might help a bit, especially if you are using phantom types and
some functions intentionally ignore type arguments.

I haven't used them before, but in the presence of scoped type
variables, wouldn't have a reader have to go look for internal
definitions to reassure himself that the type is in fact ignored
entirely?

It's not a big issue, but it seemed like a nice symmetry with pattern
matching syntax.


More information about the Haskell-Cafe mailing list