cardano-ledger-core-1.14.0.0: Core components of Cardano ledgers from the Shelley release on.
Safe HaskellSafe-Inferred
LanguageHaskell2010

Cardano.Ledger.Ap

Description

Deprecated: Because it is no longer used in Ledger

This is taken from Edward Kmett's free library See: https://hackage.haskell.org/package/free-5.2

Synopsis
  • newtype Ap f a = Ap {
    • unAp ∷ ∀ u y z. (∀ x. (x → y) → ASeq f x → z) → (u → a → y) → ASeq f u → z
    }
  • hoistAp ∷ (∀ x. f x → g x) → Ap f a → Ap g a
  • runApApplicative g ⇒ (∀ x. f x → g x) → Ap f a → g a
  • runAp_Monoid m ⇒ (∀ a. f a → m) → Ap f b → m

Documentation

newtype Ap f a Source #

The faster free Applicative.

Constructors

Ap 

Fields

  • unAp ∷ ∀ u y z. (∀ x. (x → y) → ASeq f x → z) → (u → a → y) → ASeq f u → z
     

Instances

Instances details
Applicative (Ap f) Source # 
Instance details

Defined in Cardano.Ledger.Ap

Methods

pure ∷ a → Ap f a Source #

(<*>)Ap f (a → b) → Ap f a → Ap f b Source #

liftA2 ∷ (a → b → c) → Ap f a → Ap f b → Ap f c Source #

(*>)Ap f a → Ap f b → Ap f b Source #

(<*)Ap f a → Ap f b → Ap f a Source #

Functor (Ap f) Source # 
Instance details

Defined in Cardano.Ledger.Ap

Methods

fmap ∷ (a → b) → Ap f a → Ap f b Source #

(<$) ∷ a → Ap f b → Ap f a Source #

hoistAp ∷ (∀ x. f x → g x) → Ap f a → Ap g a Source #

Given a natural transformation from f to g this gives a monoidal natural transformation from Ap f to Ap g.

runApApplicative g ⇒ (∀ x. f x → g x) → Ap f a → g a Source #

Given a natural transformation from f to g, this gives a canonical monoidal natural transformation from Ap f to g.

runAp t == retractApp . hoistApp t

runAp_Monoid m ⇒ (∀ a. f a → m) → Ap f b → m Source #

Perform a monoidal analysis over free applicative value.

Example:

count :: Ap f a -> Int
count = getSum . runAp_ (\_ -> Sum 1)