h&⍕      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^ _ ` a b c d e f g h i j k l m n o p q r s t u v w x y z { | } ~                                                                                                        $Algebra, ColAlgebra, and other stuff(c) gspia 2020-BSDgspia Safe-Inferred  /0+fcf-containersType-level Second. Tuples (,) and Either have Second-instances.Example%:kind! Eval (Second ((+) 1) '("a",3))2Eval (Second ((+) 1) '("a",3)) :: (TL.Symbol, Nat) = '("a", 4)fcf-containersType-level First. Tuples (,) and Either have First-instances.Example$:kind! Eval (First ((+) 1) '(3,"a"))1Eval (First ((+) 1) '(3,"a")) :: (Nat, TL.Symbol) = '(4, "a")fcf-containersHisto takes annotation algebra and takes a Fix-structure (from Recursion Schemes by example, Tim Williams).Examples can be found from Fcf.Data.Alg.Tree and Fcf.Data.Alg.List modules.fcf-containersHisto takes annotation algebra and takes a Fix-structure (from Recursion Schemes by example, Tim Williams).This is a helper for  as it is implemented with .fcf-containersSynthesized attributes are created in a bottom-up traversal using a catamorphism (from Recursion Schemes by example, Tim Williams).For the example, see Fcf.Data.Alg.Tree.Sizes.fcf-containersSynthesized attributes are created in a bottom-up traversal using a catamorphism (from Recursion Schemes by example, Tim Williams).,This is the algebra that is fed to the cata.fcf-containersAnnotation constructor (from Recursion Schemes by example, Tim Williams).fcf-containersStrip attribute from root (from Recursion Schemes by example, Tim Williams).fcf-containersAttribute of the root node (from Recursion Schemes by example, Tim Williams). fcf-containersAnnotated fixed-point type. A cofree comonad (from Recursion Schemes by example, Tim Williams). fcf-containersAnnotate (f r) with attribute a (from Recursion Schemes by example, Tim Williams). fcf-containersWrite a function to give a #, and feed it in together with an Check Fcf.Alg.List to see example algebras in use. There we have e.g. ListToParaFix-function.fcf-containersHylomorphism uses first ( to build a structure (unfold) and then " to process the structure (fold).Example+data NToOneCoA :: CoAlgebra (ListF Nat) Nat:{$ type instance Eval (NToOneCoA b) = If (Eval (b < 1) ) 'NilF ('ConsF b ( b TL.- 1)):}%:kind! Eval (Hylo SumAlg NToOneCoA 5)%Eval (Hylo SumAlg NToOneCoA 5) :: Nat= 15fcf-containers Ana can also be used to build a  structure.Example+data NToOneCoA :: CoAlgebra (ListF Nat) Nat:{$ type instance Eval (NToOneCoA b) = If (Eval (b < 1) ) 'NilF ('ConsF b ( b TL.- 1)):}:kind! Eval (Ana NToOneCoA 3))Eval (Ana NToOneCoA 3) :: Fix (ListF Nat)= 'Fix ('ConsF 3 ('Fix ('ConsF 2 ('Fix ('ConsF 1 ('Fix 'NilF))))))fcf-containersWrite the function to give a #, and feed it in together with an .Check Fcf.Alg.List to see example algebras in use. There we have e.g. ListToFix-function.fcf-containers)Commonly used name describing the method   eats.fcf-containers)Commonly used name describing the method  eats.fcf-containers)Commonly used name describing the method  eats.fcf-containersStructure that , can fold and that is a result structure of .  ListF structure working with Algebras, ColAlgebras, and other stuff(c) gspia 2020-BSDgspia Safe-Inferred  /0 fcf-containers>Equal tests for list equality. We may change the name to (==).Example%:kind! Eval (Equal '[1,2,3] '[1,2,3])&Eval (Equal '[1,2,3] '[1,2,3]) :: Bool= 'True%:kind! Eval (Equal '[1,2,3] '[1,3,2])&Eval (Equal '[1,2,3] '[1,3,2]) :: Bool= 'Falsefcf-containersToList for type-level lists.Example:kind! Eval (ToList 1)Eval (ToList 1) :: [Nat]= '[1]fcf-containers1Function to form Nat lists like [1..5] or [3..10]Example:kind! Eval (MToN 1 3)Eval (MToN 1 3) :: [Nat] = '[1, 2, 3]fcf-containers/Helper to form Nat lists like [1..5] or [3..10]:kind! Eval (Unfoldr ToThree 1)fcf-containersSum a Nat-list.Example:kind! Eval (Sum '[1,2,3])Eval (Sum '[1,2,3]) :: Nat= 6fcf-containersConstruct a run (that is, a natuaral number sequence from 1 to arg).Example:kind! Eval (RunInc 8)Eval (RunInc 8) :: [Nat]= '[1, 2, 3, 4, 5, 6, 7, 8]fcf-containersFor the RunIncfcf-containersFor the ListRunAlgfcf-containersThis picks up the elements on even positions on a list and is an example on how to use Histo. This example is from Tim Williams, Recursion Schemes by example.Example :kind! Eval (Evens =<< RunInc 8)"Eval (Evens =<< RunInc 8) :: [Nat]= '[2, 4, 6, 8]fcf-containers>Tim Williams, Recursion Schemes by example, example for Histo. fcf-containers>Tim Williams, Recursion Schemes by example, example for Histo.!fcf-containersTim Williams, Recursion Schemes by example, example for Para. See " -function."fcf-containers:Example from Recursion Schemes by example by Tim Williams.Example&:kind! Eval (Sliding 3 '[1,2,3,4,5,6])*Eval (Sliding 3 '[1,2,3,4,5,6]) :: [[Nat]]= '[ '[1, 2, 3], '[2, 3, 4], '[3, 4, 5], '[4, 5, 6], '[5, 6], '[6]]#fcf-containers1Example from recursion-package by Vanessa McHale.This removes duplicates from a list (by keeping the right-most one).Example:kind! Eval (Para DedupAlg =<< ListToParaFix '[1,1,3,2,5,1,3,2])Eval (Para DedupAlg =<< ListToParaFix '[1,1,3,2,5,1,3,2]) :: [Nat]= '[5, 1, 3, 2]$fcf-containers0Form a Fix-structure that can be used with Para.Example$:kind! Eval (ListToParaFix '[1,2,3])9Eval (ListToParaFix '[1,2,3]) :: Fix (ListF (Nat, [Nat]))= 'Fix ('ConsF '(1, '[2, 3]) ('Fix ('ConsF '(2, '[3]) ('Fix ('ConsF '(3, '[]) ('Fix 'NilF))))))%fcf-containers8Example algebra to calculate the prod of Nats in a list.Example3:kind! Eval (Cata ProdAlg =<< ListToFix '[1,2,3,4])3Eval (Cata ProdAlg =<< ListToFix '[1,2,3,4]) :: Nat= 24&fcf-containers7Example algebra to calculate the sum of Nats in a list.Example2:kind! Eval (Cata SumAlg =<< ListToFix '[1,2,3,4])2Eval (Cata SumAlg =<< ListToFix '[1,2,3,4]) :: Nat= 10'fcf-containers)Example algebra to calculate list length.Example0:kind! Eval (Cata LenAlg =<< ListToFix '[1,2,3])0Eval (Cata LenAlg =<< ListToFix '[1,2,3]) :: Nat= 3(fcf-containersListToFix can be used to turn a normal type-level list into the base functor type ListF, to be used with e.g. Cata. For examples in use, see ' and &.Ideally, we would have one ToFix type-level function for which we could give type instances for different type-level types, like lists, trees etc. See TODO.md.Example :kind! Eval (ListToFix '[1,2,3]),Eval (ListToFix '[1,2,3]) :: Fix (ListF Nat)= 'Fix ('ConsF 1 ('Fix ('ConsF 2 ('Fix ('ConsF 3 ('Fix 'NilF)))))))fcf-containers Base functor for a list of type [a]. !"#$%&'()+*)+*('&%$#"!  Nat helpers(c) gspia 2020-BSDgspia Safe-Inferred  /0",fcf-containersNat in-equality.:kind! Eval (2 /= 2)Eval (2 /= 2) :: Bool= 'False:kind! Eval (2 /= 3)Eval (2 /= 3) :: Bool= 'True-fcf-containers Nat equality.:kind! Eval (2 == 2)Eval (2 == 2) :: Bool= 'True:kind! Eval (2 == 3)Eval (2 == 3) :: Bool= 'False,--,*Utility collection (waiting for new place)(c) gspia 2020-BSDgspia Safe-Inferred /0$z.fcf-containers Id function.Example:kind! Eval (Id "id")Eval (Id "id") :: Symbol= "id"/fcf-containersHelper.Example;:kind! Eval (PairMaybeToMaybePair '( 'Just "txt", 'Just 1))=Eval (PairMaybeToMaybePair '( 'Just "txt", 'Just 1)) :: Maybe (Symbol, Nat)= 'Just '("txt", 1).//.Type level symbols(c) gspia 2020-BSDgspia Safe-Inferred  /0- 0fcf-containersEquality of symbolsExample:kind! Eval ("b" == "a")Eval ("b" == "a") :: Bool= 'False1fcf-containers#Larger-than comparison for symbols.Example:kind! Eval ("b" > "a")Eval ("b" > "a") :: Bool= 'True2fcf-containers!Less-than comparison for symbols.Example:kind! Eval ("a" < "b")Eval ("a" < "b") :: Bool= 'True3fcf-containers,Larger-than-or-equal comparison for symbols.Example:kind! Eval ("b" >= "a")Eval ("b" >= "a") :: Bool= 'True4fcf-containers*Less-than-or-equal comparison for symbols.Example:kind! Eval ("b" <= "a")Eval ("b" <= "a") :: Bool= 'False5fcf-containersSymbolOrd - compare two symbols and give type-level Ordering ( $ 'LT $, $ 'EQ $ or $ 'GT $ ).Example:kind! Eval (SymbolOrd "a" "b")$Eval (SymbolOrd "a" "b") :: Ordering= 'LT6fcf-containersIsDigitExample:kind! Eval (IsDigit "3")Eval (IsDigit "3") :: Bool= 'True:kind! Eval (IsDigit "a")Eval (IsDigit "a") :: Bool= 'False7fcf-containers IsSpaceDelimExample:kind! Eval (IsSpaceDelim "a")Eval (IsSpaceDelim "a") :: Bool= 'False:kind! Eval (IsSpaceDelim "\n") Eval (IsSpaceDelim "\n") :: Bool= 'True8fcf-containersIsTabExample:kind! Eval (IsTab "a")Eval (IsTab "a") :: Bool= 'False:kind! Eval (IsTab "\t")Eval (IsTab "\t") :: Bool= 'True9fcf-containers IsNewlineExample:kind! Eval (IsNewLine "a")Eval (IsNewLine "a") :: Bool= 'False:kind! Eval (IsNewLine "\n")Eval (IsNewLine "\n") :: Bool= 'True:fcf-containersIsSpaceExample:kind! Eval (IsSpace "a")Eval (IsSpace "a") :: Bool= 'False:kind! Eval (IsSpace " ")Eval (IsSpace " ") :: Bool= 'True;fcf-containersIntercalate type-level symbols.Example1:kind! Eval (Intercalate "+" '["aa", "bb", "cc"])4Eval (Intercalate "+" '["aa", "bb", "cc"]) :: Symbol = "aa+bb+cc"%:kind! Eval (Intercalate "+" '["aa"])(Eval (Intercalate "+" '["aa"]) :: Symbol= "aa"!:kind! Eval (Intercalate "+" '[])$Eval (Intercalate "+" '[]) :: Symbol= ""<fcf-containersAppend two type-level symbols.Example :kind! Eval (Append "hmm" " ok")#Eval (Append "hmm" " ok") :: Symbol = "hmm ok"0123456789:;< <;:9876543210Monad definitions(c) gspia 2020-BSDgspia Safe-Inferred  /0; =fcf-containersSequenceExample):kind! Eval (Sequence ('Just ('Right 5))):Eval (Sequence ('Just ('Right 5))) :: Either a (Maybe Nat)= 'Right ('Just 5)4:kind! Eval (Sequence '[ 'Just 3, 'Just 5, 'Just 7])fcf-containers'Id function correspondes to term level  -function.?fcf-containersHelper for [] traverse@fcf-containersTraverseExample,:kind! Eval (Traverse Id '[ '[1,2], '[3,4]])0Eval (Traverse Id '[ '[1,2], '[3,4]]) :: [[Nat]](= '[ '[1, 3], '[1, 4], '[2, 3], '[2, 4]]Afcf-containersForM = Flip MapMBfcf-containersMapMExample=:kind! Eval (MapM (ConstFn '[ 'True, 'False]) '["a","b","c"])Eval (MapM (ConstFn '[ 'True, 'False]) '["a","b","c"]) :: [[Bool]]7= '[ '[ 'True, 'True, 'True], '[ 'True, 'True, 'False],9 '[ 'True, 'False, 'True], '[ 'True, 'False, 'False],9 '[ 'False, 'True, 'True], '[ 'False, 'True, 'False],; '[ 'False, 'False, 'True], '[ 'False, 'False, 'False]]Dfcf-containersAn example implementing=sumM xs ys = do x <- xs y <- ys return (x + y)or3sumM xs ys = xs >>= (x -> ys >>= (y -> pure (x+y)))Note the use of helper functions. This is a bit awkward, a type level lambda would be nice.Hfcf-containers6Type level Bind corresponding to the value level bind H operator. Note that name (>>=) clashes with the definition given at Fcf.Combinators.(>>=). (It doesn't export it yet, though.)Monads that we define include:Identity[]MaybeEitherExampleExample: double the length of the input list and increase the numbers at the same time.!:kind! Eval ('[5,6,7] >>= Plus2M)#Eval ('[5,6,7] >>= Plus2M) :: [Nat]= '[7, 8, 8, 9, 9, 10]/:kind! Eval (XsPlusYsMonadic '[1,2,3] '[4,5,6])1Eval (XsPlusYsMonadic '[1,2,3] '[4,5,6]) :: [Nat]= '[5, 6, 7, 6, 7, 8, 7, 8, 9]Jfcf-containersType level LiftA2.Example*:kind! Eval (LiftA2 (Fcf.+) '[1,2] '[3,4]),Eval (LiftA2 (Fcf.+) '[1,2] '[3,4]) :: [Nat]= '[4, 5, 5, 6]Mfcf-containers'Helper for the [] applicative instance.Nfcf-containers( *!) corresponds to the value level N. Note that this clashes with the definition given at Fcf.Combinators.(( *)).$Applicatives that we define include:Identity[]MaybeEitherExample-:kind! Eval ('Identity Plus2 <*> 'Identity 5)6Eval ('Identity Plus2 <*> 'Identity 5) :: Identity Nat = 'Identity 79:kind! Eval ( (<*>) '[ (Fcf.+) 1, (Fcf.*) 10] '[4,5,6,7]);Eval ( (<*>) '[ (Fcf.+) 1, (Fcf.*) 10] '[4,5,6,7]) :: [Nat]= '[5, 6, 7, 8, 40, 50, 60, 70]2:kind! Eval ( (<*>) '[ (Fcf.+) 1, (Fcf.*) 10] '[])4Eval ( (<*>) '[ (Fcf.+) 1, (Fcf.*) 10] '[]) :: [Nat]= '[]#:kind! Eval ( (<*>) '[] '[4,5,6,7])#Eval ( (<*>) '[] '[4,5,6,7]) :: [b]= '[]Ofcf-containersReturn corresponds to the  at Monad or  of Applicative.:kind! Eval (Return 1) :: Maybe Nat :kind! Eval (Return 1) :: Either Symbol Nat=>?@ABCDEFGHIJKLMNOONMLKJIHGFEDCBA@?>=5Binary tree data-structure for type-level programming(c) gspia 2020-BSDgspia Safe-Inferred  /0<Pfcf-containers"Get the root nodes from a list of Ys.Qfcf-containersGet the root node from a Y.Rfcf-containers Flatten a Y.ExampleXfcf-containersFold a type-level Y.Yfcf-containersBinary tree type. PQRSTUVWXY[Z Y[ZXWVUTSRQPList helpers / utils(c) gspia 2023-BSDgspia Safe-Inferred  /0=]fcf-containersFoldl in terms of Foldr.Example':kind! Eval (Foldl (Fcf.-) 10 '[3,2,1])'Eval (Foldl (Fcf.-) 10 '[3,2,1]) :: Nat= 4]] :Map (association) data-type for the type-level programming(c) gspia 2020-BSDgspia Safe-Inferred  /0c^fcf-containers PartitionExample:kind! Eval (Partition ((>=) 35) =<< FromList '[ '(5,50), '(3,30)])Eval (Partition ((>=) 35) =<< FromList '[ '(5,50), '(3,30)]) :: (MapC Nat Nat, MapC Nat Nat),= '( 'MapC '[ '(3, 30)], 'MapC '[ '(5, 50)])_fcf-containers FilterWithKeyExample:kind! Eval (FilterWithKey (>=) =<< FromList '[ '(3,5), '(6,4)])Eval (FilterWithKey (>=) =<< FromList '[ '(3,5), '(6,4)]) :: MapC Nat Nat= 'MapC '[ '(6, 4)]`fcf-containersFilterExample:kind! Eval (Filter ((>=) 35) =<< FromList '[ '(5,50), '(3,30)])Eval (Filter ((>=) 35) =<< FromList '[ '(5,50), '(3,30)]) :: MapC Nat Nat= 'MapC '[ '(3, 30)]afcf-containersToListExample8:kind! Eval (ToList =<< FromList '[ '(5,"a"), '(3,"b")])Eval (NotMember 5 =<< FromList '[ '(5,"a"), '(3,"b")]) :: Bool= 'False=:kind! Eval (NotMember 7 =<< FromList '[ '(5,"a"), '(3,"b")])>Eval (NotMember 7 =<< FromList '[ '(5,"a"), '(3,"b")]) :: Bool= 'Trueofcf-containersMemberExample::kind! Eval (Member 5 =<< FromList '[ '(5,"a"), '(3,"b")]);Eval (Member 5 =<< FromList '[ '(5,"a"), '(3,"b")]) :: Bool= 'True::kind! Eval (Member 7 =<< FromList '[ '(5,"a"), '(3,"b")]);Eval (Member 7 =<< FromList '[ '(5,"a"), '(3,"b")]) :: Bool= 'Falsepfcf-containersLookupExample::kind! Eval (Lookup 5 =<< FromList '[ '(5,"a"), '(3,"b")])Eval (Lookup 5 =<< FromList '[ '(5,"a"), '(3,"b")]) :: Maybe Symbol = 'Just "a"::kind! Eval (Lookup 7 =<< FromList '[ '(5,"a"), '(3,"b")])Eval (Lookup 7 =<< FromList '[ '(5,"a"), '(3,"b")]) :: Maybe Symbol = 'Nothingqfcf-containersAdjustExample:kind! Eval (Adjust (Append "new ") 5 =<< FromList '[ '(5,"a"), '(3,"b")])Eval (Adjust (Append "new ") 5 =<< FromList '[ '(5,"a"), '(3,"b")]) :: MapC Nat Symbol$= 'MapC '[ '(5, "new a"), '(3, "b")]:kind! Eval (Adjust (Append "new ") 7 =<< FromList '[ '(5,"a"), '(3,"b")])Eval (Adjust (Append "new ") 7 =<< FromList '[ '(5,"a"), '(3,"b")]) :: MapC Nat Symbol = 'MapC '[ '(5, "a"), '(3, "b")]0:kind! Eval (Adjust (Append "new ") 7 =<< Empty)=) 35) =<< FromList '[ '(5,50), '(3,30)])Eval (Partition ((>=) 35) =<< FromList '[ '(5,50), '(3,30)]) :: (NatMap Nat, NatMap Nat)0= '( 'NatMap '[ '(3, 30)], 'NatMap '[ '(5, 50)]){fcf-containers FilterWithKeyExample:kind! Eval (FilterWithKey (>=) =<< FromList '[ '(3,5), '(6,4)])Eval (FilterWithKey (>=) =<< FromList '[ '(3,5), '(6,4)]) :: NatMap Nat= 'NatMap '[ '(6, 4)]|fcf-containersFilterExample:kind! Eval (Filter ((>=) 35) =<< FromList '[ '(5,50), '(3,30)])Eval (Filter ((>=) 35) =<< FromList '[ '(5,50), '(3,30)]) :: NatMap Nat= 'NatMap '[ '(3, 30)]}fcf-containersToListExample8:kind! Eval (ToList =<< FromList '[ '(5,"a"), '(3,"b")])Eval (NotMember 5 =<< FromList '[ '(5,"a"), '(3,"b")]) :: Bool= 'False=:kind! Eval (NotMember 7 =<< FromList '[ '(5,"a"), '(3,"b")])>Eval (NotMember 7 =<< FromList '[ '(5,"a"), '(3,"b")]) :: Bool= 'Truefcf-containersMemberExample::kind! Eval (Member 5 =<< FromList '[ '(5,"a"), '(3,"b")]);Eval (Member 5 =<< FromList '[ '(5,"a"), '(3,"b")]) :: Bool= 'True::kind! Eval (Member 7 =<< FromList '[ '(5,"a"), '(3,"b")]);Eval (Member 7 =<< FromList '[ '(5,"a"), '(3,"b")]) :: Bool= 'Falsefcf-containersLookupExample::kind! Eval (Lookup 5 =<< FromList '[ '(5,"a"), '(3,"b")])Eval (Lookup 5 =<< FromList '[ '(5,"a"), '(3,"b")]) :: Maybe Symbol = 'Just "a"::kind! Eval (Lookup 7 =<< FromList '[ '(5,"a"), '(3,"b")])Eval (Lookup 7 =<< FromList '[ '(5,"a"), '(3,"b")]) :: Maybe Symbol = 'Nothingfcf-containersAdjustExample:kind! Eval (Adjust (Append "new ") 5 =<< FromList '[ '(5,"a"), '(3,"b")])Eval (Adjust (Append "new ") 5 =<< FromList '[ '(5,"a"), '(3,"b")]) :: NatMap Symbol&= 'NatMap '[ '(5, "new a"), '(3, "b")]:kind! Eval (Adjust (Append "new ") 7 =<< FromList '[ '(5,"a"), '(3,"b")])Eval (Adjust (Append "new ") 7 =<< FromList '[ '(5,"a"), '(3,"b")]) :: NatMap Symbol"= 'NatMap '[ '(5, "a"), '(3, "b")]0:kind! Eval (Adjust (Append "new ") 7 =<< Empty):Eval (Adjust (Append "new ") 7 =<< Empty) :: NatMap Symbol = 'NatMap '[]fcf-containersDeleteExample::kind! Eval (Delete 5 =<< FromList '[ '(5,"a"), '(3,"b")])=Eval (Delete 5 =<< FromList '[ '(5,"a"), '(3,"b")]) :: NatMap? Symbol= 'NatMap '[ '(3, "b")]::kind! Eval (Delete 7 =<< FromList '[ '(5,"a"), '(3,"b")])=Eval (Delete 7 =<< FromList '[ '(5,"a"), '(3,"b")]) :: NatMap? Symbol"= 'NatMap '[ '(5, "a"), '(3, "b")] :kind! Eval (Delete 7 =<< Empty)%Eval (Delete 7 =<< Empty) :: NatMap v = 'NatMap '[]fcf-containers InsertWithif old there, mapif no old, addExample:kind! Eval (InsertWith Append 5 "xxx" =<< FromList '[ '(5,"a"), '(3,"b")])Eval (InsertWith Append 5 "xxx" =<< FromList '[ '(5,"a"), '(3,"b")]) :: NatMap Symbol%= 'NatMap '[ '(5, "xxxa"), '(3, "b")]:kind! Eval (InsertWith Append 7 "xxx" =<< FromList '[ '(5,"a"), '(3,"b")])Eval (InsertWith Append 7 "xxx" =<< FromList '[ '(5,"a"), '(3,"b")]) :: NatMap Symbol/= 'NatMap '[ '(5, "a"), '(3, "b"), '(7, "xxx")]1:kind! Eval (InsertWith Append 7 "xxx" =<< Empty);Eval (InsertWith Append 7 "xxx" =<< Empty) :: NatMap Symbol= 'NatMap '[ '(7, "xxx")]fcf-containersInsertExample:kind! Eval (Insert 3 "hih" =<< FromList '[ '(1,"haa"), '(2,"hoo")])Eval (Insert 3 "hih" =<< FromList '[ '(1,"haa"), '(2,"hoo")]) :: NatMap Symbol3= 'NatMap '[ '(3, "hih"), '(1, "haa"), '(2, "hoo")]fcf-containers8Use FromList to construct a NatMap from type-level list.Example1:kind! Eval (FromList '[ '(1,"haa"), '(2,"hoo")]);Eval (FromList '[ '(1,"haa"), '(2,"hoo")]) :: NatMap Symbol&= 'NatMap '[ '(1, "haa"), '(2, "hoo")]fcf-containers SingletonExample:kind! Eval (Singleton 1 "haa"))Eval (Singleton 1 "haa") :: NatMap Symbol= 'NatMap '[ '(1, "haa")]fcf-containersEmptyExample$:kind! (Eval Empty :: NatMap Symbol).(Eval Empty :: NatMap Symbol) :: NatMap Symbol = 'NatMap '[]$:kind! (Eval Empty :: NatMap String).(Eval Empty :: NatMap String) :: NatMap [Char] = 'NatMap '[]+See also the other examples in this module.fcf-containers1A type corresponding to IntMap in the containers.The representation is based on type-level lists. Please, do not use that fact but rather use the exposed API. (We hope to change the internal data type to balanced tree similar to the one used in containers. See TODO.md.)z{|}~~|{z} -Set data-structure for type-level programming(c) gspia 2020-BSDgspia Safe-Inferred  /0fcf-containers#Get the type-level list out of the .Example7:kind! Eval (ToList =<< PowerSet =<< FromList '[1,2,3])=Eval (ToList =<< PowerSet =<< FromList '[1,2,3]) :: [Set Nat]== '[ 'Set '[], 'Set '[3], 'Set '[2], 'Set '[2, 3], 'Set '[1],1 'Set '[1, 2], 'Set '[1, 3], 'Set '[1, 2, 3]]:kind! Eval (Qsort NatListOrd =<< Map ToList =<< ToList =<< PowerSet =<< FromList '[1,2,3])Eval (Qsort NatListOrd =<< Map ToList =<< ToList =<< PowerSet =<< FromList '[1,2,3]) :: [[Nat]]= '[ '[], '[1], '[1, 2], '[1, 2, 3], '[1, 3], '[2], '[2, 3], '[3]]fcf-containers5Use FromList to construct a Set from type-level list.Example:kind! Eval (FromList '[1, 2])"Eval (FromList '[1, 2]) :: Set Nat= 'Set '[1, 2]fcf-containersCalculate the power sets of a given type-level list. The algorithm is based on Gray codes.Example4:kind! Eval (PowerSet =<< FromList '["a", "b", "c"])Eval (PowerSet =<< FromList '["a", "b", "c"]) :: Set (Set Symbol)= 'Set< '[ 'Set '[], 'Set '["c"], 'Set '["b"], 'Set '["b", "c"],7 'Set '["a"], 'Set '["a", "b"], 'Set '["a", "c"], 'Set '["a", "b", "c"]];:kind! Eval (PowerSet =<< FromList '[Int, Char, Maybe Int])Eval (PowerSet =<< FromList '[Int, Char, Maybe Int]) :: Set (Set *)= 'Set1 '[ 'Set '[], 'Set '[Maybe Int], 'Set '[Char],? 'Set '[Char, Maybe Int], 'Set '[Int], 'Set '[Int, Char],< 'Set '[Int, Maybe Int], 'Set '[Int, Char, Maybe Int]]fcf-containersType-level set intersection.Example:kind! Eval (Intersection (Eval (FromList '[3, 5])) (Eval (FromList '[5, 7])))Eval (Intersection (Eval (FromList '[3, 5])) (Eval (FromList '[5, 7]))) :: Set Nat = 'Set '[5]fcf-containersType-level set difference.Example:kind! Eval (Difference (Eval (FromList '[3, 5])) (Eval (FromList '[5, 7])))Eval (Difference (Eval (FromList '[3, 5])) (Eval (FromList '[5, 7]))) :: Set Nat = 'Set '[3]fcf-containersType-level set union.Example:kind! Eval (Union (Eval (FromList '[5, 3])) (Eval (FromList '[5, 7])) )Eval (Union (Eval (FromList '[5, 3])) (Eval (FromList '[5, 7])) ) :: Set Nat= 'Set '[7, 5, 3]fcf-containersIsProperSubsetOfExample:kind! Eval (IsProperSubsetOf ('Set '[0,1,2,3,4]) ('Set '[0,1,2,3,4]))Eval (IsProperSubsetOf ('Set '[0,1,2,3,4]) ('Set '[0,1,2,3,4])) :: Bool= 'False:kind! Eval (IsProperSubsetOf ('Set '[0,2,1,3]) ('Set '[0,1,2,3,4]))Eval (IsProperSubsetOf ('Set '[0,2,1,3]) ('Set '[0,1,2,3,4])) :: Bool= 'Truefcf-containers IsSubsetOfExample7:kind! Eval (IsSubsetOf ('Set '[]) ('Set '[0,1,2,3,4]))8Eval (IsSubsetOf ('Set '[]) ('Set '[0,1,2,3,4])) :: Bool= 'True::kind! Eval (IsSubsetOf ('Set '[0,1]) ('Set '[0,1,2,3,4]));Eval (IsSubsetOf ('Set '[0,1]) ('Set '[0,1,2,3,4])) :: Bool= 'True:kind! Eval (IsSubsetOf ('Set '[0,2,1,3,4]) ('Set '[0,1,2,3,4]))Eval (IsSubsetOf ('Set '[0,2,1,3,4]) ('Set '[0,1,2,3,4])) :: Bool= 'True:kind! Eval (IsSubsetOf ('Set '[0,1,2,3,4,5]) ('Set '[0,1,2,3,4]))Eval (IsSubsetOf ('Set '[0,1,2,3,4,5]) ('Set '[0,1,2,3,4])) :: Bool= 'Falsefcf-containersSizeExample':kind! Eval (Size =<< FromList '[5, 3])'Eval (Size =<< FromList '[5, 3]) :: Nat= 2fcf-containersNullExample':kind! Eval (Null =<< FromList '[5, 3])(Eval (Null =<< FromList '[5, 3]) :: Bool= 'False:kind! Eval (Null =<< Empty)Eval (Null =<< Empty) :: Bool= 'Truefcf-containers NotMemberExample.:kind! Eval (NotMember 5 =<< FromList '[5, 3])/Eval (NotMember 5 =<< FromList '[5, 3]) :: Bool= 'False.:kind! Eval (NotMember 7 =<< FromList '[5, 3])/Eval (NotMember 7 =<< FromList '[5, 3]) :: Bool= 'Truefcf-containersMemberExample+:kind! Eval (Member 5 =<< FromList '[5, 3]),Eval (Member 5 =<< FromList '[5, 3]) :: Bool= 'True+:kind! Eval (Member 7 =<< FromList '[5, 3]),Eval (Member 7 =<< FromList '[5, 3]) :: Bool= 'Falsefcf-containersDeleteExample+:kind! Eval (Delete 5 =<< FromList '[5, 3])/Eval (Delete 5 =<< FromList '[5, 3]) :: Set Nat = 'Set '[3]+:kind! Eval (Delete 7 =<< FromList '[5, 3])/Eval (Delete 7 =<< FromList '[5, 3]) :: Set Nat= 'Set '[5, 3]fcf-containersInsertExample+:kind! Eval (Insert 3 =<< FromList '[1, 2])/Eval (Insert 3 =<< FromList '[1, 2]) :: Set Nat= 'Set '[3, 1, 2]+:kind! Eval (Insert 2 =<< FromList '[1, 2])/Eval (Insert 2 =<< FromList '[1, 2]) :: Set Nat= 'Set '[1, 2]fcf-containers SingletonExample:kind! Eval (Singleton 1)Eval (Singleton 1) :: Set Nat = 'Set '[1]fcf-containersEmptyExample:kind! (Eval Empty :: Set Nat)"(Eval Empty :: Set Nat) :: Set Nat = 'Set '[]+See also the other examples in this module.fcf-containersSet-definition. +Type-level Text data structure with methods(c) gspia 2020-BSDgspia Safe-Inferred  /0fcf-containersHelper, from symbols-package. The character tree that is needed for handling the initial character of a symbol.fcf-containersHelper, from symbols-package.fcf-containersHelper, from symbols-package.fcf-containersHelper, from symbols-package.fcf-containersHelper, from symbols-package.fcf-containersHelper, from symbols-package.fcf-containersEval (Unwords '[ 'Text "ok", 'Text "hmm", 'Text "ab"]) :: Text= 'Text "ok hmm ab"fcf-containersUnlines for type-level text. This adds a newline to each Text and then concats them.Example=:kind! Eval (Unlines '[ 'Text "ok", 'Text "hmm", 'Text "ab"])>Eval (Unlines '[ 'Text "ok", 'Text "hmm", 'Text "ab"]) :: Text= 'Text "ok\nhmm\nab\n"fcf-containersWords for type-level text.Example.:kind! Eval (Words =<< Singleton "ok hmm\nab")1Eval (Words =<< Singleton "ok hmm\nab") :: [Text])= '[ 'Text "ok", 'Text "hmm", 'Text "ab"]fcf-containersLines for type-level text.Example/:kind! Eval (Lines =<< Singleton "ok\nhmm\nab")2Eval (Lines =<< Singleton "ok\nhmm\nab") :: [Text])= '[ 'Text "ok", 'Text "hmm", 'Text "ab"]fcf-containersHelper for Splitfcf-containersHelper for Splitfcf-containersSplit for type-level text.Example<:kind! Eval (Split S.IsSpace (Eval (Singleton "cd bf abh")))?Eval (Split S.IsSpace (Eval (Singleton "cd bf abh"))) :: [Text])= '[ 'Text "cd", 'Text "bf", 'Text "abh"]fcf-containersHelper for SplitOnfcf-containersHelper for SplitOn:kind! Eval (SOTake '["a", "b"] '[ "c", "d", "a", "b", "f", "g"] '[])Eval (SOTake '["a", "b"] '[ "c", "d", "a", "b", "f", "g"] '[]) :: ([Symbol], [Symbol])= '( '["c", "d"], '["f", "g"])fcf-containersSplitOn for type-level text.Example6:kind! Eval (SplitOn ('Text "ab") ('Text "cdabfgabh"))9Eval (SplitOn ('Text "ab") ('Text "cdabfgabh")) :: [Text]'= '[ 'Text "cd", 'Text "fg", 'Text "h"]fcf-containersStrip the space, newline and tab -symbols from the beginning and and of type-level text.Example':kind! Eval (Strip ('Text " aamu \n"))(Eval (Strip ('Text " aamu \n")) :: Text= 'Text "aamu"fcf-containersDropAround for type-level text.Example5:kind! Eval (DropAround S.IsDigit ('Text "34aamu12"))6Eval (DropAround S.IsDigit ('Text "34aamu12")) :: Text= 'Text "aamu"fcf-containers'DropWhileEnd for type-level text. === Example5:kind! Eval (DropWhileEnd S.IsDigit ('Text "aamu12"))6Eval (DropWhileEnd S.IsDigit ('Text "aamu12")) :: Text= 'Text "aamu"fcf-containersDropWhile for type-level text.Example2:kind! Eval (DropWhile S.IsDigit ('Text "12aamu"))3Eval (DropWhile S.IsDigit ('Text "12aamu")) :: Text= 'Text "aamu"fcf-containers!TakeWhileEnd for type-level text.Example?:kind! Eval (TakeWhileEnd (Not <=< S.IsDigit) ('Text "12aamu"))Eval (TakeWhileEnd (Not <=< S.IsDigit) ('Text "12aamu")) :: Text= 'Text "aamu"fcf-containersTakeWhile for type-level text.Example<:kind! Eval (TakeWhile (Not <=< S.IsDigit) ('Text "aamu12"))=Eval (TakeWhile (Not <=< S.IsDigit) ('Text "aamu12")) :: Text= 'Text "aamu"fcf-containersDropEnd for type-level text.Example(:kind! Eval (DropEnd 2 ('Text "aamuna")))Eval (DropEnd 2 ('Text "aamuna")) :: Text= 'Text "aamu"fcf-containersDrop for type-level text.Example%:kind! Eval (Drop 2 ('Text "aamuna"))&Eval (Drop 2 ('Text "aamuna")) :: Text= 'Text "muna"fcf-containersTakeEnd for type-level text.Example':kind! Eval (TakeEnd 4 ('Text "haamu"))(Eval (TakeEnd 4 ('Text "haamu")) :: Text= 'Text "aamu"fcf-containersTake for type-level text.Example$:kind! Eval (Take 4 ('Text "aamun"))%Eval (Take 4 ('Text "aamun")) :: Text= 'Text "aamu"fcf-containersAll for type-level text.Example+:kind! Eval (All S.IsDigit ('Text "aamu1")),Eval (All S.IsDigit ('Text "aamu1")) :: Bool= 'False):kind! Eval (All S.IsDigit ('Text "321"))*Eval (All S.IsDigit ('Text "321")) :: Bool= 'Truefcf-containersAny for type-level text.Example+:kind! Eval (Any S.IsDigit ('Text "aamu1")),Eval (Any S.IsDigit ('Text "aamu1")) :: Bool= 'True*:kind! Eval (Any S.IsDigit ('Text "aamu"))+Eval (Any S.IsDigit ('Text "aamu")) :: Bool= 'Falsefcf-containersFConcatMap for type-level text.Example:{ "data IsIsymb :: Symbol -> Exp Bool2type instance Eval (IsIsymb s) = Eval ("i" S.== s)#data Isymb2aa :: Symbol -> Exp Text&type instance Eval (Isymb2aa s) = Eval (If (IsIsymb @@ s) (Pure ('Text "aa")) (Pure ('Text s)) ):}2:kind! Eval (FConcatMap Isymb2aa ('Text "imu ih"))3Eval (FConcatMap Isymb2aa ('Text "imu ih")) :: Text= 'Text "aamu aah"fcf-containersConcat for type-level text.Example1:kind! Eval (Concat '[ 'Text "la", 'Text "kana"])2Eval (Concat '[ 'Text "la", 'Text "kana"]) :: Text= 'Text "lakana"fcf-containersReplace for type-level text.Example:kind! Eval (Replace ('Text "tu") ('Text "la") ('Text "tuututtaa"))Eval (Replace ('Text "tu") ('Text "la") ('Text "tuututtaa")) :: Text= 'Text "laulattaa"fcf-containersReverse for type-level text.Example$:kind! Eval (Reverse ('Text "aamu"))%Eval (Reverse ('Text "aamu")) :: Text= 'Text "umaa"0:kind! Eval (Reverse =<< Reverse ('Text "aamu"))1Eval (Reverse =<< Reverse ('Text "aamu")) :: Text= 'Text "aamu"fcf-containers Intersperse for type-level text.Example,:kind! Eval (Intersperse "." ('Text "aamu"))-Eval (Intersperse "." ('Text "aamu")) :: Text= 'Text "a.a.m.u"fcf-containers Intercalate for type-level text.Example:kind! Eval (Intercalate ('Text " & ") ('[ 'Text "aamu", 'Text "valo"]))Eval (Intercalate ('Text " & ") ('[ 'Text "aamu", 'Text "valo"])) :: Text= 'Text "aamu & valo"fcf-containersFMap for type-level text.Example:{ "data IsIsymb :: Symbol -> Exp Bool2type instance Eval (IsIsymb s) = Eval ("i" S.== s)$data Isymb2e :: Symbol -> Exp Symbol%type instance Eval (Isymb2e s) = Eval (If (IsIsymb @@ s) (Pure "e") (Pure s) ):}(:kind! Eval (FMap Isymb2e ('Text "imu")))Eval (FMap Isymb2e ('Text "imu")) :: Text = 'Text "emu"fcf-containersCompare the length of type-level text to given Nat and give the Ordering.Example,:kind! Eval (CompareLength ('Text "aamu") 3)1Eval (CompareLength ('Text "aamu") 3) :: Ordering= 'GTfcf-containers5Take all except the last symbol from type-level text.Example":kind! Eval (Init ('Text "aamun")))Eval (Init ('Text "aamun")) :: Maybe Text= 'Just ('Text "aamu"):kind! Eval (Init ('Text ""))$Eval (Init ('Text "")) :: Maybe Text = 'Nothingfcf-containers"Get the tail of a type-level text.Example":kind! Eval (Tail ('Text "haamu")))Eval (Tail ('Text "haamu")) :: Maybe Text= 'Just ('Text "aamu"):kind! Eval (Tail ('Text ""))$Eval (Tail ('Text "")) :: Maybe Text = 'Nothingfcf-containers(Get the first symbol of type-level text.Example!:kind! Eval (Head ('Text "aamu"))*Eval (Head ('Text "aamu")) :: Maybe Symbol = 'Just "a":kind! Eval (Head ('Text ""))&Eval (Head ('Text "")) :: Maybe Symbol = 'Nothingfcf-containers)Get the last symbol from type-level text.Example$:kind! Eval (Unsnoc ('Text "aamun"))5Eval (Unsnoc ('Text "aamun")) :: Maybe (Symbol, Text)= 'Just '("n", 'Text "aamu"):kind! Eval (Unsnoc ('Text ""))0Eval (Unsnoc ('Text "")) :: Maybe (Symbol, Text) = 'Nothingfcf-containers*Get the first symbol from type-level text.Example$:kind! Eval (Uncons ('Text "haamu"))5Eval (Uncons ('Text "haamu")) :: Maybe (Symbol, Text)= 'Just '("h", 'Text "aamu"):kind! Eval (Uncons ('Text ""))0Eval (Uncons ('Text "")) :: Maybe (Symbol, Text) = 'Nothingfcf-containersAppend two type-level texts.Example.:kind! Eval (Append ('Text "aa") ('Text "mu"))/Eval (Append ('Text "aa") ('Text "mu")) :: Text= 'Text "aamu"fcf-containers-Add a symbol to the end of a type-level text.Example$:kind! Eval (Snoc ('Text "aam") "u")%Eval (Snoc ('Text "aam") "u") :: Text= 'Text "aamu"fcf-containers3Add a symbol to the beginning of a type-level text.Example%:kind! Eval (Cons "h" ('Text "aamu"))&Eval (Cons "h" ('Text "aamu")) :: Text= 'Text "haamu"fcf-containersLengthExample':kind! Eval (Length =<< Singleton "ab")'Eval (Length =<< Singleton "ab") :: Nat= 2fcf-containersNullExample:kind! Eval (Null ('Text "ab")) Eval (Null ('Text "ab")) :: Bool= 'False:kind! Eval (Null =<< Empty)Eval (Null =<< Empty) :: Bool= 'Truefcf-containersToSymbolExample?:kind! Eval (ToSymbol =<< FromSymbolList '["w", "o", "r", "d"])Eval (ToSymbol =<< FromSymbolList '["w", "o", "r", "d"]) :: Symbol= "word"fcf-containersSplit  to single character  list.Example3:kind! Eval (ToList =<< FromSymbolList '["a", "b"])6Eval (ToList =<< FromSymbolList '["a", "b"]) :: [Text]= '[ 'Text "a", 'Text "b"]fcf-containers#Get the type-level list out of the .Example9:kind! Eval (ToSymbolList =<< FromSymbolList '["a", "b"])>Eval (ToSymbolList =<< FromSymbolList '["a", "b"]) :: [Symbol] = '["a", "b"]fcf-containers6Use FromList to construct a Text from type-level list.Example:kind! Eval (FromSymbolList '["h", "e", "l", "l", "u", "r", "e", "i"]) Eval (FromSymbolList '["h", "e", "l", "l", "u", "r", "e", "i"]) :: Text = 'Text "hellurei"fcf-containers SingletonExample:kind! Eval (Singleton "a")Eval (Singleton "a") :: Text = 'Text "a"fcf-containersEmptyExample:kind! (Eval Empty :: Text)(Eval Empty :: Text) :: Text = 'Text ""+See also the other examples in this module.fcf-containers is a data structure, that is, a list to hold type-level symbols of length one.00.Tree data-structure for type-level programming(c) gspia 2020-BSDgspia Safe-Inferred  /0Ь fcf-containersGet the levels from a .Example:kind! Eval (Levels ('Node 1 '[ 'Node 2 '[ 'Node 3 '[ 'Node 4 '[]]], 'Node 5 '[ 'Node 6 '[]]]))Eval (Levels ('Node 1 '[ 'Node 2 '[ 'Node 3 '[ 'Node 4 '[]]], 'Node 5 '[ 'Node 6 '[]]])) :: [[Nat]]"= '[ '[1], '[2, 5], '[3, 6], '[4]]fcf-containersGet the forests from a list of s.fcf-containers"Get the root nodes from a list of s.fcf-containersGet the forest from a .fcf-containersGet the root node from a .fcf-containers Flatten a .Example:kind! Eval (Flatten ('Node 1 '[ 'Node 2 '[ 'Node 3 '[ 'Node 4 '[]]], 'Node 5 '[ 'Node 6 '[]]]))Eval (Flatten ('Node 1 '[ 'Node 2 '[ 'Node 3 '[ 'Node 4 '[]]], 'Node 5 '[ 'Node 6 '[]]])) :: [Nat]= '[1, 2, 3, 4, 5, 6]fcf-containers Unfold for a .fcf-containers Unfold for a .Example(data BuildNode :: Nat -> Exp (Nat,[Nat]):{$ type instance Eval (BuildNode x) =( If (Eval ((2 TL.* x TL.+ 1) >= 8)) '(x, '[])/ '(x, '[2 TL.* x, (2 TL.* x) TL.+ 1 ]):}$:kind! Eval (UnfoldTree BuildNode 1))Eval (UnfoldTree BuildNode 1) :: Tree Nat= 'Node 1, '[ 'Node 2 '[ 'Node 4 '[], 'Node 5 '[]],, 'Node 3 '[ 'Node 6 '[], 'Node 7 '[]]]fcf-containersFold a type-level .fcf-containersSame as in containers, except not used for any term-level computation in this module.fcf-containersSame as in containers, except not used for any term-level computation in this module.Tree-structures working with Algebras, ColAlgebras, and other stuff(c) gspia 2020-BSDgspia Safe-Inferred  /0fcf-containersEfficient Fibonacci type-level function (from Recursion Schemes by example, Tim Williams). Compare this to .Example:kind! Eval (FibHisto 100)Eval (FibHisto 100) :: Nat= 354224848179261915075fcf-containersEfficient Fibonacci algebra from Recursion Schemes by example, Tim Williams.fcf-containers=We want to be able to build NatF Fix-structures out of Nat's.fcf-containersA NatF functor that can be used with different morphisms. This tree-module is probably a wrong place to this one. Now it is here for the Fibonacci example.fcf-containers=A kind of foldable sum class. Pun may or may not be intended.fcf-containersBTreeF is a btree functor. At the moment, it is used to build sorting algorithms.fcf-containers#Fibonaccis with Hylo, not efficientExample:kind! Eval (FibHylo 10)Eval (FibHylo 10) :: Nat= 55fcf-containersCoAlgebra for the Fib-function.fcf-containersCoAlgebra to build TreeF's. This is an example from containers-package. See  and example in there.:kind! Eval (Ana BuildNodeCoA 1) :kind! Eval (Hylo CountNodesAlg BuildNodeCoA 1)fcf-containers.Size of the Tree is the number of nodes in it.ExampleSize is defined as % Cata CountNodesAlg =<< TreeToFix tr % and can be used with the following.(data BuildNode :: Nat -> Exp (Nat,[Nat]):{$ type instance Eval (BuildNode x) =( If (Eval ((2 TL.* x TL.+ 1) >= 8)) '(x, '[])0 '(x, '[ 2 TL.* x, (2 TL.* x) TL.+ 1 ]):}-:kind! Eval (Size =<< UnfoldTree BuildNode 1)-Eval (Size =<< UnfoldTree BuildNode 1) :: Nat= 7fcf-containersCount the nodes of TreeF. See the  for an example.fcf-containers'Sum the nodes of TreeF containing Nats.See the implementation of Fib for an example.fcf-containersA function to transform a Tree into fixed structure that can be used by Cata and Ana.See the implementation of  for an example.fcf-containers is functor for s. ! has Map-instance (on structure).fcf-containersBTreeF is a functorfcf-containersInstances to make TreeF to be a foldable sum. After this one, we can write the  example.fcf-containersSizes example from Recursion Schemes by example, Tim Williams. This annotes each node with the size of its subtree.Example*:kind! Eval (Sizes =<< Ana BuildNodeCoA 1)Eval (Sizes =<< Ana BuildNodeCoA 1) :: Fix (AnnF (TreeF Nat) Nat)= 'Fix ('AnnF '( 'NodeF 1 '[ 'Fix ('AnnF '( 'NodeF 2= '[ 'Fix ('AnnF '( 'NodeF 4 '[], 1)),> 'Fix ('AnnF '( 'NodeF 5 '[], 1))], 3)), 'Fix ('AnnF '( 'NodeF 3= '[ 'Fix ('AnnF '( 'NodeF 6 '[], 1)),> 'Fix ('AnnF '( 'NodeF 7 '[], 1))], 3))], 7))fcf-containers?NatF has to have functor-instances so that morphisms will work.+Type-level sorting algorithms and utilities(c) gspia 2020-BSDgspia Safe-Inferred  /0afcf-containers%Qsort - give the comparison function a -> a -> Exp Bool comparing your list elements and then Qsort will order the list.Example*:kind! Eval (Qsort (N.<) '[5,3,1,9,4,6,3]),Eval (Qsort (N.<) '[5,3,1,9,4,6,3]) :: [Nat]= '[1, 3, 3, 4, 5, 6, 9]7:kind! Eval (Qsort (S.<) '[ "bb", "e", "a", "e", "d" ])<?@ABCDEFGHIJK=LMNOPQRSTUVWXYZ[\]^_`abcdefghij k l m & n o p q r s t u v w x y z { | } ~        k l m & n o p q  s t u v w x y z { | } ~        &   u v w   x y z { ~                &                              I        J    y  &       ]^_efhx    fcf-containers-0.7.2-inplaceFcf.Alg.Morphism Fcf.Alg.List Fcf.Alg.Nat Fcf.Alg.OtherFcf.Alg.SymbolFcf.Control.MonadFcf.Data.BitreeFcf.Data.List.Utils Fcf.Data.MapCFcf.Data.NatMap Fcf.Data.SetFcf.Data.Text.Internal Fcf.Data.Text Fcf.Data.Tree Fcf.Alg.Tree Fcf.Alg.SortSecondFirstHistoHistoAlg SynthesizeSynthAlg AnnConstrStripAttrAnnAnnFParaFanoutHyloAnaCataRAlgebra CoAlgebraAlgebraFixEqualToListMToNMToNHelpSumRunInc ListRunAlgNumIterEvensEvensAlg EvensStrip SlidingAlgSlidingDedupAlg ListToParaFixProdAlgSumAlgLenAlg ListToFixListFConsFNilF/===IdPairMaybeToMaybePair><>=<= SymbolOrdIsDigit IsSpaceDelimIsTab IsNewLineIsSpace IntercalateAppendSequenceCons_fTraverseForMMapM>>XsPlusYsMonadicXPlusYs PureXPlusYPlus2M>>=LiftA2_LiftA2Plus2Plus1Star_<*>ReturnGetRootsGetRootFlatten ExampleTree4 ExampleTree3 ExampleTree2 ExampleTree1 CountSizeHelpFoldTreeTreeLeafNode $fShowTreeFoldl Partition FilterWithKeyFilterAssocsKeysElemsFoldr MapWithKeyMapDisjoint Intersection DifferenceUnionSizeNull NotMemberMemberLookupAdjustDelete InsertWithInsertFromList SingletonEmptyMapC NatMapWithKeyNatMapPowerSetIsProperSubsetOf IsSubsetOfSetCharsLookup2LookupAToList2ToList1Head1UnconsToListAHeadA ToSymbol2Head2 LookupTablechars IsInfixOf IsSuffixOf IsPrefixOfUnwordsUnlinesWordsLinesSplitSplitOn DropAround DropWhileEnd DropWhile TakeWhileEnd TakeWhileDropEndDropTakeEndTakeAllAny FConcatMapConcatReplaceReverse IntersperseFMap CompareLengthInitTailHeadUnsnocSnocConsLengthToSymbol ToSymbolListFromSymbolListTextLevels SubFLevels GetForests GetForest UnfoldForest UnfoldTreeStarTxExTr2ExT1rForestFibHisto FibAlgebraRecNTFNatToFixNatFSuccZeroSizesFSumBTreeFBEmptyFBNodeFFibHyloBuildFibTreeCoA BuildNodeCoA CountNodesAlg SumNodesAlg TreeToFixTreeFNodeFPartCmpQsortInordPartHlp NatListOrd SymbolListOrdNatOrdListOrdListCmp ListCmpFndghc-prim GHC.TypesSymbolbaseGHC.Baseidreturnpure SplitLoop SplitTakeSOLoopSOTakeD:R:EvalBTreeFMap0D:R:EvalNatFSum0D:R:EvalFixSizesD:R:EvalNatFMap0