lens-5.2.3: Lenses, Folds and Traversals
Copyright(C) 2012-2016 Edward Kmett
LicenseBSD-style (see the file LICENSE)
MaintainerEdward Kmett <ekmett@gmail.com>
Stabilityexperimental
Portabilitynon-portable
Safe HaskellSafe-Inferred
LanguageHaskell2010

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

Instances details
FoldableWithIndex i (Level i) Source # 
Instance details

Defined in Control.Lens.Internal.Level

Methods

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 #

FunctorWithIndex i (Level i) Source # 
Instance details

Defined in Control.Lens.Internal.Level

Methods

imap :: (i -> a -> b) -> Level i a -> Level i b Source #

TraversableWithIndex i (Level i) Source # 
Instance details

Defined in Control.Lens.Internal.Level

Methods

itraverse :: Applicative f => (i -> a -> f b) -> Level i a -> f (Level i b) Source #

Foldable (Level i) Source # 
Instance details

Defined in Control.Lens.Internal.Level

Methods

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 #

sum :: Num a => Level i a -> a Source #

product :: Num a => Level i a -> a Source #

Traversable (Level i) Source # 
Instance details

Defined in Control.Lens.Internal.Level

Methods

traverse :: Applicative f => (a -> f b) -> Level i a -> f (Level i b) Source #

sequenceA :: Applicative f => Level i (f a) -> f (Level i a) Source #

mapM :: Monad m => (a -> m b) -> Level i a -> m (Level i b) Source #

sequence :: Monad m => Level i (m a) -> m (Level i a) Source #

Functor (Level i) Source # 
Instance details

Defined in Control.Lens.Internal.Level

Methods

fmap :: (a -> b) -> Level i a -> Level i b Source #

(<$) :: a -> Level i b -> Level i a Source #

(Read i, Read a) => Read (Level i a) Source # 
Instance details

Defined in Control.Lens.Internal.Level

(Show i, Show a) => Show (Level i a) Source # 
Instance details

Defined in Control.Lens.Internal.Level

Methods

showsPrec :: Int -> Level i a -> ShowS Source #

show :: Level i a -> String Source #

showList :: [Level i a] -> ShowS Source #

(Eq i, Eq a) => Eq (Level i a) Source # 
Instance details

Defined in Control.Lens.Internal.Level

Methods

(==) :: Level i a -> Level i a -> Bool Source #

(/=) :: Level i a -> Level i a -> Bool Source #

(Ord i, Ord a) => Ord (Level i a) Source # 
Instance details

Defined in Control.Lens.Internal.Level

Methods

compare :: Level i a -> Level i a -> Ordering Source #

(<) :: Level i a -> Level i a -> Bool Source #

(<=) :: Level i a -> Level i a -> Bool Source #

(>) :: Level i a -> Level i a -> Bool Source #

(>=) :: Level i a -> Level i a -> Bool Source #

max :: Level i a -> Level i a -> Level i a Source #

min :: Level i a -> Level i a -> Level i a Source #

newtype Deepening i a Source #

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

Constructors

Deepening 

Fields

Instances

Instances details
Monoid (Deepening i a) Source #

This is an illegal Monoid.

Instance details

Defined in Control.Lens.Internal.Level

Semigroup (Deepening i a) Source # 
Instance details

Defined in Control.Lens.Internal.Level

Methods

(<>) :: Deepening i a -> Deepening i a -> Deepening i a Source #

sconcat :: NonEmpty (Deepening i a) -> Deepening i a Source #

stimes :: Integral b => b -> Deepening i a -> Deepening i a Source #

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.

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

Instances

Instances details
Applicative (Flows i b) Source #

This is an illegal Applicative.

Instance details

Defined in Control.Lens.Internal.Level

Methods

pure :: a -> Flows i b a Source #

(<*>) :: Flows i b (a -> b0) -> Flows i b a -> Flows i b b0 Source #

liftA2 :: (a -> b0 -> c) -> Flows i b a -> Flows i b b0 -> Flows i b c Source #

(*>) :: Flows i b a -> Flows i b b0 -> Flows i b b0 Source #

(<*) :: Flows i b a -> Flows i b b0 -> Flows i b a Source #

Functor (Flows i b) Source # 
Instance details

Defined in Control.Lens.Internal.Level

Methods

fmap :: (a -> b0) -> Flows i b a -> Flows i b b0 Source #

(<$) :: a -> Flows i b b0 -> Flows i b a Source #

Apply (Flows i b) Source # 
Instance details

Defined in Control.Lens.Internal.Level

Methods

(<.>) :: Flows i b (a -> b0) -> Flows i b a -> Flows i b b0 Source #

(.>) :: Flows i b a -> Flows i b b0 -> Flows i b b0 Source #

(<.) :: Flows i b a -> Flows i b b0 -> Flows i b a Source #

liftF2 :: (a -> b0 -> c) -> Flows i b a -> Flows i b b0 -> Flows i b c Source #