> Date: Tue, 14 Dec 2004 10:24:15 -0500
> From: Andrew Pimlott <[EMAIL PROTECTED]>
> Subject: Re: [Haskell-cafe] The difference between ($) and application
> 
> On Tue, Dec 14, 2004 at 11:23:24AM +0100, Henning Thielemann wrote:
> > 
> > On Tue, 14 Dec 2004, Andrew Pimlott wrote:
> > 
> > > (Of course, it's still useful, by itself or in a slice, as a higher-order
> > > operator.)
> > 
> > You can also use 'id' in this cases, right?
> 
> I'm thinking of things like
> 
>     zipWith ($)
>     map ($ x)

You can indeed use

zipWith id
map (`id` x)

instead. Look at the types:

id  :: a         ->  a
($) :: (a -> b)  ->  (a -> b)

The function ($) is the identity function, 
restricted to functions.

Nevertheless, I find using ($) in such a situation 
more descriptive than using id.

Cheers,
  Andres
_______________________________________________
Haskell-Cafe mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to