papa-0.7.0: src/Papa/Lens/Core.hs
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -Wall #-}
-- | The optics that "Papa" exports: the types, classes, constructors and
-- combinators of "Control.Lens" that everyday code uses, and the
-- profunctor and contravariant classes that classy optics instances
-- constrain.
--
-- The rest of "Control.Lens" is in "Papa.Lens". It is not exported from
-- "Papa", because its names clash with other libraries ('Data.Functor.Rep.index',
-- @levels@, @op@, @Over@) and with user code. Left out on purpose:
--
-- * every partial combinator (see "Papa.Lens");
-- * @(^~)@, @(^^~)@ and @(\/\/~)@, which throw for a negative exponent or a
-- zero divisor;
-- * @enum@, which throws outside the range of 'Data.Int.Int';
-- * @non@ and @nearly@, which are not lawful.
--
-- @since 0.7.0
module Papa.Lens.Core (
-- * Types
Lens,
Lens',
Traversal,
Traversal',
Traversal1,
Traversal1',
Prism,
Prism',
Iso,
Iso',
Getter,
Fold,
Fold1,
Setter,
Setter',
Review,
Optic,
Optic',
LensLike,
LensLike',
Getting,
ASetter,
ASetter',
ALens,
ALens',
ATraversal,
ATraversal',
APrism,
APrism',
AnIso,
AnIso',
IndexedLens,
IndexedLens',
IndexedTraversal,
IndexedTraversal',
IndexedFold,
IndexedGetter,
IndexedSetter,
Indexed (Indexed, runIndexed),
Indexable (indexed),
-- * Classes of profunctors and functors (for the instances of optics)
Profunctor (dimap, lmap, rmap),
Choice (left', right'),
Strong (first', second'),
Contravariant (contramap, (>$)),
phantom,
-- * Classes of containers
Field1 (_1),
Field2 (_2),
Field3 (_3),
Field4 (_4),
Field5 (_5),
Field6 (_6),
Field7 (_7),
Field8 (_8),
Field9 (_9),
Ixed (ix),
At (at),
Contains (contains),
Index,
IxValue,
Cons (_Cons),
Snoc (_Snoc),
Each (each),
AsEmpty (_Empty),
Reversing (reversing),
Plated (plate),
Wrapped (_Wrapped'),
Unwrapped,
Rewrapped,
Prefixed (prefixed),
Suffixed (suffixed),
TraverseMin (traverseMin),
TraverseMax (traverseMax),
FunctorWithIndex (imap),
FoldableWithIndex (ifoldMap, ifoldr, ifoldl),
TraversableWithIndex (itraverse),
-- * Building optics
lens,
iso,
prism,
prism',
to,
ito,
like,
folding,
setting,
sets,
unto,
un,
re,
from,
mapping,
coerced,
involuted,
reversed,
firsting,
seconding,
bimapping,
cloneLens,
cloneTraversal,
cloneIso,
clonePrism,
withIso,
withPrism,
simple,
-- * Optics of containers
folded,
traversed,
traversed1,
ifolded,
itraversed,
imapped,
mapped,
both,
both1,
beside,
alongside,
choosing,
chosen,
devoid,
united,
ignored,
only,
filtered,
filteredBy,
indices,
taking,
dropping,
takingWhile,
droppingWhile,
partsOf,
partsOf',
ipartsOf,
holesOf,
_Just,
_Nothing,
_Left,
_Right,
_Void,
_head,
_tail,
_init,
_last,
_Wrapped,
_Unwrapped,
_Wrapping,
_Unwrapping,
_Unwrapped',
cons,
snoc,
uncons,
unsnoc,
(<|),
(|>),
sans,
ala,
alaf,
au,
auf,
under,
-- * Reading
view,
views,
(^.),
preview,
previews,
(^?),
toListOf,
(^..),
toNonEmptyOf,
has,
hasn't,
isn't,
matching,
review,
reviews,
(#),
iview,
ipreview,
(^@.),
(^@?),
(^@..),
itoListOf,
-- * Folding
foldMapOf,
foldOf,
foldrOf,
foldlOf,
foldrOf',
foldlOf',
lengthOf,
nullOf,
notNullOf,
elemOf,
notElemOf,
anyOf,
allOf,
noneOf,
andOf,
orOf,
sumOf,
productOf,
firstOf,
first1Of,
lastOf,
last1Of,
findOf,
lookupOf,
maximumOf,
minimumOf,
maximum1Of,
minimum1Of,
maximumByOf,
minimumByOf,
concatOf,
concatMapOf,
traverseOf_,
forOf_,
sequenceAOf_,
ifoldMapOf,
ifoldrOf,
ifoldlOf,
itraverseOf_,
iforOf_,
ianyOf,
iallOf,
ifindOf,
-- * Writing
set,
(.~),
set',
over,
(%~),
(?~),
(<>~),
(+~),
(-~),
(*~),
(||~),
(&&~),
iover,
(%@~),
iset,
(.@~),
traverseOf,
forOf,
sequenceAOf,
itraverseOf,
iforOf,
mapAccumLOf,
mapAccumROf,
-- * Recursion
children,
universe,
universeOf,
transform,
transformOf,
rewrite,
rewriteOf,
cosmos,
cosmosOf,
-- * In a 'Control.Monad.State.Class.MonadState' or 'Control.Monad.Reader.Class.MonadReader'
use,
uses,
preuse,
assign,
modifying,
(.=),
(%=),
(?=),
(<>=),
(+=),
(-=),
zoom,
magnify,
locally,
) where
import Control.Lens (
ALens,
ALens',
APrism,
APrism',
ASetter,
ASetter',
ATraversal,
ATraversal',
AnIso,
AnIso',
AsEmpty (_Empty),
At (at),
Choice (left', right'),
Cons (_Cons),
Contains (contains),
Each (each),
Field1 (_1),
Field2 (_2),
Field3 (_3),
Field4 (_4),
Field5 (_5),
Field6 (_6),
Field7 (_7),
Field8 (_8),
Field9 (_9),
Fold,
Fold1,
FoldableWithIndex (ifoldMap, ifoldl, ifoldr),
FunctorWithIndex (imap),
Getter,
Getting,
Index,
Indexable (indexed),
Indexed (Indexed, runIndexed),
IndexedFold,
IndexedGetter,
IndexedLens,
IndexedLens',
IndexedSetter,
IndexedTraversal,
IndexedTraversal',
Iso,
Iso',
IxValue,
Ixed (ix),
Lens,
Lens',
LensLike,
LensLike',
Optic,
Optic',
Plated (plate),
Prefixed (prefixed),
Prism,
Prism',
Profunctor (dimap, lmap, rmap),
Reversing (reversing),
Review,
Rewrapped,
Setter,
Setter',
Snoc (_Snoc),
Suffixed (suffixed),
TraversableWithIndex (itraverse),
Traversal,
Traversal',
Traversal1,
Traversal1',
TraverseMax (traverseMax),
TraverseMin (traverseMin),
Unwrapped,
Wrapped (_Wrapped'),
ala,
alaf,
allOf,
alongside,
andOf,
anyOf,
assign,
au,
auf,
beside,
bimapping,
both,
both1,
children,
choosing,
chosen,
cloneIso,
cloneLens,
clonePrism,
cloneTraversal,
coerced,
concatMapOf,
concatOf,
cons,
cosmos,
cosmosOf,
devoid,
dropping,
droppingWhile,
elemOf,
filtered,
filteredBy,
findOf,
first1Of,
firstOf,
firsting,
foldMapOf,
foldOf,
folded,
folding,
foldlOf,
foldlOf',
foldrOf,
foldrOf',
forOf,
forOf_,
from,
has,
hasn't,
holesOf,
iallOf,
ianyOf,
ifindOf,
ifoldMapOf,
ifolded,
ifoldlOf,
ifoldrOf,
iforOf,
iforOf_,
ignored,
imapped,
indices,
involuted,
iover,
ipartsOf,
ipreview,
iset,
isn't,
iso,
ito,
itoListOf,
itraverseOf,
itraverseOf_,
itraversed,
iview,
last1Of,
lastOf,
lengthOf,
lens,
like,
locally,
lookupOf,
magnify,
mapAccumLOf,
mapAccumROf,
mapped,
mapping,
matching,
maximum1Of,
maximumByOf,
maximumOf,
minimum1Of,
minimumByOf,
minimumOf,
modifying,
noneOf,
notElemOf,
notNullOf,
nullOf,
only,
orOf,
over,
partsOf,
partsOf',
preuse,
preview,
previews,
prism,
prism',
productOf,
re,
reversed,
review,
reviews,
rewrite,
rewriteOf,
sans,
seconding,
sequenceAOf,
sequenceAOf_,
set,
set',
sets,
setting,
simple,
snoc,
sumOf,
taking,
takingWhile,
to,
toListOf,
toNonEmptyOf,
transform,
transformOf,
traverseOf,
traverseOf_,
traversed,
traversed1,
un,
uncons,
under,
united,
universe,
universeOf,
unsnoc,
unto,
use,
uses,
view,
views,
withIso,
withPrism,
zoom,
(#),
(%=),
(%@~),
(%~),
(&&~),
(*~),
(+=),
(+~),
(-=),
(-~),
(.=),
(.@~),
(.~),
(<>=),
(<>~),
(<|),
(?=),
(?~),
(^.),
(^..),
(^?),
(^@.),
(^@..),
(^@?),
_Just,
_Left,
_Nothing,
_Right,
_Unwrapped,
_Unwrapped',
_Unwrapping,
_Void,
_Wrapped,
_Wrapping,
_head,
_init,
_last,
_tail,
(|>),
(||~),
)
import Data.Functor.Contravariant (Contravariant (contramap, (>$)), phantom)
import Data.Profunctor (Strong (first', second'))