Search code examples
haskellsyntaxparentheses

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?


Solution

  • 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