The expression parses as Consequently the principal type isOne can check the constraints by expanding the composition:Here
g . (g x). Initially write g :: a -> r and x :: a. In the function composition, g x must itself be a function whose result can be passed to g. Hence r = b -> a for a fresh type b, sog :: a -> b -> a
g x :: b -> a
g . g x :: b -> b -> af :: (a -> b -> a) -> a -> b -> b -> af g x y z = g (g x y) zg x y has type a, and the second application accepts it and the final b-typed argument z. The two type variables remain independent; no Haskell type class constraints are required. Articles by others on the same topic
There are currently no matching articles.