Skip to content

Commit

Permalink
Ch13 revise quickCheckPure exercise (#307)
Browse files Browse the repository at this point in the history
* Revise exercises on processing results of `quickCheckPure`.

* Fix em-dash.
  • Loading branch information
shaunplee authored Feb 24, 2021
1 parent 308a271 commit afc349c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion text/chapter13.md
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,8 @@ Success : Success : ...
```

_Hint_: Use the `oneOf` function defined in `Test.QuickCheck.Gen` to define your `Arbitrary` instance.
1. (Medium) Use the `all` function to simplify the result of the `quickCheckPure` function - your function should return `true` if every test passes, and `false` otherwise. Try using the `First` monoid, defined in `monoids` with the `foldMap` function to preserve the first error in case of failure.
1. (Medium) Use `all` to simplify the result of the `quickCheckPure` function - your new function should have type `List Result -> Boolean` and should return `true` if every test passes and `false` otherwise.
1. (Medium) As another approach to simplifying the result of `quickCheckPure`, try writing a function `squashResults :: List Result -> Result`. Consider using the `First` monoid from `Data.Maybe.First` with the `foldMap` function to preserve the first error in case of failure.

## Conclusion

Expand Down

0 comments on commit afc349c

Please sign in to comment.