molten
molten

Reputation: 53

How do I correctly parenthesize nested function calls?

Given these two functions:

drex :: (Int,Int) -> [[String]] -> String

rcgmove :: String -> (Int,Int) -> (Int,Int)

When called like this:

drex ((rcgmove b (x,y)) xs)

Is an error, because xs is rcgmove's third argument. However, I want xs to be drexs second argument. How do I do this?

Upvotes: 1

Views: 1050

Answers (1)

Gabriella Gonzalez
Gabriella Gonzalez

Reputation: 35089

xs pretends like rcgmove function's third argument, and gives error. However I want xs to be drex function's second argument as you can guess. How can I give xs as drex's second argument?

Just remove the outermost parentheses:

drex (rcgmove b (x,y)) xs

Upvotes: 4

Related Questions