JsonStackFixer
Special transformer that adds IndexStart
, IndexEnd
, and FieldEnd
events in between the usual
JSON token-related events that you'd normally get from a JSON parser.
The point of this is to make the JSON events reliably "stack-like", where anything that pushes
to a context (like starting an object field) gets a corresponding "pop" event even though such
and event isn't represented by any particular token in the JSON syntax.
Having these "virtual" events occur is necessary to make JsonParsers in spac function properly.
Users of the spac library shouldn't have to use this class; support libraries (like json-spac-jackson)
should include this functionality as part of the AsPullable
typeclass that they provide.
Special transformer that adds IndexStart
, IndexEnd
, and FieldEnd
events in between the usual
JSON token-related events that you'd normally get from a JSON parser.
The point of this is to make the JSON events reliably "stack-like", where anything that pushes
to a context (like starting an object field) gets a corresponding "pop" event even though such
and event isn't represented by any particular token in the JSON syntax.
Having these "virtual" events occur is necessary to make JsonParsers in spac function properly.
Users of the spac library shouldn't have to use this class; support libraries (like json-spac-jackson)
should include this functionality as part of the AsPullable
typeclass that they provide.
Document{}
Creates a new transformer which applies the transformation function f
to each of this transformer's outputs.
Creates a new transformer which applies the transformation function f
to each of this transformer's outputs.
- Type Params
- Out2
The transformation output type
- Value Params
- f
A transformation function
- Returns
The mapped transformer
- Inherited from
- Transformer
Alias for filter
, used under the hood by for-comprehensions
Alias for filter
, used under the hood by for-comprehensions
- Value Params
- predicate
The filtering function
- Returns
The filtered transformer
- Inherited from
- Transformer
Convert this transformer to a Pipe
which will apply this transformer's logic to an fs2 Stream
.
Convert this transformer to a Pipe
which will apply this transformer's logic to an fs2 Stream
.
- Type Params
- F
Effect type for the Pipe/Stream
- Value Params
- pos
Captures the caller filename and line number, used to fill in the 'spac trace' if the parser throws an exception
- Returns
An
fs2.Pipe[F, In, Out]
that will apply this transformer's logic- Inherited from
- Transformer
Creates a new transformer which transforms the outputs of this transformer via the given function f
,
emitting each individual value from the output of that function in order before continuing.
Creates a new transformer which transforms the outputs of this transformer via the given function f
,
emitting each individual value from the output of that function in order before continuing.
- Type Params
- Out2
The transformed output type
- Value Params
- f
A function that transforms outputs from this transformer into a collection of other outputs
- Returns
A new transformer which emits any number of transformed outputs based on outputs from this transformer
- Inherited from
- Transformer
Applies this transformer's logic to an iterator, returning a new Iterator which yields values
emitted by this transformer when run on the underlying itr
.
Applies this transformer's logic to an iterator, returning a new Iterator which yields values
emitted by this transformer when run on the underlying itr
.
- Value Params
- itr
An iterator
- Returns
A wrapped version of
itr
, transformed via this transformer- Inherited from
- Transformer
Convenience for this into Parser.fold(init)(f)
Convenience for this into Parser.fold(init)(f)
- Inherited from
- Transformer
Creates a copy of this transformer, but with a different toString
Creates a copy of this transformer, but with a different toString
- Value Params
- name
The new "name" (i.e.
toString
for this transformer
- Returns
A copy of this transformer whose
toString
returns the givenname
- Inherited from
- Transformer
Convenience for this into Parser.toList
Convenience for this into Parser.toList
- Inherited from
- Transformer
Attach this transformer to a parser
, creating a new parser that encapsulates the pair.
Values emitted from this transformer will be passed as inputs to the parser
,
and the resulting output from the parser
will be yielded as output by the combined parser.
Attach this transformer to a parser
, creating a new parser that encapsulates the pair.
Values emitted from this transformer will be passed as inputs to the parser
,
and the resulting output from the parser
will be yielded as output by the combined parser.
- Inherited from
- Transformer
Creates a new transformer which sends inputs to both this transformer and the right
transformer.
Whenever either this
or right
emit a value, that value will be emitted from the returned transformer,
wrapped as a Left
or Right
depending on which underlying transformer emitted it.
For each individual input, the resulting values emitted by this transformer will be emitted before
the resulting values emitted by the right
transformer.
Creates a new transformer which sends inputs to both this transformer and the right
transformer.
Whenever either this
or right
emit a value, that value will be emitted from the returned transformer,
wrapped as a Left
or Right
depending on which underlying transformer emitted it.
For each individual input, the resulting values emitted by this transformer will be emitted before
the resulting values emitted by the right
transformer.
- Type Params
- In2
Contravariance-friendly version of
In
- Out2
The output type of the
right
transformer
- Value Params
- right
Another transformer
- Returns
The merged transformer
- Inherited from
- Transformer
Returns this transformer, but with a different view of the Out
type.
The Out <:< Out2
implicit evidence is used to make sure the asInstanceOf
cast is safe.
This is mostly useful when you know you have a transformer that yields a tuple or some kind of type constructor.
Returns this transformer, but with a different view of the Out
type.
The Out <:< Out2
implicit evidence is used to make sure the asInstanceOf
cast is safe.
This is mostly useful when you know you have a transformer that yields a tuple or some kind of type constructor.
- Inherited from
- Transformer
Creates a new transformer which filters the outputs from this transformer.
Creates a new transformer which filters the outputs from this transformer.
- Value Params
- predicate
A function which decides whether an output from this transformer should be emitted from the returned transformer.
true
means emit,false
means skip.
- Returns
The filtered transformer
- Inherited from
- Transformer
Creates a new transformer which folds outputs from this transformer into a "state" which is emitted each time.
Creates a new transformer which folds outputs from this transformer into a "state" which is emitted each time.
- Type Params
- Out2
The type of the scan "state"
- Value Params
- init
The initial "state"
- op
State update function; this is called for each
Out
emitted by this transformer, and the result is emitted by the combined transformer in addition to becoming the next "state"
- Returns
The new transformer
- Inherited from
- Transformer
Like mergeEither
, but when both sides have a common output type.
This is a less-roundabout way of doing .mergeEither(right).map(_.merge)
.
The same order-of-operations rules apply as with mergeEither
, where this transformer "goes first" for each input.
Like mergeEither
, but when both sides have a common output type.
This is a less-roundabout way of doing .mergeEither(right).map(_.merge)
.
The same order-of-operations rules apply as with mergeEither
, where this transformer "goes first" for each input.
- Type Params
- In2
Contravariance-friendly version of
In
- Out2
Common output type between
this
andthat
- Value Params
- that
Another transformer
- Returns
The merged transformer
- Inherited from
- Transformer
Attach this transformer to the next
transformer, creating a single transformer that encapsulates the pair.
Values emitted from this transformer will be passed as inputs to the next
transformer,
and the resulting outputs from the next
transformer are emitted as outputs from the combined transformer.
Attach this transformer to the next
transformer, creating a single transformer that encapsulates the pair.
Values emitted from this transformer will be passed as inputs to the next
transformer,
and the resulting outputs from the next
transformer are emitted as outputs from the combined transformer.
- Inherited from
- Transformer
Convenience for this into Parser.firstOpt
Convenience for this into Parser.firstOpt
- Inherited from
- Transformer
Returns this transformer, but with less restricted In
/ Out
types.
Returns this transformer, but with less restricted In
/ Out
types.
- Type Params
- In2
A subtype of
In
- Out2
A supertype of
Out
- Returns
This transformer (not a copy, it's actually literally
this
)- Inherited from
- Transformer
Creates a new transformer which filters and maps the outputs from this transformer
Creates a new transformer which filters and maps the outputs from this transformer
- Type Params
- Out2
Result type of the
pf
- Value Params
- pf
Partial function responsible for the filtering and mapping of outputs from this transformer
- Returns
The filteried and mapped transformer
- Inherited from
- Transformer
Value members
Concrete methods
Deprecated and Inherited methods
- Deprecated
- Inherited from
- Transformer
- Deprecated
- Inherited from
- Transformer
- Deprecated
- Inherited from
- Transformer
- Deprecated
- Inherited from
- Transformer
- Deprecated
- Inherited from
- Transformer
- Deprecated
- Inherited from
- Transformer
- Deprecated
- Inherited from
- Transformer
- Deprecated
- Inherited from
- Transformer