Closed asr closed 6 years ago
Asr, have you noticed Fn
pattern, it should be exported. IIRC we had good reason to not export Fun constructor, could you check a PR that added it to main module export list (should be recent, in the last year). But if there weren't any reason, than this is :+1:
Sent from my iPhone
On 26 Dec 2017, at 18.47, Andrés Sicard-Ramírez notifications@github.com wrote:
Data constructor Fun(Fun) is not exported by QuickCheck.hs. This PR fix this issue.
You can view, comment on, or merge this pull request online at:
https://github.com/nick8325/quickcheck/pull/194
Commit Summary
Exported data constructor
Fun(Fun)
. File ChangesM Test/QuickCheck.hs (2) Patch Links:
https://github.com/nick8325/quickcheck/pull/194.patch https://github.com/nick8325/quickcheck/pull/194.diff — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.
@phadej, I hadn't notice the Fn
pattern, thanks!
From the example in the documentation
prop_foo :: Fun String Integer -> Bool
prop_foo (Fn f) = f "banana" == f "monkey" || f "banana" == f "elephant"
using the Fn
pattern, I got the warning (when compiling with the -Wall
flag):
Pattern match(es) are non-exhaustive
In an equation for ‘prop_foo’: Patterns not matched: _
Note that the warning disappears if I use the data constructor Fun
instead:
import Test.QuickCheck.Function
prop_bar :: Fun String Integer -> Bool
prop_bar (Fun _ f) = f "banana" == f "monkey" || f "banana" == f "elephant"
Can I avoid the above warning without adding the equation
prop_foo _ = ...
?
IIRC we had good reason to not export Fun constructor, could you check a PR that added it to main module export list (should be recent, in the last year).
It's #104, but it just says "I intentionally didn't re-export Fun
constructor". Anyway, seems like a good idea to add.
Data constructor
Fun(Fun)
is not exported byQuickCheck.hs
. This PR fix this issue.