You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
weakenDiscard and strengthenDiscard each form a commutative monoid. In fact, they correspond to the monoid operation which picks the least (or greatest) element, according to some ordering. Each has a unit:
For weakenDiscard it's the strongest: const (Just DiscardResultAndTrace)
For strengthenDiscard it's the weakest: const Nothing
I think the properties we want to check are:
-- ordering (for appropriately-defined min/max functions):\d1 d2 a -> weakenDiscard d1 d2 a =min (d1 a) (d2 a)
\d1 d2 a -> strengthenDiscard d1 d2 a =max (d1 a) (d2 a)
-- commutativity\d1 d2 a -> weakenDiscard d1 d2 a == weakenDiscard d2 d1 a
\d1 d2 a -> strengthenDiscard d1 d2 a == strengthenDiscard d2 d1 a
-- identity\d a -> weakenDiscard (const (JustDiscardResultAndTrace)) d a == d a
\d a -> strengthenDiscard (constNothing) d a == d a
These could also serve as nice documentation, if presented well. Perhaps we should even add newtype'd monoids!
weakenDiscard
andstrengthenDiscard
each form a commutative monoid. In fact, they correspond to the monoid operation which picks the least (or greatest) element, according to some ordering. Each has a unit:weakenDiscard
it's the strongest:const (Just DiscardResultAndTrace)
strengthenDiscard
it's the weakest:const Nothing
I think the properties we want to check are:
These could also serve as nice documentation, if presented well. Perhaps we should even add newtype'd monoids!
The text was updated successfully, but these errors were encountered: