-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Data structures and algorithms for first-class-families -- -- Package fcf-containers provides type-level functions and data -- structures that operate on type-level computations. Specifically, we -- mimick the contents of containers-package and show how these can be -- used. Everything is based on the ideas given in the -- first-class-families -package. @package fcf-containers @version 0.7.2 -- |

Fcf.Alg.Morphism

-- -- Type-level Cata and Ana can be used to do complex -- computation that live only on type-level or on compile-time. As an -- example, see the sorting algorithm in Fcf.Alg.Tree -module. -- -- This module also provides some other type-level functions that -- probably will find other place after a while. E.g. First and -- Second and their instances on Either and tuple. module Fcf.Alg.Morphism -- | Structure that Cata can fold and that is a result structure of -- Ana. data Fix f Fix :: f (Fix f) -> Fix f -- | Commonly used name describing the method Cata eats. type Algebra f a = f a -> Exp a -- | Commonly used name describing the method Ana eats. type CoAlgebra f a = a -> Exp (f a) -- | Commonly used name describing the method Para eats. type RAlgebra f a = f (Fix f, a) -> Exp a -- | Write the function to give a Fix, and feed it in together with -- an Algebra. -- -- Check Fcf.Alg.List to see example algebras in use. There we have e.g. -- ListToFix-function. data Cata :: Algebra f a -> Fix f -> Exp a -- | Ana can also be used to build a Fix 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))))))
--   
data Ana :: CoAlgebra f a -> a -> Exp (Fix f) -- | Hylomorphism uses first Ana to build a structure (unfold) and -- then Cata 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
--   = 15
--   
data Hylo :: Algebra f a -> CoAlgebra f b -> b -> Exp a data Fanout :: RAlgebra f a -> Fix f -> Exp (Fix f, a) -- | Write a function to give a Fix, and feed it in together with an -- RAlgebra -- -- Check Fcf.Alg.List to see example algebras in use. There we have e.g. -- ListToParaFix-function. data Para :: RAlgebra f a -> Fix f -> Exp a -- | Annotate (f r) with attribute a (from Recursion Schemes by example, -- Tim Williams). newtype AnnF f a r AnnF :: (f r, a) -> AnnF f a r -- | Annotated fixed-point type. A cofree comonad (from Recursion Schemes -- by example, Tim Williams). type Ann f a = Fix (AnnF f a) -- | Attribute of the root node (from Recursion Schemes by example, Tim -- Williams). data Attr :: Ann f a -> Exp a -- | Strip attribute from root (from Recursion Schemes by example, Tim -- Williams). data Strip :: Ann f a -> Exp (f (Ann f a)) -- | Annotation constructor (from Recursion Schemes by example, Tim -- Williams). data AnnConstr :: (f (Ann f a), a) -> Exp (Fix (AnnF f a)) -- | 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. data SynthAlg :: (f a -> Exp a) -> f (Ann f a) -> Exp (Ann f a) -- | 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. data Synthesize :: (f a -> Exp a) -> Fix f -> Exp (Ann f a) -- | Histo takes annotation algebra and takes a Fix-structure (from -- Recursion Schemes by example, Tim Williams). -- -- This is a helper for Histo as it is implemented with -- Cata. data HistoAlg :: (f (Ann f a) -> Exp a) -> f (Ann f a) -> Exp (Ann f a) -- | Histo 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. data Histo :: (f (Ann f a) -> Exp a) -> Fix f -> Exp a -- | Type-level First. Tuples (,) and Either have -- First-instances. -- --

Example

-- --
--   >>> :kind! Eval (First ((+) 1) '(3,"a"))
--   Eval (First ((+) 1) '(3,"a")) :: (Nat, TL.Symbol)
--   = '(4, "a")
--   
data First :: (a -> Exp b) -> f a c -> Exp (f b c) -- | Type-level Second. Tuples (,) and Either have -- Second-instances. -- --

Example

-- --
--   >>> :kind! Eval (Second ((+) 1) '("a",3))
--   Eval (Second ((+) 1) '("a",3)) :: (TL.Symbol, Nat)
--   = '("a", 4)
--   
data Second :: (c -> Exp d) -> f a c -> Exp (f a d) -- |

Fcf.Alg.List

-- -- Type-level ListF to be used with Cata, Ana and Hylo. -- -- This module also contains other list-related functions (that might -- move to other place some day). module Fcf.Alg.List -- | Base functor for a list of type [a]. data ListF a b ConsF :: a -> b -> ListF a b NilF :: ListF a b -- | ListToFix 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 LenAlg and SumAlg. -- -- 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))))))
--   
data ListToFix :: [a] -> Exp (Fix (ListF a)) -- | Example algebra to calculate list length. -- --

Example

-- --
--   >>> :kind! Eval (Cata LenAlg =<< ListToFix '[1,2,3])
--   Eval (Cata LenAlg =<< ListToFix '[1,2,3]) :: Nat
--   = 3
--   
data LenAlg :: Algebra (ListF a) Nat -- | Example algebra to calculate the sum of Nats in a list. -- --

Example

-- --
--   >>> :kind! Eval (Cata SumAlg =<< ListToFix '[1,2,3,4])
--   Eval (Cata SumAlg =<< ListToFix '[1,2,3,4]) :: Nat
--   = 10
--   
data SumAlg :: Algebra (ListF Nat) Nat -- | Example algebra to calculate the prod of Nats in a list. -- --

Example

-- --
--   >>> :kind! Eval (Cata ProdAlg =<< ListToFix '[1,2,3,4])
--   Eval (Cata ProdAlg =<< ListToFix '[1,2,3,4]) :: Nat
--   = 24
--   
data ProdAlg :: Algebra (ListF Nat) Nat -- | Form a Fix-structure that can be used with Para. -- --

Example

-- --
--   >>> :kind! Eval (ListToParaFix '[1,2,3])
--   Eval (ListToParaFix '[1,2,3]) :: Fix (ListF (Nat, [Nat]))
--   = 'Fix
--       ('ConsF
--          '(1, '[2, 3])
--          ('Fix ('ConsF '(2, '[3]) ('Fix ('ConsF '(3, '[]) ('Fix 'NilF))))))
--   
data ListToParaFix :: [a] -> Exp (Fix (ListF (a, [a]))) -- | Example 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]
--   
data DedupAlg :: RAlgebra (ListF (a, [a])) [a] -- | 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]]
--   
data Sliding :: Nat -> [a] -> Exp [[a]] -- | Tim Williams, Recursion Schemes by example, example for Para. See -- Sliding-function. data SlidingAlg :: Nat -> RAlgebra (ListF (a, [a])) [[a]] -- | Tim Williams, Recursion Schemes by example, example for Histo. data EvensStrip :: ListF a (Ann (ListF a) [a]) -> Exp [a] -- | Tim Williams, Recursion Schemes by example, example for Histo. data EvensAlg :: ListF a (Ann (ListF a) [a]) -> Exp [a] -- | 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]
--   
data Evens :: [a] -> Exp [a] -- | For the ListRunAlg data NumIter :: a -> Nat -> Exp (Maybe (a, Nat)) -- | For the RunInc data ListRunAlg :: Nat -> Exp (Maybe (Nat, Nat)) -- | Construct 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]
--   
data RunInc :: Nat -> Exp [Nat] -- | Sum a Nat-list. -- --

Example

-- --
--   >>> :kind! Eval (Sum '[1,2,3])
--   Eval (Sum '[1,2,3]) :: Nat
--   = 6
--   
data Sum :: [Nat] -> Exp Nat -- | Helper to form Nat lists like [1..5] or [3..10] -- -- :kind! Eval (Unfoldr ToThree 1) data MToNHelp :: Nat -> Nat -> Exp (Maybe (Nat, Nat)) -- | Function to form Nat lists like [1..5] or [3..10] -- --

Example

-- --
--   >>> :kind! Eval (MToN 1 3)
--   Eval (MToN 1 3) :: [Nat]
--   = '[1, 2, 3]
--   
data MToN :: Nat -> Nat -> Exp [Nat] -- | ToList for type-level lists. -- --

Example

-- --
--   >>> :kind! Eval (ToList 1)
--   Eval (ToList 1) :: [Nat]
--   = '[1]
--   
data ToList :: a -> Exp [a] -- | 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
--   = 'False
--   
data Equal :: [a] -> [a] -> Exp Bool -- |

Fcf.Data.Nat

module Fcf.Alg.Nat -- | Nat equality. -- --
--   >>> :kind! Eval (2 == 2)
--   Eval (2 == 2) :: Bool
--   = 'True
--   
-- --
--   >>> :kind! Eval (2 == 3)
--   Eval (2 == 3) :: Bool
--   = 'False
--   
data (==) :: Nat -> Nat -> Exp Bool -- | Nat in-equality. -- --
--   >>> :kind! Eval (2 /= 2)
--   Eval (2 /= 2) :: Bool
--   = 'False
--   
-- --
--   >>> :kind! Eval (2 /= 3)
--   Eval (2 /= 3) :: Bool
--   = 'True
--   
data (/=) :: Nat -> Nat -> Exp Bool -- |

Fcf.Alg.Other

-- -- To be moved to some other place module Fcf.Alg.Other -- | Helper. -- --

Example

-- --
--   >>> :kind! Eval (PairMaybeToMaybePair '( 'Just "txt", 'Just 1))
--   Eval (PairMaybeToMaybePair '( 'Just "txt", 'Just 1)) :: Maybe
--                                                             (Symbol, Nat)
--   = 'Just '("txt", 1)
--   
data PairMaybeToMaybePair :: (Maybe a, Maybe b) -> Exp (Maybe (a, b)) -- | Id function. -- --

Example

-- --
--   >>> :kind! Eval (Id "id")
--   Eval (Id "id") :: Symbol
--   = "id"
--   
data Id :: a -> Exp a -- |

Fcf.Alg.Symbol

-- -- Type-level symbols and functions for them. -- -- Note that the operators from this module conflict with -- GHC.TypeLits. -- -- TODO: Would this whole module have a place first-class-families? module Fcf.Alg.Symbol -- | Append two type-level symbols. -- --

Example

-- --
--   >>> :kind! Eval (Append "hmm" " ok")
--   Eval (Append "hmm" " ok") :: Symbol
--   = "hmm ok"
--   
data Append :: Symbol -> Symbol -> Exp Symbol -- | Intercalate type-level symbols. -- --

Example

-- --
--   >>> :kind! Eval (Intercalate "+" '["aa", "bb", "cc"])
--   Eval (Intercalate "+" '["aa", "bb", "cc"]) :: Symbol
--   = "aa+bb+cc"
--   
-- --
--   >>> :kind! Eval (Intercalate "+" '["aa"])
--   Eval (Intercalate "+" '["aa"]) :: Symbol
--   = "aa"
--   
-- --
--   >>> :kind! Eval (Intercalate "+" '[])
--   Eval (Intercalate "+" '[]) :: Symbol
--   = ""
--   
data Intercalate :: Symbol -> [Symbol] -> Exp Symbol -- | IsSpace -- --

Example

-- --
--   >>> :kind! Eval (IsSpace "a")
--   Eval (IsSpace "a") :: Bool
--   = 'False
--   
-- --
--   >>> :kind! Eval (IsSpace " ")
--   Eval (IsSpace " ") :: Bool
--   = 'True
--   
data IsSpace :: Symbol -> Exp Bool -- | IsNewline -- --

Example

-- --
--   >>> :kind! Eval (IsNewLine "a")
--   Eval (IsNewLine "a") :: Bool
--   = 'False
--   
-- --
--   >>> :kind! Eval (IsNewLine "\n")
--   Eval (IsNewLine "\n") :: Bool
--   = 'True
--   
data IsNewLine :: Symbol -> Exp Bool -- | IsTab -- --

Example

-- --
--   >>> :kind! Eval (IsTab "a")
--   Eval (IsTab "a") :: Bool
--   = 'False
--   
-- --
--   >>> :kind! Eval (IsTab "\t")
--   Eval (IsTab "\t") :: Bool
--   = 'True
--   
data IsTab :: Symbol -> Exp Bool -- | IsSpaceDelim -- --

Example

-- --
--   >>> :kind! Eval (IsSpaceDelim "a")
--   Eval (IsSpaceDelim "a") :: Bool
--   = 'False
--   
-- --
--   >>> :kind! Eval (IsSpaceDelim "\n")
--   Eval (IsSpaceDelim "\n") :: Bool
--   = 'True
--   
data IsSpaceDelim :: Symbol -> Exp Bool -- | IsDigit -- --

Example

-- --
--   >>> :kind! Eval (IsDigit "3")
--   Eval (IsDigit "3") :: Bool
--   = 'True
--   
-- --
--   >>> :kind! Eval (IsDigit "a")
--   Eval (IsDigit "a") :: Bool
--   = 'False
--   
data IsDigit :: Symbol -> Exp Bool -- | SymbolOrd - compare two symbols and give type-level Ordering ( $ 'LT -- $, $ 'EQ $ or $ 'GT $ ). -- --

Example

-- --
--   >>> :kind! Eval (SymbolOrd "a" "b")
--   Eval (SymbolOrd "a" "b") :: Ordering
--   = 'LT
--   
data SymbolOrd :: Symbol -> Symbol -> Exp Ordering -- | Less-than-or-equal comparison for symbols. -- --

Example

-- --
--   >>> :kind! Eval ("b" <= "a")
--   Eval ("b" <= "a") :: Bool
--   = 'False
--   
data (<=) :: Symbol -> Symbol -> Exp Bool -- | Larger-than-or-equal comparison for symbols. -- --

Example

-- --
--   >>> :kind! Eval ("b" >= "a")
--   Eval ("b" >= "a") :: Bool
--   = 'True
--   
data (>=) :: Symbol -> Symbol -> Exp Bool -- | Less-than comparison for symbols. -- --

Example

-- --
--   >>> :kind! Eval ("a" < "b")
--   Eval ("a" < "b") :: Bool
--   = 'True
--   
data (<) :: Symbol -> Symbol -> Exp Bool -- | Larger-than comparison for symbols. -- --

Example

-- --
--   >>> :kind! Eval ("b" > "a")
--   Eval ("b" > "a") :: Bool
--   = 'True
--   
data (>) :: Symbol -> Symbol -> Exp Bool -- | Equality of symbols -- --

Example

-- --
--   >>> :kind! Eval ("b" == "a")
--   Eval ("b" == "a") :: Bool
--   = 'False
--   
data (==) :: Symbol -> Symbol -> Exp Bool -- |

Fcf.Control.Monad

module Fcf.Control.Monad -- | Return corresponds to the return at Monad or pure of -- Applicative. -- -- :kind! Eval (Return 1) :: Maybe Nat :kind! Eval (Return 1) :: Either -- Symbol Nat data Return :: a -> Exp (m a) -- | (*) corresponds to the value level <*>. Note that -- this clashes with the definition given at -- Fcf.Combinators.((*)). -- -- Applicatives that we define include: -- -- -- --

Example

-- --
--   >>> :kind! Eval ('Identity Plus2 <*> 'Identity 5)
--   Eval ('Identity Plus2 <*> 'Identity 5) :: Identity Nat
--   = 'Identity 7
--   
-- --
--   >>> :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]
--   
--   >>> :kind! Eval ( (<*>) '[ (Fcf.+) 1, (Fcf.*) 10] '[])
--   Eval ( (<*>) '[ (Fcf.+) 1, (Fcf.*) 10] '[]) :: [Nat]
--   = '[]
--   
--   >>> :kind! Eval ( (<*>) '[] '[4,5,6,7])
--   Eval ( (<*>) '[] '[4,5,6,7]) :: [b]
--   = '[]
--   
data (<*>) :: f (a -> Exp b) -> f a -> Exp (f b) -- | Helper for the [] applicative instance. data Star_ :: (a -> Exp b) -> f a -> Exp (f b) data Plus1 :: Nat -> Exp Nat data Plus2 :: Nat -> Exp Nat -- | Type level LiftA2. -- --

Example

-- --
--   >>> :kind! Eval (LiftA2 (Fcf.+) '[1,2] '[3,4])
--   Eval (LiftA2 (Fcf.+) '[1,2] '[3,4]) :: [Nat]
--   = '[4, 5, 5, 6]
--   
data LiftA2 :: (a -> b -> Exp c) -> f a -> f b -> Exp (f c) data LiftA2_ :: (a -> b -> Exp c) -> a -> f b -> Exp (f c) -- | Type level Bind corresponding to the value level bind >>= -- operator. Note that name (>>=) clashes with the definition given -- at Fcf.Combinators.(>>=). (It doesn't export it yet, though.) -- -- Monads that we define include: -- -- -- --

Example

-- -- Example: 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])
--   Eval (XsPlusYsMonadic '[1,2,3] '[4,5,6]) :: [Nat]
--   = '[5, 6, 7, 6, 7, 8, 7, 8, 9]
--   
data (>>=) :: m a -> (a -> Exp (m b)) -> Exp (m b) data Plus2M :: Nat -> Exp [Nat] data PureXPlusY :: Nat -> Nat -> Exp [Nat] data XPlusYs :: Nat -> [Nat] -> Exp [Nat] -- | An example implementing -- -- sumM xs ys = do x <- xs y <- ys return (x + y) -- -- or -- -- sumM 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. data XsPlusYsMonadic :: [Nat] -> [Nat] -> Exp [Nat] data (>>) :: m a -> m b -> Exp (m b) -- | MapM -- --

Example

-- --
--   >>> :kind! Eval (MapM (ConstFn '[ 'True, 'False]) '["a","b","c"])
--   Eval (MapM (ConstFn '[ 'True, 'False]) '["a","b","c"]) :: [[Bool]]
--   = '[ '[ 'True, 'True, 'True], '[ 'True, 'True, 'False],
--        '[ 'True, 'False, 'True], '[ 'True, 'False, 'False],
--        '[ 'False, 'True, 'True], '[ 'False, 'True, 'False],
--        '[ 'False, 'False, 'True], '[ 'False, 'False, 'False]]
--   
data MapM :: (a -> Exp (m b)) -> t a -> Exp (m (t b)) -- | ForM = Flip MapM data ForM :: t a -> (a -> Exp (m b)) -> Exp (m (t b)) -- | Traverse -- --

Example

-- --
--   >>> :kind! Eval (Traverse Id '[ '[1,2], '[3,4]])
--   Eval (Traverse Id '[ '[1,2], '[3,4]]) :: [[Nat]]
--   = '[ '[1, 3], '[1, 4], '[2, 3], '[2, 4]]
--   
data Traverse :: (a -> Exp (f b)) -> t a -> Exp (f (t b)) -- | Helper for [] traverse data Cons_f :: (a -> Exp (f b)) -> a -> f [b] -> Exp (f [b]) -- | Id function correspondes to term level id-function. data Id :: a -> Exp a -- | Sequence -- --

Example

-- --
--   >>> :kind! Eval (Sequence ('Just ('Right 5)))
--   Eval (Sequence ('Just ('Right 5))) :: Either a (Maybe Nat)
--   = 'Right ('Just 5)
--   
-- --
--   >>> :kind! Eval (Sequence '[ 'Just 3, 'Just 5, 'Just 7])
--   Eval (Sequence '[ 'Just 3, 'Just 5, 'Just 7]) :: Maybe [Nat]
--   = 'Just '[3, 5, 7]
--   
-- --
--   >>> :kind! Eval (Sequence '[ 'Just 3, 'Nothing, 'Just 7])
--   Eval (Sequence '[ 'Just 3, 'Nothing, 'Just 7]) :: Maybe [Nat]
--   = 'Nothing
--   
-- --
--   >>> :kind! Eval (Sequence '[ '[1,2], '[3,4]])
--   Eval (Sequence '[ '[1,2], '[3,4]]) :: [[Nat]]
--   = '[ '[1, 3], '[1, 4], '[2, 3], '[2, 4]]
--   
data Sequence :: t (f a) -> Exp (f (t a)) -- |

Fcf.Data.Bitree

-- -- Binary trees module Fcf.Data.Bitree -- | Binary tree type. data Tree a Leaf :: a -> Tree a Node :: Tree a -> a -> Tree a -> Tree a -- | Fold a type-level Tree. data FoldTree :: (a -> [b] -> Exp b) -> Tree a -> Exp b data CountSizeHelp :: Nat -> [Nat] -> Exp Nat type ExampleTree1 = 'Leaf 1 type ExampleTree2 = 'Node ('Leaf 2) 1 ('Leaf 3) type ExampleTree3 = 'Node ('Node ('Leaf 4) 2 ('Leaf 5)) 1 ('Node ('Leaf 6) 3 ('Leaf 7)) type ExampleTree4 = 'Node ('Node ('Leaf 4) 2 ('Leaf 5)) 1 ('Leaf 3) -- | Flatten a Tree. -- --

Example

data Flatten :: Tree a -> Exp [a] -- | Get the root node from a Tree. data GetRoot :: Tree a -> Exp a -- | Get the root nodes from a list of Trees. data GetRoots :: [Tree a] -> Exp [a] instance GHC.Show.Show a => GHC.Show.Show (Fcf.Data.Bitree.Tree a) -- |

Fcf.Data.List.Utils

-- -- The following would probably have better place at the -- first-class-families library. That is, polish and make a PR. module Fcf.Data.List.Utils -- | Foldl in terms of Foldr. -- --

Example

-- --
--   >>> :kind! Eval (Foldl (Fcf.-) 10 '[3,2,1])
--   Eval (Foldl (Fcf.-) 10 '[3,2,1]) :: Nat
--   = 4
--   
data Foldl :: (b -> a -> Exp b) -> b -> t a -> Exp b -- |

Fcf.Data.MapC

-- -- MapC provides an interface to mapping keys to values, which is similar -- to that given by the containers-package. Note that the this module -- still misses some of the methods that can be found in containers. If -- you need some, please do open up an issue or better, make a PR. -- -- Many of the examples are from containers-package. -- -- We call this MapC because name Map is reserved to the map-function in -- Fcf-package. The internal representation is type-level list. We hope -- that one day the internal representation is based on balanced trees -- similar to the one used in the containers. module Fcf.Data.MapC -- | 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.) data MapC k v MapC :: [(k, v)] -> MapC k v -- | Null -- --

Example

-- --
--   >>> :kind! Eval (Null =<< FromList '[ '(5,"a"), '(3,"b")])
--   Eval (Null =<< FromList '[ '(5,"a"), '(3,"b")]) :: Bool
--   = 'False
--   
--   >>> :kind! Eval (Null =<< Empty)
--   Eval (Null =<< Empty) :: Bool
--   = 'True
--   
data Null :: MapC k v -> Exp Bool -- | Size -- --

Example

-- --
--   >>> :kind! Eval (Size =<< FromList '[ '(5,"a"), '(3,"b")])
--   Eval (Size =<< FromList '[ '(5,"a"), '(3,"b")]) :: Nat
--   = 2
--   
data Size :: MapC k v -> Exp Nat -- | Lookup -- --

Example

-- --
--   >>> :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
--   = 'Nothing
--   
data Lookup :: k -> MapC k v -> Exp (Maybe v) -- | Member -- --

Example

-- --
--   >>> :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
--   = 'False
--   
data Member :: k -> MapC k v -> Exp Bool -- | NotMember -- --

Example

-- --
--   >>> :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
--   = 'True
--   
data NotMember :: k -> MapC k v -> Exp Bool -- | Disjoint -- --

Example

-- --
--   >>> :kind! Eval (Disjoint (Eval (FromList '[ '(3,"a"), '(5,"b")])) (Eval (FromList '[ '(5,"B"), '(7,"C")])))
--   Eval (Disjoint (Eval (FromList '[ '(3,"a"), '(5,"b")])) (Eval (FromList '[ '(5,"B"), '(7,"C")]))) :: Bool
--   = 'False
--   
-- --
--   >>> :kind! Eval (Disjoint (Eval (FromList '[ '(3,"a"), '(5,"b")])) (Eval (FromList '[ '(2,"B"), '(7,"C")])))
--   Eval (Disjoint (Eval (FromList '[ '(3,"a"), '(5,"b")])) (Eval (FromList '[ '(2,"B"), '(7,"C")]))) :: Bool
--   = 'True
--   
--   >>> :kind! Eval (Disjoint (Eval Empty) (Eval Empty))
--   Eval (Disjoint (Eval Empty) (Eval Empty)) :: Bool
--   = 'True
--   
data Disjoint :: MapC k v -> MapC k v -> Exp Bool -- | Elems -- --

Example

-- --
--   >>> :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]
--   = '[]
--   
data Elems :: MapC k v -> Exp [v] -- | Keys -- --

Example

-- --
--   >>> :kind! Eval (Keys =<< FromList '[ '(5,"a"), '(3,"b")])
--   Eval (Keys =<< FromList '[ '(5,"a"), '(3,"b")]) :: [Nat]
--   = '[5, 3]
--   
--   >>> :kind! Eval (Keys =<< Empty)
--   Eval (Keys =<< Empty) :: [k]
--   = '[]
--   
data Keys :: MapC k v -> Exp [k] -- | Assocs -- --

Example

-- --
--   >>> :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)]
--   = '[]
--   
data Assocs :: MapC k v -> Exp [(k, v)] -- | Empty -- --

Example

-- --
--   >>> :kind! (Eval Empty :: MapC Nat Symbol)
--   (Eval Empty :: MapC Nat Symbol) :: MapC Nat Symbol
--   = 'MapC '[]
--   
-- --
--   >>> :kind! (Eval Empty :: MapC Int String)
--   (Eval Empty :: MapC Int String) :: MapC Int [Char]
--   = 'MapC '[]
--   
-- -- See also the other examples in this module. data Empty :: Exp (MapC k v) -- | Singleton -- --

Example

-- --
--   >>> :kind! Eval (Singleton 1 "haa")
--   Eval (Singleton 1 "haa") :: MapC Nat Symbol
--   = 'MapC '[ '(1, "haa")]
--   
data Singleton :: k -> v -> Exp (MapC k v) -- | Insert -- --

Example

-- --
--   >>> :kind! Eval (Insert 3 "hih" =<< FromList '[ '(1,"haa"), '(2,"hoo")])
--   Eval (Insert 3 "hih" =<< FromList '[ '(1,"haa"), '(2,"hoo")]) :: MapC 
--                                                                      Nat Symbol
--   = 'MapC '[ '(3, "hih"), '(1, "haa"), '(2, "hoo")]
--   
data Insert :: k -> v -> MapC k v -> Exp (MapC k v) -- | InsertWith if old there, map if no old, add -- --

Example

-- --
--   >>> :kind! Eval (InsertWith Append 5 "xxx" =<< FromList '[ '(5,"a"), '(3,"b")])
--   Eval (InsertWith Append 5 "xxx" =<< FromList '[ '(5,"a"), '(3,"b")]) :: MapC
--                                                                             Nat Symbol
--   = 'MapC '[ '(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")]) :: MapC
--                                                                             Nat Symbol
--   = 'MapC '[ '(5, "a"), '(3, "b"), '(7, "xxx")]
--   
--   >>> :kind! Eval (InsertWith Append 7 "xxx" =<< Empty)
--   Eval (InsertWith Append 7 "xxx" =<< Empty) :: MapC Nat Symbol
--   = 'MapC '[ '(7, "xxx")]
--   
data InsertWith :: (v -> v -> Exp v) -> k -> v -> MapC k v -> Exp (MapC k v) -- | Delete -- --

Example

-- --
--   >>> :kind! Eval (Delete 5 =<< FromList '[ '(5,"a"), '(3,"b")])
--   Eval (Delete 5 =<< FromList '[ '(5,"a"), '(3,"b")]) :: MapC
--                                                            Nat Symbol
--   = 'MapC '[ '(3, "b")]
--   
-- --
--   >>> :kind! Eval (Delete 7 =<< FromList '[ '(5,"a"), '(3,"b")])
--   Eval (Delete 7 =<< FromList '[ '(5,"a"), '(3,"b")]) :: MapC
--                                                            Nat Symbol
--   = 'MapC '[ '(5, "a"), '(3, "b")]
--   
-- --
--   >>> :kind! Eval (Delete 7 =<< Empty)
--   Eval (Delete 7 =<< Empty) :: MapC Nat v
--   = 'MapC '[]
--   
data Delete :: k -> MapC k v -> Exp (MapC k v) -- | Union -- --

Example

-- --
--   >>> :kind! Eval (Union (Eval (FromList '[ '(5,"a"), '(3,"b")])) (Eval (FromList '[ '(5,"A"), '(7,"c")])) )
--   Eval (Union (Eval (FromList '[ '(5,"a"), '(3,"b")])) (Eval (FromList '[ '(5,"A"), '(7,"c")])) ) :: MapC 
--                                                                                                        Nat 
--                                                                                                        Symbol
--   = 'MapC '[ '(7, "c"), '(5, "a"), '(3, "b")]
--   
data Union :: MapC k v -> MapC k v -> Exp (MapC k v) -- | Difference -- --

Example

-- --
--   >>> :kind! Eval (Difference (Eval (FromList '[ '(3,"a"), '(5,"b")])) (Eval (FromList '[ '(5,"B"), '(7,"C")])))
--   Eval (Difference (Eval (FromList '[ '(3,"a"), '(5,"b")])) (Eval (FromList '[ '(5,"B"), '(7,"C")]))) :: MapC 
--                                                                                                            Nat 
--                                                                                                            Symbol
--   = 'MapC '[ '(3, "a")]
--   
data Difference :: MapC k v -> MapC k v -> Exp (MapC k v) -- | Intersection -- --

Example

-- --
--   >>> :kind! Eval (Intersection (Eval (FromList '[ '(3,"a"), '(5,"b")])) (Eval (FromList '[ '(5,"B"), '(7,"C")])))
--   Eval (Intersection (Eval (FromList '[ '(3,"a"), '(5,"b")])) (Eval (FromList '[ '(5,"B"), '(7,"C")]))) :: MapC 
--                                                                                                              Nat 
--                                                                                                              Symbol
--   = 'MapC '[ '(5, "b")]
--   
data Intersection :: MapC k v -> MapC k v -> Exp (MapC k v) -- | Adjust -- --

Example

-- --
--   >>> :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")]
--   
-- --
--   >>> :kind! Eval (Adjust (Append "new ") 7 =<< Empty)
--   Eval (Adjust (Append "new ") 7 =<< Empty) :: MapC Nat Symbol
--   = 'MapC '[]
--   
data Adjust :: (v -> Exp v) -> k -> MapC k v -> Exp (MapC k v) data Map :: (v -> Exp w) -> MapC k v -> Exp (MapC k w) data MapWithKey :: (k -> v -> Exp w) -> MapC k v -> Exp (MapC k w) -- | Foldr -- -- Fold the values in the map using the given right-associative binary -- operator, such that 'foldr f z == foldr f z . elems'. -- -- Note: the order of values in MapC is not well defined at the moment. -- --

Example

-- --
--   >>> :kind! Eval (Fcf.Data.MapC.Foldr (+) 0  =<< (FromList '[ '(1,1), '(2,2)]))
--   Eval (Fcf.Data.MapC.Foldr (+) 0  =<< (FromList '[ '(1,1), '(2,2)])) :: Nat
--   = 3
--   
data Foldr :: (v -> w -> Exp w) -> w -> MapC k v -> Exp w -- | Filter -- --

Example

-- --
--   >>> :kind! Eval (Filter ((>=) 35) =<< FromList '[ '(5,50), '(3,30)])
--   Eval (Filter ((>=) 35) =<< FromList '[ '(5,50), '(3,30)]) :: MapC 
--                                                                  Nat Nat
--   = 'MapC '[ '(3, 30)]
--   
data Filter :: (v -> Exp Bool) -> MapC k v -> Exp (MapC k v) -- | FilterWithKey -- --

Example

-- --
--   >>> :kind! Eval (FilterWithKey (>=) =<< FromList '[ '(3,5), '(6,4)])
--   Eval (FilterWithKey (>=) =<< FromList '[ '(3,5), '(6,4)]) :: MapC
--                                                                  Nat Nat
--   = 'MapC '[ '(6, 4)]
--   
data FilterWithKey :: (k -> v -> Exp Bool) -> MapC k v -> Exp (MapC k v) -- | Partition -- --

Example

-- --
--   >>> :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)])
--   
data Partition :: (v -> Exp Bool) -> MapC k v -> Exp (MapC k v, MapC k v) -- | Use FromList to construct a MapC from type-level list. -- --

Example

-- --
--   >>> :kind! Eval (FromList '[ '(1,"haa"), '(2,"hoo")])
--   Eval (FromList '[ '(1,"haa"), '(2,"hoo")]) :: MapC Nat Symbol
--   = 'MapC '[ '(1, "haa"), '(2, "hoo")]
--   
data FromList :: [(k, v)] -> Exp (MapC k v) -- | ToList -- --

Example

-- --
--   >>> :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)]
--   = '[]
--   
data ToList :: MapC k v -> Exp [(k, v)] -- |

Fcf.Data.NatMap

-- -- NatMap provides an interface to mapping keys (Nat's) to values, which -- is similar to IntMap given by the containers-package. Note that the -- this module still misses some of the methods that can be found in -- containers. If you need some, please do open up an issue or better, -- make a PR. -- -- Many of the examples are from containers-package. module Fcf.Data.NatMap -- | A 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.) data NatMap v NatMap :: [(Nat, v)] -> NatMap v -- | Null -- --

Example

-- --
--   >>> :kind! Eval (Null =<< FromList '[ '(5,"a"), '(3,"b")])
--   Eval (Null =<< FromList '[ '(5,"a"), '(3,"b")]) :: Bool
--   = 'False
--   
--   >>> :kind! Eval (Null =<< Empty)
--   Eval (Null =<< Empty) :: Bool
--   = 'True
--   
data Null :: NatMap v -> Exp Bool -- | Size -- --

Example

-- --
--   >>> :kind! Eval (Size =<< FromList '[ '(5,"a"), '(3,"b")])
--   Eval (Size =<< FromList '[ '(5,"a"), '(3,"b")]) :: Nat
--   = 2
--   
data Size :: NatMap v -> Exp Nat -- | Lookup -- --

Example

-- --
--   >>> :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
--   = 'Nothing
--   
data Lookup :: Nat -> NatMap v -> Exp (Maybe v) -- | Member -- --

Example

-- --
--   >>> :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
--   = 'False
--   
data Member :: Nat -> NatMap v -> Exp Bool -- | NotMember -- --

Example

-- --
--   >>> :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
--   = 'True
--   
data NotMember :: Nat -> NatMap v -> Exp Bool -- | Disjoint -- --

Example

-- --
--   >>> :kind! Eval (Disjoint (Eval (FromList '[ '(3,"a"), '(5,"b")])) (Eval (FromList '[ '(5,"B"), '(7,"C")])))
--   Eval (Disjoint (Eval (FromList '[ '(3,"a"), '(5,"b")])) (Eval (FromList '[ '(5,"B"), '(7,"C")]))) :: Bool
--   = 'False
--   
-- --
--   >>> :kind! Eval (Disjoint (Eval (FromList '[ '(3,"a"), '(5,"b")])) (Eval (FromList '[ '(2,"B"), '(7,"C")])))
--   Eval (Disjoint (Eval (FromList '[ '(3,"a"), '(5,"b")])) (Eval (FromList '[ '(2,"B"), '(7,"C")]))) :: Bool
--   = 'True
--   
--   >>> :kind! Eval (Disjoint (Eval Empty) (Eval Empty))
--   Eval (Disjoint (Eval Empty) (Eval Empty)) :: Bool
--   = 'True
--   
data Disjoint :: NatMap v -> NatMap v -> Exp Bool -- | Elems -- --

Example

-- --
--   >>> :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]
--   = '[]
--   
data Elems :: NatMap v -> Exp [v] -- | Keys -- --

Example

-- --
--   >>> :kind! Eval (Keys =<< FromList '[ '(5,"a"), '(3,"b")])
--   Eval (Keys =<< FromList '[ '(5,"a"), '(3,"b")]) :: [Nat]
--   = '[5, 3]
--   
--   >>> :kind! Eval (Keys =<< Empty)
--   Eval (Keys =<< Empty) :: [Nat]
--   = '[]
--   
data Keys :: NatMap v -> Exp [Nat] -- | Assocs -- --

Example

-- --
--   >>> :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)]
--   = '[]
--   
data Assocs :: NatMap v -> Exp [(Nat, v)] -- | Empty -- --

Example

-- --
--   >>> :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. data Empty :: Exp (NatMap v) -- | Singleton -- --

Example

-- --
--   >>> :kind! Eval (Singleton 1 "haa")
--   Eval (Singleton 1 "haa") :: NatMap Symbol
--   = 'NatMap '[ '(1, "haa")]
--   
data Singleton :: Nat -> v -> Exp (NatMap v) -- | Insert -- --

Example

-- --
--   >>> :kind! Eval (Insert 3 "hih" =<< FromList '[ '(1,"haa"), '(2,"hoo")])
--   Eval (Insert 3 "hih" =<< FromList '[ '(1,"haa"), '(2,"hoo")]) :: NatMap 
--                                                                      Symbol
--   = 'NatMap '[ '(3, "hih"), '(1, "haa"), '(2, "hoo")]
--   
data Insert :: Nat -> v -> NatMap v -> Exp (NatMap v) -- | InsertWith -- -- if old there, map -- -- if no old, add -- --

Example

-- --
--   >>> :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")]
--   
-- --
--   >>> :kind! Eval (InsertWith Append 7 "xxx" =<< Empty)
--   Eval (InsertWith Append 7 "xxx" =<< Empty) :: NatMap Symbol
--   = 'NatMap '[ '(7, "xxx")]
--   
data InsertWith :: (v -> v -> Exp v) -> Nat -> v -> NatMap v -> Exp (NatMap v) -- | Delete -- --

Example

-- --
--   >>> :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 '[]
--   
data Delete :: Nat -> NatMap v -> Exp (NatMap v) -- | Union -- --

Example

-- --
--   >>> :kind! Eval (Union (Eval (FromList '[ '(5,"a"), '(3,"b")])) (Eval (FromList '[ '(5,"A"), '(7,"c")])) )
--   Eval (Union (Eval (FromList '[ '(5,"a"), '(3,"b")])) (Eval (FromList '[ '(5,"A"), '(7,"c")])) ) :: NatMap 
--                                                                                                        Symbol
--   = 'NatMap '[ '(7, "c"), '(5, "a"), '(3, "b")]
--   
data Union :: NatMap v -> NatMap v -> Exp (NatMap v) -- | Difference -- --

Example

-- --
--   >>> :kind! Eval (Difference (Eval (FromList '[ '(3,"a"), '(5,"b")])) (Eval (FromList '[ '(5,"B"), '(7,"C")])))
--   Eval (Difference (Eval (FromList '[ '(3,"a"), '(5,"b")])) (Eval (FromList '[ '(5,"B"), '(7,"C")]))) :: NatMap 
--                                                                                                            Symbol
--   = 'NatMap '[ '(3, "a")]
--   
data Difference :: NatMap v -> NatMap v -> Exp (NatMap v) -- | Intersection -- --

Example

-- --
--   >>> :kind! Eval (Intersection (Eval (FromList '[ '(3,"a"), '(5,"b")])) (Eval (FromList '[ '(5,"B"), '(7,"C")])))
--   Eval (Intersection (Eval (FromList '[ '(3,"a"), '(5,"b")])) (Eval (FromList '[ '(5,"B"), '(7,"C")]))) :: NatMap 
--                                                                                                              Symbol
--   = 'NatMap '[ '(5, "b")]
--   
data Intersection :: NatMap v -> NatMap v -> Exp (NatMap v) -- | Adjust -- --

Example

-- --
--   >>> :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")]
--   
-- --
--   >>> :kind! Eval (Adjust (Append "new ") 7 =<< Empty)
--   Eval (Adjust (Append "new ") 7 =<< Empty) :: NatMap Symbol
--   = 'NatMap '[]
--   
data Adjust :: (v -> Exp v) -> Nat -> NatMap v -> Exp (NatMap v) -- | Map -- --

Example

-- --
--   >>> :kind! Eval (Fcf.Data.NatMap.Map (Append "x") =<< FromList '[ '(5,"a"), '(3,"b")])
--   Eval (Fcf.Data.NatMap.Map (Append "x") =<< FromList '[ '(5,"a"), '(3,"b")]) :: NatMap 
--                                                                                    Symbol
--   = 'NatMap '[ '(5, "xa"), '(3, "xb")]
--   
data Map :: (v -> Exp w) -> NatMap v -> Exp (NatMap w) -- | NatMapWithKey -- --

Example

data NatMapWithKey :: (Nat -> v -> Exp w) -> NatMap v -> Exp (NatMap w) -- | Foldr -- -- Fold the values in the map using the given right-associative binary -- operator, such that 'foldr f z == foldr f z . elems'. -- -- Note: the order of values in NatMap is not well defined at the moment. -- --

Example

-- --
--   >>> :kind! Eval (Fcf.Data.NatMap.Foldr (+) 0  =<< (FromList '[ '(1,1), '(2,2)]))
--   Eval (Fcf.Data.NatMap.Foldr (+) 0  =<< (FromList '[ '(1,1), '(2,2)])) :: Nat
--   = 3
--   
data Foldr :: (v -> w -> Exp w) -> w -> NatMap v -> Exp w -- | Filter -- --

Example

-- --
--   >>> :kind! Eval (Filter ((>=) 35) =<< FromList '[ '(5,50), '(3,30)])
--   Eval (Filter ((>=) 35) =<< FromList '[ '(5,50), '(3,30)]) :: NatMap 
--                                                                  Nat
--   = 'NatMap '[ '(3, 30)]
--   
data Filter :: (v -> Exp Bool) -> NatMap v -> Exp (NatMap v) -- | FilterWithKey -- --

Example

-- --
--   >>> :kind! Eval (FilterWithKey (>=) =<< FromList '[ '(3,5), '(6,4)])
--   Eval (FilterWithKey (>=) =<< FromList '[ '(3,5), '(6,4)]) :: NatMap
--                                                                  Nat
--   = 'NatMap '[ '(6, 4)]
--   
data FilterWithKey :: (Nat -> v -> Exp Bool) -> NatMap v -> Exp (NatMap v) -- | Partition -- --

Example

-- --
--   >>> :kind! Eval (Partition ((>=) 35) =<< FromList '[ '(5,50), '(3,30)])
--   Eval (Partition ((>=) 35) =<< FromList '[ '(5,50), '(3,30)]) :: (NatMap 
--                                                                      Nat, 
--                                                                    NatMap Nat)
--   = '( 'NatMap '[ '(3, 30)], 'NatMap '[ '(5, 50)])
--   
data Partition :: (v -> Exp Bool) -> NatMap v -> Exp (NatMap v, NatMap v) -- | Use FromList to construct a NatMap from type-level list. -- --

Example

-- --
--   >>> :kind! Eval (FromList '[ '(1,"haa"), '(2,"hoo")])
--   Eval (FromList '[ '(1,"haa"), '(2,"hoo")]) :: NatMap Symbol
--   = 'NatMap '[ '(1, "haa"), '(2, "hoo")]
--   
data FromList :: [(Nat, v)] -> Exp (NatMap v) -- | ToList -- --

Example

-- --
--   >>> :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)]
--   = '[]
--   
data ToList :: NatMap v -> Exp [(Nat, v)] -- |

Fcf.Data.Set

-- -- Set provides an interface which is similar to the that given by the -- containers-package. If a method is missing here that you need, please -- do open up an issue or better, make a PR. -- -- Many of the examples are from containers-package. The internal -- representation is based on lists. We hope that a more efficient one -- will be used one day. module Fcf.Data.Set -- | Set-definition. data Set a Set :: [a] -> Set a -- | Member -- --

Example

-- --
--   >>> :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
--   
data Member :: v -> Set v -> Exp Bool -- | NotMember -- --

Example

-- --
--   >>> :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
--   = 'True
--   
data NotMember :: v -> Set v -> Exp Bool -- | Null -- --

Example

-- --
--   >>> :kind! Eval (Null =<< FromList '[5, 3])
--   Eval (Null =<< FromList '[5, 3]) :: Bool
--   = 'False
--   
--   >>> :kind! Eval (Null =<< Empty)
--   Eval (Null =<< Empty) :: Bool
--   = 'True
--   
data Null :: Set v -> Exp Bool -- | Size -- --

Example

-- --
--   >>> :kind! Eval (Size =<< FromList '[5, 3])
--   Eval (Size =<< FromList '[5, 3]) :: Nat
--   = 2
--   
data Size :: Set v -> Exp Nat -- | IsSubsetOf -- --

Example

-- --
--   >>> :kind! Eval (IsSubsetOf ('Set '[]) ('Set '[0,1,2,3,4]))
--   Eval (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
--   = 'False
--   
data IsSubsetOf :: Set a -> Set a -> Exp Bool -- | IsProperSubsetOf -- --

Example

-- --
--   >>> :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
--   = 'True
--   
data IsProperSubsetOf :: Set a -> Set a -> Exp Bool -- | Empty -- --

Example

-- --
--   >>> :kind! (Eval Empty :: Set Nat)
--   (Eval Empty :: Set Nat) :: Set Nat
--   = 'Set '[]
--   
-- -- See also the other examples in this module. data Empty :: Exp (Set v) -- | Singleton -- --

Example

-- --
--   >>> :kind! Eval (Singleton 1)
--   Eval (Singleton 1) :: Set Nat
--   = 'Set '[1]
--   
data Singleton :: v -> Exp (Set v) -- | Insert -- --

Example

-- --
--   >>> :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]
--   
data Insert :: v -> Set v -> Exp (Set v) -- | Delete -- --

Example

-- --
--   >>> :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]
--   
data Delete :: v -> Set v -> Exp (Set v) -- | Calculate the power sets of a given type-level list. The algorithm is -- based on Gray codes. -- --

Example

-- --
--   >>> :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"],
--          '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 *)
--   = 'Set
--       '[ 'Set '[], 'Set '[Maybe Int], 'Set '[Char],
--          'Set '[Char, Maybe Int], 'Set '[Int], 'Set '[Int, Char],
--          'Set '[Int, Maybe Int], 'Set '[Int, Char, Maybe Int]]
--   
data PowerSet :: Set a -> Exp (Set (Set a)) -- | Type-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]
--   
data Union :: Set v -> Set v -> Exp (Set v) -- | Type-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]
--   
data Difference :: Set v -> Set v -> Exp (Set v) -- | Type-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]
--   
data Intersection :: Set v -> Set v -> Exp (Set v) -- | Use FromList to construct a Set from type-level list. -- --

Example

-- --
--   >>> :kind! Eval (FromList '[1, 2])
--   Eval (FromList '[1, 2]) :: Set Nat
--   = 'Set '[1, 2]
--   
data FromList :: [v] -> Exp (Set v) -- | Get the type-level list out of the Set. -- --

Example

-- --
--   >>> :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],
--        '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]]
--   
data ToList :: Set v -> Exp [v] -- |

Fcf.Data.Text.Internal

-- -- This is from https://kcsongor.github.io/symbol-parsing-haskell/ -- -- Please do also check the symbols library at Hackage. module Fcf.Data.Text.Internal type LookupTable = Tree (Symbol, Symbol) type family Head2 (sym :: Symbol) :: Symbol type family ToList (sym :: Symbol) :: [Symbol] data ToSymbol2 :: [Symbol] -> Exp Symbol data HeadA :: Symbol -> Exp Symbol data ToListA :: Symbol -> Exp [Symbol] data Uncons :: Symbol -> Exp (Maybe Symbol) -- | Helper, from symbols-package. type family Head1 (x :: Symbol) (o :: Ordering) :: Symbol -- | Helper, from symbols-package. type family ToList1 (x :: Symbol) (pfx :: Symbol) :: [Symbol] -- | Helper, from symbols-package. type family ToList2 (x :: Symbol) (pfx :: Symbol) (o :: Ordering) :: [Symbol] -- | Helper, from symbols-package. type family LookupA (x :: Symbol) (pfx :: Symbol) (xs :: Tree Symbol) :: Symbol -- | Helper, from symbols-package. type family Lookup2 (x :: Symbol) (pfx :: Symbol) (c :: Symbol) (o :: Ordering) (l :: Tree Symbol) (r :: Tree Symbol) :: Symbol -- | Helper, from symbols-package. (Generate the character tree.) chars :: Tree String -- | Helper, from symbols-package. The character tree that is needed for -- handling the initial character of a symbol. type Chars = 'Node ('Node ('Node ('Node ('Node ('Node ('Node ('Leaf "\NUL") "\SOH" ('Leaf "\SOH")) "\STX" ('Node ('Leaf "\STX") "\ETX" ('Leaf "\ETX"))) "\EOT" ('Node ('Node ('Leaf "\EOT") "\ENQ" ('Leaf "\ENQ")) "\ACK" ('Node ('Leaf "\ACK") "\a" ('Leaf "\a")))) "\b" ('Node ('Node ('Node ('Leaf "\b") "\t" ('Leaf "\t")) "\n" ('Node ('Leaf "\n") "\v" ('Leaf "\v"))) "\f" ('Node ('Node ('Leaf "\f") "\r" ('Leaf "\r")) "\SO" ('Node ('Leaf "\SO") "\SI" ('Leaf "\SI"))))) "\DLE" ('Node ('Node ('Node ('Node ('Leaf "\DLE") "\DC1" ('Leaf "\DC1")) "\DC2" ('Node ('Leaf "\DC2") "\DC3" ('Leaf "\DC3"))) "\DC4" ('Node ('Node ('Leaf "\DC4") "\NAK" ('Leaf "\NAK")) "\SYN" ('Node ('Leaf "\SYN") "\ETB" ('Leaf "\ETB")))) "\CAN" ('Node ('Node ('Node ('Leaf "\CAN") "\EM" ('Leaf "\EM")) "\SUB" ('Node ('Leaf "\SUB") "\ESC" ('Leaf "\ESC"))) "\FS" ('Node ('Node ('Leaf "\FS") "\GS" ('Leaf "\GS")) "\RS" ('Node ('Leaf "\RS") "\US" ('Leaf "\US")))))) " " ('Node ('Node ('Node ('Node ('Node ('Leaf " ") "!" ('Leaf "!")) "\"" ('Node ('Leaf "\"") "#" ('Leaf "#"))) "$" ('Node ('Node ('Leaf "$") "%" ('Leaf "%")) "&" ('Node ('Leaf "&") "'" ('Leaf "'")))) "(" ('Node ('Node ('Node ('Leaf "(") ")" ('Leaf ")")) "*" ('Node ('Leaf "*") "+" ('Leaf "+"))) "," ('Node ('Node ('Leaf ",") "-" ('Leaf "-")) "." ('Node ('Leaf ".") "/" ('Leaf "/"))))) "0" ('Node ('Node ('Node ('Node ('Leaf "0") "1" ('Leaf "1")) "2" ('Node ('Leaf "2") "3" ('Leaf "3"))) "4" ('Node ('Node ('Leaf "4") "5" ('Leaf "5")) "6" ('Node ('Leaf "6") "7" ('Leaf "7")))) "8" ('Node ('Node ('Node ('Leaf "8") "9" ('Leaf "9")) ":" ('Node ('Leaf ":") ";" ('Leaf ";"))) "<" ('Node ('Node ('Leaf "<") "=" ('Leaf "=")) ">" ('Node ('Leaf ">") "?" ('Leaf "?"))))))) "@" ('Node ('Node ('Node ('Node ('Node ('Node ('Leaf "@") "A" ('Leaf "A")) "B" ('Node ('Leaf "B") "C" ('Leaf "C"))) "D" ('Node ('Node ('Leaf "D") "E" ('Leaf "E")) "F" ('Node ('Leaf "F") "G" ('Leaf "G")))) "H" ('Node ('Node ('Node ('Leaf "H") "I" ('Leaf "I")) "J" ('Node ('Leaf "J") "K" ('Leaf "K"))) "L" ('Node ('Node ('Leaf "L") "M" ('Leaf "M")) "N" ('Node ('Leaf "N") "O" ('Leaf "O"))))) "P" ('Node ('Node ('Node ('Node ('Leaf "P") "Q" ('Leaf "Q")) "R" ('Node ('Leaf "R") "S" ('Leaf "S"))) "T" ('Node ('Node ('Leaf "T") "U" ('Leaf "U")) "V" ('Node ('Leaf "V") "W" ('Leaf "W")))) "X" ('Node ('Node ('Node ('Leaf "X") "Y" ('Leaf "Y")) "Z" ('Node ('Leaf "Z") "[" ('Leaf "["))) "\\" ('Node ('Node ('Leaf "\\") "]" ('Leaf "]")) "^" ('Node ('Leaf "^") "_" ('Leaf "_")))))) "`" ('Node ('Node ('Node ('Node ('Node ('Leaf "`") "a" ('Leaf "a")) "b" ('Node ('Leaf "b") "c" ('Leaf "c"))) "d" ('Node ('Node ('Leaf "d") "e" ('Leaf "e")) "f" ('Node ('Leaf "f") "g" ('Leaf "g")))) "h" ('Node ('Node ('Node ('Leaf "h") "i" ('Leaf "i")) "j" ('Node ('Leaf "j") "k" ('Leaf "k"))) "l" ('Node ('Node ('Leaf "l") "m" ('Leaf "m")) "n" ('Node ('Leaf "n") "o" ('Leaf "o"))))) "p" ('Node ('Node ('Node ('Node ('Leaf "p") "q" ('Leaf "q")) "r" ('Node ('Leaf "r") "s" ('Leaf "s"))) "t" ('Node ('Node ('Leaf "t") "u" ('Leaf "u")) "v" ('Node ('Leaf "v") "w" ('Leaf "w")))) "x" ('Node ('Node ('Node ('Leaf "x") "y" ('Leaf "y")) "z" ('Node ('Leaf "z") "{" ('Leaf "{"))) "|" ('Node ('Node ('Leaf "|") "}" ('Leaf "}")) "~" ('Node ('Leaf "~") "\DEL" ('Leaf "\DEL"))))))) -- |

Fcf.Data.Text

-- -- We mimick Data.Text but on type level. The internal representation is -- based on type level lists. module Fcf.Data.Text -- | Text is a data structure, that is, a list to hold type-level -- symbols of length one. data Text Text :: Symbol -> Text -- | Empty -- --

Example

-- --
--   >>> :kind! (Eval Empty :: Text)
--   (Eval Empty :: Text) :: Text
--   = 'Text ""
--   
-- -- See also the other examples in this module. data Empty :: Exp Text -- | Singleton -- --

Example

-- --
--   >>> :kind! Eval (Singleton "a")
--   Eval (Singleton "a") :: Text
--   = 'Text "a"
--   
data Singleton :: Symbol -> Exp Text data FromList :: [Text] -> Exp Text -- | Use 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" data FromSymbolList :: [Symbol] -> Exp Text -- | Split Text to single character Text list. -- --

Example

-- --
--   >>> :kind! Eval (ToList =<< FromSymbolList '["a", "b"])
--   Eval (ToList =<< FromSymbolList '["a", "b"]) :: [Text]
--   = '[ 'Text "a", 'Text "b"]
--   
data ToList :: Text -> Exp [Text] -- | ToSymbol -- --

Example

-- --
--   >>> :kind! Eval (ToSymbol =<< FromSymbolList '["w", "o", "r", "d"])
--   Eval (ToSymbol =<< FromSymbolList '["w", "o", "r", "d"]) :: Symbol
--   = "word"
--   
data ToSymbol :: Text -> Exp Symbol -- | Get the type-level list out of the Text. -- --

Example

-- --
--   >>> :kind! Eval (ToSymbolList =<< FromSymbolList '["a", "b"])
--   Eval (ToSymbolList =<< FromSymbolList '["a", "b"]) :: [Symbol]
--   = '["a", "b"]
--   
data ToSymbolList :: Text -> Exp [Symbol] -- | Null -- --

Example

-- --
--   >>> :kind! Eval (Null ('Text "ab"))
--   Eval (Null ('Text "ab")) :: Bool
--   = 'False
--   
-- --
--   >>> :kind! Eval (Null =<< Empty)
--   Eval (Null =<< Empty) :: Bool
--   = 'True
--   
data Null :: Text -> Exp Bool -- | Length -- --

Example

-- --
--   >>> :kind! Eval (Length =<< Singleton "ab")
--   Eval (Length =<< Singleton "ab") :: Nat
--   = 2
--   
data Length :: Text -> Exp Nat -- | Append two type-level texts. -- --

Example

-- --
--   >>> :kind! Eval (Append ('Text "aa") ('Text "mu"))
--   Eval (Append ('Text "aa") ('Text "mu")) :: Text
--   = 'Text "aamu"
--   
data Append :: Text -> Text -> Exp Text -- | Add 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"
--   
data Cons :: Symbol -> Text -> Exp Text -- | 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"
--   
data Snoc :: Text -> Symbol -> Exp Text -- | Get the first symbol from type-level text. -- --

Example

-- --
--   >>> :kind! Eval (Uncons ('Text "haamu"))
--   Eval (Uncons ('Text "haamu")) :: Maybe (Symbol, Text)
--   = 'Just '("h", 'Text "aamu")
--   
-- --
--   >>> :kind! Eval (Uncons ('Text ""))
--   Eval (Uncons ('Text "")) :: Maybe (Symbol, Text)
--   = 'Nothing
--   
data Uncons :: Text -> Exp (Maybe (Symbol, Text)) -- | Get the last symbol from type-level text. -- --

Example

-- --
--   >>> :kind! Eval (Unsnoc ('Text "aamun"))
--   Eval (Unsnoc ('Text "aamun")) :: Maybe (Symbol, Text)
--   = 'Just '("n", 'Text "aamu")
--   
-- --
--   >>> :kind! Eval (Unsnoc ('Text ""))
--   Eval (Unsnoc ('Text "")) :: Maybe (Symbol, Text)
--   = 'Nothing
--   
data Unsnoc :: Text -> Exp (Maybe (Symbol, Text)) -- | 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
--   = 'Nothing
--   
data Head :: Text -> Exp (Maybe Symbol) -- | 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
--   = 'Nothing
--   
data Tail :: Text -> Exp (Maybe Text) -- | Take 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
--   = 'Nothing
--   
data Init :: Text -> Exp (Maybe Text) -- | Compare the length of type-level text to given Nat and give the -- Ordering. -- --

Example

-- --
--   >>> :kind! Eval (CompareLength ('Text "aamu") 3)
--   Eval (CompareLength ('Text "aamu") 3) :: Ordering
--   = 'GT
--   
data CompareLength :: Text -> Nat -> Exp Ordering -- | FMap for type-level text. -- --

Example

-- --
--   >>> :{
--   data IsIsymb :: Symbol -> Exp Bool
--   type 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"
--   
data FMap :: (Symbol -> Exp Symbol) -> Text -> Exp Text -- | 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"
--   
data Intercalate :: Text -> [Text] -> Exp Text -- | Intersperse for type-level text. -- --

Example

-- --
--   >>> :kind! Eval (Intersperse "." ('Text "aamu"))
--   Eval (Intersperse "." ('Text "aamu")) :: Text
--   = 'Text "a.a.m.u"
--   
data Intersperse :: Symbol -> Text -> Exp Text -- | Reverse for type-level text. -- --

Example

-- --
--   >>> :kind! Eval (Reverse ('Text "aamu"))
--   Eval (Reverse ('Text "aamu")) :: Text
--   = 'Text "umaa"
--   
-- --
--   >>> :kind! Eval (Reverse =<< Reverse ('Text "aamu"))
--   Eval (Reverse =<< Reverse ('Text "aamu")) :: Text
--   = 'Text "aamu"
--   
data Reverse :: Text -> Exp Text -- | Replace 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"
--   
data Replace :: Text -> Text -> Text -> Exp Text -- | Concat for type-level text. -- --

Example

-- --
--   >>> :kind! Eval (Concat '[ 'Text "la", 'Text "kana"])
--   Eval (Concat '[ 'Text "la", 'Text "kana"]) :: Text
--   = 'Text "lakana"
--   
data Concat :: [Text] -> Exp Text -- | FConcatMap for type-level text. -- --

Example

-- --
--   >>> :{
--   data IsIsymb :: Symbol -> Exp Bool
--   type 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))
--       )
--   :}
--   
-- --
--   >>> :kind! Eval (FConcatMap Isymb2aa ('Text "imu ih"))
--   Eval (FConcatMap Isymb2aa ('Text "imu ih")) :: Text
--   = 'Text "aamu aah"
--   
data FConcatMap :: (Symbol -> Exp Text) -> Text -> Exp Text -- | Any 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
--   = 'False
--   
data Any :: (Symbol -> Exp Bool) -> Text -> Exp Bool -- | All 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
--   = 'True
--   
data All :: (Symbol -> Exp Bool) -> Text -> Exp Bool -- | Take for type-level text. -- --

Example

-- --
--   >>> :kind! Eval (Take 4 ('Text "aamun"))
--   Eval (Take 4 ('Text "aamun")) :: Text
--   = 'Text "aamu"
--   
data Take :: Nat -> Text -> Exp Text -- | TakeEnd for type-level text. -- --

Example

-- --
--   >>> :kind! Eval (TakeEnd 4 ('Text "haamu"))
--   Eval (TakeEnd 4 ('Text "haamu")) :: Text
--   = 'Text "aamu"
--   
data TakeEnd :: Nat -> Text -> Exp Text -- | Drop for type-level text. -- --

Example

-- --
--   >>> :kind! Eval (Drop 2 ('Text "aamuna"))
--   Eval (Drop 2 ('Text "aamuna")) :: Text
--   = 'Text "muna"
--   
data Drop :: Nat -> Text -> Exp Text -- | DropEnd for type-level text. -- --

Example

-- --
--   >>> :kind! Eval (DropEnd 2 ('Text "aamuna"))
--   Eval (DropEnd 2 ('Text "aamuna")) :: Text
--   = 'Text "aamu"
--   
data DropEnd :: Nat -> Text -> Exp Text -- | TakeWhile for type-level text. -- --

Example

-- --
--   >>> :kind! Eval (TakeWhile (Not <=< S.IsDigit) ('Text "aamu12"))
--   Eval (TakeWhile (Not <=< S.IsDigit) ('Text "aamu12")) :: Text
--   = 'Text "aamu"
--   
data TakeWhile :: (Symbol -> Exp Bool) -> Text -> Exp Text -- | TakeWhileEnd for type-level text. -- --

Example

-- --
--   >>> :kind! Eval (TakeWhileEnd (Not <=< S.IsDigit) ('Text "12aamu"))
--   Eval (TakeWhileEnd (Not <=< S.IsDigit) ('Text "12aamu")) :: Text
--   = 'Text "aamu"
--   
data TakeWhileEnd :: (Symbol -> Exp Bool) -> Text -> Exp Text -- | DropWhile for type-level text. -- --

Example

-- --
--   >>> :kind! Eval (DropWhile S.IsDigit ('Text "12aamu"))
--   Eval (DropWhile S.IsDigit ('Text "12aamu")) :: Text
--   = 'Text "aamu"
--   
data DropWhile :: (Symbol -> Exp Bool) -> Text -> Exp Text -- | DropWhileEnd for type-level text. === Example -- --
--   >>> :kind! Eval (DropWhileEnd S.IsDigit ('Text "aamu12"))
--   Eval (DropWhileEnd S.IsDigit ('Text "aamu12")) :: Text
--   = 'Text "aamu"
--   
data DropWhileEnd :: (Symbol -> Exp Bool) -> Text -> Exp Text -- | DropAround for type-level text. -- --

Example

-- --
--   >>> :kind! Eval (DropAround S.IsDigit ('Text "34aamu12"))
--   Eval (DropAround S.IsDigit ('Text "34aamu12")) :: Text
--   = 'Text "aamu"
--   
data DropAround :: (Symbol -> Exp Bool) -> Text -> Exp Text -- | Strip 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"
--   
data Strip :: Text -> Exp Text -- | SplitOn for type-level text. -- --

Example

-- --
--   >>> :kind! Eval (SplitOn ('Text "ab") ('Text "cdabfgabh"))
--   Eval (SplitOn ('Text "ab") ('Text "cdabfgabh")) :: [Text]
--   = '[ 'Text "cd", 'Text "fg", 'Text "h"]
--   
data SplitOn :: Text -> Text -> Exp [Text] -- | Split 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"]
--   
data Split :: (Symbol -> Exp Bool) -> Text -> Exp [Text] -- | Lines for type-level text. -- --

Example

-- --
--   >>> :kind! Eval (Lines =<< Singleton "ok\nhmm\nab")
--   Eval (Lines =<< Singleton "ok\nhmm\nab") :: [Text]
--   = '[ 'Text "ok", 'Text "hmm", 'Text "ab"]
--   
data Lines :: Text -> Exp [Text] -- | Words for type-level text. -- --

Example

-- --
--   >>> :kind! Eval (Words =<< Singleton "ok hmm\nab")
--   Eval (Words =<< Singleton "ok hmm\nab") :: [Text]
--   = '[ 'Text "ok", 'Text "hmm", 'Text "ab"]
--   
data Words :: Text -> Exp [Text] -- | Unlines 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"
--   
data Unlines :: [Text] -> Exp Text -- | Unwords for type-level text. This uses Intercalate to add -- space-symbol between the given texts. -- --

Example

-- --
--   >>> :kind! Eval (Unwords '[ 'Text "ok", 'Text "hmm", 'Text "ab"])
--   Eval (Unwords '[ 'Text "ok", 'Text "hmm", 'Text "ab"]) :: Text
--   = 'Text "ok hmm ab"
--   
data Unwords :: [Text] -> Exp Text -- | IsPrefixOf for type-level text. -- --

Example

-- --
--   >>> :kind! Eval (IsPrefixOf ('Text "aa") ('Text "aamiainen"))
--   Eval (IsPrefixOf ('Text "aa") ('Text "aamiainen")) :: Bool
--   = 'True
--   
data IsPrefixOf :: Text -> Text -> Exp Bool -- | IsSuffixOf for type-level text. -- --

Example

-- --
--   >>> :kind! Eval (IsSuffixOf ('Text "nen") ('Text "aamiainen"))
--   Eval (IsSuffixOf ('Text "nen") ('Text "aamiainen")) :: Bool
--   = 'True
--   
data IsSuffixOf :: Text -> Text -> Exp Bool -- | IsInfixOf for type-level text. -- --

Example

-- --
--   >>> :kind! Eval (IsInfixOf ('Text "mia") ('Text "aamiainen"))
--   Eval (IsInfixOf ('Text "mia") ('Text "aamiainen")) :: Bool
--   = 'True
--   
data IsInfixOf :: Text -> Text -> Exp Bool -- |

Fcf.Data.Tree

-- -- Tree provides an interface which is similar to the that given by the -- container-package. If a method is missing here that you need, please -- do open up an issue or better, make a PR. -- -- This module provides it's own but (almost) identical definitions of -- Tree and Forest. The reason for not using the definitions given in the -- containers is that since nothing else is needed from containers, we -- are able to have less dependencies. -- -- Many of the examples are from containers-package. module Fcf.Data.Tree -- | Same as in containers, except not used for any term-level computation -- in this module. data Tree a Node :: a -> [Tree a] -> Tree a -- | Same as in containers, except not used for any term-level computation -- in this module. type Forest a = [Tree a] type ExT1r = 'Node 1 '[ 'Node 2 '[ 'Node 3 '[ 'Node 4 '[]]], 'Node 5 '[ 'Node 6 '[]]] type ExTr2 = 'Node ('Just 1) '[ 'Node ('Just 2) '[ 'Node ('Just 3) '[ 'Node ('Just 4) '[]]], 'Node ('Just 5) '[ 'Node ('Just 6) '[]]] data StarTx :: Tree a -> Tree (a -> Exp b) -> Exp (Tree b) -- | Fold a type-level Tree. data FoldTree :: (a -> [b] -> Exp b) -> Tree a -> Exp b -- | Unfold for a Tree. -- --

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 '[]]]
--   
data UnfoldTree :: (b -> Exp (a, [b])) -> b -> Exp (Tree a) -- | Unfold for a Forest. data UnfoldForest :: (b -> Exp (a, [b])) -> [b] -> Exp (Forest a) -- | Flatten a Tree. -- --

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]
--   
data Flatten :: Tree a -> Exp [a] -- | Get the root node from a Tree. data GetRoot :: Tree a -> Exp a -- | Get the forest from a Tree. data GetForest :: Tree a -> Exp [Tree a] -- | Get the root nodes from a list of Trees. data GetRoots :: [Tree a] -> Exp [a] -- | Get the forests from a list of Trees. data GetForests :: [Tree a] -> Exp [Tree a] data SubFLevels :: [Tree a] -> Exp (Maybe ([a], [Tree a])) -- | Get the levels from a Tree. -- --

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]]
--   
data Levels :: Tree a -> Exp [[a]] -- |

Fcf.Alg.Tree

-- -- Type-level TreeF and BTreeF to be used with Cata, Ana -- and Hylo. This also provides some algorithms: general purpose sorting -- with Qsort, Size of an Tree, Fibonaccis. module Fcf.Alg.Tree -- | TreeF is functor for Trees. TreeF has -- Map-instance (on structure). data TreeF a b NodeF :: a -> [b] -> TreeF a b -- | A function to transform a Tree into fixed structure that can be used -- by Cata and Ana. -- -- See the implementation of Size for an example. data TreeToFix :: Tree a -> Exp (Fix (TreeF a)) -- | Sum the nodes of TreeF containing Nats. -- -- See the implementation of Fib for an example. data SumNodesAlg :: Algebra (TreeF Nat) Nat -- | Count the nodes of TreeF. -- -- See the Size for an example. data CountNodesAlg :: Algebra (TreeF a) Nat -- | Size of the Tree is the number of nodes in it. -- -- Example -- -- Size 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, '[])
--             '(x, '[ 2 TL.* x, (2 TL.* x) TL.+ 1 ])
--   :}
--   
-- --
--   >>> :kind! Eval (Size =<< UnfoldTree BuildNode 1)
--   Eval (Size =<< UnfoldTree BuildNode 1) :: Nat
--   = 7
--   
data Size :: Tree a -> Exp Nat -- | CoAlgebra to build TreeF's. This is an example from -- containers-package. See Size and example in there. -- -- :kind! Eval (Ana BuildNodeCoA 1) :kind! Eval (Hylo CountNodesAlg -- BuildNodeCoA 1) data BuildNodeCoA :: CoAlgebra (TreeF Nat) Nat -- | CoAlgebra for the Fib-function. data BuildFibTreeCoA :: CoAlgebra (TreeF Nat) Nat -- | Fibonaccis with Hylo, not efficient -- -- Example -- --
--   >>> :kind! Eval (FibHylo 10)
--   Eval (FibHylo 10) :: Nat
--   = 55
--   
data FibHylo :: Nat -> Exp Nat -- | BTreeF is a btree functor. At the moment, it is used to build sorting -- algorithms. data BTreeF a b BEmptyF :: BTreeF a b BNodeF :: a -> b -> b -> BTreeF a b -- | A kind of foldable sum class. Pun may or may not be intended. data FSum :: f a -> Exp a data Sizes :: Fix f -> Exp (Ann f Nat) -- | A 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. data NatF r Succ :: r -> NatF r Zero :: NatF r -- | We want to be able to build NatF Fix-structures out of Nat's. data NatToFix :: Nat -> Exp (Fix NatF) data RecNTF :: Nat -> Exp (Fix NatF) -- | Efficient Fibonacci algebra from Recursion Schemes by example, Tim -- Williams. data FibAlgebra :: NatF (Ann NatF Nat) -> Exp Nat -- | Efficient Fibonacci type-level function (from Recursion Schemes by -- example, Tim Williams). Compare this to FibHylo. -- -- Example -- --
--   >>> :kind! Eval (FibHisto 100)
--   Eval (FibHisto 100) :: Nat
--   = 354224848179261915075
--   
data FibHisto :: Nat -> Exp Nat -- |

Fcf.Alg.Sort

module Fcf.Alg.Sort data ListCmpFnd :: [Ordering] -> Exp Ordering -- | Compare lists with the given comparison for the elements. data ListCmp :: (a -> a -> Exp Ordering) -> [a] -> [a] -> Exp Ordering -- | Give true if the first list is before the second, given the comparison -- function for the elements. data ListOrd :: (a -> a -> Exp Ordering) -> [a] -> [a] -> Exp Bool -- | Comparison for the Nats. -- -- TODO: Would this fit to Fcf.Data.Nat on first-class-families? data NatOrd :: Nat -> Nat -> Exp Ordering -- | Comparison for Symbol lists. -- -- Useful when sorting with Qsort. data SymbolListOrd :: [Symbol] -> [Symbol] -> Exp Bool -- | Comparison for Nat lists. -- -- Useful when sorting with Qsort. data NatListOrd :: [Nat] -> [Nat] -> Exp Bool data PartHlp :: (a -> a -> Exp Bool) -> CoAlgebra (BTreeF a) [a] data Inord :: Algebra (BTreeF a) [a] -- | 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]
--   
-- --
--   >>> :kind! Eval (Qsort (S.<) '[ "bb", "e", "a", "e", "d" ])
--   Eval (Qsort (S.<) '[ "bb", "e", "a", "e", "d" ]) :: [Symbol]
--   = '["a", "bb", "d", "e", "e"]
--   
data Qsort :: (a -> a -> Exp Bool) -> [a] -> Exp [a] data PartCmp :: (a -> a -> Exp Bool) -> CoAlgebra (BTreeF a) [a]