How I can calculate the type of (> 0)?

Viewed 107

Whenever I have an operator section with its left argument partially applied, i.e:

(0 >)

I just simply rewrite the operator in its prefix form and proceed with calculation:

(>) 0

How can I calculate the type of an operator section that has its right argument partially applied ?

1 Answers

For (>), it doesn't matter, because both arguments have the same type. Remove either Ord a => a from Ord a => a -> a -> Bool, and you are left with Ord a => a -> Bool.

In general, you just remove the type corresponding to the applied argument. For example, given (??) :: Int -> Char -> Bool,

-- with the Int argument supplied, you still need a Char
(x ??) == (\y -> x ?? y) :: Char -> Bool
-- with the Char argument supplied, you still need an Int
(?? y) == (\x -> x ?? y) :: Int -> Bool
Related