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
Is there a technical reason why this instance doesn't exist? It seems well-behaved (some sanity-check proofs are at the bottom of the page).
fstP :: Product f g a -> f a
fstP (Pair a _) = a
sndP :: Product f g a -> g a
sndP (Pair _ a) = a
instance (MonadError e f, MonadError e g) => MonadError e (Product f g) where
throwError e = Pair (throwError e) (throwError e)
catchError (Pair ma mb) f = Pair (catchError ma (fstP . f)) (catchError mb (sndP . f))
catchError m throwError = m
catchError (Pair f g) throwError
= { inline catchError }
Pair (catchError f (fstP . throwError)) (catchError g (sndP . throwError))
= { inline throwError }
Pair
(catchError f (fstP . (\e -> Pair (throwError e) (throwError e)))
(catchError g (sndP . (\e -> Pair (throwError e) (throwError e)))
= { inline (.) }
Pair
(catchError f (\e -> fstP (Pair (throwError e) (throwError e)))
(catchError g (\e -> sndP (Pair (throwError e) (throwError e)))
= { eta-reduction }
Pair
(catchError f (\e -> throwError e))
(catchError g (\e -> throwError e))
= { eta-reduction }
Pair
(catchError f throwError)
(catchError g throwError)
= { hypothesis }
Pair f g
catchError (throwError e) pure = pure e
catchError (throwError e) pure
= { inline throwError }
catchError (Pair (throwError e) (throwError e)) pure = pure e
= { inline catchError }
Pair (catchError (throwError e) (fstP . pure)) (catchError (throwError e) (sndP . pure))
= { inline pure, (.) }
Pair
(catchError (throwError e) (\x -> fstP (Pair (pure x) (pure x))))
(catchError (throwError e) (\x -> sndP (Pair (pure x) (pure x))))
= { eta-reduction }
Pair
(catchError (throwError e) (\x -> pure x))
(catchError (throwError e) (\x -> pure x))
= { eta-reduction }
Pair
(catchError (throwError e) pure)
(catchError (throwError e) pure)
= { hypothesis }
Pair (pure e) (pure e}
= { pure }
pure e
The text was updated successfully, but these errors were encountered:
Is there a technical reason why this instance doesn't exist? It seems well-behaved (some sanity-check proofs are at the bottom of the page).
The text was updated successfully, but these errors were encountered: