lens-4.19.2: 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.Magma

Description

 
Synopsis

Magma

data Magma i t b a where #

This provides a way to peek at the internal structure of a Traversal or IndexedTraversal

Constructors

MagmaAp :: Magma i (x -> y) b a -> Magma i x b a -> Magma i y b a 
MagmaPure :: x -> Magma i x b a 
MagmaFmap :: (x -> y) -> Magma i x b a -> Magma i y b a 
Magma :: i -> a -> Magma i b b a 

Instances

Instances details
TraversableWithIndex i (Magma i t b) # 
Instance details

Defined in Control.Lens.Indexed

Methods

itraverse :: Applicative f => (i -> a -> f b0) -> Magma i t b a -> f (Magma i t b b0) #

itraversed :: IndexedTraversal i (Magma i t b a) (Magma i t b b0) a b0 #

FoldableWithIndex i (Magma i t b) # 
Instance details

Defined in Control.Lens.Indexed

Methods

ifoldMap :: Monoid m => (i -> a -> m) -> Magma i t b a -> m #

ifolded :: IndexedFold i (Magma i t b a) a #

ifoldr :: (i -> a -> b0 -> b0) -> b0 -> Magma i t b a -> b0 #

ifoldl :: (i -> b0 -> a -> b0) -> b0 -> Magma i t b a -> b0 #

ifoldr' :: (i -> a -> b0 -> b0) -> b0 -> Magma i t b a -> b0 #

ifoldl' :: (i -> b0 -> a -> b0) -> b0 -> Magma i t b a -> b0 #

FunctorWithIndex i (Magma i t b) # 
Instance details

Defined in Control.Lens.Indexed

Methods

imap :: (i -> a -> b0) -> Magma i t b a -> Magma i t b b0 #

imapped :: IndexedSetter i (Magma i t b a) (Magma i t b b0) a b0 #

Functor (Magma i t b) # 
Instance details

Defined in Control.Lens.Internal.Magma

Methods

fmap :: (a -> b0) -> Magma i t b a -> Magma i t b b0 #

(<$) :: a -> Magma i t b b0 -> Magma i t b a #

Foldable (Magma i t b) # 
Instance details

Defined in Control.Lens.Internal.Magma

Methods

fold :: Monoid m => Magma i t b m -> m #

foldMap :: Monoid m => (a -> m) -> Magma i t b a -> m #

foldMap' :: Monoid m => (a -> m) -> Magma i t b a -> m #

foldr :: (a -> b0 -> b0) -> b0 -> Magma i t b a -> b0 #

foldr' :: (a -> b0 -> b0) -> b0 -> Magma i t b a -> b0 #

foldl :: (b0 -> a -> b0) -> b0 -> Magma i t b a -> b0 #

foldl' :: (b0 -> a -> b0) -> b0 -> Magma i t b a -> b0 #

foldr1 :: (a -> a -> a) -> Magma i t b a -> a #

foldl1 :: (a -> a -> a) -> Magma i t b a -> a #

toList :: Magma i t b a -> [a] #

null :: Magma i t b a -> Bool #

length :: Magma i t b a -> Int #

elem :: Eq a => a -> Magma i t b a -> Bool #

maximum :: Ord a => Magma i t b a -> a #

minimum :: Ord a => Magma i t b a -> a #

sum :: Num a => Magma i t b a -> a #

product :: Num a => Magma i t b a -> a #

Traversable (Magma i t b) # 
Instance details

Defined in Control.Lens.Internal.Magma

Methods

traverse :: Applicative f => (a -> f b0) -> Magma i t b a -> f (Magma i t b b0) #

sequenceA :: Applicative f => Magma i t b (f a) -> f (Magma i t b a) #

mapM :: Monad m => (a -> m b0) -> Magma i t b a -> m (Magma i t b b0) #

sequence :: Monad m => Magma i t b (m a) -> m (Magma i t b a) #

(Show i, Show a) => Show (Magma i t b a) # 
Instance details

Defined in Control.Lens.Internal.Magma

Methods

showsPrec :: Int -> Magma i t b a -> ShowS #

show :: Magma i t b a -> String #

showList :: [Magma i t b a] -> ShowS #

runMagma :: Magma i t a a -> t #

Run a Magma where all the individual leaves have been converted to the expected type

Molten

newtype Molten i a b t #

This is a a non-reassociating initially encoded version of Bazaar.

Constructors

Molten 

Fields

Instances

Instances details
IndexedComonad (Molten i) # 
Instance details

Defined in Control.Lens.Internal.Magma

Methods

iextract :: Molten i a a t -> t #

iduplicate :: Molten i a c t -> Molten i a b (Molten i b c t) #

iextend :: (Molten i b c t -> r) -> Molten i a c t -> Molten i a b r #

IndexedFunctor (Molten i) # 
Instance details

Defined in Control.Lens.Internal.Magma

Methods

ifmap :: (s -> t) -> Molten i a b s -> Molten i a b t #

Sellable (Indexed i) (Molten i) # 
Instance details

Defined in Control.Lens.Internal.Magma

Methods

sell :: Indexed i a (Molten i a b b) #

Bizarre (Indexed i) (Molten i) # 
Instance details

Defined in Control.Lens.Internal.Magma

Methods

bazaar :: Applicative f => Indexed i a (f b) -> Molten i a b t -> f t #

Functor (Molten i a b) # 
Instance details

Defined in Control.Lens.Internal.Magma

Methods

fmap :: (a0 -> b0) -> Molten i a b a0 -> Molten i a b b0 #

(<$) :: a0 -> Molten i a b b0 -> Molten i a b a0 #

Applicative (Molten i a b) # 
Instance details

Defined in Control.Lens.Internal.Magma

Methods

pure :: a0 -> Molten i a b a0 #

(<*>) :: Molten i a b (a0 -> b0) -> Molten i a b a0 -> Molten i a b b0 #

liftA2 :: (a0 -> b0 -> c) -> Molten i a b a0 -> Molten i a b b0 -> Molten i a b c #

(*>) :: Molten i a b a0 -> Molten i a b b0 -> Molten i a b b0 #

(<*) :: Molten i a b a0 -> Molten i a b b0 -> Molten i a b a0 #

a ~ b => Comonad (Molten i a b) # 
Instance details

Defined in Control.Lens.Internal.Magma

Methods

extract :: Molten i a b a0 -> a0 #

duplicate :: Molten i a b a0 -> Molten i a b (Molten i a b a0) #

extend :: (Molten i a b a0 -> b0) -> Molten i a b a0 -> Molten i a b b0 #

Apply (Molten i a b) # 
Instance details

Defined in Control.Lens.Internal.Magma

Methods

(<.>) :: Molten i a b (a0 -> b0) -> Molten i a b a0 -> Molten i a b b0 #

(.>) :: Molten i a b a0 -> Molten i a b b0 -> Molten i a b b0 #

(<.) :: Molten i a b a0 -> Molten i a b b0 -> Molten i a b a0 #

liftF2 :: (a0 -> b0 -> c) -> Molten i a b a0 -> Molten i a b b0 -> Molten i a b c #

Mafic

data Mafic a b t #

This is used to generate an indexed magma from an unindexed source

By constructing it this way we avoid infinite reassociations in sums where possible.

Constructors

Mafic Int (Int -> Magma Int t b a) 

Instances

Instances details
IndexedFunctor Mafic # 
Instance details

Defined in Control.Lens.Internal.Magma

Methods

ifmap :: (s -> t) -> Mafic a b s -> Mafic a b t #

Bizarre (Indexed Int) Mafic # 
Instance details

Defined in Control.Lens.Internal.Magma

Methods

bazaar :: Applicative f => Indexed Int a (f b) -> Mafic a b t -> f t #

Functor (Mafic a b) # 
Instance details

Defined in Control.Lens.Internal.Magma

Methods

fmap :: (a0 -> b0) -> Mafic a b a0 -> Mafic a b b0 #

(<$) :: a0 -> Mafic a b b0 -> Mafic a b a0 #

Applicative (Mafic a b) # 
Instance details

Defined in Control.Lens.Internal.Magma

Methods

pure :: a0 -> Mafic a b a0 #

(<*>) :: Mafic a b (a0 -> b0) -> Mafic a b a0 -> Mafic a b b0 #

liftA2 :: (a0 -> b0 -> c) -> Mafic a b a0 -> Mafic a b b0 -> Mafic a b c #

(*>) :: Mafic a b a0 -> Mafic a b b0 -> Mafic a b b0 #

(<*) :: Mafic a b a0 -> Mafic a b b0 -> Mafic a b a0 #

Apply (Mafic a b) # 
Instance details

Defined in Control.Lens.Internal.Magma

Methods

(<.>) :: Mafic a b (a0 -> b0) -> Mafic a b a0 -> Mafic a b b0 #

(.>) :: Mafic a b a0 -> Mafic a b b0 -> Mafic a b b0 #

(<.) :: Mafic a b a0 -> Mafic a b b0 -> Mafic a b a0 #

liftF2 :: (a0 -> b0 -> c) -> Mafic a b a0 -> Mafic a b b0 -> Mafic a b c #

Sellable ((->) :: Type -> Type -> Type) Mafic # 
Instance details

Defined in Control.Lens.Internal.Magma

Methods

sell :: a -> Mafic a b b #

runMafic :: Mafic a b t -> Magma Int t b a #

Generate a Magma using from a prefix sum.

TakingWhile

data TakingWhile p (g :: * -> *) a b t #

This is used to generate an indexed magma from an unindexed source

By constructing it this way we avoid infinite reassociations where possible.

In TakingWhile p g a b t, g has a nominal role to avoid exposing an illegal _|_ via Contravariant, while the remaining arguments are degraded to a nominal role by the invariants of Magma

Constructors

TakingWhile Bool t (Bool -> Magma () t b (Corep p a)) 

Instances

Instances details
Corepresentable p => Bizarre p (TakingWhile p g) # 
Instance details

Defined in Control.Lens.Internal.Magma

Methods

bazaar :: Applicative f => p a (f b) -> TakingWhile p g a b t -> f t #

IndexedFunctor (TakingWhile p f) # 
Instance details

Defined in Control.Lens.Internal.Magma

Methods

ifmap :: (s -> t) -> TakingWhile p f a b s -> TakingWhile p f a b t #

Functor (TakingWhile p f a b) # 
Instance details

Defined in Control.Lens.Internal.Magma

Methods

fmap :: (a0 -> b0) -> TakingWhile p f a b a0 -> TakingWhile p f a b b0 #

(<$) :: a0 -> TakingWhile p f a b b0 -> TakingWhile p f a b a0 #

Applicative (TakingWhile p f a b) # 
Instance details

Defined in Control.Lens.Internal.Magma

Methods

pure :: a0 -> TakingWhile p f a b a0 #

(<*>) :: TakingWhile p f a b (a0 -> b0) -> TakingWhile p f a b a0 -> TakingWhile p f a b b0 #

liftA2 :: (a0 -> b0 -> c) -> TakingWhile p f a b a0 -> TakingWhile p f a b b0 -> TakingWhile p f a b c #

(*>) :: TakingWhile p f a b a0 -> TakingWhile p f a b b0 -> TakingWhile p f a b b0 #

(<*) :: TakingWhile p f a b a0 -> TakingWhile p f a b b0 -> TakingWhile p f a b a0 #

Contravariant f => Contravariant (TakingWhile p f a b) # 
Instance details

Defined in Control.Lens.Internal.Magma

Methods

contramap :: (a0 -> b0) -> TakingWhile p f a b b0 -> TakingWhile p f a b a0 #

(>$) :: b0 -> TakingWhile p f a b b0 -> TakingWhile p f a b a0 #

Apply (TakingWhile p f a b) # 
Instance details

Defined in Control.Lens.Internal.Magma

Methods

(<.>) :: TakingWhile p f a b (a0 -> b0) -> TakingWhile p f a b a0 -> TakingWhile p f a b b0 #

(.>) :: TakingWhile p f a b a0 -> TakingWhile p f a b b0 -> TakingWhile p f a b b0 #

(<.) :: TakingWhile p f a b a0 -> TakingWhile p f a b b0 -> TakingWhile p f a b a0 #

liftF2 :: (a0 -> b0 -> c) -> TakingWhile p f a b a0 -> TakingWhile p f a b b0 -> TakingWhile p f a b c #

runTakingWhile :: TakingWhile p f a b t -> Magma () t b (Corep p a) #

Generate a Magma with leaves only while the predicate holds from left to right.