//------------------------------------------------------------------------------ // This code was generated by myriad. // Changes to this file will be lost when the code is regenerated. //------------------------------------------------------------------------------ namespace ConsumePluginNoAttr /// Description of how to combine cases during a fold type TreeBuilderNoAttrCataCase<'b, 'a, 'TreeBuilderNoAttr, 'TreeNoAttr> = /// How to operate on the Child case abstract Child : 'TreeBuilderNoAttr -> 'TreeBuilderNoAttr /// How to operate on the Parent case abstract Parent : 'TreeNoAttr -> 'TreeBuilderNoAttr /// Description of how to combine cases during a fold type TreeNoAttrCataCase<'a, 'b, 'TreeBuilderNoAttr, 'TreeNoAttr> = /// How to operate on the Const case abstract Const : ConstNoAttr<'a> -> 'b -> 'TreeNoAttr /// How to operate on the Pair case abstract Pair : 'TreeNoAttr -> 'TreeNoAttr -> PairOpKindNoAttr -> 'TreeNoAttr /// How to operate on the Sequential case abstract Sequential : 'TreeNoAttr list -> 'TreeNoAttr /// How to operate on the Builder case abstract Builder : 'TreeNoAttr -> 'TreeBuilderNoAttr -> 'TreeNoAttr /// Specifies how to perform a fold (catamorphism) over the type TreeNoAttr and its friends. type TreeNoAttrCata<'b, 'a, 'TreeBuilderNoAttr, 'TreeNoAttr> = { /// How to perform a fold (catamorphism) over the type TreeBuilderNoAttr TreeBuilderNoAttr : TreeBuilderNoAttrCataCase<'b, 'a, 'TreeBuilderNoAttr, 'TreeNoAttr> /// How to perform a fold (catamorphism) over the type TreeNoAttr TreeNoAttr : TreeNoAttrCataCase<'a, 'b, 'TreeBuilderNoAttr, 'TreeNoAttr> } /// Methods to perform a catamorphism over the type TreeNoAttr [] module TreeNoAttrCata = [] type private Instruction<'b, 'a> = | Process__TreeBuilderNoAttr of TreeBuilderNoAttr<'b, 'a> | Process__TreeNoAttr of TreeNoAttr<'a, 'b> | TreeBuilderNoAttr_Child | TreeBuilderNoAttr_Parent | TreeNoAttr_Pair of PairOpKindNoAttr | TreeNoAttr_Sequential of int | TreeNoAttr_Builder let private loop (cata : TreeNoAttrCata<'b, 'a, 'TreeBuilderNoAttr, 'TreeNoAttr>) (instructions : ResizeArray>) = let treeNoAttrStack = ResizeArray<'TreeNoAttr> () let treeBuilderNoAttrStack = ResizeArray<'TreeBuilderNoAttr> () while instructions.Count > 0 do let currentInstruction = instructions.[instructions.Count - 1] instructions.RemoveAt (instructions.Count - 1) match currentInstruction with | Instruction.Process__TreeBuilderNoAttr x -> match x with | TreeBuilderNoAttr.Child (arg0_0) -> instructions.Add Instruction.TreeBuilderNoAttr_Child instructions.Add (Instruction.Process__TreeBuilderNoAttr arg0_0) | TreeBuilderNoAttr.Parent (arg0_0) -> instructions.Add Instruction.TreeBuilderNoAttr_Parent instructions.Add (Instruction.Process__TreeNoAttr arg0_0) | Instruction.Process__TreeNoAttr x -> match x with | TreeNoAttr.Const (arg0_0, arg1_0) -> cata.TreeNoAttr.Const arg0_0 arg1_0 |> treeNoAttrStack.Add | TreeNoAttr.Pair (arg0_0, arg1_0, arg2_0) -> instructions.Add (Instruction.TreeNoAttr_Pair (arg2_0)) instructions.Add (Instruction.Process__TreeNoAttr arg0_0) instructions.Add (Instruction.Process__TreeNoAttr arg1_0) | TreeNoAttr.Sequential (arg0_0) -> instructions.Add (Instruction.TreeNoAttr_Sequential ((List.length arg0_0))) for elt in arg0_0 do instructions.Add (Instruction.Process__TreeNoAttr elt) | TreeNoAttr.Builder (arg0_0, arg1_0) -> instructions.Add Instruction.TreeNoAttr_Builder instructions.Add (Instruction.Process__TreeNoAttr arg0_0) instructions.Add (Instruction.Process__TreeBuilderNoAttr arg1_0) | Instruction.TreeBuilderNoAttr_Child -> let arg0_0 = treeBuilderNoAttrStack.[treeBuilderNoAttrStack.Count - 1] treeBuilderNoAttrStack.RemoveAt (treeBuilderNoAttrStack.Count - 1) cata.TreeBuilderNoAttr.Child arg0_0 |> treeBuilderNoAttrStack.Add | Instruction.TreeBuilderNoAttr_Parent -> let arg0_0 = treeNoAttrStack.[treeNoAttrStack.Count - 1] treeNoAttrStack.RemoveAt (treeNoAttrStack.Count - 1) cata.TreeBuilderNoAttr.Parent arg0_0 |> treeBuilderNoAttrStack.Add | Instruction.TreeNoAttr_Pair arg2_0 -> let arg0_0 = treeNoAttrStack.[treeNoAttrStack.Count - 1] treeNoAttrStack.RemoveAt (treeNoAttrStack.Count - 1) let arg1_0 = treeNoAttrStack.[treeNoAttrStack.Count - 1] treeNoAttrStack.RemoveAt (treeNoAttrStack.Count - 1) cata.TreeNoAttr.Pair arg0_0 arg1_0 arg2_0 |> treeNoAttrStack.Add | Instruction.TreeNoAttr_Sequential arg0_0 -> let arg0_0_len = arg0_0 let arg0_0 = seq { for i = treeNoAttrStack.Count - 1 downto treeNoAttrStack.Count - arg0_0 do yield treeNoAttrStack.[i] } |> Seq.toList treeNoAttrStack.RemoveRange (treeNoAttrStack.Count - arg0_0_len, arg0_0_len) cata.TreeNoAttr.Sequential arg0_0 |> treeNoAttrStack.Add | Instruction.TreeNoAttr_Builder -> let arg0_0 = treeNoAttrStack.[treeNoAttrStack.Count - 1] treeNoAttrStack.RemoveAt (treeNoAttrStack.Count - 1) let arg1_0 = treeBuilderNoAttrStack.[treeBuilderNoAttrStack.Count - 1] treeBuilderNoAttrStack.RemoveAt (treeBuilderNoAttrStack.Count - 1) cata.TreeNoAttr.Builder arg0_0 arg1_0 |> treeNoAttrStack.Add treeBuilderNoAttrStack, treeNoAttrStack /// Execute the catamorphism. let runTreeBuilderNoAttr (cata : TreeNoAttrCata<'b, 'a, 'TreeBuilderNoAttrRet, 'TreeNoAttrRet>) (x : TreeBuilderNoAttr<'b, 'a>) : 'TreeBuilderNoAttrRet = let instructions = ResizeArray () instructions.Add (Instruction.Process__TreeBuilderNoAttr x) let treeBuilderNoAttrRetStack, treeNoAttrRetStack = loop cata instructions Seq.exactlyOne treeBuilderNoAttrRetStack /// Execute the catamorphism. let runTreeNoAttr (cata : TreeNoAttrCata<'b, 'a, 'TreeBuilderNoAttrRet, 'TreeNoAttrRet>) (x : TreeNoAttr<'a, 'b>) : 'TreeNoAttrRet = let instructions = ResizeArray () instructions.Add (Instruction.Process__TreeNoAttr x) let treeBuilderNoAttrRetStack, treeNoAttrRetStack = loop cata instructions Seq.exactlyOne treeNoAttrRetStack