module Fresnel.Maybe
(
_Just
, _Nothing
) where
import Fresnel.Prism
_Just :: Prism (Maybe a) (Maybe a') a a'
_Just :: forall a a'. Prism (Maybe a) (Maybe a') a a'
_Just = (a' -> Maybe a')
-> (Maybe a -> Either (Maybe a') a)
-> Prism (Maybe a) (Maybe a') a a'
forall b t s a. (b -> t) -> (s -> Either t a) -> Prism s t a b
prism a' -> Maybe a'
forall a. a -> Maybe a
Just (Either (Maybe a') a
-> (a -> Either (Maybe a') a) -> Maybe a -> Either (Maybe a') a
forall b a. b -> (a -> b) -> Maybe a -> b
maybe (Maybe a' -> Either (Maybe a') a
forall a b. a -> Either a b
Left Maybe a'
forall a. Maybe a
Nothing) a -> Either (Maybe a') a
forall a b. b -> Either a b
Right)
_Nothing :: Prism' (Maybe a) ()
_Nothing :: forall a. Prism' (Maybe a) ()
_Nothing = (() -> Maybe a)
-> (Maybe a -> Maybe ()) -> Prism (Maybe a) (Maybe a) () ()
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' (Maybe a -> () -> Maybe a
forall a b. a -> b -> a
const Maybe a
forall a. Maybe a
Nothing) (Maybe () -> (a -> Maybe ()) -> Maybe a -> Maybe ()
forall b a. b -> (a -> b) -> Maybe a -> b
maybe (() -> Maybe ()
forall a. a -> Maybe a
Just ()) (Maybe () -> a -> Maybe ()
forall a b. a -> b -> a
const Maybe ()
forall a. Maybe a
Nothing))