PreviousUpNext

14.4.68  Printf_Combinator

The standard library Printf_Combinator api defines access to text formatting modelled on C’s printf(). This library was written in 2002 by Matthias Blume; the design is inspired by Olivier Danvy’s "Functional Prettyprinting" work.

This interface provides an alternative to the Sfprintf API, upon which the default global printf is based.

The Printf_Combinator api is implemented by the printf_combinator package.

The Printf_Combinator api source code is in src/lib/src/printf-combinator.api.

The above information is manually maintained and may contain errors.

api {    Format X;
    Fragment (X, Y) = Format(X ) -> Format(Y );
    Glue X = Fragment((X, X) );
    Element (X, Y) = Fragment((X, Y -> X) );
    format : Fragment((String, X) ) -> X;
    format' : (List(String ) -> X) -> Fragment((X, Y) ) -> Y;
    using : (Y -> String) -> Element((X, Y) );
    int : Element((X, Int) );
    float : Element((X, Float) );
    bool : Element((X, Bool) );
    string : Element((X, String) );
    string' : Element((X, String) );
    char : Element((X, Char) );
    char' : Element((X, Char) );
    int' : number_string::Radix -> Element((X, Int) );
    float' : number_string::Float_Format -> Element((X, Float) );
    glue : Element((Y, X) ) -> X -> Glue(Y );
    nothing : Glue(X );
    text : String -> Glue(X );
    sp : Int -> Glue(X );
    nl : Glue(X );
    tab : Glue(X );
    Place ;
    left : Place;
    center : Place;
    right : Place;
    pad : Place -> Int -> Fragment((X, Y) ) -> Fragment((X, Y) );
    trim : Place -> Int -> Fragment((X, Y) ) -> Fragment((X, Y) );
    fit : Place -> Int -> Fragment((X, Y) ) -> Fragment((X, Y) );
    padl : Int -> Fragment((X, Y) ) -> Fragment((X, Y) );
    padr : Int -> Fragment((X, Y) ) -> Fragment((X, Y) );
};


Comments and suggestions to: bugs@mythryl.org

PreviousUpNext