Skip to content

Commit 0da49d3

Browse files
committed
Reinstate transformers Selective instance for ExceptT
1 parent 785f654 commit 0da49d3

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/Control/Selective.hs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ import GHC.Conc (STM)
5454
import qualified Control.Monad.Trans.RWS.Strict as S
5555
import qualified Control.Monad.Trans.State.Strict as S
5656
import qualified Control.Monad.Trans.Writer.Strict as S
57+
import Control.Monad.Trans.Except (ExceptT)
58+
import qualified Control.Monad.Trans.Except
5759

5860
-- | Selective applicative functors. You can think of 'select' as a selective
5961
-- function application: when given a value of type 'Left' @a@, you __must apply__
@@ -509,6 +511,9 @@ instance Selective (ST s) where select = selectM
509511
instance Selective STM where select = selectM
510512

511513
instance Selective (ContT r m) where select = selectM
514+
-- | Note that there is an instance for an isomorphic functor 'Control.Selective.Trans.Except'
515+
-- which does not need the 'Monad m' constraint.
516+
instance Monad m => Selective (ExceptT e m) where select = selectM
512517
instance Monad m => Selective (MaybeT m) where select = selectM
513518
instance (Monoid w, Monad m) => Selective (RWST r w s m) where select = selectM
514519
instance (Monoid w, Monad m) => Selective (S.RWST r w s m) where select = selectM

0 commit comments

Comments
 (0)