úÎ!iéÛ      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼ ½ ¾ ¿ À Á Â Ã Ä Å Æ Ç È É Ê Ë Ì Í Î Ï Ð Ñ Ò Ó Ô Õ Ö × Ø Ù Ú $Algebra, ColAlgebra, and other stuff(c) gspia 2020-BSDgspiaSafe -.HUV;…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-containerslHisto 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-containerslHisto 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-containers…Synthesized 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-containers…Synthesized 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-containersJAnnotation constructor (from Recursion Schemes by example, Tim Williams).fcf-containersMStrip attribute from root (from Recursion Schemes by example, Tim Williams).fcf-containersNAttribute of the root node (from Recursion Schemes by example, Tim Williams). fcf-containers`Annotated fixed-point type. A cofree comonad (from Recursion Schemes by example, Tim Williams). fcf-containersSAnnotate (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)B= '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 .ZCheck 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 .  CListF structure working with Algebras, ColAlgebras, and other stuff(c) gspia 2020-BSDgspiaSafe -.HUVnÄ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-containersSum a Nat-list.Example:kind! Eval (Sum '[1,2,3])Eval (Sum '[1,2,3]) :: Nat= 6fcf-containersDConstruct 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-containers¡This 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-containersCTim 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]]C= '[ '[1, 2, 3], '[2, 3, 4], '[3, 4, 5], '[4, 5, 6], '[5, 6], '[6]]!fcf-containers1Example from recursion-package by Vanessa McHale.DThis 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])BEval (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])I ('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-containersŽListToFix can be used to turn a norma 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)B= 'Fix ('ConsF 1 ('Fix ('ConsF 2 ('Fix ('ConsF 3 ('Fix 'NilF))))))'fcf-containers Base functor for a list of type [a]. !"#$%&')(')(&%$#"! Type level symbols(c) gspia 2020-BSDgspiaSafe -.HUV¶ *fcf-containersEquality of symbolsExample:kind! Eval ("b" == "a")Eval ("b" == "a") :: Bool= 'False+fcf-containers#Larger-than comparison for symbols.Example:kind! Eval ("b" > "a")Eval ("b" > "a") :: Bool= 'True,fcf-containers!Less-than comparison for symbols.Example:kind! Eval ("a" < "b")Eval ("a" < "b") :: Bool= 'True-fcf-containers,Larger-than-or-equal comparison for symbols.Example:kind! Eval ("b" >= "a")Eval ("b" >= "a") :: Bool= 'True.fcf-containers*Less-than-or-equal comparison for symbols.Example:kind! Eval ("b" <= "a")Eval ("b" <= "a") :: Bool= 'False/fcf-containers_SymbolOrd - compare two symbols and give type-level Ordering ( $ 'LT $, $ 'EQ $ or $ 'GT $ ).Example:kind! Eval (SymbolOrd "a" "b")$Eval (SymbolOrd "a" "b") :: Ordering= 'LT0fcf-containersIsDigitExample:kind! Eval (IsDigit "3")Eval (IsDigit "3") :: Bool= 'True:kind! Eval (IsDigit "a")Eval (IsDigit "a") :: Bool= 'False1fcf-containers IsSpaceDelimExample:kind! Eval (IsSpaceDelim "a")Eval (IsSpaceDelim "a") :: Bool= 'False:kind! Eval (IsSpaceDelim "\n") Eval (IsSpaceDelim "\n") :: Bool= 'True2fcf-containersIsTabExample:kind! Eval (IsTab "a")Eval (IsTab "a") :: Bool= 'False:kind! Eval (IsTab "\t")Eval (IsTab "\t") :: Bool= 'True3fcf-containers IsNewlineExample:kind! Eval (IsNewLine "a")Eval (IsNewLine "a") :: Bool= 'False:kind! Eval (IsNewLine "\n")Eval (IsNewLine "\n") :: Bool= 'True4fcf-containersIsSpaceExample:kind! Eval (IsSpace "a")Eval (IsSpace "a") :: Bool= 'False:kind! Eval (IsSpace " ")Eval (IsSpace " ") :: Bool= 'True5fcf-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= ""6fcf-containersAppend two type-level symbols.Example :kind! Eval (Append "hmm" " ok")#Eval (Append "hmm" " ok") :: Symbol = "hmm ok"Û*+,-./0123456 6543210/.-,+*:Map (association) data-type for the type-level programming(c) gspia 2020-BSDgspiaSafe -.HUV²7fcf-containers PartitionExampleC:kind! Eval (Partition ((>=) 35) =<< FromList '[ '(5,50), '(3,30)])FEval (Partition ((>=) 35) =<< FromList '[ '(5,50), '(3,30)]) :: (MapC L Nat Nat, N MapC Nat Nat),= '( 'MapC '[ '(3, 30)], 'MapC '[ '(5, 50)])8fcf-containers FilterWithKeyExample@:kind! Eval (FilterWithKey (>=) =<< FromList '[ '(3,5), '(6,4)])AEval (FilterWithKey (>=) =<< FromList '[ '(3,5), '(6,4)]) :: MapCF Nat Nat= 'MapC '[ '(6, 4)]9fcf-containersFilterExample@:kind! Eval (Filter ((>=) 35) =<< FromList '[ '(5,50), '(3,30)])BEval (Filter ((>=) 35) =<< FromList '[ '(5,50), '(3,30)]) :: MapC F Nat Nat= 'MapC '[ '(3, 30)]:fcf-containersToListExample8:kind! Eval (ToList =<< FromList '[ '(5,"a"), '(3,"b")])<Eval (ToList =<< FromList '[ '(5,"a"), '(3,"b")]) :: [(Nat, ? Symbol)]= '[ '(5, "a"), '(3, "b")]:kind! Eval (ToList =<< Empty)#Eval (ToList =<< Empty) :: [(k, v)]= '[];fcf-containersAssocsExample8:kind! Eval (Assocs =<< FromList '[ '(5,"a"), '(3,"b")])<Eval (Assocs =<< FromList '[ '(5,"a"), '(3,"b")]) :: [(Nat, ? Symbol)]= '[ '(5, "a"), '(3, "b")]:kind! Eval (Assocs =<< Empty)#Eval (Assocs =<< Empty) :: [(k, v)]= '[]<fcf-containersKeysExample6:kind! Eval (Keys =<< FromList '[ '(5,"a"), '(3,"b")])8Eval (Keys =<< FromList '[ '(5,"a"), '(3,"b")]) :: [Nat] = '[5, 3]:kind! Eval (Keys =<< Empty)Eval (Keys =<< Empty) :: [k]= '[]=fcf-containersElemsExample7:kind! Eval (Elems =<< FromList '[ '(5,"a"), '(3,"b")])<Eval (Elems =<< FromList '[ '(5,"a"), '(3,"b")]) :: [Symbol] = '["a", "b"]:kind! Eval (Elems =<< Empty)Eval (Elems =<< Empty) :: [v]= '[]>fcf-containersFoldr{Fold the values in the map using the given right-associative binary operator, such that 'foldr f z == foldr f z . elems'.DNote: the order of values in MapC is not well defined at the moment.ExampleJ:kind! Eval (Fcf.Data.MapC.Foldr (+) 0 =<< (FromList '[ '(1,1), '(2,2)]))JEval (Fcf.Data.MapC.Foldr (+) 0 =<< (FromList '[ '(1,1), '(2,2)])) :: Nat= 3Afcf-containersDisjointExampleh:kind! Eval (Disjoint (Eval (FromList '[ '(3,"a"), '(5,"b")])) (Eval (FromList '[ '(5,"B"), '(7,"C")])))iEval (Disjoint (Eval (FromList '[ '(3,"a"), '(5,"b")])) (Eval (FromList '[ '(5,"B"), '(7,"C")]))) :: Bool= 'Falseh:kind! Eval (Disjoint (Eval (FromList '[ '(3,"a"), '(5,"b")])) (Eval (FromList '[ '(2,"B"), '(7,"C")])))iEval (Disjoint (Eval (FromList '[ '(3,"a"), '(5,"b")])) (Eval (FromList '[ '(2,"B"), '(7,"C")]))) :: Bool= 'True0:kind! Eval (Disjoint (Eval Empty) (Eval Empty))1Eval (Disjoint (Eval Empty) (Eval Empty)) :: Bool= 'TrueBfcf-containers IntersectionExamplel:kind! Eval (Intersection (Eval (FromList '[ '(3,"a"), '(5,"b")])) (Eval (FromList '[ '(5,"B"), '(7,"C")])))nEval (Intersection (Eval (FromList '[ '(3,"a"), '(5,"b")])) (Eval (FromList '[ '(5,"B"), '(7,"C")]))) :: MapC o Nat q Symbol= 'MapC '[ '(5, "b")]Cfcf-containers DifferenceExamplej:kind! Eval (Difference (Eval (FromList '[ '(3,"a"), '(5,"b")])) (Eval (FromList '[ '(5,"B"), '(7,"C")])))lEval (Difference (Eval (FromList '[ '(3,"a"), '(5,"b")])) (Eval (FromList '[ '(5,"B"), '(7,"C")]))) :: MapC m Nat o Symbol= 'MapC '[ '(3, "a")]Dfcf-containersUnionExamplef:kind! Eval (Union (Eval (FromList '[ '(5,"a"), '(3,"b")])) (Eval (FromList '[ '(5,"A"), '(7,"c")])) )hEval (Union (Eval (FromList '[ '(5,"a"), '(3,"b")])) (Eval (FromList '[ '(5,"A"), '(7,"c")])) ) :: MapC i Nat k Symbol+= 'MapC '[ '(7, "c"), '(5, "a"), '(3, "b")]Efcf-containersSizeExample6:kind! Eval (Size =<< FromList '[ '(5,"a"), '(3,"b")])6Eval (Size =<< FromList '[ '(5,"a"), '(3,"b")]) :: Nat= 2Ffcf-containersNullExample6:kind! Eval (Null =<< FromList '[ '(5,"a"), '(3,"b")])7Eval (Null =<< FromList '[ '(5,"a"), '(3,"b")]) :: Bool= 'False:kind! Eval (Null =<< Empty)Eval (Null =<< Empty) :: Bool= 'TrueGfcf-containers NotMemberExample=:kind! Eval (NotMember 5 =<< 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= 'TrueHfcf-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= 'FalseIfcf-containersLookupExample::kind! Eval (Lookup 5 =<< FromList '[ '(5,"a"), '(3,"b")])CEval (Lookup 5 =<< FromList '[ '(5,"a"), '(3,"b")]) :: Maybe Symbol = 'Just "a"::kind! Eval (Lookup 7 =<< FromList '[ '(5,"a"), '(3,"b")])CEval (Lookup 7 =<< FromList '[ '(5,"a"), '(3,"b")]) :: Maybe Symbol = 'NothingJfcf-containersAdjustExampleJ:kind! Eval (Adjust (Append "new ") 5 =<< FromList '[ '(5,"a"), '(3,"b")])KEval (Adjust (Append "new ") 5 =<< FromList '[ '(5,"a"), '(3,"b")]) :: MapCS Nat Symbol$= 'MapC '[ '(5, "new a"), '(3, "b")]J:kind! Eval (Adjust (Append "new ") 7 =<< FromList '[ '(5,"a"), '(3,"b")])KEval (Adjust (Append "new ") 7 =<< FromList '[ '(5,"a"), '(3,"b")]) :: MapCS Nat Symbol = 'MapC '[ '(5, "a"), '(3, "b")]0:kind! Eval (Adjust (Append "new ") 7 =<< Empty)<Eval (Adjust (Append "new ") 7 =<< Empty) :: MapC Nat Symbol = 'MapC '[]Kfcf-containersDeleteExample::kind! Eval (Delete 5 =<< FromList '[ '(5,"a"), '(3,"b")]);Eval (Delete 5 =<< FromList '[ '(5,"a"), '(3,"b")]) :: MapCC Nat Symbol= 'MapC '[ '(3, "b")]::kind! Eval (Delete 7 =<< FromList '[ '(5,"a"), '(3,"b")]);Eval (Delete 7 =<< FromList '[ '(5,"a"), '(3,"b")]) :: MapCC Nat Symbol = 'MapC '[ '(5, "a"), '(3, "b")] :kind! Eval (Delete 7 =<< Empty)'Eval (Delete 7 =<< Empty) :: MapC Nat v = 'MapC '[]Lfcf-containers-InsertWith if old there, map if no old, addExampleK:kind! Eval (InsertWith Append 5 "xxx" =<< FromList '[ '(5,"a"), '(3,"b")])LEval (InsertWith Append 5 "xxx" =<< FromList '[ '(5,"a"), '(3,"b")]) :: MapCT Nat Symbol#= 'MapC '[ '(5, "xxxa"), '(3, "b")]K:kind! Eval (InsertWith Append 7 "xxx" =<< FromList '[ '(5,"a"), '(3,"b")])LEval (InsertWith Append 7 "xxx" =<< FromList '[ '(5,"a"), '(3,"b")]) :: MapCT Nat Symbol-= 'MapC '[ '(5, "a"), '(3, "b"), '(7, "xxx")]1:kind! Eval (InsertWith Append 7 "xxx" =<< Empty)=Eval (InsertWith Append 7 "xxx" =<< Empty) :: MapC Nat Symbol= 'MapC '[ '(7, "xxx")]Mfcf-containersInsertExampleD:kind! Eval (Insert 3 "hih" =<< FromList '[ '(1,"haa"), '(2,"hoo")])FEval (Insert 3 "hih" =<< FromList '[ '(1,"haa"), '(2,"hoo")]) :: MapC M Nat Symbol1= 'MapC '[ '(3, "hih"), '(1, "haa"), '(2, "hoo")]Nfcf-containers6Use FromList to construct a MapC from type-level list.Example1:kind! Eval (FromList '[ '(1,"haa"), '(2,"hoo")])=Eval (FromList '[ '(1,"haa"), '(2,"hoo")]) :: MapC Nat Symbol$= 'MapC '[ '(1, "haa"), '(2, "hoo")]Ofcf-containers SingletonExample:kind! Eval (Singleton 1 "haa")+Eval (Singleton 1 "haa") :: MapC Nat Symbol= 'MapC '[ '(1, "haa")]Pfcf-containersEmptyExample&:kind! (Eval Empty :: MapC Nat Symbol)2(Eval Empty :: MapC Nat Symbol) :: MapC Nat Symbol = 'MapC '[]&:kind! (Eval Empty :: MapC Int String)2(Eval Empty :: MapC Int String) :: MapC Int [Char] = 'MapC '[]+See also the other examples in this module.Qfcf-containers‚A type corresponding to Map in the containers. We call this MapC because name Map is reserved to the map-function in Fcf-package.á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.)789:;<=>?@ABCDEFGHIJKLMNOPQRQRFEIHGA=<;POMLKDCBJ@?>987N:=NatMap data-type for the type-level programming (like IntMap)(c) gspia 2020-BSDgspiaSafe -.HUV¬ÀSfcf-containers PartitionExampleC:kind! Eval (Partition ((>=) 35) =<< FromList '[ '(5,50), '(3,30)])HEval (Partition ((>=) 35) =<< FromList '[ '(5,50), '(3,30)]) :: (NatMap H Nat, L NatMap Nat)0= '( 'NatMap '[ '(3, 30)], 'NatMap '[ '(5, 50)])Tfcf-containers FilterWithKeyExample@:kind! Eval (FilterWithKey (>=) =<< FromList '[ '(3,5), '(6,4)])CEval (FilterWithKey (>=) =<< FromList '[ '(3,5), '(6,4)]) :: NatMapB Nat= 'NatMap '[ '(6, 4)]Ufcf-containersFilterExample@:kind! Eval (Filter ((>=) 35) =<< FromList '[ '(5,50), '(3,30)])DEval (Filter ((>=) 35) =<< FromList '[ '(5,50), '(3,30)]) :: NatMap B Nat= 'NatMap '[ '(3, 30)]Vfcf-containersToListExample8:kind! Eval (ToList =<< FromList '[ '(5,"a"), '(3,"b")])<Eval (ToList =<< FromList '[ '(5,"a"), '(3,"b")]) :: [(Nat, ? Symbol)]= '[ '(5, "a"), '(3, "b")]:kind! Eval (ToList =<< Empty)%Eval (ToList =<< Empty) :: [(Nat, v)]= '[]Wfcf-containersAssocsExample8:kind! Eval (Assocs =<< FromList '[ '(5,"a"), '(3,"b")])<Eval (Assocs =<< FromList '[ '(5,"a"), '(3,"b")]) :: [(Nat, ? Symbol)]= '[ '(5, "a"), '(3, "b")]:kind! Eval (Assocs =<< Empty)%Eval (Assocs =<< Empty) :: [(Nat, v)]= '[]Xfcf-containersKeysExample6:kind! Eval (Keys =<< FromList '[ '(5,"a"), '(3,"b")])8Eval (Keys =<< FromList '[ '(5,"a"), '(3,"b")]) :: [Nat] = '[5, 3]:kind! Eval (Keys =<< Empty)Eval (Keys =<< Empty) :: [Nat]= '[]Yfcf-containersElemsExample7:kind! Eval (Elems =<< FromList '[ '(5,"a"), '(3,"b")])<Eval (Elems =<< FromList '[ '(5,"a"), '(3,"b")]) :: [Symbol] = '["a", "b"]:kind! Eval (Elems =<< Empty)Eval (Elems =<< Empty) :: [v]= '[]Zfcf-containersFoldr{Fold the values in the map using the given right-associative binary operator, such that 'foldr f z == foldr f z . elems'.FNote: the order of values in NatMap is not well defined at the moment.ExampleL:kind! Eval (Fcf.Data.NatMap.Foldr (+) 0 =<< (FromList '[ '(1,1), '(2,2)]))LEval (Fcf.Data.NatMap.Foldr (+) 0 =<< (FromList '[ '(1,1), '(2,2)])) :: Nat= 3[fcf-containers NatMapWithKeyExample\fcf-containersMapExampleR:kind! Eval (Fcf.Data.NatMap.Map (Append "x") =<< FromList '[ '(5,"a"), '(3,"b")])VEval (Fcf.Data.NatMap.Map (Append "x") =<< FromList '[ '(5,"a"), '(3,"b")]) :: NatMap W Symbol$= 'NatMap '[ '(5, "xa"), '(3, "xb")]]fcf-containersDisjointExampleh:kind! Eval (Disjoint (Eval (FromList '[ '(3,"a"), '(5,"b")])) (Eval (FromList '[ '(5,"B"), '(7,"C")])))iEval (Disjoint (Eval (FromList '[ '(3,"a"), '(5,"b")])) (Eval (FromList '[ '(5,"B"), '(7,"C")]))) :: Bool= 'Falseh:kind! Eval (Disjoint (Eval (FromList '[ '(3,"a"), '(5,"b")])) (Eval (FromList '[ '(2,"B"), '(7,"C")])))iEval (Disjoint (Eval (FromList '[ '(3,"a"), '(5,"b")])) (Eval (FromList '[ '(2,"B"), '(7,"C")]))) :: Bool= 'True0:kind! Eval (Disjoint (Eval Empty) (Eval Empty))1Eval (Disjoint (Eval Empty) (Eval Empty)) :: Bool= 'True^fcf-containers IntersectionExamplel:kind! Eval (Intersection (Eval (FromList '[ '(3,"a"), '(5,"b")])) (Eval (FromList '[ '(5,"B"), '(7,"C")])))pEval (Intersection (Eval (FromList '[ '(3,"a"), '(5,"b")])) (Eval (FromList '[ '(5,"B"), '(7,"C")]))) :: NatMap q Symbol= 'NatMap '[ '(5, "b")]_fcf-containers DifferenceExamplej:kind! Eval (Difference (Eval (FromList '[ '(3,"a"), '(5,"b")])) (Eval (FromList '[ '(5,"B"), '(7,"C")])))nEval (Difference (Eval (FromList '[ '(3,"a"), '(5,"b")])) (Eval (FromList '[ '(5,"B"), '(7,"C")]))) :: NatMap o Symbol= 'NatMap '[ '(3, "a")]`fcf-containersUnionExamplef:kind! Eval (Union (Eval (FromList '[ '(5,"a"), '(3,"b")])) (Eval (FromList '[ '(5,"A"), '(7,"c")])) )jEval (Union (Eval (FromList '[ '(5,"a"), '(3,"b")])) (Eval (FromList '[ '(5,"A"), '(7,"c")])) ) :: NatMap k Symbol-= 'NatMap '[ '(7, "c"), '(5, "a"), '(3, "b")]afcf-containersSizeExample6:kind! Eval (Size =<< FromList '[ '(5,"a"), '(3,"b")])6Eval (Size =<< FromList '[ '(5,"a"), '(3,"b")]) :: Nat= 2bfcf-containersNullExample6:kind! Eval (Null =<< FromList '[ '(5,"a"), '(3,"b")])7Eval (Null =<< FromList '[ '(5,"a"), '(3,"b")]) :: Bool= 'False:kind! Eval (Null =<< Empty)Eval (Null =<< Empty) :: Bool= 'Truecfcf-containers NotMemberExample=:kind! Eval (NotMember 5 =<< 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= 'Truedfcf-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= 'Falseefcf-containersLookupExample::kind! Eval (Lookup 5 =<< FromList '[ '(5,"a"), '(3,"b")])CEval (Lookup 5 =<< FromList '[ '(5,"a"), '(3,"b")]) :: Maybe Symbol = 'Just "a"::kind! Eval (Lookup 7 =<< FromList '[ '(5,"a"), '(3,"b")])CEval (Lookup 7 =<< FromList '[ '(5,"a"), '(3,"b")]) :: Maybe Symbol = 'Nothingffcf-containersAdjustExampleJ:kind! Eval (Adjust (Append "new ") 5 =<< FromList '[ '(5,"a"), '(3,"b")])MEval (Adjust (Append "new ") 5 =<< FromList '[ '(5,"a"), '(3,"b")]) :: NatMapO Symbol&= 'NatMap '[ '(5, "new a"), '(3, "b")]J:kind! Eval (Adjust (Append "new ") 7 =<< FromList '[ '(5,"a"), '(3,"b")])MEval (Adjust (Append "new ") 7 =<< FromList '[ '(5,"a"), '(3,"b")]) :: NatMapO Symbol"= 'NatMap '[ '(5, "a"), '(3, "b")]0:kind! Eval (Adjust (Append "new ") 7 =<< Empty):Eval (Adjust (Append "new ") 7 =<< Empty) :: NatMap Symbol = 'NatMap '[]gfcf-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 '[]hfcf-containers InsertWithif old there, mapif no old, addExampleK:kind! Eval (InsertWith Append 5 "xxx" =<< FromList '[ '(5,"a"), '(3,"b")])NEval (InsertWith Append 5 "xxx" =<< FromList '[ '(5,"a"), '(3,"b")]) :: NatMapP Symbol%= 'NatMap '[ '(5, "xxxa"), '(3, "b")]K:kind! Eval (InsertWith Append 7 "xxx" =<< FromList '[ '(5,"a"), '(3,"b")])NEval (InsertWith Append 7 "xxx" =<< FromList '[ '(5,"a"), '(3,"b")]) :: NatMapP 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")]ifcf-containersInsertExampleD:kind! Eval (Insert 3 "hih" =<< FromList '[ '(1,"haa"), '(2,"hoo")])HEval (Insert 3 "hih" =<< FromList '[ '(1,"haa"), '(2,"hoo")]) :: NatMap I Symbol3= 'NatMap '[ '(3, "hih"), '(1, "haa"), '(2, "hoo")]jfcf-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")]kfcf-containers SingletonExample:kind! Eval (Singleton 1 "haa"))Eval (Singleton 1 "haa") :: NatMap Symbol= 'NatMap '[ '(1, "haa")]lfcf-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.mfcf-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.)STUVWXYZ[\]^_`abcdefghijklmnmnbaedc]YXWlkihg`_^f\[ZUTSjV-Set data-structure for type-level programming(c) gspia 2020-BSDgspiaSafe -.HUVùofcf-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]]B= '[ '[], '[1], '[1, 2], '[1, 2, 3], '[1, 3], '[2], '[2, 3], '[3]]pfcf-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]qfcf-containers\Calculate the power sets of a given type-level list. The algorithm is based on Gray codes.Example4:kind! Eval (PowerSet =<< FromList '["a", "b", "c"])AEval (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])CEval (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]]rfcf-containersType-level set intersection.ExampleN:kind! Eval (Intersection (Eval (FromList '[3, 5])) (Eval (FromList '[5, 7])))OEval (Intersection (Eval (FromList '[3, 5])) (Eval (FromList '[5, 7]))) :: Set P Nat = 'Set '[5]sfcf-containersType-level set difference.ExampleL:kind! Eval (Difference (Eval (FromList '[3, 5])) (Eval (FromList '[5, 7])))MEval (Difference (Eval (FromList '[3, 5])) (Eval (FromList '[5, 7]))) :: Set N Nat = 'Set '[3]tfcf-containersType-level set union.ExampleH:kind! Eval (Union (Eval (FromList '[5, 3])) (Eval (FromList '[5, 7])) )IEval (Union (Eval (FromList '[5, 3])) (Eval (FromList '[5, 7])) ) :: Set J Nat= 'Set '[7, 5, 3]ufcf-containersIsProperSubsetOf ExampleF:kind! Eval (IsProperSubsetOf ('Set '[0,1,2,3,4]) ('Set '[0,1,2,3,4]))GEval (IsProperSubsetOf ('Set '[0,1,2,3,4]) ('Set '[0,1,2,3,4])) :: Bool= 'FalseD:kind! Eval (IsProperSubsetOf ('Set '[0,2,1,3]) ('Set '[0,1,2,3,4]))EEval (IsProperSubsetOf ('Set '[0,2,1,3]) ('Set '[0,1,2,3,4])) :: Bool= 'Truevfcf-containers IsSubsetOf Example7: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]))AEval (IsSubsetOf ('Set '[0,2,1,3,4]) ('Set '[0,1,2,3,4])) :: Bool= 'TrueB:kind! Eval (IsSubsetOf ('Set '[0,1,2,3,4,5]) ('Set '[0,1,2,3,4]))CEval (IsSubsetOf ('Set '[0,1,2,3,4,5]) ('Set '[0,1,2,3,4])) :: Bool= 'Falsewfcf-containersSizeExample':kind! Eval (Size =<< FromList '[5, 3])'Eval (Size =<< FromList '[5, 3]) :: Nat= 2xfcf-containersNullExample':kind! Eval (Null =<< FromList '[5, 3])(Eval (Null =<< FromList '[5, 3]) :: Bool= 'False:kind! Eval (Null =<< Empty)Eval (Null =<< Empty) :: Bool= 'Trueyfcf-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= 'Truezfcf-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= 'False{fcf-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.opqrstuvwxyz{|}~€€zyxwvu~}|{qtsrpo+Type-level Text data structure with methods(c) gspia 2020-BSDgspiaSafe -.HUV¹'1fcf-containersIsInfixOf for type-level text.Exampleg:kind! Eval (IsInfixOf ('Text '["m", "i", "a"]) ('Text '["a", "a", "m", "i", "a", "i", "n", "e", "n"]))hEval (IsInfixOf ('Text '["m", "i", "a"]) ('Text '["a", "a", "m", "i", "a", "i", "n", "e", "n"])) :: Bool= 'True‚fcf-containersIsSuffixOf for type-level text.Exampleh:kind! Eval (IsSuffixOf ('Text '["n", "e", "n"]) ('Text '["a", "a", "m", "i", "a", "i", "n", "e", "n"]))iEval (IsSuffixOf ('Text '["n", "e", "n"]) ('Text '["a", "a", "m", "i", "a", "i", "n", "e", "n"])) :: Bool= 'Trueƒfcf-containersIsPrefixOf for type-level text.Examplec:kind! Eval (IsPrefixOf ('Text '["a", "a"]) ('Text '["a", "a", "m", "i", "a", "i", "n", "e", "n"]))dEval (IsPrefixOf ('Text '["a", "a"]) ('Text '["a", "a", "m", "i", "a", "i", "n", "e", "n"])) :: Bool= 'True„fcf-containers'Unwords for type-level text. This uses ›. to add space-symbol between the given texts.ExampleW:kind! Eval (Unwords '[ 'Text '["o", "k"], 'Text '["h", "m", "m "], 'Text '["a", "b"]])XEval (Unwords '[ 'Text '["o", "k"], 'Text '["h", "m", "m "], 'Text '["a", "b"]]) :: Text7= 'Text '["o", "k", " ", "h", "m", "m ", " ", "a", "b"]…fcf-containersUUnlines for type-level text. This adds a newline to each Text and then concats them.ExampleW:kind! Eval (Unlines '[ 'Text '["o", "k"], 'Text '["h", "m", "m "], 'Text '["a", "b"]])XEval (Unlines '[ 'Text '["o", "k"], 'Text '["h", "m", "m "], 'Text '["a", "b"]]) :: Text?= 'Text '["o", "k", "\n", "h", "m", "m ", "\n", "a", "b", "\n"]†fcf-containersWords for type-level text.ExampleR:kind! Eval (Words =<< FromList '[ "o", "k", " ", "h", "m", "m ", "\n", "a", "b"])UEval (Words =<< FromList '[ "o", "k", " ", "h", "m", "m ", "\n", "a", "b"]) :: [Text]C= '[ 'Text '["o", "k"], 'Text '["h", "m", "m "], 'Text '["a", "b"]]‡fcf-containersLines for type-level text.ExampleS:kind! Eval (Lines =<< FromList '[ "o", "k", "\n", "h", "m", "m ", "\n", "a", "b"])VEval (Lines =<< FromList '[ "o", "k", "\n", "h", "m", "m ", "\n", "a", "b"]) :: [Text]C= '[ 'Text '["o", "k"], 'Text '["h", "m", "m "], 'Text '["a", "b"]]Üfcf-containersHelper for SplitÝfcf-containersHelper for Splitˆfcf-containersSplit for type-level text.Example_:kind! Eval (Split S.IsSpace (Eval (FromList '[ "c", "d", " ", "b", "f", " ", "a", "b", "h"])))bEval (Split S.IsSpace (Eval (FromList '[ "c", "d", " ", "b", "f", " ", "a", "b", "h"]))) :: [Text]B= '[ 'Text '["c", "d"], 'Text '["b", "f"], 'Text '["a", "b", "h"]]Þfcf-containersHelper for SplitOnßfcf-containersHelper for SplitOnE:kind! Eval (SOTake '["a", "b"] '[ "c", "d", "a", "b", "f", "g"] '[])LEval (SOTake '["a", "b"] '[ "c", "d", "a", "b", "f", "g"] '[]) :: ([Symbol],L [Symbol])= '( '["c", "d"], '["f", "g"])‰fcf-containersSplitOn for type-level text.Exampleu:kind! Eval (SplitOn (Eval (FromList '["a", "b"])) (Eval (FromList '[ "c", "d", "a", "b", "f", "g", "a", "b", "h"])))xEval (SplitOn (Eval (FromList '["a", "b"])) (Eval (FromList '[ "c", "d", "a", "b", "f", "g", "a", "b", "h"]))) :: [Text]8= '[ 'Text '["c", "d"], 'Text '["f", "g"], 'Text '["h"]]Šfcf-containersYStrip the space, newline and tab -symbols from the beginning and and of type-level text.ExampleF:kind! Eval (Strip ('Text '[" ", " ", "a", "a", "m", "u", " ", "\n"]))GEval (Strip ('Text '[" ", " ", "a", "a", "m", "u", " ", "\n"])) :: Text= 'Text '["a", "a", "m", "u"]‹fcf-containersDropAround for type-level text.ExampleM:kind! Eval (DropAround S.IsDigit ('Text '["3","4","a","a","m","u","1","2"]))NEval (DropAround S.IsDigit ('Text '["3","4","a","a","m","u","1","2"])) :: Text= 'Text '["a", "a", "m", "u"]Œfcf-containers'DropWhileEnd for type-level text. === ExampleG:kind! Eval (DropWhileEnd S.IsDigit ('Text '["a","a","m","u","1","2"]))HEval (DropWhileEnd S.IsDigit ('Text '["a","a","m","u","1","2"])) :: Text= 'Text '["a", "a", "m", "u"]fcf-containersDropWhile for type-level text.ExampleD:kind! Eval (DropWhile S.IsDigit ('Text '["1","2","a","a","m","u"]))EEval (DropWhile S.IsDigit ('Text '["1","2","a","a","m","u"])) :: Text= 'Text '["a", "a", "m", "u"]Žfcf-containers!TakeWhileEnd for type-level text.ExampleQ:kind! Eval (TakeWhileEnd (Not <=< S.IsDigit) ('Text '["1","2","a","a","m","u"]))REval (TakeWhileEnd (Not <=< S.IsDigit) ('Text '["1","2","a","a","m","u"])) :: Text= 'Text '["a", "a", "m", "u"]fcf-containersTakeWhile for type-level text.ExampleN:kind! Eval (TakeWhile (Not <=< S.IsDigit) ('Text '["a","a","m","u","1","2"]))OEval (TakeWhile (Not <=< S.IsDigit) ('Text '["a","a","m","u","1","2"])) :: Text= 'Text '["a", "a", "m", "u"]fcf-containersDropEnd for type-level text.Example?:kind! Eval (DropEnd 2 ('Text '["a", "a", "m", "u", "n", "a"]))@Eval (DropEnd 2 ('Text '["a", "a", "m", "u", "n", "a"])) :: Text= 'Text '["a", "a", "m", "u"]‘fcf-containersDrop for type-level text.Example<:kind! Eval (Drop 2 ('Text '["a", "a", "m", "u", "n", "a"]))=Eval (Drop 2 ('Text '["a", "a", "m", "u", "n", "a"])) :: Text= 'Text '["m", "u", "n", "a"]’fcf-containersTakeEnd for type-level text.Example::kind! Eval (TakeEnd 4 ('Text '["h", "a", "a", "m", "u"]));Eval (TakeEnd 4 ('Text '["h", "a", "a", "m", "u"])) :: Text= 'Text '["a", "a", "m", "u"]“fcf-containersTake for type-level text.Example7:kind! Eval (Take 4 ('Text '["a", "a", "m", "u", "n"]))8Eval (Take 4 ('Text '["a", "a", "m", "u", "n"])) :: Text= 'Text '["a", "a", "m", "u"]”fcf-containersAll for type-level text.Example::kind! Eval (All S.IsDigit ('Text '["a","a","m","u","1"]));Eval (All S.IsDigit ('Text '["a","a","m","u","1"])) :: Bool= 'False2:kind! Eval (All S.IsDigit ('Text '["3","2","1"]))3Eval (All S.IsDigit ('Text '["3","2","1"])) :: Bool= 'True•fcf-containersAny for type-level text.Example::kind! Eval (Any S.IsDigit ('Text '["a","a","m","u","1"]));Eval (Any S.IsDigit ('Text '["a","a","m","u","1"])) :: Bool= 'True6:kind! Eval (Any S.IsDigit ('Text '["a","a","m","u"]))7Eval (Any S.IsDigit ('Text '["a","a","m","u"])) :: Bool= 'False–fcf-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 '["a","a"])) (Pure ('Text '[s])) ):}D:kind! Eval (FConcatMap Isymb2aa ('Text '["i","m","u"," ","i","h"]))EEval (FConcatMap Isymb2aa ('Text '["i","m","u"," ","i","h"])) :: Text1= 'Text '["a", "a", "m", "u", " ", "a", "a", "h"]—fcf-containersConcat for type-level text.ExampleC:kind! Eval (Concat '[ 'Text '["l","a"], 'Text '["k","a","n","a"]])DEval (Concat '[ 'Text '["l","a"], 'Text '["k","a","n","a"]]) :: Text'= 'Text '["l", "a", "k", "a", "n", "a"]˜fcf-containersReplace for type-level text.Examplej:kind! Eval (Replace ('Text '["t","u"]) ('Text '["l","a"]) ('Text '["t","u","u","t","u","t","t","a","a"]))kEval (Replace ('Text '["t","u"]) ('Text '["l","a"]) ('Text '["t","u","u","t","u","t","t","a","a"])) :: Text6= 'Text '["l", "a", "u", "l", "a", "t", "t", "a", "a"]™fcf-containersReverse for type-level text.Example3:kind! Eval (Reverse ('Text '["a", "a", "m", "u"]))4Eval (Reverse ('Text '["a", "a", "m", "u"])) :: Text= 'Text '["u", "m", "a", "a"]?:kind! Eval (Reverse =<< Reverse ('Text '["a", "a", "m", "u"]))@Eval (Reverse =<< Reverse ('Text '["a", "a", "m", "u"])) :: Text= 'Text '["a", "a", "m", "u"]šfcf-containers Intersperse for type-level text.Example;:kind! Eval (Intersperse "." ('Text '["a", "a", "m", "u"]))<Eval (Intersperse "." ('Text '["a", "a", "m", "u"])) :: Text,= 'Text '["a", ".", "a", ".", "m", ".", "u"]›fcf-containers Intercalate for type-level text.Exampleq:kind! Eval (Intercalate ('Text '[" ", "&", " "]) ('[ 'Text '["a", "a", "m", "u"], 'Text '["v", "a", "l", "o"]]))rEval (Intercalate ('Text '[" ", "&", " "]) ('[ 'Text '["a", "a", "m", "u"], 'Text '["v", "a", "l", "o"]])) :: Text@= 'Text '["a", "a", "m", "u", " ", "&", " ", "v", "a", "l", "o"]œ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) ):}1:kind! Eval (FMap Isymb2e ('Text '["i","m","u"]))2Eval (FMap Isymb2e ('Text '["i","m","u"])) :: Text= 'Text '["e", "m", "u"]fcf-containersJCompare the length of type-level text to given Nat and give the Ordering.Example;:kind! Eval (CompareLength ('Text '["a", "a", "m", "u"]) 3)@Eval (CompareLength ('Text '["a", "a", "m", "u"]) 3) :: Ordering= 'GTžfcf-containers5Take all except the last symbol from type-level text.Example5:kind! Eval (Init ('Text '["a", "a", "m", "u", "n"]))<Eval (Init ('Text '["a", "a", "m", "u", "n"])) :: Maybe Text%= 'Just ('Text '["a", "a", "m", "u"]):kind! Eval (Init ('Text '[]))%Eval (Init ('Text '[])) :: Maybe Text = 'NothingŸfcf-containers"Get the tail of a type-level text.Example5:kind! Eval (Tail ('Text '["h", "a", "a", "m", "u"]))<Eval (Tail ('Text '["h", "a", "a", "m", "u"])) :: Maybe Text%= 'Just ('Text '["a", "a", "m", "u"]):kind! Eval (Tail ('Text '[]))%Eval (Tail ('Text '[])) :: Maybe Text = 'Nothing fcf-containers(Get the first symbol of type-level text.Example0:kind! Eval (Head ('Text '["a", "a", "m", "u"]))9Eval (Head ('Text '["a", "a", "m", "u"])) :: Maybe Symbol = 'Just "a":kind! Eval (Head ('Text '[]))'Eval (Head ('Text '[])) :: Maybe Symbol = 'Nothing¡fcf-containers)Get the last symbol from type-level text.Example7:kind! Eval (Unsnoc ('Text '["a", "a", "m", "u", "n"]))9Eval (Unsnoc ('Text '["a", "a", "m", "u", "n"])) :: MaybeD (Symbol, Text)+= 'Just '("n", 'Text '["a", "a", "m", "u"]) :kind! Eval (Unsnoc ('Text '[]))1Eval (Unsnoc ('Text '[])) :: Maybe (Symbol, Text) = 'Nothing¢fcf-containers*Get the first symbol from type-level text.Example7:kind! Eval (Uncons ('Text '["h", "a", "a", "m", "u"]))9Eval (Uncons ('Text '["h", "a", "a", "m", "u"])) :: MaybeD (Symbol, Text)+= 'Just '("h", 'Text '["a", "a", "m", "u"]) :kind! Eval (Uncons ('Text '[]))1Eval (Uncons ('Text '[])) :: Maybe (Symbol, Text) = 'Nothing£fcf-containersAppend two type-level texts.Example<:kind! Eval (Append ('Text '["a", "a"]) ('Text '["m", "u"]))=Eval (Append ('Text '["a", "a"]) ('Text '["m", "u"])) :: Text= 'Text '["a", "a", "m", "u"]¤fcf-containers-Add a symbol to the end of a type-level text.Example/:kind! Eval (Snoc ('Text '["a", "a", "m"]) "u")0Eval (Snoc ('Text '["a", "a", "m"]) "u") :: Text= 'Text '["a", "a", "m", "u"]¥fcf-containers3Add a symbol to the beginning of a type-level text.Example4:kind! Eval (Cons "h" ('Text '["a", "a", "m", "u"]))5Eval (Cons "h" ('Text '["a", "a", "m", "u"])) :: Text"= 'Text '["h", "a", "a", "m", "u"]¦fcf-containersLengthExample-:kind! Eval (Length =<< FromList '["a", "b"])-Eval (Length =<< FromList '["a", "b"]) :: Nat= 2§fcf-containersNullExample+:kind! Eval (Null =<< FromList '["a", "b"]),Eval (Null =<< FromList '["a", "b"]) :: Bool= 'False:kind! Eval (Null =<< Empty)Eval (Null =<< Empty) :: Bool= 'True¨fcf-containersToSymbolExample9:kind! Eval (ToSymbol =<< FromList '["w", "o", "r", "d"])<Eval (ToSymbol =<< FromList '["w", "o", "r", "d"]) :: Symbol= "word"©fcf-containers#Get the type-level list out of the ­.Example-:kind! Eval (ToList =<< FromList '["a", "b"])2Eval (ToList =<< FromList '["a", "b"]) :: [Symbol] = '["a", "b"]ªfcf-containers6Use FromList to construct a Text from type-level list.Example¶:kind! Eval (FromList '["h", "e", "l", "l", "u", "r", "e", "i"]) Eval (FromList '["h", "e", "l", "l", "u", "r", "e", "i"]) :: Text = 'Text '["h", "e", "l", "l", "u", "r", "e", "i"]«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­P is a data structure, that is, a list to hold type-level symbols of length one..‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ¡¢£¤¥¦§¨©ª«¬­®.­®¬«ª©¨§¦£¥¤¢¡ Ÿžœ›š™˜—–•”“’‘ŽŒ‹Š‰ˆ‡†…„ƒ‚.Tree data-structure for type-level programming(c) gspia 2020-BSDgspiaSafe -.HUVÒ` ¯fcf-containersGet the levels from a º.Example_:kind! Eval (Levels ('Node 1 '[ 'Node 2 '[ 'Node 3 '[ 'Node 4 '[]]], 'Node 5 '[ 'Node 6 '[]]]))cEval (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 '[]]]))bEval (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-containersWSame as in containers, except not used for any term-level computation in this module.ºfcf-containersWSame as in containers, except not used for any term-level computation in this module. ¯°±²³´µ¶·¸¹º» º»¹¸·¶µ´³²±°¯ CTree-structures working with Algebras, ColAlgebras, and other stuff(c) gspia 2020-BSDgspiaSafe -.HUV(¼fcf-containersnEfficient Fibonacci type-level function (from Recursion Schemes by example, Tim Williams). Compare this to È.Example:kind! Eval (FibHisto 100)Eval (FibHisto 100) :: Nat= 354224848179261915075½fcf-containersLEfficient 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-containersRBTreeF 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= 55Éfcf-containersCoAlgebra for the Fib-function.Êfcf-containersMCoAlgebra to build TreeF's. This is an example from containers-package. See Ë and example in there.Q: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= 7Ìfcf-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-containersVA 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 functoráfcf-containersPInstances to make TreeF to be a foldable sum. After this one, we can write the à example.âfcf-containerstSizes 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)AEval (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-BSDgspiaSafe -.HUV•Òfcf-containers%Qsort - give the comparison function a -> a -> Exp BoolC 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" ])<Eval (Qsort (S.<) '[ "bb", "e", "a", "e", "d" ]) :: [Symbol]= '["a", "bb", "d", "e", "e"]Õfcf-containersComparison for Nat lists.Useful when sorting with Qsort.Öfcf-containersComparison for Symbol lists.Useful when sorting with Qsort.×fcf-containersComparison for the Nats.=TODO: Would this fit to Fcf.Data.Nat on first-class-families?Øfcf-containersbGive true if the first list is before the second, given the comparison function for the elements.Ùfcf-containers9Compare lists with the given comparison for the elements. ÑÒÓÔÕÖרÙÚ ÚÙØ×ÖÕÔÓÒÑä    !"#$%&'()*+,-./0123456789:;<=>?@AB CDEFGHIJKLMNOPQRSTUVWXYY@AB CDEFZHIJKLMNOPQRSTUVWX[[ V\JKL]^MNOPSUWX__`abcdefghijklmnopqrstuvwx>yz{|}~?€‚Nƒ VWX„„…†‡ˆ‰Š‹ŒŽ‘ ’ “ ” • – — ˜ ™ š › œ  ž Ÿ   M ¡ ¢ £ ¤ ¥ ¦ § ¨ © ª « ¬ ­ ® ¯°±²³´µ¶ · ¸ ¹ º»fcf-containers-0.5.0-inplaceFcf.Alg.Morphism Fcf.Alg.ListFcf.Alg.Symbol Fcf.Data.MapCFcf.Data.NatMap Fcf.Data.Set Fcf.Data.Text Fcf.Data.Tree Fcf.Alg.Tree Fcf.Alg.SortSecondFirstHistoHistoAlg SynthesizeSynthAlg AnnConstrStripAttrAnnAnnFParaFanoutHyloAnaCataRAlgebra CoAlgebraAlgebraFixEqualToListSumRunInc ListRunAlgNumIterEvensEvensAlg EvensStrip SlidingAlgSlidingDedupAlg ListToParaFixProdAlgSumAlgLenAlg ListToFixListFConsFNilF==><>=<= SymbolOrdIsDigit IsSpaceDelimIsTab IsNewLineIsSpace IntercalateAppend Partition FilterWithKeyFilterAssocsKeysElemsFoldr MapWithKeyMapDisjoint Intersection DifferenceUnionSizeNull NotMemberMemberLookupAdjustDelete InsertWithInsertFromList SingletonEmptyMapC NatMapWithKeyNatMapPowerSetIsProperSubsetOf IsSubsetOfSet IsInfixOf IsSuffixOf IsPrefixOfUnwordsUnlinesWordsLinesSplitSplitOn DropAround DropWhileEnd DropWhile TakeWhileEnd TakeWhileDropEndDropTakeEndTakeAllAny FConcatMapConcatReplaceReverse IntersperseFMap CompareLengthInitTailHeadUnsnocUnconsSnocConsLengthToSymbolTextLevels SubFLevels GetForestsGetRoots GetForestGetRootFlatten UnfoldForest UnfoldTreeFoldTreeForestTreeNodeFibHisto FibAlgebraRecNTFNatToFixNatFSuccZeroSizesFSumBTreeFBEmptyFBNodeFFibHyloBuildFibTreeCoA BuildNodeCoA CountNodesAlg SumNodesAlg TreeToFixTreeFNodeFPartCmpQsortInordPartHlp NatListOrd SymbolListOrdNatOrdListOrdListCmp ListCmpFndghc-prim GHC.TypesSymbol SplitLoop SplitTakeSOLoopSOTakeD:R:EvalBTreeFMap0D:R:EvalNatFSum0D:R:EvalFixSizesD:R:EvalNatFMap0