Context Module
Types
| Type | Description |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Functions and values
| Function or value |
Description
|
|
|
|
|
|
|
|
|
|
Write everything at current column indentation, set `indent` and `atColumn` on current column position
/// Example (same as above):
{ X = // indent=2, atColumn=2
"some long string" // indent=6, atColumn=2
Y = 1 // indent=2, atColumn=2
}
`atCurrentColumn` was called on `X`, then `indent` was called, "some long string" have indent 6, because it is indented from `atCurrentColumn` pos (2).
|
|
|
|
|
|
|
|
|
Full Usage:
colWithNlnWhenItemIsMultiline items ctx
Parameters:
ColMultilineItem list
ctx : Context
Returns: Context
|
This helper function takes a list of expressions and ranges.
If the expression is multiline it will add a newline before and after the expression.
Unless it is the first expression in the list, that will never have a leading new line.
F.ex.
let a = AAAA
let b =
BBBB
BBBB
let c = CCCC
will be formatted as:
let a = AAAA
let b =
BBBB
BBBBB
let c = CCCC
|
Full Usage:
colWithNlnWhenItemIsMultilineUsingConfig items ctx
Parameters:
ColMultilineItem list
ctx : Context
Returns: Context
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Full Usage:
onlyIf cond f ctx
Parameters:
bool
f : 'a -> 'a
ctx : 'a
Returns: 'a
|
|
Full Usage:
onlyIfCtx cond f ctx
Parameters:
'a -> bool
f : 'a -> 'a
ctx : 'a
Returns: 'a
|
|
Full Usage:
onlyIfNot cond f ctx
Parameters:
bool
f : 'a -> 'a
ctx : 'a
Returns: 'a
|
|
Full Usage:
optSingle f o ctx
Parameters:
'a -> 'b -> 'b
o : 'a option
ctx : 'b
Returns: 'b
|
similar to opt, only takes a single function f to apply when there is a value
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Full Usage:
sepNone
Returns: 'a -> 'a
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
This adds a WriterEvent to the Context. One event could potentially be split up into multiple events. The event is also being processed in the WriterModel of the Context.
|
fantomas