
Does writing it like this help any? until :: (c -> Bool) -> (c -> c) -> (c -> c) foldr :: (( a ) -> ( b ) -> ( b )) -> b -> [a] -> b Anonymous Anonymous wrote:
Hello,
I'm new at haskell and I have the following question:
let's say I type the following:
function = foldr until
Now my first question is what is the type of this function? Well let's see what the type of until and foldr is:
until :: (a -> Bool) -> (a -> a) -> a -> a foldr :: (a -> b -> b) -> b -> [a] -> b
So I would be thinking: we fill until in the position of (a -> b -> b) so, a correspond with (a -> Bool) and b correspond with (a -> a) and b correspond with a. Hmm a small problem, I think we can divide that as follows: b1 corresponds with (a -> a) and b2 corresponds with a. So I get:
foldr until :: b1 -> [a] -> b2 foldr until :: (a -> a) -> [a -> Bool] -> a
Is this a correct way of thinking or am I wrong?
And another question is: can someone give me an example how this can be executed? All my code that I tried to execute resulted in errors with "foldr until".
Thanks!