fromRight' x ≡ x^?!_Right
>>> fromRight' (Right 12) 12
rightToMaybe ≡ either (const Nothing) JustUsing Control.Lens:
rightToMaybe ≡ preview _Right rightToMaybe x ≡ x^?_Right
>>> rightToMaybe (Left 12) Nothing
>>> rightToMaybe (Right 12) Just 12
leftToMaybe ≡ either Just (const Nothing)Using Control.Lens:
leftToMaybe ≡ preview _Left leftToMaybe x ≡ x^?_Left
>>> leftToMaybe (Left 12) Just 12
>>> leftToMaybe (Right 12) Nothing