Documentation ¶
Overview ¶
Code generated by mkunion. DO NOT EDIT.
Code generated by mkunion. DO NOT EDIT.
Code generated by mkunion. DO NOT EDIT.
Code generated by mkunion. DO NOT EDIT.
Index ¶
- func A1Shape() shape.Shape
- func A1ToJSON(x *A1) ([]byte, error)
- func AlphabetSchemaDef() *schema.UnionVariants[Alphabet]
- func AlphabetShape() shape.Shape
- func AlphabetToJSON(x Alphabet) ([]byte, error)
- func B2Shape() shape.Shape
- func B2ToJSON(x *B2) ([]byte, error)
- func BranchShape() shape.Shape
- func BranchToJSON(x *Branch) ([]byte, error)
- func C3Shape() shape.Shape
- func C3ToJSON(x *C3) ([]byte, error)
- func KShape() shape.Shape
- func KToJSON(x *K) ([]byte, error)
- func LeafShape() shape.Shape
- func LeafToJSON(x *Leaf) ([]byte, error)
- func MatchAlphabet[TOut any](x Alphabet, f1 func(x *A1) TOut, f2 func(x *B2) TOut, f3 func(x *C3) TOut, ...) TOut
- func MatchAlphabetNumberTupleR0[T0 Alphabet, T1 Number](t0 T0, t1 T1, f0 func(x0 *A1, x1 *N0), f1 func(x0 *C3, x1 any), ...)
- func MatchAlphabetNumberTupleR1[T0 Alphabet, T1 Number, TOut1 any](t0 T0, t1 T1, f0 func(x0 *A1, x1 *N0) TOut1, f1 func(x0 *C3, x1 any) TOut1, ...) TOut1
- func MatchAlphabetNumberTupleR2[T0 Alphabet, T1 Number, TOut1 any, TOut2 any](t0 T0, t1 T1, f0 func(x0 *A1, x1 *N0) (TOut1, TOut2), ...) (TOut1, TOut2)
- func MatchAlphabetNumberTupleR3[T0 Alphabet, T1 Number, TOut1 any, TOut2 any, TOut3 any](t0 T0, t1 T1, f0 func(x0 *A1, x1 *N0) (TOut1, TOut2, TOut3), ...) (TOut1, TOut2, TOut3)
- func MatchAlphabetR2[TOut1, TOut2 any](x Alphabet, f1 func(x *A1) (TOut1, TOut2), f2 func(x *B2) (TOut1, TOut2), ...) (TOut1, TOut2)
- func MatchNumber[TOut any](x Number, f1 func(x *N0) TOut, f2 func(x *N1) TOut, df func(x Number) TOut) TOut
- func MatchNumberR2[TOut1, TOut2 any](x Number, f1 func(x *N0) (TOut1, TOut2), f2 func(x *N1) (TOut1, TOut2), ...) (TOut1, TOut2)
- func MatchTree[TOut any](x Tree, f1 func(x *Branch) TOut, f2 func(x *Leaf) TOut, f3 func(x *K) TOut, ...) TOut
- func MatchTreeR2[TOut1, TOut2 any](x Tree, f1 func(x *Branch) (TOut1, TOut2), f2 func(x *Leaf) (TOut1, TOut2), ...) (TOut1, TOut2)
- func MustMatchAlphabet[TOut any](x Alphabet, f1 func(x *A1) TOut, f2 func(x *B2) TOut, f3 func(x *C3) TOut) TOut
- func MustMatchAlphabetR0(x Alphabet, f1 func(x *A1), f2 func(x *B2), f3 func(x *C3))
- func MustMatchAlphabetR2[TOut1, TOut2 any](x Alphabet, f1 func(x *A1) (TOut1, TOut2), f2 func(x *B2) (TOut1, TOut2), ...) (TOut1, TOut2)
- func MustMatchNumber[TOut any](x Number, f1 func(x *N0) TOut, f2 func(x *N1) TOut) TOut
- func MustMatchNumberR0(x Number, f1 func(x *N0), f2 func(x *N1))
- func MustMatchNumberR2[TOut1, TOut2 any](x Number, f1 func(x *N0) (TOut1, TOut2), f2 func(x *N1) (TOut1, TOut2)) (TOut1, TOut2)
- func MustMatchTree[TOut any](x Tree, f1 func(x *Branch) TOut, f2 func(x *Leaf) TOut, f3 func(x *K) TOut) TOut
- func MustMatchTreeR0(x Tree, f1 func(x *Branch), f2 func(x *Leaf), f3 func(x *K))
- func MustMatchTreeR2[TOut1, TOut2 any](x Tree, f1 func(x *Branch) (TOut1, TOut2), f2 func(x *Leaf) (TOut1, TOut2), ...) (TOut1, TOut2)
- func N0Shape() shape.Shape
- func N0ToJSON(x *N0) ([]byte, error)
- func N1Shape() shape.Shape
- func N1ToJSON(x *N1) ([]byte, error)
- func NumberSchemaDef() *schema.UnionVariants[Number]
- func NumberShape() shape.Shape
- func NumberToJSON(x Number) ([]byte, error)
- func ReduceTreeBreadthFirst[A any](r TreeReducer[A], v Tree, init A) A
- func ReduceTreeDepthFirst[A any](r TreeReducer[A], v Tree, init A) A
- func TreeSchemaDef() *schema.UnionVariants[Tree]
- func TreeShape() shape.Shape
- func TreeToJSON(x Tree) ([]byte, error)
- type A1
- type Alphabet
- type AlphabetUnionJSON
- type AlphabetVisitor
- type B2
- type Branch
- type C3
- type K
- type Leaf
- type MatchAlphabetNumberTuple
- type N0
- type N1
- type Number
- type NumberUnionJSON
- type NumberVisitor
- type Tree
- type TreeBreadthFirstVisitor
- type TreeDefaultReduction
- type TreeDefaultVisitor
- type TreeDepthFirstVisitor
- type TreeReducer
- type TreeUnionJSON
- type TreeVisitor
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AlphabetSchemaDef ¶
func AlphabetSchemaDef() *schema.UnionVariants[Alphabet]
func AlphabetToJSON ¶
func BranchShape ¶
func BranchToJSON ¶
func LeafToJSON ¶
func MatchAlphabet ¶
func MatchAlphabetR2 ¶
func MatchNumber ¶
func MatchNumberR2 ¶
func MatchTreeR2 ¶
func MustMatchAlphabet ¶
func MustMatchAlphabetR0 ¶
func MustMatchAlphabetR2 ¶
func MustMatchNumber ¶
func MustMatchNumberR0 ¶
func MustMatchNumberR2 ¶
func MustMatchTree ¶
func MustMatchTreeR0 ¶
func MustMatchTreeR2 ¶
func NumberSchemaDef ¶
func NumberSchemaDef() *schema.UnionVariants[Number]
func NumberToJSON ¶
func ReduceTreeBreadthFirst ¶
func ReduceTreeBreadthFirst[A any](r TreeReducer[A], v Tree, init A) A
func ReduceTreeDepthFirst ¶
func ReduceTreeDepthFirst[A any](r TreeReducer[A], v Tree, init A) A
func TreeSchemaDef ¶
func TreeSchemaDef() *schema.UnionVariants[Tree]
func TreeToJSON ¶
Types ¶
type A1 ¶
type A1 struct{}
func A1FromJSON ¶
func (*A1) AcceptAlphabet ¶
func (r *A1) AcceptAlphabet(v AlphabetVisitor) any
func (*A1) MarshalJSON ¶
func (*A1) UnmarshalJSON ¶
type Alphabet ¶
type Alphabet interface {
AcceptAlphabet(g AlphabetVisitor) any
}
func AlphabetFromJSON ¶
type AlphabetUnionJSON ¶
type AlphabetUnionJSON struct { Type string `json:"$type,omitempty"` A1 json.RawMessage `json:"github.com/widmogrod/mkunion/x/generators/testutils.A1,omitempty"` B2 json.RawMessage `json:"github.com/widmogrod/mkunion/x/generators/testutils.B2,omitempty"` C3 json.RawMessage `json:"github.com/widmogrod/mkunion/x/generators/testutils.C3,omitempty"` }
mkunion-extension:json
type AlphabetVisitor ¶
type B2 ¶
type B2 struct{}
func B2FromJSON ¶
func (*B2) AcceptAlphabet ¶
func (r *B2) AcceptAlphabet(v AlphabetVisitor) any
func (*B2) MarshalJSON ¶
func (*B2) UnmarshalJSON ¶
type Branch ¶
func BranchFromJSON ¶
func (*Branch) AcceptTree ¶
func (r *Branch) AcceptTree(v TreeVisitor) any
func (*Branch) MarshalJSON ¶
func (*Branch) UnmarshalJSON ¶
type C3 ¶
type C3 struct{}
func C3FromJSON ¶
func (*C3) AcceptAlphabet ¶
func (r *C3) AcceptAlphabet(v AlphabetVisitor) any
func (*C3) MarshalJSON ¶
func (*C3) UnmarshalJSON ¶
type K ¶
type K string
func (*K) AcceptTree ¶
func (r *K) AcceptTree(v TreeVisitor) any
func (*K) MarshalJSON ¶
func (*K) UnmarshalJSON ¶
type Leaf ¶
type Leaf struct{ Value int }
func LeafFromJSON ¶
func (*Leaf) AcceptTree ¶
func (r *Leaf) AcceptTree(v TreeVisitor) any
func (*Leaf) MarshalJSON ¶
func (*Leaf) UnmarshalJSON ¶
type N0 ¶
type N0 struct{}
func N0FromJSON ¶
func (*N0) AcceptNumber ¶
func (r *N0) AcceptNumber(v NumberVisitor) any
func (*N0) MarshalJSON ¶
func (*N0) UnmarshalJSON ¶
type N1 ¶
type N1 struct{}
func N1FromJSON ¶
func (*N1) AcceptNumber ¶
func (r *N1) AcceptNumber(v NumberVisitor) any
func (*N1) MarshalJSON ¶
func (*N1) UnmarshalJSON ¶
type NumberUnionJSON ¶
type NumberUnionJSON struct { Type string `json:"$type,omitempty"` N0 json.RawMessage `json:"github.com/widmogrod/mkunion/x/generators/testutils.N0,omitempty"` N1 json.RawMessage `json:"github.com/widmogrod/mkunion/x/generators/testutils.N1,omitempty"` }
mkunion-extension:json
type TreeBreadthFirstVisitor ¶
type TreeBreadthFirstVisitor[A any] struct { // contains filtered or unexported fields }
func (*TreeBreadthFirstVisitor[A]) VisitBranch ¶
func (d *TreeBreadthFirstVisitor[A]) VisitBranch(v *Branch) any
func (*TreeBreadthFirstVisitor[A]) VisitK ¶
func (d *TreeBreadthFirstVisitor[A]) VisitK(v *K) any
func (*TreeBreadthFirstVisitor[A]) VisitLeaf ¶
func (d *TreeBreadthFirstVisitor[A]) VisitLeaf(v *Leaf) any
type TreeDefaultReduction ¶
type TreeDefaultReduction[A any] struct { PanicOnFallback bool DefaultStopReduction bool OnBranch func(x *Branch, agg A) (result A, stop bool) OnLeaf func(x *Leaf, agg A) (result A, stop bool) OnK func(x *K, agg A) (result A, stop bool) }
func (*TreeDefaultReduction[A]) ReduceBranch ¶
func (t *TreeDefaultReduction[A]) ReduceBranch(x *Branch, agg A) (result A, stop bool)
func (*TreeDefaultReduction[A]) ReduceK ¶
func (t *TreeDefaultReduction[A]) ReduceK(x *K, agg A) (result A, stop bool)
func (*TreeDefaultReduction[A]) ReduceLeaf ¶
func (t *TreeDefaultReduction[A]) ReduceLeaf(x *Leaf, agg A) (result A, stop bool)
type TreeDefaultVisitor ¶
type TreeDefaultVisitor[A any] struct { Default A OnBranch func(x *Branch) A OnLeaf func(x *Leaf) A OnK func(x *K) A }
mkunion-extension:default_visitor
func (*TreeDefaultVisitor[A]) VisitBranch ¶
func (t *TreeDefaultVisitor[A]) VisitBranch(v *Branch) any
func (*TreeDefaultVisitor[A]) VisitK ¶
func (t *TreeDefaultVisitor[A]) VisitK(v *K) any
func (*TreeDefaultVisitor[A]) VisitLeaf ¶
func (t *TreeDefaultVisitor[A]) VisitLeaf(v *Leaf) any
type TreeDepthFirstVisitor ¶
type TreeDepthFirstVisitor[A any] struct { // contains filtered or unexported fields }
func (*TreeDepthFirstVisitor[A]) VisitBranch ¶
func (d *TreeDepthFirstVisitor[A]) VisitBranch(v *Branch) any
func (*TreeDepthFirstVisitor[A]) VisitK ¶
func (d *TreeDepthFirstVisitor[A]) VisitK(v *K) any
func (*TreeDepthFirstVisitor[A]) VisitLeaf ¶
func (d *TreeDepthFirstVisitor[A]) VisitLeaf(v *Leaf) any
type TreeReducer ¶
type TreeReducer[A any] interface { ReduceBranch(x *Branch, agg A) (result A, stop bool) ReduceLeaf(x *Leaf, agg A) (result A, stop bool) ReduceK(x *K, agg A) (result A, stop bool) }
mkunion-extension:reducer_dfs
type TreeUnionJSON ¶
type TreeUnionJSON struct { Type string `json:"$type,omitempty"` Branch json.RawMessage `json:"github.com/widmogrod/mkunion/x/generators/testutils.Branch,omitempty"` Leaf json.RawMessage `json:"github.com/widmogrod/mkunion/x/generators/testutils.Leaf,omitempty"` K json.RawMessage `json:"github.com/widmogrod/mkunion/x/generators/testutils.K,omitempty"` }
mkunion-extension:json
Click to show internal directories.
Click to hide internal directories.