The test suite for Applicative.hs accepts the following code:
(<*>) (f :. fs) xs = (f <$> xs) ++ (fs <*> xs)
(<*>) _ _ = Nil
and rejects the following code:
(<*>) (f :. fs) (x :. xs) = (f x) :. (fs <*> xs)
(<*>) _ _ = Nil
I'm under the impression that these are both valid applicative instances (I think the second one is essentially the ZipList applicative instance, but I'm not actually sure).
If so, it might be useful to somehow alert the students that, while the second instance is valid, they should search for an entirely different instance (and not stare at that one and try to get it to work).
The test suite for Applicative.hs accepts the following code:
and rejects the following code:
I'm under the impression that these are both valid applicative instances (I think the second one is essentially the ZipList applicative instance, but I'm not actually sure).
If so, it might be useful to somehow alert the students that, while the second instance is valid, they should search for an entirely different instance (and not stare at that one and try to get it to work).