So I'm playing around with the y-combinator and anonymous functions, and I ran into this weird error:
Couldn't match expected type `t0 -> t1 -> t2'
with actual type `forall b. b -> [b] -> [b]'
The lambda expression `\ (n :: Int) newVal xs -> ...'
has three arguments,
but its type `Int -> forall b. b -> [b] -> [b]' has only one
(source code that creates the error, and version that I eventually got working)
If I modify the types slightly to avoid Rank N polymorphism (use forall b. Int -> b -> [b] -> [b]
), the error is similar:
Couldn't match expected type `t0 -> t1 -> t2 -> t3'
with actual type `forall b. Int -> b -> [b] -> [b]'
The lambda expression `\ (n :: Int) newVal xs -> ...'
has three arguments,
but its type `forall b. Int -> b -> [b] -> [b]' has none
Could someone explain to me why forall b. b -> [b] -> [b]
has no arguments?