-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | rose trees -- -- Rose Trees are trees with an unbounded number of branches per -- node. Each node contains a value and zero or more subtrees. @package rose @version 0.1 -- | Rose Trees are trees with an unbounded number of branches per -- node. Each node contains a value and zero or more subtrees. module Rose -- | A Rose tree. This type can be produced and consumed using the -- Rose pattern. data Rose a pattern Rose :: a -> [Rose a] -> Rose a -- | Generate a singleton rose tree. It has no leaves and one shoot. -- --
-- >>> singleton @Int 3 -- Rose 3 [] --singleton :: a -> Rose a -- | Use coiteration to generate a rose tree from a seed. -- -- The coiteration terminates when the generating function returns an -- empty list: -- --
-- >>> 'coiter' (\i -> if i > 3 then [] else [i + 1]) 0 -- Rose 0 [Rose 1 [Rose 2 [Rose 3 [Rose 4 []]]]] ---- -- An infinite, lazy generator for the fibonacci sequence: -- --
-- >>> take 10 $ map fst $ 'Data.Foldable.toList' $ 'coiter' (\(a, b) -> [(b, a + b)]) (0, 1) --coiter :: (a -> [a]) -> a -> Rose a -- | Like coiter for comonadic values. coiterW :: Comonad w => (w a -> [w a]) -> w a -> Rose a -- | Unfold a rose tree from a seed. unfold :: (b -> (a, [b])) -> b -> Rose a -- | Unfold a rose tree from a seed, monadically. unfoldM :: Monad m => (b -> m (a, [b])) -> b -> m (Rose a) -- | Construct an Lens into a rose tree given a list of lenses -- into the base functor. -- -- When the input list is empty, this is equivalent to _extract. -- When the input list is non-empty, this composes the input lenses with -- _unwrap to walk through the rose tree before using -- _extract to get the element at the final location. -- -- For more on lenses see the lens package on hackage. -- --
-- telescoped :: [Lens' [Rose a] (Rose a)] -> Lens' (Rose a) a ---- --
-- telescoped :: [Traversal' [Rose a] (Rose a)] -> Traversal' (Rose a) a ---- --
-- telescoped :: [Getter [Rose a] (Rose a)] -> Getter (Rose a) a ---- --
-- telescoped :: [Fold [Rose a] (Rose a)] -> Fold (Rose a) a ---- --
-- telescoped :: [Setter' [Rose a] (Rose a)] -> Setter' (Rose a) a --telescoped :: Functor f => [(Rose a -> f (Rose a)) -> [Rose a] -> f [Rose a]] -> (a -> f a) -> Rose a -> f (Rose a) -- | Construct an Lens into a rose tree given a list of lenses -- into the base functor. -- -- The only difference between this and telescoped is that -- telescoped focuses on a single value, but this focuses on the -- entire remaining subtree. When the input list is empty, this is -- equivalent to id. When the input list is non-empty, this -- composes the input lenses with _unwrap to walk through the rose -- tree. -- -- For more on lenses see the lens package on hackage. -- --
-- telescoped :: [Lens' [Rose a] (Rose a)] -> Lens' (Rose a) (Rose a) ---- --
-- telescoped :: [Traversal' [Rose a] (Rose a)] -> Traversal' (Rose a) (Rose a) ---- --
-- telescoped :: [Getter [Rose a] (Rose a)] -> Getter (Rose a) (Rose a) ---- --
-- telescoped :: [Fold [Rose a] (Rose a)] -> Fold (Rose a) (Rose a) ---- --
-- telescoped :: [Setter' [Rose a] (Rose a)] -> Setter' (Rose a) (Rose a) --telescoped_ :: Functor f => [(Rose a -> f (Rose a)) -> [Rose a] -> f [Rose a]] -> (Rose a -> f (Rose a)) -> Rose a -> f (Rose a) -- | A Traversal' that gives access to all non-leaf elements of a -- rose tree, where non-leaf is defined as x from Rose x -- xs where null xs is False. -- -- Because this doesn't give access to all values in the rose tree, it -- cannot be used to change types (use traverse for that). shoots :: Applicative f => (a -> f a) -> Rose a -> f (Rose a) -- | A Traversal' that gives access to all leaf elements of a rose -- tree, where leaf is defined as x from Rose x xs -- where null xs is True. -- -- Because this doesn't give access to all values in the rose tree, it -- cannot be used to change types (use traverse for that). leaves :: Applicative f => (a -> f a) -> Rose a -> f (Rose a) instance Data.Functor.Classes.Ord1 Rose.Rose instance GHC.Classes.Ord a => GHC.Classes.Ord (Rose.Rose a) instance Control.Monad.Zip.MonadZip Rose.Rose instance GHC.Base.Monad Rose.Rose instance GHC.Base.Functor Rose.Rose instance Data.Foldable.Foldable Rose.Rose instance Data.Functor.Classes.Eq1 Rose.Rose instance GHC.Classes.Eq a => GHC.Classes.Eq (Rose.Rose a) instance Control.Comonad.Cofree.Class.ComonadCofree [] Rose.Rose instance GHC.Base.Applicative Rose.Rose instance GHC.Generics.Generic1 Rose.Rose instance GHC.Generics.Generic (Rose.Rose a) instance GHC.Show.Show a => GHC.Show.Show (Rose.Rose a) instance Data.Functor.Classes.Show1 Rose.Rose instance GHC.Read.Read a => GHC.Read.Read (Rose.Rose a) instance Data.Functor.Classes.Read1 Rose.Rose instance Data.Traversable.Traversable Rose.Rose instance Control.Comonad.Comonad Rose.Rose