[1 of 1] Compiling Main ( prog.hs, prog.o )
prog.hs:3:11: error:
• Couldn't match expected type ‘(t2 -> t3) -> t4’
with actual type ‘p’
because type variables ‘t2’, ‘t3’, ‘t4’ would escape their scope
These (rigid, skolem) type variables are bound by
the inferred type of d :: (t1 -> t2 -> t3) -> t4
at prog.hs:3:5-25
• In the expression: f (\ t -> x x t)
In an equation for ‘d’: d x = f (\ t -> x x t)
In an equation for ‘fix'’:
fix' f
= d d
where
d x = f (\ t -> x x t)
• Relevant bindings include
x :: t1 -> t2 -> t3 (bound at prog.hs:3:7)
d :: (t1 -> t2 -> t3) -> t4 (bound at prog.hs:3:5)
f :: p (bound at prog.hs:1:6)
fix' :: p -> t (bound at prog.hs:1:1)
|
3 | d x = f (\t -> x x t)
| ^^^^^^^^^^^^^^^
prog.hs:3:22: error:
• Occurs check: cannot construct the infinite type:
t1 ~ t1 -> t2 -> t3
• In the first argument of ‘x’, namely ‘x’
In the expression: x x t
In the first argument of ‘f’, namely ‘(\ t -> x x t)’
• Relevant bindings include
t :: t2 (bound at prog.hs:3:15)
x :: t1 -> t2 -> t3 (bound at prog.hs:3:7)
d :: (t1 -> t2 -> t3) -> t4 (bound at prog.hs:3:5)
|
3 | d x = f (\t -> x x t)
| ^