-
Notifications
You must be signed in to change notification settings - Fork 2
Allow manually specifying description of contramapped Predicate #17
Copy link
Copy link
Open
Description
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:
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:
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.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels