elm-monocle-compatible Prism
s.
{ getOption : a -> Maybe b
, reverseGet : b -> a
}
Constructor
leftp : Prism (Either a x) a
Prism
for the Left
value. Also known as _Left
in other languages.
.getOption leftp (Left 1) == Just 1
.getOption leftp (Right "fish") == Nothing
.reverseGet leftp 2 == Left 2
rightp : Prism (Either x b) b
Prism
for the Right
value. Also known as _Right
in other languages.
.getOption rightp (Left 1) == Nothing
.getOption rightp (Right "fish") == Just "fish"
.reverseGet rightp "phish" == Right "phish"