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
We use prisms for error handling a lot, an example:
instanceAsEvaluationErrorUnliftingEvaluationErrorUnliftingErrorUnliftingErrorwhere
_EvaluationError = coerced
{-# INLINE _EvaluationError #-}
--| An 'UnliftingEvaluationError' /is/ an 'EvaluationError', hence for this instance we only-- require both @operational@ and @structural@ to have '_UnliftingError' prisms, so that we can-- handle both the cases pointwisely.instance (AsUnliftingErroroperational, AsUnliftingErrorstructural) =>AsUnliftingEvaluationError (EvaluationErroroperationalstructural) where
_UnliftingEvaluationError = go . coerced where
go =
prism'
(bimap
(review _UnliftingError)
(review _UnliftingError))
(bitraverse
(reoption . matching _UnliftingError)
(reoption . matching _UnliftingError))
{-# INLINE _UnliftingEvaluationError #-}
instanceAsUnliftingEvaluationErrorBuiltinErrorwhere
_UnliftingEvaluationError = _BuiltinUnliftingEvaluationError . _UnliftingEvaluationError
{-# INLINE _UnliftingEvaluationError #-}
This all is pretty complex and I've got parts of it wrong in the past. Do we really need it? I don't think we use the matching part of any of these prisms anywhere, only the review one? So can we just make those into regular functions?
We'll lose some Template Haskell convenience that comes with prismatic error handling, but given the amount of hand-written code, maybe even that will be net positive.
Or do we use the matching part somewhere?
The text was updated successfully, but these errors were encountered:
We use prisms for error handling a lot, an example:
This all is pretty complex and I've got parts of it wrong in the past. Do we really need it? I don't think we use the
matching
part of any of these prisms anywhere, only thereview
one? So can we just make those into regular functions?We'll lose some Template Haskell convenience that comes with prismatic error handling, but given the amount of hand-written code, maybe even that will be net positive.
Or do we use the
matching
part somewhere?The text was updated successfully, but these errors were encountered: