[Haskell-cafe] wildcards for type variables?

Ivan Lazar Miljenovic ivan.miljenovic at gmail.com
Thu Jan 14 08:24:55 EST 2010


Ozgur Akgun <ozgurakgun at gmail.com> writes:

> Can someone give an example of a "reasonable" function that never uses one
> of its parameters, and justify the existence of that parameter in this case,
> please?

I would like to bring your attention to the "const" function:

,----
| const     :: a -> b -> a
| const a _ = a
`----

For justification, I often use this function when I need to provide a
function that takes two arguments by the function I want to use only
needs one; as such either const of (flip const) can let me absorb and
ignore the unneeded argument.

Satisfied? ;-)

-- 
Ivan Lazar Miljenovic
Ivan.Miljenovic at gmail.com
IvanMiljenovic.wordpress.com


More information about the Haskell-Cafe mailing list