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
instance (HaskVerdictar, HaskVerdictbr) =>HaskVerdict (a:&&b) rwhere
haskVerdict _ x =And<$> haskVerdict pa x <*> haskVerdict pb x
where pa =Proxy::Proxya
pb =Proxy::Proxyb
The Applicative in question is Maybe and for this problem Nothingindicates success.
So this implementation shortcuts with success whenever any of the conditions is met.
To fix this you can use this implementation instead:
instance (HaskVerdictar, HaskVerdictbr) =>HaskVerdict (a:&&b) rwhere
haskVerdict _ x =case (haskVerdict pa x, haskVerdict pb x) of
(Just ex, Just ey) ->Just (And ex ey)
(Just ex, _) ->Just ex
(_, Just ey) ->Just ey
_ ->Nothingwhere pa =Proxy::Proxya
pb =Proxy::Proxyb
The text was updated successfully, but these errors were encountered:
@jkarni earlier you've wondered why this test fails.
Here's localized problem (reproducible with
stack ghci
):The reason is this instance for
:&&
:The
Applicative
in question isMaybe
and for this problemNothing
indicates success.So this implementation shortcuts with success whenever any of the conditions is met.
To fix this you can use this implementation instead:
The text was updated successfully, but these errors were encountered: