úÎ!7ò4¾3      !"#$%&'()*+,-./012A short tutorial with code.None%,.4=>?@AHSUVXegk3¹open-adt-tutorialA two element cons element.open-adt-tutorialA one element cons element.open-adt-tutorialThe base case of a list type.open-adt-tutorialAA type alias to reduce typing when writing the types of algebras.open-adt-tutorialDA list type with a two element cons. This type is defined with the 3+ synonym, which is simply conveinience for  Fix (VarF r).open-adt-tutorialThe base functor of the  type.open-adt-tutorialPA list type. We obtain this type by taking the fixed point of its base functor.open-adt-tutorialThe base functor of the  type. It is a 4 with the row .open-adt-tutorialHThe row of the second list type. This type re-uses the constructors of 6 and includes a third constructor: a two element cons.open-adt-tutorialBThe row of the first list type. It defines a "standard" list type. open-adt-tutorial9This type class defines a fmap-like operation over lists.$open-adt-tutorial Construct a . The patterns  and  are used. T>>> print exList1 Fix (VarF (Cons1F' 0 (Fix (VarF (Cons1F' 1 (Fix (VarF NilF')))))))%open-adt-tutorial Construct a . V>>> print exList2 Fix (VarF (Cons2F' 2 3 (Fix (VarF (Cons1F' 4 (Fix (VarF NilF')))))))&open-adt-tutorialThe constructor  is added to $! without changing its structure. T>>> print result1 Fix (VarF (Cons1F' 0 (Fix (VarF (Cons1F' 1 (Fix (VarF NilF')))))))'open-adt-tutorialRemove a constructor using 5 to convert a  to a . m>>> print result2 Fix (VarF (Cons1F' 2 (Fix (VarF (Cons1F' 3 (Fix (VarF (Cons1F' 4 (Fix (VarF NilF'))))))))))(open-adt-tutorial>Use "traditional" pattern matching to write an algebra over a . X>>> print result3 Fix (VarF (Cons2F' 0 0 (Fix (VarF (Cons2F' 1 1 (Fix (VarF NilF'))))))))open-adt-tutorialAn alternative way of writing ( using 6. X>>> print result4 Fix (VarF (Cons2F' 0 0 (Fix (VarF (Cons2F' 1 1 (Fix (VarF NilF')))))))*open-adt-tutorial Apply the ! function to any  (OpenADT r)7 provided all its constructors satisfy the constraint (OverList a a' s).+open-adt-tutorialDemonstrate that * can be applied to $. 6result5 = fmapList (show @Int) exList1 :: List1 String X>>> print result5 Fix (VarF (Cons1F' "0" (Fix (VarF (Cons1F' "1" (Fix (VarF NilF'))))))),open-adt-tutorialDemonstrate that * can be applied to %. 6result6 = fmapList (show @Int) exList2 :: List2 String \>>> print result6 Fix (VarF (Cons2F' "2" "3" (Fix (VarF (Cons1F' "4" (Fix (VarF NilF')))))))-open-adt-tutorial'Demonstrate how to handle subsets of a 4 individually.}Below is an alternate, but identical, implementation for the case where one subset of variants matched is a single variant (7 is used instead of 8).  result7 = 9" alg exList2 where alg w = case 7s w #cons2F of Left (Cons2F' a b x) -> Cons1 ("(" <> show a <> " : " <> show b <> ")") x Right leftovers -> ! (show @Int) leftovers ^>>> print result7 Fix (VarF (Cons1F' "(2 : 3)" (Fix (VarF (Cons1F' "4" (Fix (VarF NilF'))))))).open-adt-tutorialcThis is the function invoked by the executable in this package. It simply prints out the examples.  !"#$%&'()*+,-. "#$%&'() !*+,-.:      !"#$%&'()*+,-./0123425625728928:28;<=>?,open-adt-tutorial-1.0-63p3UMn3kjOJlwNboUasgnData.OpenADT.TutorialCons2FCons2F'Cons1FCons1F'NilFNilF'Alg$fEqNilF $fFunctorNilF $fShowNilF $fEqCons1F$fFunctorCons1F $fShowCons1F $fEqCons2F$fFunctorCons2F $fShowCons2F $fEq1NilF $fEq1Cons1F $fEq1Cons2F $fShow1NilF $fShow1Cons1FList2List2FList1List1F List2RowF List1RowFNil $fShow1Cons2FCons1OverList fmapList'Cons2exList1exList2result1result2result3result4fmapListresult5result6result7main'$fOverListaa'rVarF$fOverListaa'rCons2F$fOverListaa'rCons1F$fOverListaa'rNilF#open-adt-1.0-8uICJyDgYPGKoNeKz4RcHT Data.OpenADTOpenADTData.OpenADT.VarFVarF reduceVarFData.OpenADT.VariantsFcaseonFtrialF multiTrialF.recursion-schemes-5.0.3-4Vut65J3Nh382yxLqDzf35Data.Functor.Foldablecata