I have a function in Haskell that is defined as follows:
f2 x y = if x then x else y
When trying to determine the type of y, I would assume it could be of any valid Haskell type, since it is not required for evaluating the if-part. However, checking the type signature with
:type f2
yields
f2 :: Bool -> Bool -> Bool
Why does the y argument need to be of type Bool in this case?