reducing error effects - Polysemy

Welcome to the Functional Programming Zulip Chat Archive. You can join the chat here.

drlkf

hello,
i'm having an issue reducing my error effects into one aggregate type, i have
the following code:

handleHTTPError
  :: Member (Error e) r
  => (HTTPError -> e)
  -> Sem (Error HTTPError ': r) a
  -> Sem r a
handleHTTPError = mapError

handleProcessError
  :: Member (Error e) r
  => (ProcessError -> e)
  -> Sem (Error ProcessError ': r) a
  -> Sem r a
handleProcessError = mapError

handleCommandErrors
  :: Member (Error e) r
  => (ProcessError -> e)
  -> (HTTPError -> e)
  -> Sem (Error ProcessError ': Error HTTPError ': r) a
  -> Sem r a
handleCommandErrors p h = handleHTTPError h . handleProcessError p

but the compiler seems to believe that i want to transform ProcessError into
HTTPError with the right-most call:

     Couldn't match type e with HTTPError
        arising from a use of handleProcessError
      e is a rigid type variable bound by
        the type signature for:
          handleCommandErrors :: forall e
                                        (r :: Polysemy.Internal.Kind.EffectRow) a.
                                 Member (Error e) r =>
                                 (ProcessError -> e)
                                 -> (HTTPError -> e)
                                 -> Sem (Error ProcessError : Error HTTPError : r) a
                                 -> Sem r a

how can i tell the compiler explicitly that the first call is meant to transform
ProcessError into e?