ftree-0.1.5: Depth-typed functor-based trees, both top-down and bottom-up

Data.FTree.BottomUp

Description

Top-down, depth-typed functor trees. In other words, right-associated n-ary functor composition. See http://conal.net/blog/posts/a-trie-for-length-typed-vectors/.

Synopsis
• data T :: (* -> *) -> * -> * -> * where
• type (:^) = T
• unL :: (f :^ Z) a -> a
• unB :: (f :^ S n) a -> (f :^ n) (f a)
• foldT :: forall f n a z. Functor f => (a -> z) -> (f a -> a) -> (f :^ n) a -> z
• inT :: (a -> b) -> (forall n. IsNat n => (f :^ n) (f a) -> (f :^ n) (f b)) -> forall n. (f :^ n) a -> (f :^ n) b
• inT2 :: (a -> b -> c) -> (forall n. IsNat n => (f :^ n) (f a) -> (f :^ n) (f b) -> (f :^ n) (f c)) -> forall n. (f :^ n) a -> (f :^ n) b -> (f :^ n) c
• inL :: (a -> b) -> (f :^ Z) a -> (f :^ Z) b
• inB :: ((f :^ n) (f a) -> (f :^ n) (f b)) -> (f :^ S n) a -> (f :^ S n) b
• inL2 :: (a -> b -> c) -> (f :^ Z) a -> (f :^ Z) b -> (f :^ Z) c
• inB2 :: ((f :^ n) (f a) -> (f :^ n) (f b) -> (f :^ n) (f c)) -> (f :^ S n) a -> (f :^ S n) b -> (f :^ S n) c

# Documentation

data T :: (* -> *) -> * -> * -> * where Source #

Constructors

 L :: a -> T f Z a B :: IsNat n => T f n (f a) -> T f (S n) a
Instances
 Functor f => Functor (f :^ n) Source # Instance detailsDefined in Data.FTree.BottomUp Methodsfmap :: (a -> b) -> (f :^ n) a -> (f :^ n) b #(<\$) :: a -> (f :^ n) b -> (f :^ n) a # (IsNat n, Applicative f) => Applicative (f :^ n) Source # Instance detailsDefined in Data.FTree.BottomUp Methodspure :: a -> (f :^ n) a #(<*>) :: (f :^ n) (a -> b) -> (f :^ n) a -> (f :^ n) b #liftA2 :: (a -> b -> c) -> (f :^ n) a -> (f :^ n) b -> (f :^ n) c #(*>) :: (f :^ n) a -> (f :^ n) b -> (f :^ n) b #(<*) :: (f :^ n) a -> (f :^ n) b -> (f :^ n) a # (Functor f, Foldable f) => Foldable (f :^ n) Source # Instance detailsDefined in Data.FTree.BottomUp Methodsfold :: Monoid m => (f :^ n) m -> m #foldMap :: Monoid m => (a -> m) -> (f :^ n) a -> m #foldr :: (a -> b -> b) -> b -> (f :^ n) a -> b #foldr' :: (a -> b -> b) -> b -> (f :^ n) a -> b #foldl :: (b -> a -> b) -> b -> (f :^ n) a -> b #foldl' :: (b -> a -> b) -> b -> (f :^ n) a -> b #foldr1 :: (a -> a -> a) -> (f :^ n) a -> a #foldl1 :: (a -> a -> a) -> (f :^ n) a -> a #toList :: (f :^ n) a -> [a] #null :: (f :^ n) a -> Bool #length :: (f :^ n) a -> Int #elem :: Eq a => a -> (f :^ n) a -> Bool #maximum :: Ord a => (f :^ n) a -> a #minimum :: Ord a => (f :^ n) a -> a #sum :: Num a => (f :^ n) a -> a #product :: Num a => (f :^ n) a -> a # Traversable f => Traversable (f :^ n) Source # Instance detailsDefined in Data.FTree.BottomUp Methodstraverse :: Applicative f0 => (a -> f0 b) -> (f :^ n) a -> f0 ((f :^ n) b) #sequenceA :: Applicative f0 => (f :^ n) (f0 a) -> f0 ((f :^ n) a) #mapM :: Monad m => (a -> m b) -> (f :^ n) a -> m ((f :^ n) b) #sequence :: Monad m => (f :^ n) (m a) -> m ((f :^ n) a) # (Functor f, ShowF f) => ShowF (f :^ n) Source # Instance detailsDefined in Data.FTree.BottomUp MethodsshowF :: Show a => (f :^ n) a -> String #showsPrecF :: Show a => Int -> (f :^ n) a -> ShowS # (Foldable f, Applicative f, IsNat n, Eq a) => Eq ((f :^ n) a) Source # Instance detailsDefined in Data.FTree.BottomUp Methods(==) :: (f :^ n) a -> (f :^ n) a -> Bool #(/=) :: (f :^ n) a -> (f :^ n) a -> Bool # (Foldable f, Applicative f, IsNat n, Ord a) => Ord ((f :^ n) a) Source # Instance detailsDefined in Data.FTree.BottomUp Methodscompare :: (f :^ n) a -> (f :^ n) a -> Ordering #(<) :: (f :^ n) a -> (f :^ n) a -> Bool #(<=) :: (f :^ n) a -> (f :^ n) a -> Bool #(>) :: (f :^ n) a -> (f :^ n) a -> Bool #(>=) :: (f :^ n) a -> (f :^ n) a -> Bool #max :: (f :^ n) a -> (f :^ n) a -> (f :^ n) a #min :: (f :^ n) a -> (f :^ n) a -> (f :^ n) a # (Functor f, ShowF f, Show a) => Show ((f :^ n) a) Source # Instance detailsDefined in Data.FTree.BottomUp MethodsshowsPrec :: Int -> (f :^ n) a -> ShowS #show :: (f :^ n) a -> String #showList :: [(f :^ n) a] -> ShowS # (IsNat n, Applicative f, Semigroup m) => Semigroup ((f :^ n) m) Source # Instance detailsDefined in Data.FTree.BottomUp Methods(<>) :: (f :^ n) m -> (f :^ n) m -> (f :^ n) m #sconcat :: NonEmpty ((f :^ n) m) -> (f :^ n) m #stimes :: Integral b => b -> (f :^ n) m -> (f :^ n) m # (IsNat n, Applicative f, Monoid m) => Monoid ((f :^ n) m) Source # Instance detailsDefined in Data.FTree.BottomUp Methodsmempty :: (f :^ n) m #mappend :: (f :^ n) m -> (f :^ n) m -> (f :^ n) m #mconcat :: [(f :^ n) m] -> (f :^ n) m #

type (:^) = T Source #

unL :: (f :^ Z) a -> a Source #

unB :: (f :^ S n) a -> (f :^ n) (f a) Source #

foldT :: forall f n a z. Functor f => (a -> z) -> (f a -> a) -> (f :^ n) a -> z Source #

inT :: (a -> b) -> (forall n. IsNat n => (f :^ n) (f a) -> (f :^ n) (f b)) -> forall n. (f :^ n) a -> (f :^ n) b Source #

Operate inside the representation of f :^ n to make another, preserving depth.

inT2 :: (a -> b -> c) -> (forall n. IsNat n => (f :^ n) (f a) -> (f :^ n) (f b) -> (f :^ n) (f c)) -> forall n. (f :^ n) a -> (f :^ n) b -> (f :^ n) c Source #

Operate inside the representation of two f :^ n to make another, preserving depth.

inL :: (a -> b) -> (f :^ Z) a -> (f :^ Z) b Source #

inB :: ((f :^ n) (f a) -> (f :^ n) (f b)) -> (f :^ S n) a -> (f :^ S n) b Source #

inL2 :: (a -> b -> c) -> (f :^ Z) a -> (f :^ Z) b -> (f :^ Z) c Source #

inB2 :: ((f :^ n) (f a) -> (f :^ n) (f b) -> (f :^ n) (f c)) -> (f :^ S n) a -> (f :^ S n) b -> (f :^ S n) c Source #