module Data.Either.Optics
( _Left
, _Right
)
where
import Optics.Prism
_Left :: Prism (Either a b) (Either c b) a c
_Left :: Prism (Either a b) (Either c b) a c
_Left =
(c -> Either c b)
-> (Either a b -> Either (Either c b) a)
-> Prism (Either a b) (Either c b) a c
forall b t s a. (b -> t) -> (s -> Either t a) -> Prism s t a b
prism
c -> Either c b
forall a b. a -> Either a b
Left
(\ Either a b
x ->
case Either a b
x of
Left a
y -> a -> Either (Either c b) a
forall a b. b -> Either a b
Right a
y
Right b
y -> Either c b -> Either (Either c b) a
forall a b. a -> Either a b
Left (b -> Either c b
forall a b. b -> Either a b
Right b
y)
)
{-# INLINE _Left #-}
_Right :: Prism (Either a b) (Either a c) b c
_Right :: Prism (Either a b) (Either a c) b c
_Right =
(c -> Either a c)
-> (Either a b -> Either (Either a c) b)
-> Prism (Either a b) (Either a c) b c
forall b t s a. (b -> t) -> (s -> Either t a) -> Prism s t a b
prism
c -> Either a c
forall a b. b -> Either a b
Right
(\ Either a b
x ->
case Either a b
x of
Left a
y -> Either a c -> Either (Either a c) b
forall a b. a -> Either a b
Left (a -> Either a c
forall a b. a -> Either a b
Left a
y)
Right b
y -> b -> Either (Either a c) b
forall a b. b -> Either a b
Right b
y
)
{-# INLINE _Right #-}