[Haskell-beginners] Exercise 7.2a
Francesco Ariis
fa-ml at ariis.it
Wed Aug 15 17:22:03 UTC 2018
Hello Trent,
On Wed, Aug 15, 2018 at 10:08:29AM -0700, trent shipley wrote:
> Also, at this point I am having trouble reading these function declarations.
>
> all :: (a -> Bool) -> [Bool] -> Bool
> all b ls = and (map b ls)
There must be a typo in the text. The correct signature is
all :: (a -> Bool) -> [a] -> Bool
Which is logical:
- we take a list of `a`s (`[a]`)
- we pass them through a function `a -> Bool`,
obtaining `[Bool]`
- we check if the resulting list is all comprised of `True`s.
Does that help?
More information about the Beginners
mailing list