HORIZON HASKELLDocslts/ghc-10.0.x8fef28d2026-11-02Search packagesCtrl K
Theme: |

GHC 10.0.0.20260917 · lts/ghc-10.0.x · 8fef28d · 2026-11-02

Moduleopenapi3-3.2.5Haskell2010

Data.OpenApi.Declare

Declare monad transformer and associated functions.

Synopsis
  • Packageopenapi3-3.2.5
  • Exports12
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourceDeclare.hs
newtypenewtype DeclareT d (m :: Type -> Type) a

A declare monad transformer parametrized by:

  • d — the output to accumulate (declarations);

  • m — the inner monad.

This monad transformer is similar to both state and writer monad transformers. Thus it can be seen as

  • a restricted append-only version of a state monad transformer or

  • a writer monad transformer with the extra ability to read all previous output.

Constructors

Instances5MonadDeclare, MonadTrans, Monad, Functor, Applicative
classclass (Applicative m, Monad m) => MonadDeclare d (m :: Type -> Type) | m -> d where

Definitions of declare and look must satisfy the following laws:

monoid homomorphism (mempty)

declare mempty == return ()

monoid homomorphism (mappend)

declare x >> declare y == declare (x <> y)

for every

x

,

y

declare-look

declare x >> look == fmap (<> x) look <* declare x

for every

x

look as left identity

look >> m == m

for every

m

Methods

  • declare :: d -> m ()

    declare x is an action that produces the output x.

  • look :: m d

    look is an action that returns all the output so far.

Instances12MonadDeclare, …
typetype Declare d = DeclareT d Identity

A declare monad parametrized by d — the output to accumulate (declarations).

This monad is similar to both state and writer monads. Thus it can be seen as

  • a restricted append-only version of a state monad or

  • a writer monad with the extra ability to read all previous output.

valueexecDeclare :: Declare d a -> d -> d

Execute Declate d a computation, ignoring result and only producing output d.