processRefileDests :: Maybe [InboxHandlerRefileDestSpec] -> ([ConfigError], RefileDests)
processRefileDests maybeRefileDestSpecs =
  let
    refileSpecs :: [InboxHandlerRefileDestSpec]
    refileSpecs = maybe [] id maybeRefileDestSpecs

    hasRightNumChars :: InboxHandlerRefileDestSpec -> Bool
    hasRightNumChars spec = moreThanOneChar $ T.unpack $ refileDestKey spec

    (rightNumCharsCmds,
     wrongNumCharsCmds) = List.partition hasRightNumChars refileSpecs

    errors = ErrorRefileDestKeyWrongNumChars <$> wrongNumCharsCmds

    toPair spec = (refileDestKey spec, spec)

    successes = toPair <$> rightNumCharsCmds
  in
    (errors, M.fromList successes)
processRefileDests :: Maybe [InboxHandlerRefileDestSpec] -> ([ConfigError], RefileDests)
processRefileDests maybeRefileDestSpecs =
  let
    refileSpecs :: [InboxHandlerRefileDestSpec]
    refileSpecs = maybe [] id maybeRefileDestSpecs

    hasRightNumChars :: InboxHandlerRefileDestSpec -> Bool
    hasRightNumChars spec = moreThanOneChar $ T.unpack $ refileDestKey spec

    (rightNumCharsCmds,
     wrongNumCharsCmds) = List.partition hasRightNumChars refileSpecs

    errors = ErrorRefileDestKeyWrongNumChars <$> wrongNumCharsCmds

    toPair spec = (refileDestKey spec, spec)

    successes = toPair <$> rightNumCharsCmds
  in
    (errors, M.fromList successes)
processRefileDests maybeRefileDestSpecs =
  let
    refileSpecs :: [InboxHandlerRefileDestSpec]
    refileSpecs = maybe [] id maybeRefileDestSpecs

    hasRightNumChars :: InboxHandlerRefileDestSpec -> Bool
    hasRightNumChars spec = moreThanOneChar $ T.unpack $ refileDestKey spec

    (rightNumCharsCmds,
     wrongNumCharsCmds) = List.partition hasRightNumChars refileSpecs

    errors = ErrorRefileDestKeyWrongNumChars <$> wrongNumCharsCmds

    toPair spec = (refileDestKey spec, spec)

    successes = toPair <$> rightNumCharsCmds
  in
    (errors, M.fromList successes)