[Haskell-cafe] question regarding the $ apply operator

Ting Lei tinlyx at hotmail.com
Tue Jul 19 08:16:00 CEST 2011


Hi

I have a naive question regarding the basic use of the $ operator, and I am confused why certain times it doesn't seem to work.
e.g.
The following works:

applySkip i f ls = (take i) ls ++ f (drop i ls)

But the following doesn't:

applySkip i f ls = (take i) ls ++ f $ drop i ls

which gives me an error:

    The first argument of ($) takes one argument,
    but its type `[a0]' has none
    In the expression: (take i) ls ++ f $ drop i ls
    In an equation for `applySkip':
        applySkip i f ls = (take i) ls ++ f $ drop i ls


FYI, I am using GHC 7.0.3 for this.
Thanks in advance for comments.


Ting
 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20110718/a0419db7/attachment.htm>


More information about the Haskell-Cafe mailing list