yesod-session-persist-0.0.0.2: SQL session backend for Yesod
Safe HaskellSafe-Inferred
LanguageGHC2021

Embedding

Synopsis

Documentation

data Embedding (con :: (Type -> Type) -> Constraint) e a Source #

Targets a value that is optionally present in some stateful monadic context

Constructors

Embedding 

Fields

  • embed :: forall m. con m => Maybe a -> m ()

    Sets or clears the value

  • extract :: forall m. (Functor m, con m) => m (Either e (Maybe a))

    Removes the value if present, returning what was removed

embed :: con m => Embedding con e a -> Maybe a -> m () Source #

extract :: (Functor m, con m) => Embedding con e a -> m (Either e (Maybe a)) Source #

extractIgnoringError :: (Functor m, con m) => Embedding con e a -> m (Maybe a) Source #

dimapEmbedding :: (a -> Either e b) -> (b -> a) -> Embedding con e a -> Embedding con e b Source #