Copyright | (C) 2012-2016 Edward Kmett |
---|---|
License | BSD-style (see the file LICENSE) |
Maintainer | Edward Kmett <ekmett@gmail.com> |
Stability | experimental |
Portability | non-portable |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
This module provides implementation details of the combinators in
Control.Lens.Level
, which provides for the breadth-first
Traversal
of
an arbitrary
Traversal
.
Levels
This data type represents a path-compressed copy of one level of a source data structure. We can safely use path-compression because we know the depth of the tree.
Path compression is performed by viewing a
Level
as a PATRICIA trie of the
paths into the structure to leaves at a given depth, similar in many ways
to a
IntMap
, but unlike a regular PATRICIA trie we do not need
to store the mask bits merely the depth of the fork.
One invariant of this structure is that underneath a
Two
node you will not
find any
Zero
nodes, so
Zero
can only occur at the root.
Instances
FunctorWithIndex i ( Level i) Source # | |
FoldableWithIndex i ( Level i) Source # | |
Defined in Control.Lens.Internal.Level ifoldMap :: Monoid m => (i -> a -> m) -> Level i a -> m Source # ifoldMap' :: Monoid m => (i -> a -> m) -> Level i a -> m Source # ifoldr :: (i -> a -> b -> b) -> b -> Level i a -> b Source # ifoldl :: (i -> b -> a -> b) -> b -> Level i a -> b Source # ifoldr' :: (i -> a -> b -> b) -> b -> Level i a -> b Source # ifoldl' :: (i -> b -> a -> b) -> b -> Level i a -> b Source # |
|
TraversableWithIndex i ( Level i) Source # | |
Defined in Control.Lens.Internal.Level |
|
Functor ( Level i) Source # | |
Foldable ( Level i) Source # | |
Defined in Control.Lens.Internal.Level fold :: Monoid m => Level i m -> m Source # foldMap :: Monoid m => (a -> m) -> Level i a -> m Source # foldMap' :: Monoid m => (a -> m) -> Level i a -> m Source # foldr :: (a -> b -> b) -> b -> Level i a -> b Source # foldr' :: (a -> b -> b) -> b -> Level i a -> b Source # foldl :: (b -> a -> b) -> b -> Level i a -> b Source # foldl' :: (b -> a -> b) -> b -> Level i a -> b Source # foldr1 :: (a -> a -> a) -> Level i a -> a Source # foldl1 :: (a -> a -> a) -> Level i a -> a Source # toList :: Level i a -> [a] Source # null :: Level i a -> Bool Source # length :: Level i a -> Int Source # elem :: Eq a => a -> Level i a -> Bool Source # maximum :: Ord a => Level i a -> a Source # minimum :: Ord a => Level i a -> a Source # |
|
Traversable ( Level i) Source # | |
Defined in Control.Lens.Internal.Level |
|
( Eq i, Eq a) => Eq ( Level i a) Source # | |
( Ord i, Ord a) => Ord ( Level i a) Source # | |
Defined in Control.Lens.Internal.Level |
|
( Read i, Read a) => Read ( Level i a) Source # | |
( Show i, Show a) => Show ( Level i a) Source # | |
newtype Deepening i a Source #
Deepening | |
|
deepening :: i -> a -> Deepening i a Source #
Generate the leaf of a given
Deepening
based on whether or not we're at the correct depth.
This is an illegal
Applicative
used to replace the contents of a list of consecutive
Level
values
representing each layer of a structure into the original shape that they were derived from.
Attempting to
Flow
something back into a shape other than the one it was taken from will fail.
Instances
Functor ( Flows i b) Source # | |
Applicative ( Flows i b) Source # |
This is an illegal
|
Apply ( Flows i b) Source # | |
Defined in Control.Lens.Internal.Level |