Remove the envTHandle function since it is not particularly helpful.

This commit is contained in:
(cdep)illabout 2019-07-07 22:33:18 +09:00
parent 917f0efc44
commit a33d8b3f83
3 changed files with 2 additions and 14 deletions

View File

@ -180,7 +180,6 @@ module Servant.Checked.Exceptions
, catchesEnvT
, emptyEnvT
, envTRemove
, envTHandle
-- ** Other 'EnvelopeT' combinators
, relaxEnvT
, liftA2EnvT

View File

@ -43,7 +43,6 @@ module Servant.Checked.Exceptions.Envelope (
, catchesEnvT
, emptyEnvT
, envTRemove
, envTHandle
-- ** Other EnvelopeT combinators
, relaxEnvT
, liftA2EnvT

View File

@ -476,13 +476,13 @@ bindEnvT (EnvelopeT m) f =
-- >>> envTRemove env1 :: EnvelopeT '[Double] Identity (Either Float String)
-- EnvelopeT (Identity (SuccEnvelope (Right "hello")))
--
-- Failing to pull out an error in an 'Envelope':
-- Failing to pull out an error in an 'EnvelopeT':
--
-- >>> let env2 = throwErrEnvT (3.5 :: Double) :: EnvelopeT '[String, Double] Identity Float
-- >>> envTRemove env2 :: EnvelopeT '[Double] Identity (Either Float String)
-- EnvelopeT (Identity (ErrEnvelope (Identity 3.5)))
--
-- Note that if you have an 'Envelope' with multiple errors of the same type,
-- Note that if you have an 'EnvelopeT' with multiple errors of the same type,
-- they will all be handled at the same time:
--
-- >>> let env3 = throwErrEnvT (3.5 :: Double) :: EnvelopeT '[String, Double, Char, Double] Identity Float
@ -506,13 +506,3 @@ envTRemove (EnvelopeT m) = EnvelopeT $ fmap go m
case envelopeRemove envel of
Right e -> SuccEnvelope (Right e)
Left envel -> fmap Left envel
envTHandle
:: (ElemRemove e es, Monad m)
=> (a -> EnvelopeT (Remove e es) m x)
-> (e -> EnvelopeT (Remove e es) m x)
-> EnvelopeT es m a
-> EnvelopeT (Remove e es) m x
envTHandle aHandler eHandler envT = do
aOrE <- envTRemove envT
either aHandler eHandler aOrE