Skip to content

Test for List Applicative instance is ambigious  #8

@mark-schultz-wu

Description

@mark-schultz-wu

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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions