Page
Library
Module
Module type
Parameter
Class
Class type
Source
Rich_string.MakeSourceGiven an Enricher type, constructs a rich string type.
The type of a rich string.
The type of a rich string.
rs1 = rs2 determines whether rs1 and rs2 are equal.
IMPORTANT: no pruning or optimization is performed. This means that two rich strings that render the same might not be considered equal.
rs1 ++ rs2 appends rs2 at the end of rs1.
It is equivalent to the built-in string operator ^.
# print (String "hello" ++ String "world")
"helloworld"
- : unit = ()string s lifts the built-in string s to the enriched world.
For example, if the enricher is an ANSI style type, this enables the ability to stylize s.
enrich enrichment rs adds the enrichment to the rich string rs.
For example, if the enricher is an ANSI style type, this translates to adding a new style to s.
join ?on:sep rss concatenates all rss into one, separated by sep. By default, sep is a single space.
It is equivalent to the built-in string function String.concat.
flatten rss concatenates all rss into one.
It is equivalent to join~on:Empty rss.
join_lines rss concatenates all rss into one, separated by line feeds.
It is equivalent to join~on:(String "\n") rss.
render rs generates a built-in string such that rs can be used in interfaces that expect strings, e.g. IO.
print ?out ?ending rs prints rs in out, appending ending after. out defaults to stdout and ending defaults to Some (String "\n").