lens-3.9.2: Lenses, Folds and Traversals

Portabilitynon-portable
Stabilityexperimental
MaintainerEdward Kmett <ekmett@gmail.com>
Safe HaskellTrustworthy

Control.Lens.Internal.Level

Contents

Description

This module provides implementation details of the combinators in Control.Lens.Level, which provides for the breadth-first Traversal of an arbitrary Traversal.

Synopsis

Levels

data Level i a Source

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.

Constructors

Two !Word !(Level i a) !(Level i a) 
One i a 
Zero 

Instances

TraversableWithIndex i (Level i) 
FoldableWithIndex i (Level i) 
FunctorWithIndex i (Level i) 
Functor (Level i) 
Foldable (Level i) 
Traversable (Level i) 
(Eq i, Eq a) => Eq (Level i a) 
(Ord i, Ord a) => Ord (Level i a) 
(Read i, Read a) => Read (Level i a) 
(Show i, Show a) => Show (Level i a) 

newtype Deepening i a Source

This is an illegal Monoid used to construct a single Level.

Constructors

Deepening 

Fields

runDeepening :: forall r. Int -> (Level i a -> Bool -> r) -> r
 

Instances

Monoid (Deepening i a)

This is an illegal Monoid.

Semigroup (Deepening i a) 

deepening :: i -> a -> Deepening i aSource

Generate the leaf of a given Deepening based on whether or not we're at the correct depth.

newtype Flows i b a Source

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.

Constructors

Flows 

Fields

runFlows :: [Level i b] -> a
 

Instances

Functor (Flows i b) 
Applicative (Flows i b)

This is an illegal Applicative.

Apply (Flows i b)