[Haskell-cafe] instance for (Show ([(String, Int)] -> Int))
Aaron Gray
aaronngray.lists at gmail.com
Tue Dec 28 00:37:01 CET 2010
On 24 December 2010 23:58, Daniel Fischer
<daniel.is.fischer at googlemail.com>wrote:
> On Saturday 25 December 2010 00:32:38, Aaron Gray wrote:
> > Okay great, works this end too, but what does the 'flip' do ???
>
> It flips the order of arguments to calc. You could also write
>
> main = getContents >>= print . (`calc` []) . lexer
>
> Generally,
>
> flip f = \x y -> f y x
>
> or
>
> flip f x = \y -> f y x
>
> flip f x y = f y x
>
Or :-
calcExpr :: [Token] -> Int
calcExpr tokens = calc tokens []
process = print . calcExpr . lexer
makes things clearer.
Aaron
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20101227/ad25f3a9/attachment.htm>
More information about the Haskell-Cafe
mailing list