Skip to content

Add forAll #47

@hdgarrood

Description

@hdgarrood

From Test.QuickCheck:

forAll :: (Show a, Testable prop) => Gen a -> (a -> prop) -> Property

Essentially, this allows you to write quickCheck tests without relying on an Arbitrary instance for all of the arguments you need. This would help us avoid the problem of orphan Arbitrary instances. For instance:

quickCheck $ forAll (maps :: Gen (Map Int String))
                    (\m -> m == Map.fromUnfoldable (Map.toFoldable m))

or something. Then, we are free to put Gen values for any type anywhere, without all the newtype shenanigans. We can also freely parameterize Gen values based on other values that are only available at runtime, etc etc. I'm sure I've complained about these aspects of type classes before. ;)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions