(*)
も
(+)
も、それぞれ
Num
型クラスのインスタンスであればどれでも受け取るようになっています。
なので、
:t
の結果が
(Num a, Num (a -> a -> a)) => ...
となっているとおり、これらの条件を満たす型が
本当にあれば この式も普通に型チェックを通ります。
ただ、実際のところ
(Num a, Num (a -> a -> a))
を満たす型は意図的に、頑張って作らない限りは存在しないので、いざ
((*) (+))
を使おうとしたその時に型エラーになる可能性が高いです。
例えば以下のように:
> ((*) (+)) (+) 1 2 3 :: Integer
<interactive>:4:1: error:
? No instance for (Num
((Integer -> Integer)
-> (Integer -> Integer) -> Integer -> Integer))
arising from a use of ‘*’
(maybe you haven't applied a function to enough arguments?)
? In the expression: ((*) (+)) (+) 1 2 3 :: Integer
In an equation for ‘it’: it = ((*) (+)) (+) 1 2 3 :: Integer
<interactive>:4:6: error:
? No instance for (Num (Integer -> Integer))
arising from a use of ‘+’
(maybe you haven't applied a function to enough arguments?)
? In the first argument of ‘(*)’, namely ‘(+)’
In the expression: ((*) (+)) (+) 1 2 3 :: Integer
In an equation for ‘it’: it = ((*) (+)) (+) 1 2 3 :: Integer