[fschwidom@localhost: Re: [Haskell-beginners] ($) operator]

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[fschwidom@localhost: Re: [Haskell-beginners] ($) operator]

Frank Schwidom
----- Forwarded message from Frank Schwidom <fschwidom@localhost> -----

Date: Sat, 24 Jan 2009 21:40:54 +0000
From: Frank Schwidom <fschwidom@localhost>
To: John Hartnup <[hidden email]>
Subject: Re: [Haskell-beginners] ($) operator
Message-ID: <20090124214053.GA4496@BigBox>
References: <[hidden email]>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <[hidden email]>
User-Agent: Mutt/1.5.16 (2007-06-09)
Status: RO

On Sat, Jan 24, 2009 at 07:37:29PM +0000, John Hartnup wrote:

> Hi.
>
> I'm working through Real World Haskell, and although it's going well
> (I just finished the exercise to write a glob matcher without using a
> regex library, and I'm pleased as punch), I keep seeing the ($)
> operator, and I'm not sure I understand its use. If the book explains
> it, I've been unable to find it.
>
> Empirically, it seems like:
> a $ b c d e f
> .. is equivalent to ..
> a (b c d e f)
>
> But is that it's only purpose? To placate the LISP haters by removing
> parentheses?
>
> (1 +) 2  does the same thing as (1 +) $ 2, and has the same type.
>
> Am I missing something?
>
> Thanks,
> John
>
>
> --
> "There is no way to peace; peace is the way"
> _______________________________________________
> Beginners mailing list
> [hidden email]
> http://www.haskell.org/mailman/listinfo/beginners

maybe can this answer your question:

A:
((==) True) (1 == 1) -- won't work: ((==) True) 1 == 1

=>

((==) True) ((==) 1 1) -- won't work: ((==) True) (==) 1 1

=>

((==) True) $ (==) 1 1

=>

((==) True) $ 1 == 1


Regards


----- End forwarded message -----