Currently, contramap, with, and qWith are all ways to preprocess the value before passing the value to the next Predicate. But they all update the description with a hardcoded method:
contramap says in a property: ...
with says property at Foo.hs:1:1: ...
qWith says <funcname>: ...
This might be fine in most cases, but it can get pretty weird with things like contains:
ghci> explain (contains $ $(qWith [| abs |]) (gt 5)) [2 :: Int]
"all elements abs: ≤ 5"
it'd be nice to do something like
>>> explain (contains $ withAs "after absolute value " abs (gt 5)) [2 :: Int]
"all elements after absolute value ≤ 5"
Also, related, there's no way to contramap without changing the explanation. (IMO, contramap shouldn't change the message at all, but maybe that's a separate discussion). This could be useful for things like unwrapping newtypes.
Currently,
contramap,with, andqWithare all ways to preprocess the value before passing the value to the next Predicate. But they all update the description with a hardcoded method:contramapsaysin a property: ...withsaysproperty at Foo.hs:1:1: ...qWithsays<funcname>: ...This might be fine in most cases, but it can get pretty weird with things like
contains:it'd be nice to do something like
Also, related, there's no way to contramap without changing the explanation. (IMO,
contramapshouldn't change the message at all, but maybe that's a separate discussion). This could be useful for things like unwrapping newtypes.