I have a function, that uses the Dot-operator. Now I want to write it without the dot. How can I do this?
all p = and . map p
Is this right?
all p = and (map p)
I get these errors:
4.hs:8:13:
Couldn't match expected type `[Bool]'
with actual type `[a0] -> [b0]'
In the return type of a call of `map'
Probable cause: `map' is applied to too few arguments
In the first argument of `and', namely `(map p)'
In the expression: and (map p)
Look at the definition of (.)
:
f . g = \ x -> f (g x)
Expanding this gives
and . (map p) = \x -> and ((map p) x)
or
all p x = and (map p x)