FSharpx.Extras


LayoutOps

Namespace: Microsoft.FSharp.Text.StructuredFormat

A layout is a sequence of strings which have been joined together. The strings are classified as words, separators and left and right parenthesis. This classification determines where spaces are inserted. A joint is either unbreakable, breakable or broken. If a joint is broken the RHS layout occurs on the next line with optional indentation. A layout can be squashed to for given width which forces breaks as required.

Functions and values

Function or valueDescription
( -- ) layout1 layout2
Signature: layout1:Layout -> layout2:Layout -> Layout

Join, possible break with indent=1

CompiledName: op_MinusMinus

( --- ) layout1 layout2
Signature: layout1:Layout -> layout2:Layout -> Layout

Join, possible break with indent=2

CompiledName: op_MinusMinusMinus

( @@ ) layout1 layout2
Signature: layout1:Layout -> layout2:Layout -> Layout

Join broken with ident=0

CompiledName: op_AtAt

( @@- ) layout1 layout2
Signature: layout1:Layout -> layout2:Layout -> Layout

Join broken with ident=1

CompiledName: op_AtAtMinus

( @@-- ) layout1 layout2
Signature: layout1:Layout -> layout2:Layout -> Layout

Join broken with ident=2

CompiledName: op_AtAtMinusMinus

( ^^ ) layout1 layout2
Signature: layout1:Layout -> layout2:Layout -> Layout

Join, unbreakable.

CompiledName: op_HatHat

( ++ ) layout1 layout2
Signature: layout1:Layout -> layout2:Layout -> Layout

Join, possible break with indent=0

CompiledName: op_PlusPlus

aboveL layout1 layout2
Signature: layout1:Layout -> layout2:Layout -> Layout

Layout two vertically.

aboveListL layouts
Signature: layouts:Layout list -> Layout

Layout list vertically.

braceL layout
Signature: layout:Layout -> Layout

Wrap braces around layout.

bracketL Layout
Signature: Layout:Layout -> Layout

Wrap round brackets around Layout.

commaListL layouts
Signature: layouts:Layout list -> Layout

Join layouts into a comma separated list.

emptyL
Signature: Layout

The empty layout

isEmptyL layout
Signature: layout:Layout -> bool

Is it the empty layout?

leftL text
Signature: text:string -> Layout

An string which is left parenthesis (no space on the right).

listL selector value
Signature: selector:('T -> Layout) -> value:'T list -> Layout
Type parameters: 'T

Layout like an F# list.

objL value
Signature: value:obj -> Layout

An uninterpreted leaf, to be interpreted into a string by the layout engine. This allows leaf layouts for numbers, strings and other atoms to be customized according to culture.

optionL selector value
Signature: selector:('T -> Layout) -> value:'T option -> Layout
Type parameters: 'T

Layout like an F# option.

rightL text
Signature: text:string -> Layout

An string which is right parenthesis (no space on the left).

semiListL layouts
Signature: layouts:Layout list -> Layout

Join layouts into a semi-colon separated list.

sepL text
Signature: text:string -> Layout

An string which requires no spaces either side.

sepListL layout1 layouts
Signature: layout1:Layout -> layouts:Layout list -> Layout

Join layouts into a list separated using the given Layout.

spaceListL layouts
Signature: layouts:Layout list -> Layout

Join layouts into a space separated list.

squareBracketL layout
Signature: layout:Layout -> Layout

Wrap square brackets around layout.

tagAttrL text maps layout
Signature: text:string -> maps:(string * string) list -> layout:Layout -> Layout

See tagL

tupleL layouts
Signature: layouts:Layout list -> Layout

Form tuple of layouts.

unfoldL selector folder state count
Signature: selector:('T -> Layout) -> folder:('State -> ('T * 'State) option) -> state:'State -> count:int -> Layout list
Type parameters: 'T, 'State

For limitting layout of list-like sequences (lists,arrays,etc). unfold a list of items using (project and z) making layout list via itemL. If reach maxLength (before exhausting) then truncate.

wordL text
Signature: text:string -> Layout

An string leaf

Fork me on GitHub