:: Either a a -> a package:either

Extracts the element out of a Left and throws an error if its argument take the form Right _. Using Control.Lens:
fromLeft' x ≡ x^?!_Left
>>> fromLeft' (Left 12)
12
Extracts the element out of a Right and throws an error if its argument take the form Left _. Using Control.Lens:
fromRight' x ≡ x^?!_Right
>>> fromRight' (Right 12)
12
Maybe get the Right side of an Either.
rightToMaybeeither (const Nothing) Just
Using Control.Lens:
rightToMaybe ≡ preview _Right
rightToMaybe x ≡ x^?_Right
>>> rightToMaybe (Left 12)
Nothing
>>> rightToMaybe (Right 12)
Just 12
Maybe get the Left side of an Either.
leftToMaybeeither Just (const Nothing)
Using Control.Lens:
leftToMaybe ≡ preview _Left
leftToMaybe x ≡ x^?_Left
>>> leftToMaybe (Left 12)
Just 12
>>> leftToMaybe (Right 12)
Nothing