[Haskell-cafe] wildcards for type variables?

Ketil Malde ketil at malde.org
Thu Jan 14 08:31:08 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?

E.g, 'const' is useful when you need something to feed to a higher order
function:

  -- an element <=3 starts a new group
  *Main> groupBy (const (>3)) [1,2,3,4,1,5,6]
  [[1],[2],[3,4],[1,5,6]]

Not the best example, perhaps, but the existence of const allows you to
easily reuse existing framework.

There's also 'par', although it's raison d'être is to have an effect on
the second parameter, so it is arguably "using" it.

-k
-- 
If I haven't seen further, it is by standing in the footprints of giants


More information about the Haskell-Cafe mailing list