fromRight package:either

Extract the right value or a default.
fromRight b ≡ either (const b) id
>>> fromRight "hello" (Right "world")
"world"
>>> fromRight "hello" (Left 42)
"hello"
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