So I have this function in my code
type Player = Char
choose :: Player -> a -> a -> a
choose p a b
| p == 'X' = a
| p == 'O' = b
At one point it is used like so
(choose p (+) (-)) 5 5
I can clearly see that it chooses between the (+) or (-) function and then applies it on 5 and 5. In fact I even tested it in GHCi for myself.
However, here are the type signatures for the aforementioned functions
(+) :: Num a => a -> a -> a
(-) :: Num a => a -> a -> a
I simply do not understand how a function of this type signature can be passed to choose. Shouldn't choose have a type signature like this?
choose :: Num a => Player -> (a -> a -> a) -> (a -> a -> a) -> (a -> a -> a)
Could someone help me shine a light on this?