plutus-core-1.36.0.0: Language library for Plutus Core
Safe HaskellSafe-Inferred
LanguageHaskell2010

PlutusCore.StdLib.Data.Function

Description

Combinators.

Synopsis

Documentation

constTermLike term TyName Name uni fun ⇒ term () Source #

const as a PLC term.

/\(A B :: *) -> \(x : A) (y : B) -> x

idFunTermLike term TyName Name uni fun ⇒ term () Source #

id as a PLC term.

/\(A :: *) -> \(x : A) -> x

applyFunTermLike term TyName Name uni fun ⇒ term () Source #

($) as a PLC term.

/\(A B :: *) -> \(f : A -> B) (x : A) -> f x

selfDataRecursiveType uni fun () Source #

Self as a PLC type.

fix \(self :: * -> *) (a :: *) -> self a -> a

unrollTermLike term TyName Name uni fun ⇒ term () Source #

unroll as a PLC term.

/\(a :: *) -> \(s : self a) -> unwrap s s

fixTermLike term TyName Name uni fun ⇒ term () Source #

fix as a PLC term.

/\(a b :: *) -> \(f : (a -> b) -> a -> b) ->
    unroll {a -> b} (iwrap selfF (a -> b) \(s : self (a -> b)) ->
        f (\(x : a) -> unroll {a -> b} s x))

See plutusrunQuote $ docsfomega/z-combinator-benchmarks for details.

fixAndTypeTermLike term TyName Name uni fun ⇒ (term (), Type TyName uni ()) Source #

fixByTermLike term TyName Name uni fun ⇒ term () Source #

The fixBy combinator.

fixBy :
    forall (F :: * -> *) .
    ((F ~> Id) -> (F ~> Id)) ->
    ((F ~> F) -> (F ~> Id))

fixByAndTypeTermLike term TyName Name uni fun ⇒ (term (), Type TyName uni ()) Source #

fixNTermLike term TyName Name uni fun ⇒ Integer → term () → term () Source #

Make a n-ary fixpoint combinator.

FixN n :
    forall A1 B1 ... An Bn :: * .
    (forall Q :: * .
        ((A1 -> B1) -> ... -> (An -> Bn) -> Q) ->
        (A1 -> B1) ->
        ... ->
        (An -> Bn) ->
        Q) ->
    (forall R :: * . ((A1 -> B1) -> ... (An -> Bn) -> R) -> R)

fixNAndTypeTermLike term TyName Name uni fun ⇒ Integer → term () → (term (), Type TyName uni ()) Source #

data FunctionDef term tyname name uni fun ann Source #

A PLC function.

Constructors

FunctionDef 

Fields

getMutualFixOfTermLike term TyName Name uni fun ⇒ ann → term ann → [FunctionDef term TyName Name uni fun ann] → Quote (Tuple term uni ann) Source #

Get the fixed-point of a list of mutually recursive functions.

MutualFixOf _ fixN [ FunctionDef _ fN1 (FunctionType _ a1 b1) f1
                   , ...
                   , FunctionDef _ fNn (FunctionType _ an bn) fn
                   ] =
    Tuple [(a1 -> b1) ... (an -> bn)] $
        fixN {a1} {b1} ... {an} {bn}
            /\(q :: *) -> \(choose : (a1 -> b1) -> ... -> (an -> bn) -> q) ->
                \(fN1 : a1 -> b1) ... (fNn : an -> bn) -> choose f1 ... fn

getSingleFixOfTermLike term TyName Name uni fun ⇒ ann → term ann → FunctionDef term TyName Name uni fun ann → term ann Source #

Get the fixed-point of a single recursive function.