[email protected]
[Top] [All Lists]

Re: [Haskell-cafe] wildcards for type variables?

Subject: Re: [Haskell-cafe] wildcards for type variables?
From: Ketil Malde
Date: Thu, 14 Jan 2010 14:31:08 +0100
Ozgur Akgun <[email protected]> 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
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

<Prev in Thread] Current Thread [Next in Thread>