-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Extra utilities and instances for optics-core -- -- This package provides extra definitions and instances that extend the -- optics-core package, without incurring too many -- dependencies. See the optics package for more -- documentation. @package optics-extra @version 0.4 -- | This module exists to provide documentation for lenses for working -- with HashMap, which might otherwise be obscured by their -- genericity. -- -- HashMap is an instance of At and provides at as a -- lens on values at keys: -- --
-- >>> HashMap.fromList [(1, "world")] ^. at 1 -- Just "world" ---- --
-- >>> HashMap.empty & at 1 .~ Just "world" -- fromList [(1,"world")] ---- --
-- >>> HashMap.empty & at 0 .~ Just "hello" -- fromList [(0,"hello")] ---- -- We can traverse, fold over, and map over key-value pairs in a -- HashMap, thanks to indexed traversals, folds and setters. -- --
-- >>> iover imapped const $ HashMap.fromList [(1, "Venus")] -- fromList [(1,1)] ---- --
-- >>> ifoldMapOf ifolded (\i _ -> Sum i) $ HashMap.fromList [(2, "Earth"), (3, "Mars")]
-- Sum {getSum = 5}
--
--
-- -- >>> itraverseOf_ ifolded (curry print) $ HashMap.fromList [(4, "Jupiter")] -- (4,"Jupiter") ---- --
-- >>> itoListOf ifolded $ HashMap.fromList [(5, "Saturn")] -- [(5,"Saturn")] ---- -- A related class, Ixed, allows us to use ix to traverse a -- value at a particular key. -- --
-- >>> HashMap.fromList [(2, "Earth")] & ix 2 %~ ("New " ++)
-- fromList [(2,"New Earth")]
--
--
-- -- >>> preview (ix 8) HashMap.empty -- Nothing --module Data.HashMap.Optics -- | Construct a hash map from an IxFold. -- -- The construction is left-biased (see union), i.e. the first -- occurrences of keys in the fold or traversal order are preferred. -- --
-- >>> toMapOf ifolded ["hello", "world"] -- fromList [(0,"hello"),(1,"world")] ---- --
-- >>> toMapOf (folded % ifolded) [('a',"alpha"),('b', "beta")]
-- fromList [('a',"alpha"),('b',"beta")]
--
--
--
-- >>> toMapOf (folded % ifolded) [('a', "hello"), ('b', "world"), ('a', "dummy")]
-- fromList [('a',"hello"),('b',"world")]
--
toMapOf :: (Is k A_Fold, is `HasSingleIndex` i, Eq i, Hashable i) => Optic' k is s a -> s -> HashMap i a
-- | Version of at strict in the value inside the Just
-- constructor.
--
-- Example:
--
-- -- >>> (at () .~ Just (error "oops") $ Nothing) `seq` () -- () ---- --
-- >>> (at' () .~ Just (error "oops") $ Nothing) `seq` () -- *** Exception: oops -- ... ---- --
-- >>> view (at ()) (Just $ error "oops") `seq` () -- () ---- --
-- >>> view (at' ()) (Just $ error "oops") `seq` () -- *** Exception: oops -- ... ---- -- It also works as expected for other data structures: -- --
-- >>> (at 1 .~ Just (error "oops") $ Map.empty) `seq` () -- () ---- --
-- >>> (at' 1 .~ Just (error "oops") $ Map.empty) `seq` () -- *** Exception: oops -- ... --at' :: At m => Index m -> Lens' m (Maybe (IxValue m)) -- | This module defines optics for constructing and manipulating finite -- HashSets. module Data.HashSet.Optics -- | This Setter can be used to change the type of a HashSet -- by mapping the elements to new values. -- -- Sadly, you can't create a valid Traversal for a HashSet, -- but you can manipulate it by reading using folded and -- reindexing it via setmapped. -- --
-- >>> over setmapped (+1) (HashSet.fromList [1,2,3,4]) -- fromList [2,3,4,5] --setmapped :: (Eq b, Hashable b) => Setter (HashSet a) (HashSet b) a b -- | Construct a HashSet from a fold. -- --
-- >>> setOf folded ["hello","world"] -- fromList ["hello","world"] ---- --
-- >>> setOf (folded % _2) [("hello",1),("world",2),("!!!",3)]
-- fromList [1,2,3]
--
setOf :: (Is k A_Fold, Eq a, Hashable a) => Optic' k is s a -> s -> HashSet a
-- | This module provides Isos for converting lazy Text to or
-- from a String or Builder, and an IxTraversal
-- for traversing the individual characters of a Text.
--
-- If you need to work with both strict and lazy text,
-- Data.Text.Optics provides combinators that support both
-- varieties using a typeclass.
module Data.Text.Lazy.Optics
-- | This isomorphism can be used to pack (or unpack)
-- lazy Text.
--
-- -- >>> "hello" ^. packed -- :: Text -- "hello" ---- --
-- pack x ≡ x ^. packed -- unpack x ≡ x ^. re packed -- packed ≡ re unpacked --packed :: Iso' String Text -- | This isomorphism can be used to unpack (or pack) -- lazy Text. -- --
-- >>> Text.pack "hello" ^. unpacked -- :: String -- "hello" ---- --
-- pack x ≡ x ^. re unpacked -- unpack x ≡ x ^. packed ---- -- This Iso is provided for notational convenience rather than out -- of great need, since -- --
-- unpacked ≡ re packed --unpacked :: Iso' Text String -- | This is an alias for unpacked that makes it clearer how to use -- it with (#). -- --
-- _Text = re packed ---- --
-- >>> _Text # "hello" -- :: Text -- "hello" --_Text :: Iso' Text String -- | Traverse the individual characters in a Text. -- --
-- >>> anyOf text (=='c') $ Text.pack "chello" -- True ---- --
-- text = unpacked % traversed ---- -- When the type is unambiguous, you can also use the more general -- each. -- --
-- text ≡ each ---- -- Note that when just using this as a Setter, sets -- map can be more efficient. text :: IxTraversal' Int Text Char -- | Convert between lazy Text and Builder . -- --
-- fromLazyText x ≡ x ^. builder -- toLazyText x ≡ x ^. re builder --builder :: Iso' Text Builder -- | Encode/Decode a lazy Text to/from lazy ByteString, via -- UTF-8. -- -- Note: This function does not decode lazily, as it must consume the -- entire input before deciding whether or not it fails. -- --
-- >>> LBS.unpack (utf8 # Text.pack "☃") -- [226,152,131] --utf8 :: Prism' ByteString Text pattern Text :: String -> Text -- | This module provides Isos for converting strict Text to -- or from a String or Builder, and an IxTraversal -- for traversing the individual characters of a Text. -- -- If you need to work with both strict and lazy text, -- Data.Text.Optics provides combinators that support both -- varieties using a typeclass. module Data.Text.Strict.Optics -- | This isomorphism can be used to pack (or unpack) -- strict Text. -- --
-- >>> "hello" ^. packed -- :: Text -- "hello" ---- --
-- pack x ≡ x ^. packed -- unpack x ≡ x ^. re packed -- packed ≡ re unpacked -- packed ≡ iso pack unpack --packed :: Iso' String Text -- | This isomorphism can be used to unpack (or pack) -- strict Text. -- --
-- >>> Strict.pack "hello" ^. unpacked -- :: String -- "hello" ---- -- This Iso is provided for notational convenience rather than out -- of great need, since -- --
-- unpacked ≡ re packed ---- --
-- pack x ≡ x ^. re unpacked -- unpack x ≡ x ^. packed -- unpacked ≡ iso unpack pack --unpacked :: Iso' Text String -- | Convert between strict Text and Builder . -- --
-- fromText x ≡ x ^. builder -- toStrict (toLazyText x) ≡ x ^. re builder --builder :: Iso' Text Builder -- | Traverse the individual characters in strict Text. -- --
-- >>> anyOf text (=='o') (Strict.pack "hello") -- True ---- -- When the type is unambiguous, you can also use the more general -- each. -- --
-- text ≡ unpacked % traversed -- text ≡ each ---- -- Note that when just using this as a Setter, sets -- map can be more efficient. text :: IxTraversal' Int Text Char -- | Encode/Decode a strict Text to/from strict ByteString, -- via UTF-8. -- --
-- >>> utf8 # Strict.pack "☃" -- "\226\152\131" --utf8 :: Prism' ByteString Text -- | This is an alias for unpacked that makes it more obvious how to -- use it with # -- --
-- > _Text # "hello" -- :: Text ---- -- "hello" _Text :: Iso' Text String pattern Text :: String -> Text -- | This module provides Isos for converting strict or lazy -- Text to or from a String or Builder, and an -- IxTraversal for traversing the individual characters of a -- Text. -- -- The same combinators support both strict and lazy text using the -- IsText typeclass. You can import Data.Text.Strict.Optics -- or Data.Text.Lazy.Optics instead if you prefer monomorphic -- versions. module Data.Text.Optics -- | Traversals for strict or lazy Text class IsText t -- | This isomorphism can be used to pack (or unpack) -- strict or lazy Text. -- --
-- pack x ≡ x ^. packed -- unpack x ≡ x ^. re packed -- packed ≡ re unpacked --packed :: IsText t => Iso' String t -- | Convert between strict or lazy Text and a Builder. -- --
-- fromText x ≡ x ^. builder --builder :: IsText t => Iso' t Builder -- | Traverse the individual characters in strict or lazy Text. -- --
-- text = unpacked . traversed --text :: IsText t => IxTraversal' Int t Char -- | This isomorphism can be used to unpack (or pack) -- both strict or lazy Text. -- --
-- unpack x ≡ x ^. unpacked -- pack x ≡ x ^. re unpacked ---- -- This Iso is provided for notational convenience rather than out -- of great need, since -- --
-- unpacked ≡ re packed --unpacked :: IsText t => Iso' t String -- | This is an alias for unpacked that makes it clearer how to use -- it with (#). -- --
-- _Text = re packed ---- --
-- >>> _Text # "hello" :: Strict.Text -- "hello" --_Text :: IsText t => Iso' t String pattern Text :: IsText t => String -> t instance Data.Text.Optics.IsText GHC.Base.String instance Data.Text.Optics.IsText Data.Text.Internal.Text instance Data.Text.Optics.IsText Data.Text.Internal.Lazy.Text -- | This module provides optics for Map and Set-like -- containers, including an AffineTraversal to traverse a key in a -- map or an element of a sequence: -- --
-- >>> preview (ix 1) ['a','b','c'] -- Just 'b' ---- -- a Lens to get, set or delete a key in a map: -- --
-- >>> set (at 0) (Just 'b') (Map.fromList [(0, 'a')]) -- fromList [(0,'b')] ---- -- and a Lens to insert or remove an element of a set: -- --
-- >>> IntSet.fromList [1,2,3,4] & contains 3 .~ False -- fromList [1,2,4] ---- -- This module includes the core definitions from Optics.At.Core -- along with extra (orphan) instances. module Optics.At -- | Type family that takes a key-value container type and returns the type -- of keys (indices) into the container, for example Index -- (Map k a) ~ k. This is shared by Ixed, At -- and Contains. type family Index s -- | Type family that takes a key-value container type and returns the type -- of values stored in the container, for example IxValue -- (Map k a) ~ a. This is shared by both Ixed and -- At. type family IxValue m -- | Provides a simple AffineTraversal lets you traverse the value -- at a given key in a Map or element at an ordinal position in a -- list or Seq. class Ixed m where { -- | Type family that takes a key-value container type and returns the kind -- of optic to index into it. For most containers, it's -- An_AffineTraversal, Representable (Naperian) -- containers it is A_Lens, and multi-maps would have -- A_Traversal. type family IxKind m; type IxKind m = An_AffineTraversal; } -- | NB: Setting the value of this AffineTraversal will only -- set the value in at if it is already present. -- -- If you want to be able to insert missing values, you want -- at. -- --
-- >>> [1,2,3,4] & ix 2 %~ (*10) -- [1,2,30,4] ---- --
-- >>> "abcd" & ix 2 .~ 'e' -- "abed" ---- --
-- >>> "abcd" ^? ix 2 -- Just 'c' ---- --
-- >>> [] ^? ix 2 -- Nothing --ix :: Ixed m => Index m -> Optic' (IxKind m) NoIx m (IxValue m) -- | A definition of ix for types with an At instance. This -- is the default if you don't specify a definition for ix. ixAt :: At m => Index m -> AffineTraversal' m (IxValue m) -- | At provides a Lens that can be used to read, write or -- delete the value associated with a key in a Map-like container -- on an ad hoc basis. -- -- An instance of At should satisfy: -- --
-- ix k ≡ at k % _Just --class (Ixed m, IxKind m ~ An_AffineTraversal) => At m -- |
-- >>> Map.fromList [(1,"world")] ^. at 1 -- Just "world" ---- --
-- >>> at 1 ?~ "hello" $ Map.empty -- fromList [(1,"hello")] ---- -- Note: Usage of this function might introduce space leaks if -- you're not careful to make sure that values put inside the Just -- constructor are evaluated. To force the values and avoid such leaks, -- use at' instead. -- -- Note: Map-like containers form a reasonable instance, -- but not Array-like ones, where you cannot satisfy the -- Lens laws. at :: At m => Index m -> Lens' m (Maybe (IxValue m)) -- | Version of at strict in the value inside the Just -- constructor. -- -- Example: -- --
-- >>> (at () .~ Just (error "oops") $ Nothing) `seq` () -- () ---- --
-- >>> (at' () .~ Just (error "oops") $ Nothing) `seq` () -- *** Exception: oops -- ... ---- --
-- >>> view (at ()) (Just $ error "oops") `seq` () -- () ---- --
-- >>> view (at' ()) (Just $ error "oops") `seq` () -- *** Exception: oops -- ... ---- -- It also works as expected for other data structures: -- --
-- >>> (at 1 .~ Just (error "oops") $ Map.empty) `seq` () -- () ---- --
-- >>> (at' 1 .~ Just (error "oops") $ Map.empty) `seq` () -- *** Exception: oops -- ... --at' :: At m => Index m -> Lens' m (Maybe (IxValue m)) -- | Delete the value associated with a key in a Map-like container -- --
-- sans k = at k .~ Nothing --sans :: At m => Index m -> m -> m -- | This class provides a simple Lens that lets you view (and -- modify) information about whether or not a container contains a given -- Index. Instances are provided for Set-like containers -- only. class Contains m -- |
-- >>> IntSet.fromList [1,2,3,4] ^. contains 3 -- True ---- --
-- >>> IntSet.fromList [1,2,3,4] ^. contains 5 -- False ---- --
-- >>> IntSet.fromList [1,2,3,4] & contains 3 .~ False -- fromList [1,2,4] --contains :: Contains m => Index m -> Lens' m Bool instance (GHC.Classes.Eq a, Data.Hashable.Class.Hashable a) => Optics.At.Core.Contains (Data.HashSet.Internal.HashSet a) instance (GHC.Classes.Eq k, Data.Hashable.Class.Hashable k) => Optics.At.Core.Ixed (Data.HashMap.Internal.HashMap k a) instance (GHC.Classes.Eq k, Data.Hashable.Class.Hashable k) => Optics.At.Core.Ixed (Data.HashSet.Internal.HashSet k) instance Optics.At.Core.Ixed (Data.Vector.Vector a) instance Data.Primitive.Types.Prim a => Optics.At.Core.Ixed (Data.Vector.Primitive.Vector a) instance Foreign.Storable.Storable a => Optics.At.Core.Ixed (Data.Vector.Storable.Vector a) instance Data.Vector.Unboxed.Base.Unbox a => Optics.At.Core.Ixed (Data.Vector.Unboxed.Base.Vector a) instance Optics.At.Core.Ixed Data.Text.Internal.Text instance Optics.At.Core.Ixed Data.Text.Internal.Lazy.Text instance Optics.At.Core.Ixed Data.ByteString.Internal.ByteString instance Optics.At.Core.Ixed Data.ByteString.Lazy.Internal.ByteString instance (GHC.Classes.Eq k, Data.Hashable.Class.Hashable k) => Optics.At.Core.At (Data.HashMap.Internal.HashMap k a) instance (GHC.Classes.Eq k, Data.Hashable.Class.Hashable k) => Optics.At.Core.At (Data.HashSet.Internal.HashSet k) -- | This module defines the Cons and Snoc classes, which -- provide Prisms for the leftmost and rightmost elements of a -- container, respectively. module Optics.Cons -- | This class provides a way to attach or detach elements on the left -- side of a structure in a flexible manner. class Cons s t a b | s -> a, t -> b, s b -> t, t a -> s -- |
-- _Cons :: Prism [a] [b] (a, [a]) (b, [b]) -- _Cons :: Prism (Seq a) (Seq b) (a, Seq a) (b, Seq b) -- _Cons :: Prism (Vector a) (Vector b) (a, Vector a) (b, Vector b) -- _Cons :: Prism' String (Char, String) -- _Cons :: Prism' Text (Char, Text) -- _Cons :: Prism' ByteString (Word8, ByteString) --_Cons :: Cons s t a b => Prism s t (a, s) (b, t) -- | cons an element onto a container. -- -- This is an infix alias for cons. -- --
-- >>> 1 <| [] -- [1] ---- --
-- >>> 'a' <| "bc" -- "abc" ---- --
-- >>> 1 <| [] -- [1] ---- --
-- >>> 1 <| [2, 3] -- [1,2,3] --(<|) :: Cons s s a a => a -> s -> s infixr 5 <| -- | cons an element onto a container. -- --
-- >>> cons 'a' "" -- "a" ---- --
-- >>> cons 'a' "bc" -- "abc" --cons :: Cons s s a a => a -> s -> s infixr 5 `cons` -- | Attempt to extract the left-most element from a container, and a -- version of the container without that element. -- --
-- >>> uncons [] -- Nothing ---- --
-- >>> uncons [1, 2, 3] -- Just (1,[2,3]) --uncons :: Cons s s a a => s -> Maybe (a, s) -- | An AffineTraversal reading and writing to the head of a -- non-empty container. -- --
-- >>> "abc" ^? _head -- Just 'a' ---- --
-- >>> "abc" & _head .~ 'd' -- "dbc" ---- --
-- >>> [1,2,3] & _head %~ (*10) -- [10,2,3] ---- --
-- >>> [] & _head %~ absurd -- [] ---- --
-- >>> [1,2,3] ^? _head -- Just 1 ---- --
-- >>> [] ^? _head -- Nothing ---- --
-- >>> [1,2] ^? _head -- Just 1 ---- --
-- >>> [] & _head .~ 1 -- [] ---- --
-- >>> [0] & _head .~ 2 -- [2] ---- --
-- >>> [0,1] & _head .~ 2 -- [2,1] --_head :: Cons s s a a => AffineTraversal' s a -- | An AffineTraversal reading and writing to the tail of a -- non-empty container. -- --
-- >>> "ab" & _tail .~ "cde" -- "acde" ---- --
-- >>> [] & _tail .~ [1,2] -- [] ---- --
-- >>> [1,2,3,4,5] & _tail % traversed %~ (*10) -- [1,20,30,40,50] ---- --
-- >>> [1,2] & _tail .~ [3,4,5] -- [1,3,4,5] ---- --
-- >>> [] & _tail .~ [1,2] -- [] ---- --
-- >>> "abc" ^? _tail -- Just "bc" ---- --
-- >>> "hello" ^? _tail -- Just "ello" ---- --
-- >>> "" ^? _tail -- Nothing --_tail :: Cons s s a a => AffineTraversal' s s -- | Pattern synonym for matching on the leftmost element of a structure. -- --
-- >>> case ['a','b','c'] of (x :< _) -> x -- 'a' --pattern (:<) :: Cons s s a a => a -> s -> s infixr 5 :< -- | This class provides a way to attach or detach elements on the right -- side of a structure in a flexible manner. class Snoc s t a b | s -> a, t -> b, s b -> t, t a -> s _Snoc :: Snoc s t a b => Prism s t (s, a) (t, b) -- | snoc an element onto the end of a container. -- -- This is an infix alias for snoc. -- --
-- >>> "" |> 'a' -- "a" ---- --
-- >>> "bc" |> 'a' -- "bca" --(|>) :: Snoc s s a a => s -> a -> s infixl 5 |> -- | snoc an element onto the end of a container. -- --
-- >>> snoc "hello" '!' -- "hello!" --snoc :: Snoc s s a a => s -> a -> s infixl 5 `snoc` -- | Attempt to extract the right-most element from a container, and a -- version of the container without that element. -- --
-- >>> unsnoc "hello!"
-- Just ("hello",'!')
--
--
-- -- >>> unsnoc "" -- Nothing --unsnoc :: Snoc s s a a => s -> Maybe (s, a) -- | An AffineTraversal reading and replacing all but the a last -- element of a non-empty container. -- --
-- >>> "abcd" ^? _init -- Just "abc" ---- --
-- >>> "" ^? _init -- Nothing ---- --
-- >>> "ab" & _init .~ "cde" -- "cdeb" ---- --
-- >>> [] & _init .~ [1,2] -- [] ---- --
-- >>> [1,2,3,4] & _init % traversed %~ (*10) -- [10,20,30,4] ---- --
-- >>> [1,2,3] ^? _init -- Just [1,2] ---- --
-- >>> "hello" ^? _init -- Just "hell" ---- --
-- >>> [] ^? _init -- Nothing --_init :: Snoc s s a a => AffineTraversal' s s -- | An AffineTraversal reading and writing to the last element of a -- non-empty container. -- --
-- >>> "abc" ^? _last -- Just 'c' ---- --
-- >>> "" ^? _last -- Nothing ---- --
-- >>> [1,2,3] & _last %~ (+1) -- [1,2,4] ---- --
-- >>> [1,2] ^? _last -- Just 2 ---- --
-- >>> [] & _last .~ 1 -- [] ---- --
-- >>> [0] & _last .~ 2 -- [2] ---- --
-- >>> [0,1] & _last .~ 2 -- [0,2] --_last :: Snoc s s a a => AffineTraversal' s a -- | Pattern synonym for matching on the rightmost element of a structure. -- --
-- >>> case ['a','b','c'] of (_ :> x) -> x -- 'c' --pattern (:>) :: Snoc s s a a => s -> a -> s infixl 5 :> instance Optics.Cons.Core.Cons Data.ByteString.Internal.ByteString Data.ByteString.Internal.ByteString GHC.Word.Word8 GHC.Word.Word8 instance Optics.Cons.Core.Cons Data.ByteString.Lazy.Internal.ByteString Data.ByteString.Lazy.Internal.ByteString GHC.Word.Word8 GHC.Word.Word8 instance Optics.Cons.Core.Cons Data.Text.Internal.Text Data.Text.Internal.Text GHC.Types.Char GHC.Types.Char instance Optics.Cons.Core.Cons Data.Text.Internal.Lazy.Text Data.Text.Internal.Lazy.Text GHC.Types.Char GHC.Types.Char instance Optics.Cons.Core.Cons (Data.Vector.Vector a) (Data.Vector.Vector b) a b instance (Data.Primitive.Types.Prim a, Data.Primitive.Types.Prim b) => Optics.Cons.Core.Cons (Data.Vector.Primitive.Vector a) (Data.Vector.Primitive.Vector b) a b instance (Foreign.Storable.Storable a, Foreign.Storable.Storable b) => Optics.Cons.Core.Cons (Data.Vector.Storable.Vector a) (Data.Vector.Storable.Vector b) a b instance (Data.Vector.Unboxed.Base.Unbox a, Data.Vector.Unboxed.Base.Unbox b) => Optics.Cons.Core.Cons (Data.Vector.Unboxed.Base.Vector a) (Data.Vector.Unboxed.Base.Vector b) a b instance Optics.Cons.Core.Snoc (Data.Vector.Vector a) (Data.Vector.Vector b) a b instance (Data.Primitive.Types.Prim a, Data.Primitive.Types.Prim b) => Optics.Cons.Core.Snoc (Data.Vector.Primitive.Vector a) (Data.Vector.Primitive.Vector b) a b instance (Foreign.Storable.Storable a, Foreign.Storable.Storable b) => Optics.Cons.Core.Snoc (Data.Vector.Storable.Vector a) (Data.Vector.Storable.Vector b) a b instance (Data.Vector.Unboxed.Base.Unbox a, Data.Vector.Unboxed.Base.Unbox b) => Optics.Cons.Core.Snoc (Data.Vector.Unboxed.Base.Vector a) (Data.Vector.Unboxed.Base.Vector b) a b instance Optics.Cons.Core.Snoc Data.ByteString.Internal.ByteString Data.ByteString.Internal.ByteString GHC.Word.Word8 GHC.Word.Word8 instance Optics.Cons.Core.Snoc Data.ByteString.Lazy.Internal.ByteString Data.ByteString.Lazy.Internal.ByteString GHC.Word.Word8 GHC.Word.Word8 instance Optics.Cons.Core.Snoc Data.Text.Internal.Text Data.Text.Internal.Text GHC.Types.Char GHC.Types.Char instance Optics.Cons.Core.Snoc Data.Text.Internal.Lazy.Text Data.Text.Internal.Lazy.Text GHC.Types.Char GHC.Types.Char -- | This module defines the AsEmpty class, which provides a -- Prism for a type that may be _Empty. -- --
-- >>> isn't _Empty [1,2,3] -- True ---- --
-- >>> case Nothing of { Empty -> True; _ -> False }
-- True
--
module Optics.Empty
-- | Class for types that may be _Empty.
class AsEmpty a
-- | -- >>> isn't _Empty [1,2,3] -- True --_Empty :: AsEmpty a => Prism' a () -- | Pattern synonym for matching on any type with an AsEmpty -- instance. -- --
-- >>> case Nothing of { Empty -> True; _ -> False }
-- True
--
pattern Empty :: AsEmpty a => a
instance Optics.Empty.Core.AsEmpty (Data.HashMap.Internal.HashMap k a)
instance Optics.Empty.Core.AsEmpty (Data.HashSet.Internal.HashSet a)
instance Optics.Empty.Core.AsEmpty (Data.Vector.Vector a)
instance Data.Vector.Unboxed.Base.Unbox a => Optics.Empty.Core.AsEmpty (Data.Vector.Unboxed.Base.Vector a)
instance Foreign.Storable.Storable a => Optics.Empty.Core.AsEmpty (Data.Vector.Storable.Vector a)
instance Optics.Empty.Core.AsEmpty Data.ByteString.Internal.ByteString
instance Optics.Empty.Core.AsEmpty Data.ByteString.Lazy.Internal.ByteString
instance Optics.Empty.Core.AsEmpty Data.Text.Internal.Text
instance Optics.Empty.Core.AsEmpty Data.Text.Internal.Lazy.Text
-- | This module spends a lot of time fiddling around with
-- ByteString internals to work around
-- http://hackage.haskell.org/trac/ghc/ticket/7556 on older
-- Haskell Platforms and to improve constant and asymptotic factors in
-- our performance.
module Optics.Extra.Internal.ByteString
-- | Traverse a strict ByteString in a relatively balanced fashion,
-- as a balanced tree with biased runs of elements at the leaves.
traversedStrictTree :: IxTraversal' Int64 ByteString Word8
-- | Traverse a strict ByteString in a relatively balanced fashion,
-- as a balanced tree with biased runs of elements at the leaves,
-- pretending the bytes are chars.
traversedStrictTree8 :: IxTraversal' Int64 ByteString Char
-- | An IxTraversal of the individual bytes in a lazy
-- ByteString.
traversedLazy :: IxTraversal' Int64 ByteString Word8
-- | An IxTraversal of the individual bytes in a lazy
-- ByteString pretending the bytes are chars.
traversedLazy8 :: IxTraversal' Int64 ByteString Char
module Data.ByteString.Strict.Optics
-- | pack (or unpack) a list of bytes into a
-- ByteString
--
-- -- packedBytes ≡ re unpackedBytes -- pack x ≡ x ^. packedBytes -- unpack x ≡ x ^. re packedBytes ---- --
-- >>> [104,101,108,108,111] ^. packedBytes -- "hello" --packedBytes :: Iso' [Word8] ByteString -- | unpack (or pack) a ByteString into a list of -- bytes. -- --
-- unpackedBytes ≡ re packedBytes -- unpack x ≡ x ^. unpackedBytes -- pack x ≡ x ^. re unpackedBytes ---- --
-- >>> "hello" ^. packedChars % unpackedBytes -- [104,101,108,108,111] --unpackedBytes :: Iso' ByteString [Word8] -- | Traverse each Word8 in a ByteString. -- -- This Traversal walks the ByteString in a tree-like -- fashion enable zippers to seek to locations in logarithmic time and -- accelerating many monoidal queries, but up to associativity (and -- constant factors) it is equivalent to the much slower: -- --
-- bytes ≡ unpackedBytes % traversed ---- --
-- >>> anyOf bytes (== 0x80) (Char8.pack "hello") -- False ---- -- Note that when just using this as a Setter, sets -- map can be more efficient. bytes :: IxTraversal' Int64 ByteString Word8 -- | pack (or unpack) a list of characters into a -- ByteString -- -- When writing back to the ByteString it is assumed that every -- Char lies between 'x00' and 'xff'. -- --
-- packedChars ≡ re unpackedChars -- pack x ≡ x ^. packedChars -- unpack x ≡ x ^. re packedChars ---- --
-- >>> foldOf (packedChars % each % to (\w -> let x = showHex w "" in if Prelude.length x == 1 then '0':x else x)) "hello" -- "68656c6c6f" --packedChars :: Iso' String ByteString -- | unpack (or pack) a list of characters into a -- ByteString -- -- When writing back to the ByteString it is assumed that every -- Char lies between 'x00' and 'xff'. -- --
-- unpackedChars ≡ re packedChars -- unpack x ≡ x ^. unpackedChars -- pack x ≡ x ^. re unpackedChars ---- --
-- >>> [104,101,108,108,111] ^. packedBytes % unpackedChars -- "hello" --unpackedChars :: Iso' ByteString String -- | Traverse the individual bytes in a ByteString as characters. -- -- When writing back to the ByteString it is assumed that every -- Char lies between 'x00' and 'xff'. -- -- This Traversal walks the ByteString in a tree-like -- fashion enable zippers to seek to locations in logarithmic time and -- accelerating many monoidal queries, but up to associativity (and -- constant factors) it is equivalent to the much slower: -- --
-- chars = unpackedChars % traversed ---- --
-- >>> anyOf chars (== 'h') $ Char8.pack "hello" -- True --chars :: IxTraversal' Int64 ByteString Char pattern Bytes :: [Word8] -> ByteString pattern Chars :: [Char] -> ByteString -- | Lazy ByteString lenses. module Data.ByteString.Lazy.Optics -- | pack (or unpack) a list of bytes into a -- ByteString. -- --
-- packedBytes ≡ re unpackedBytes -- pack x ≡ x ^. packedBytes -- unpack x ≡ x ^. re packedBytes ---- --
-- >>> [104,101,108,108,111] ^. packedBytes == Char8.pack "hello" -- True --packedBytes :: Iso' [Word8] ByteString -- | unpack (or pack) a ByteString into a list of -- bytes. -- --
-- unpackedBytes ≡ re packedBytes -- unpack x ≡ x ^. unpackedBytes -- pack x ≡ x ^. re unpackedBytes ---- --
-- >>> "hello" ^. packedChars % unpackedBytes -- [104,101,108,108,111] --unpackedBytes :: Iso' ByteString [Word8] -- | Traverse the individual bytes in a ByteString. -- -- This Traversal walks each strict ByteString chunk in a -- tree-like fashion enable zippers to seek to locations more quickly and -- accelerate many monoidal queries, but up to associativity (and -- constant factors) it is equivalent to the much slower: -- --
-- bytes ≡ unpackedBytes % traversed ---- --
-- >>> anyOf bytes (== 0x80) (Char8.pack "hello") -- False ---- -- Note that when just using this as a Setter, sets -- map can be more efficient. bytes :: IxTraversal' Int64 ByteString Word8 -- | pack (or unpack) a list of characters into a -- ByteString. -- -- When writing back to the ByteString it is assumed that every -- Char lies between 'x00' and 'xff'. -- --
-- packedChars ≡ re unpackedChars -- pack x ≡ x ^. packedChars -- unpack x ≡ x ^. re packedChars ---- --
-- >>> foldOf (packedChars % each % to (\w -> let x = showHex w "" in if Prelude.length x == 1 then '0':x else x)) "hello" -- "68656c6c6f" --packedChars :: Iso' String ByteString -- | unpack (or pack) a list of characters into a -- ByteString -- -- When writing back to the ByteString it is assumed that every -- Char lies between 'x00' and 'xff'. -- --
-- unpackedChars ≡ re packedChars -- unpack x ≡ x ^. unpackedChars -- pack x ≡ x ^. re unpackedChars ---- --
-- >>> [104,101,108,108,111] ^. packedBytes % unpackedChars -- "hello" --unpackedChars :: Iso' ByteString String -- | Traverse the individual bytes in a ByteString as characters. -- -- When writing back to the ByteString it is assumed that every -- Char lies between 'x00' and 'xff'. -- -- This Traversal walks each strict ByteString chunk in a -- tree-like fashion enable zippers to seek to locations more quickly and -- accelerate many monoidal queries, but up to associativity (and -- constant factors) it is equivalent to: -- --
-- chars = unpackedChars % traversed ---- --
-- >>> anyOf chars (== 'h') $ Char8.pack "hello" -- True --chars :: IxTraversal' Int64 ByteString Char pattern Bytes :: [Word8] -> ByteString pattern Chars :: [Char] -> ByteString module Data.ByteString.Optics -- | Traversals for ByteStrings. class IsByteString t -- | pack (or unpack) a list of bytes into a strict or lazy -- ByteString. -- --
-- pack x ≡ x ^. packedBytes -- unpack x ≡ x ^. re packedBytes -- packedBytes ≡ re unpackedBytes --packedBytes :: IsByteString t => Iso' [Word8] t -- | pack (or unpack) a list of characters into a strict or -- lazy ByteString. -- -- When writing back to the ByteString it is assumed that every -- Char lies between 'x00' and 'xff'. -- --
-- pack x ≡ x ^. packedChars -- unpack x ≡ x ^. re packedChars -- packedChars ≡ re unpackedChars --packedChars :: IsByteString t => Iso' String t -- | Traverse each Word8 in a strict or lazy ByteString -- -- This Traversal walks each strict ByteString chunk in a -- tree-like fashion enable zippers to seek to locations more quickly and -- accelerate many monoidal queries, but up to associativity (and -- constant factors) it is equivalent to the much slower: -- --
-- bytes ≡ unpackedBytes . traversed ---- --
-- anyOf bytes (== 0x80) :: ByteString -> Bool --bytes :: IsByteString t => IxTraversal' Int64 t Word8 -- | Traverse the individual bytes in a strict or lazy ByteString -- as characters. -- -- When writing back to the ByteString it is assumed that every -- Char lies between 'x00' and 'xff'. -- -- This Traversal walks each strict ByteString chunk in a -- tree-like fashion enable zippers to seek to locations more quickly and -- accelerate many monoidal queries, but up to associativity (and -- constant factors) it is equivalent to the much slower: -- --
-- chars ≡ unpackedChars . traversed ---- --
-- anyOf chars (== 'c') :: ByteString -> Bool --chars :: IsByteString t => IxTraversal' Int64 t Char -- | unpack (or pack) a ByteString into a list of -- bytes. -- --
-- unpackedBytes ≡ re packedBytes -- unpack x ≡ x ^. unpackedBytes -- pack x ≡ x ^. re unpackedBytes ---- --
-- unpackedBytes :: Iso' ByteString [Word8] -- unpackedBytes :: Iso' ByteString [Word8] --unpackedBytes :: IsByteString t => Iso' t [Word8] -- | unpack (or pack) a list of characters into a strict (or -- lazy) ByteString -- -- When writing back to the ByteString it is assumed that every -- Char lies between 'x00' and 'xff'. -- --
-- unpackedChars ≡ re packedChars -- unpack x ≡ x ^. unpackedChars -- pack x ≡ x ^. re unpackedChars ---- --
-- unpackedChars :: Iso' ByteString String -- unpackedChars :: Iso' ByteString String --unpackedChars :: IsByteString t => Iso' t String pattern Bytes :: IsByteString t => [Word8] -> t pattern Chars :: IsByteString t => [Char] -> t instance Data.ByteString.Optics.IsByteString Data.ByteString.Internal.ByteString instance Data.ByteString.Optics.IsByteString Data.ByteString.Lazy.Internal.ByteString module Optics.Extra.Internal.Vector -- | Return the the subset of given ordinals within a given bound and in -- order of the first occurrence seen. -- -- Bound: 0 <= x < l -- --
-- >>> ordinalNub 3 [-1,2,1,4,2,3] -- [2,1] --ordinalNub :: Int -> [Int] -> [Int] -- | This module provides lenses and traversals for working with generic -- vectors. module Data.Vector.Generic.Optics -- | Similar to toListOf, but returning a Vector. -- --
-- >>> (toVectorOf each (8,15) :: Vector.Vector Int) == Vector.fromList [8,15] -- True --toVectorOf :: (Is k A_Fold, Vector v a) => Optic' k is s a -> s -> v a -- | Convert a Vector to a version that doesn't retain any extra -- memory. forced :: (Vector v a, Vector v b) => Iso (v a) (v b) (v a) (v b) -- | Convert a list to a Vector (or back.) -- --
-- >>> ([1,2,3] ^. vector :: Vector.Vector Int) == Vector.fromList [1,2,3] -- True ---- --
-- >>> Vector.fromList [0,8,15] ^. re vector -- [0,8,15] --vector :: (Vector v a, Vector v b) => Iso [a] [b] (v a) (v b) -- | Convert a Vector to a finite Bundle (or back.) asStream :: (Vector v a, Vector v b) => Iso (v a) (v b) (Bundle v a) (Bundle v b) -- | Convert a Vector to a finite Bundle from right to left -- (or back.) asStreamR :: (Vector v a, Vector v b) => Iso (v a) (v b) (Bundle v a) (Bundle v b) -- | Convert a Vector back and forth to an initializer that when run -- produces a copy of the Vector. cloned :: Vector v a => Iso' (v a) (New v a) -- | Different vector implementations are isomorphic to each other. converted :: (Vector v a, Vector w a, Vector v b, Vector w b) => Iso (v a) (v b) (w a) (w b) -- | sliced i n provides a Lens that edits the n -- elements starting at index i from a Lens. -- -- This is only a valid Lens if you do not change the length of -- the resulting Vector. -- -- Attempting to return a longer or shorter vector will result in -- violations of the Lens laws. -- --
-- >>> Vector.fromList [1..10] ^. sliced 2 5 == Vector.fromList [3,4,5,6,7] -- True ---- --
-- >>> (Vector.fromList [1..10] & sliced 2 5 % mapped .~ 0) == Vector.fromList [1,2,0,0,0,0,0,8,9,10] -- True --sliced :: Vector v a => Int -> Int -> Lens' (v a) (v a) -- | This Traversal will ignore any duplicates in the supplied list -- of indices. -- --
-- >>> toListOf (ordinals [1,3,2,5,9,10]) $ Vector.fromList [2,4..40] -- [4,8,6,12,20,22] --ordinals :: forall v a. Vector v a => [Int] -> IxTraversal' Int (v a) a -- | Like ix but polymorphic in the vector type. vectorIx :: Vector v a => Int -> Traversal' (v a) a -- | Indexed vector traversal for a generic vector. vectorTraverse :: forall v w a b. (Vector v a, Vector w b) => IxTraversal Int (v a) (w b) a b -- | This module provides lenses and traversals for working with vectors. module Data.Vector.Optics -- | Similar to toListOf, but returning a Vector. -- --
-- >>> toVectorOf each (8,15) == Vector.fromList [8,15] -- True --toVectorOf :: Is k A_Fold => Optic' k is s a -> s -> Vector a -- | Convert a list to a Vector (or back) -- --
-- >>> [1,2,3] ^. vector == Vector.fromList [1,2,3] -- True ---- --
-- >>> [1,2,3] ^. vector % re vector -- [1,2,3] ---- --
-- >>> Vector.fromList [0,8,15] ^. re vector % vector == Vector.fromList [0,8,15] -- True --vector :: Iso [a] [b] (Vector a) (Vector b) -- | Convert a Vector to a version that doesn't retain any extra -- memory. forced :: Iso (Vector a) (Vector b) (Vector a) (Vector b) -- | sliced i n provides a Lens that edits the n -- elements starting at index i from a Lens. -- -- This is only a valid Lens if you do not change the length of -- the resulting Vector. -- -- Attempting to return a longer or shorter vector will result in -- violations of the Lens laws. -- --
-- >>> Vector.fromList [1..10] ^. sliced 2 5 == Vector.fromList [3,4,5,6,7] -- True ---- --
-- >>> (Vector.fromList [1..10] & sliced 2 5 % mapped .~ 0) == Vector.fromList [1,2,0,0,0,0,0,8,9,10] -- True --sliced :: Int -> Int -> Lens' (Vector a) (Vector a) -- | This Traversal will ignore any duplicates in the supplied list -- of indices. -- --
-- >>> toListOf (ordinals [1,3,2,5,9,10]) $ Vector.fromList [2,4..40] -- [4,8,6,12,20,22] --ordinals :: forall a. [Int] -> IxTraversal' Int (Vector a) a module Optics.Extra.Internal.Zoom -- | Used by Zoom to zoom into StateT. newtype Focusing m c s Focusing :: m (c, s) -> Focusing m c s [unfocusing] :: Focusing m c s -> m (c, s) stateZoom :: (Is k A_Lens, Monad m) => Optic' k is t s -> (s -> m (c, s)) -> t -> m (c, t) stateZoomMaybe :: (Is k An_AffineTraversal, Monad m) => Optic' k is t s -> (s -> m (c, s)) -> t -> m (Maybe c, t) stateZoomMany :: (Is k A_Traversal, Monad m, Monoid c) => Optic' k is t s -> (s -> m (c, s)) -> t -> m (c, t) -- | Used by Zoom to zoom into RWST. newtype FocusingWith w m c s FocusingWith :: m (c, s, w) -> FocusingWith w m c s [unfocusingWith] :: FocusingWith w m c s -> m (c, s, w) rwsZoom :: (Is k A_Lens, Monad m) => Optic' k is t s -> (r -> s -> m (c, s, w)) -> r -> t -> m (c, t, w) rwsZoomMaybe :: (Is k An_AffineTraversal, Monad m, Monoid w) => Optic' k is t s -> (r -> s -> m (c, s, w)) -> r -> t -> m (Maybe c, t, w) rwsZoomMany :: (Is k A_Traversal, Monad m, Monoid w, Monoid c) => Optic' k is t s -> (r -> s -> m (c, s, w)) -> r -> t -> m (c, t, w) -- | Make a Monoid out of Maybe for error handling. newtype May a May :: Maybe a -> May a [getMay] :: May a -> Maybe a shuffleMay :: Maybe (May c) -> May (Maybe c) -- | Make a Monoid out of Either for error handling. newtype Err e a Err :: Either e a -> Err e a [getErr] :: Err e a -> Either e a shuffleErr :: Maybe (Err e c) -> Err e (Maybe c) -- | Wrap a monadic effect. newtype Effect m r Effect :: m r -> Effect m r [getEffect] :: Effect m r -> m r -- | Wrap a monadic effect. Used when magnifying RWST. newtype EffectRWS w s m c EffectRWS :: (s -> m (c, s, w)) -> EffectRWS w s m c [getEffectRWS] :: EffectRWS w s m c -> s -> m (c, s, w) rwsMagnify :: Is k A_Getter => Optic' k is a b -> (b -> s -> f (c, s, w)) -> a -> s -> f (c, s, w) rwsMagnifyMaybe :: (Is k An_AffineFold, Applicative m, Monoid w) => Optic' k is a b -> (b -> s -> m (c, s, w)) -> a -> s -> m (Maybe c, s, w) rwsMagnifyMany :: (Is k A_Fold, Monad m, Monoid w, Monoid c) => Optic' k is a b -> (b -> s -> m (c, s, w)) -> a -> s -> m (c, s, w) shuffleS :: s -> Maybe (c, s) -> (Maybe c, s) shuffleW :: Monoid w => Maybe (c, w) -> (Maybe c, w) instance (GHC.Base.Semigroup c, GHC.Base.Semigroup w, GHC.Base.Monad m) => GHC.Base.Semigroup (Optics.Extra.Internal.Zoom.EffectRWS w s m c) instance (GHC.Base.Monoid c, GHC.Base.Monoid w, GHC.Base.Monad m) => GHC.Base.Monoid (Optics.Extra.Internal.Zoom.EffectRWS w s m c) instance (GHC.Base.Monad m, GHC.Base.Semigroup r) => GHC.Base.Semigroup (Optics.Extra.Internal.Zoom.Effect m r) instance (GHC.Base.Monad m, GHC.Base.Monoid r) => GHC.Base.Monoid (Optics.Extra.Internal.Zoom.Effect m r) instance GHC.Base.Semigroup a => GHC.Base.Semigroup (Optics.Extra.Internal.Zoom.Err e a) instance GHC.Base.Monoid a => GHC.Base.Monoid (Optics.Extra.Internal.Zoom.Err e a) instance GHC.Base.Semigroup a => GHC.Base.Semigroup (Optics.Extra.Internal.Zoom.May a) instance GHC.Base.Monoid a => GHC.Base.Monoid (Optics.Extra.Internal.Zoom.May a) instance GHC.Base.Monad m => GHC.Base.Functor (Optics.Extra.Internal.Zoom.FocusingWith w m s) instance (GHC.Base.Monad m, GHC.Base.Monoid s, GHC.Base.Monoid w) => GHC.Base.Applicative (Optics.Extra.Internal.Zoom.FocusingWith w m s) instance GHC.Base.Monad m => GHC.Base.Functor (Optics.Extra.Internal.Zoom.Focusing m c) instance (GHC.Base.Monad m, GHC.Base.Monoid s) => GHC.Base.Applicative (Optics.Extra.Internal.Zoom.Focusing m s) -- | This module defines general functionality for indexed optics. See the -- "Indexed optics" section of the overview documentation in the -- Optics module of the main optics package for more -- details. -- -- Unlike Optics.Indexed.Core, this includes the definitions from -- modules for specific indexed optic flavours such as -- Optics.IxTraversal, and includes additional instances for -- FunctorWithIndex and similar classes. module Optics.Indexed -- | Class for optic kinds that can have indices. class IxOptic k s t a b -- | Convert an indexed optic to its unindexed equivalent. noIx :: forall (is :: IxList). (IxOptic k s t a b, NonEmptyIndices is) => Optic k is s t a b -> Optic k NoIx s t a b -- | Construct a conjoined indexed optic that provides a separate code path -- when used without indices. Useful for defining indexed optics that are -- as efficient as their unindexed equivalents when used without indices. -- -- Note: conjoined f g is well-defined if and only -- if f ≡ noIx g. conjoined :: forall (is :: IxList) i k s t a b. HasSingleIndex is i => Optic k NoIx s t a b -> Optic k is s t a b -> Optic k is s t a b -- | Compose two indexed optics. Their indices are composed as a pair. -- --
-- >>> itoListOf (ifolded <%> ifolded) ["foo", "bar"] -- [((0,0),'f'),((0,1),'o'),((0,2),'o'),((1,0),'b'),((1,1),'a'),((1,2),'r')] --(<%>) :: forall k l m s t a b (is :: IxList) i (js :: IxList) j u v. (JoinKinds k l m, IxOptic m s t a b, HasSingleIndex is i, HasSingleIndex js j) => Optic k is s t u v -> Optic l js u v a b -> Optic m (WithIx (i, j)) s t a b infixl 9 <%> -- | Compose two indexed optics and drop indices of the left one. (If you -- want to compose a non-indexed and an indexed optic, you can just use -- (%).) -- --
-- >>> itoListOf (ifolded %> ifolded) ["foo", "bar"] -- [(0,'f'),(1,'o'),(2,'o'),(0,'b'),(1,'a'),(2,'r')] --(%>) :: forall k l m s t u v (is :: IxList) (js :: IxList) a b. (JoinKinds k l m, IxOptic k s t u v, NonEmptyIndices is) => Optic k is s t u v -> Optic l js u v a b -> Optic m js s t a b infixl 9 %> -- | Compose two indexed optics and drop indices of the right one. (If you -- want to compose an indexed and a non-indexed optic, you can just use -- (%).) -- --
-- >>> itoListOf (ifolded <% ifolded) ["foo", "bar"] -- [(0,'f'),(0,'o'),(0,'o'),(1,'b'),(1,'a'),(1,'r')] --(<%) :: forall k l m u v a b (js :: IxList) (is :: IxList) s t. (JoinKinds k l m, IxOptic l u v a b, NonEmptyIndices js) => Optic k is s t u v -> Optic l js u v a b -> Optic m is s t a b infixl 9 <% -- | Remap the index. -- --
-- >>> itoListOf (reindexed succ ifolded) "foo" -- [(1,'f'),(2,'o'),(3,'o')] ---- --
-- >>> itoListOf (ifolded %& reindexed succ) "foo" -- [(1,'f'),(2,'o'),(3,'o')] --reindexed :: forall (is :: IxList) i j k s t a b. HasSingleIndex is i => (i -> j) -> Optic k is s t a b -> Optic k (WithIx j) s t a b -- | Flatten indices obtained from two indexed optics. -- --
-- >>> itoListOf (ifolded % ifolded %& icompose (,)) ["foo","bar"] -- [((0,0),'f'),((0,1),'o'),((0,2),'o'),((1,0),'b'),((1,1),'a'),((1,2),'r')] --icompose :: (i -> j -> ix) -> Optic k '[i, j] s t a b -> Optic k (WithIx ix) s t a b -- | Flatten indices obtained from three indexed optics. -- --
-- >>> itoListOf (ifolded % ifolded % ifolded %& icompose3 (,,)) [["foo","bar"],["xyz"]] -- [((0,0,0),'f'),((0,0,1),'o'),((0,0,2),'o'),((0,1,0),'b'),((0,1,1),'a'),((0,1,2),'r'),((1,0,0),'x'),((1,0,1),'y'),((1,0,2),'z')] --icompose3 :: (i1 -> i2 -> i3 -> ix) -> Optic k '[i1, i2, i3] s t a b -> Optic k (WithIx ix) s t a b -- | Flatten indices obtained from four indexed optics. icompose4 :: (i1 -> i2 -> i3 -> i4 -> ix) -> Optic k '[i1, i2, i3, i4] s t a b -> Optic k (WithIx ix) s t a b -- | Flatten indices obtained from five indexed optics. icompose5 :: (i1 -> i2 -> i3 -> i4 -> i5 -> ix) -> Optic k '[i1, i2, i3, i4, i5] s t a b -> Optic k (WithIx ix) s t a b -- | Flatten indices obtained from arbitrary number of indexed optics. icomposeN :: forall k i (is :: IxList) s t a b. (CurryCompose is, NonEmptyIndices is) => Curry is i -> Optic k is s t a b -> Optic k (WithIx i) s t a b -- | A Functor with an additional index. -- -- Instances must satisfy a modified form of the Functor laws: -- --
-- imap f . imap g ≡ imap (\i -> f i . g i) -- imap (\_ a -> a) ≡ id --class Functor f => FunctorWithIndex i (f :: Type -> Type) | f -> i -- | Map with access to the index. imap :: FunctorWithIndex i f => (i -> a -> b) -> f a -> f b -- | A container that supports folding with an additional index. class Foldable f => FoldableWithIndex i (f :: Type -> Type) | f -> i -- | Fold a container by mapping value to an arbitrary Monoid with -- access to the index i. -- -- When you don't need access to the index then foldMap is more -- flexible in what it accepts. -- --
-- foldMap ≡ ifoldMap . const --ifoldMap :: (FoldableWithIndex i f, Monoid m) => (i -> a -> m) -> f a -> m -- | A variant of ifoldMap that is strict in the accumulator. ifoldMap' :: (FoldableWithIndex i f, Monoid m) => (i -> a -> m) -> f a -> m -- | Right-associative fold of an indexed container with access to the -- index i. -- -- When you don't need access to the index then foldr is more -- flexible in what it accepts. -- --
-- foldr ≡ ifoldr . const --ifoldr :: FoldableWithIndex i f => (i -> a -> b -> b) -> b -> f a -> b -- | Left-associative fold of an indexed container with access to the index -- i. -- -- When you don't need access to the index then foldl is more -- flexible in what it accepts. -- --
-- foldl ≡ ifoldl . const --ifoldl :: FoldableWithIndex i f => (i -> b -> a -> b) -> b -> f a -> b -- | Strictly fold right over the elements of a structure with -- access to the index i. -- -- When you don't need access to the index then foldr' is more -- flexible in what it accepts. -- --
-- foldr' ≡ ifoldr' . const --ifoldr' :: FoldableWithIndex i f => (i -> a -> b -> b) -> b -> f a -> b -- | Fold over the elements of a structure with an index, associating to -- the left, but strictly. -- -- When you don't need access to the index then foldlOf' is more -- flexible in what it accepts. -- --
-- foldlOf' l ≡ ifoldlOf' l . const --ifoldl' :: FoldableWithIndex i f => (i -> b -> a -> b) -> b -> f a -> b -- | Traverse elements with access to the index i, discarding the -- results. -- -- When you don't need access to the index then traverse_ is -- more flexible in what it accepts. -- --
-- traverse_ l = itraverse . const --itraverse_ :: (FoldableWithIndex i t, Applicative f) => (i -> a -> f b) -> t a -> f () -- | Traverse elements with access to the index i, discarding the -- results (with the arguments flipped). -- --
-- ifor_ ≡ flip itraverse_ ---- -- When you don't need access to the index then for_ is more -- flexible in what it accepts. -- --
-- for_ a ≡ ifor_ a . const --ifor_ :: (FoldableWithIndex i t, Applicative f) => t a -> (i -> a -> f b) -> f () -- | Extract the key-value pairs from a structure. -- -- When you don't need access to the indices in the result, then -- toList is more flexible in what it accepts. -- --
-- toList ≡ map snd . itoList --itoList :: FoldableWithIndex i f => f a -> [(i, a)] -- | A Traversable with an additional index. -- -- An instance must satisfy a (modified) form of the Traversable -- laws: -- --
-- itraverse (const Identity) ≡ Identity -- fmap (itraverse f) . itraverse g ≡ getCompose . itraverse (\i -> Compose . fmap (f i) . g i) --class (FunctorWithIndex i t, FoldableWithIndex i t, Traversable t) => TraversableWithIndex i (t :: Type -> Type) | t -> i -- | Traverse an indexed container. -- --
-- itraverse ≡ itraverseOf itraversed --itraverse :: (TraversableWithIndex i t, Applicative f) => (i -> a -> f b) -> t a -> f (t b) -- | Traverse with an index (and the arguments flipped). -- --
-- for a ≡ ifor a . const -- ifor ≡ flip itraverse --ifor :: (TraversableWithIndex i t, Applicative f) => t a -> (i -> a -> f b) -> f (t b) -- | This module defines the Each class, which provides an -- IxTraversal that extracts each element of a (potentially -- monomorphic) container. module Optics.Each -- | Extract each element of a (potentially monomorphic) container. -- --
-- >>> over each (*10) (1,2,3) -- (10,20,30) ---- --
-- >>> iover each (\i a -> a*10 + succ i) (1,2,3) -- (11,22,33) --class Each i s t a b | s -> i a, t -> i b, s b -> t, t a -> s each :: Each i s t a b => IxTraversal i s t a b instance (k GHC.Types.~ k') => Optics.Each.Core.Each k (Data.HashMap.Internal.HashMap k a) (Data.HashMap.Internal.HashMap k' b) a b instance Optics.Each.Core.Each GHC.Types.Int (Data.Vector.Vector a) (Data.Vector.Vector b) a b instance (Data.Primitive.Types.Prim a, Data.Primitive.Types.Prim b) => Optics.Each.Core.Each GHC.Types.Int (Data.Vector.Primitive.Vector a) (Data.Vector.Primitive.Vector b) a b instance (Foreign.Storable.Storable a, Foreign.Storable.Storable b) => Optics.Each.Core.Each GHC.Types.Int (Data.Vector.Storable.Vector a) (Data.Vector.Storable.Vector b) a b instance (Data.Vector.Unboxed.Base.Unbox a, Data.Vector.Unboxed.Base.Unbox b) => Optics.Each.Core.Each GHC.Types.Int (Data.Vector.Unboxed.Base.Vector a) (Data.Vector.Unboxed.Base.Vector b) a b instance (a GHC.Types.~ GHC.Types.Char, b GHC.Types.~ GHC.Types.Char) => Optics.Each.Core.Each GHC.Types.Int Data.Text.Internal.Text Data.Text.Internal.Text a b instance (a GHC.Types.~ GHC.Types.Char, b GHC.Types.~ GHC.Types.Char) => Optics.Each.Core.Each GHC.Types.Int Data.Text.Internal.Lazy.Text Data.Text.Internal.Lazy.Text a b instance (a GHC.Types.~ GHC.Word.Word8, b GHC.Types.~ GHC.Word.Word8) => Optics.Each.Core.Each GHC.Int.Int64 Data.ByteString.Internal.ByteString Data.ByteString.Internal.ByteString a b instance (a GHC.Types.~ GHC.Word.Word8, b GHC.Types.~ GHC.Word.Word8) => Optics.Each.Core.Each GHC.Int.Int64 Data.ByteString.Lazy.Internal.ByteString Data.ByteString.Lazy.Internal.ByteString a b -- | This module contains utilities for working with Setters in a -- MonadState context. If you prefer operator versions, you may -- wish to import Optics.State.Operators. module Optics.State -- | Map over the target(s) of an Optic in our monadic state. -- --
-- >>> execState (do modifying _1 (*10); modifying _2 $ stimes 5) (6,"o") -- (60,"ooooo") ---- --
-- >>> execState (modifying each $ stimes 2) ("a","b")
-- ("aa","bb")
--
modifying :: (Is k A_Setter, MonadState s m) => Optic k is s s a b -> (a -> b) -> m ()
-- | Version of modifying that is strict in both optic application
-- and state modification.
--
--
-- >>> flip evalState ('a','b') $ modifying _1 (errorWithoutStackTrace "oops")
-- ()
--
--
--
-- >>> flip evalState ('a','b') $ modifying' _1 (errorWithoutStackTrace "oops")
-- *** Exception: oops
--
modifying' :: (Is k A_Setter, MonadState s m) => Optic k is s s a b -> (a -> b) -> m ()
-- | Replace the target(s) of an Optic in our monadic state with a
-- new value, irrespective of the old.
--
--
-- >>> execState (do assign _1 'c'; assign _2 'd') ('a','b')
-- ('c','d')
--
--
--
-- >>> execState (assign each 'c') ('a','b')
-- ('c','c')
--
assign :: (Is k A_Setter, MonadState s m) => Optic k is s s a b -> b -> m ()
-- | Version of assign that is strict in both optic application and
-- state modification.
--
--
-- >>> flip evalState ('a','b') $ assign _1 (errorWithoutStackTrace "oops")
-- ()
--
--
--
-- >>> flip evalState ('a','b') $ assign' _1 (errorWithoutStackTrace "oops")
-- *** Exception: oops
--
assign' :: (Is k A_Setter, MonadState s m) => Optic k is s s a b -> b -> m ()
-- | Use the target of a Lens, Iso, or Getter in the
-- current state.
--
--
-- >>> evalState (use _1) ('a','b')
-- 'a'
--
--
--
-- >>> evalState (use _2) ("hello","world")
-- "world"
--
use :: (Is k A_Getter, MonadState s m) => Optic' k is s a -> m a
-- | Use the target of a AffineTraveral or AffineFold in
-- the current state.
--
-- -- >>> evalState (preuse $ _1 % _Right) (Right 'a','b') -- Just 'a' --preuse :: (Is k An_AffineFold, MonadState s m) => Optic' k is s a -> m (Maybe a) -- | EXPERIMENTAL module Optics.View -- | Generalized view (even more powerful than view from the lens -- library). -- -- View the value(s) pointed to by an optic. -- -- The type of the result depends on the optic. You get: -- --
-- >>> evalState (guse _1) ('a','b')
-- 'a'
--
--
--
-- >>> evalState (guse _2) ("hello","world")
-- "world"
--
guse :: (ViewableOptic k a, MonadState s m) => Optic' k is s a -> m (ViewResult k a)
-- | Use the target of a Lens, Iso or Getter in the
-- current state, or use a summary of a Fold or Traversal
-- that points to a monoidal value.
--
--
-- >>> evalState (guses _1 length) ("hello","world")
-- 5
--
guses :: (ViewableOptic k r, MonadState s m) => Optic' k is s a -> (a -> r) -> m (ViewResult k r)
-- | This is a generalized form of listen that only extracts the
-- portion of the log that is focused on by a Getter. If given a
-- Fold or a Traversal then a monoidal summary of the parts
-- of the log that are visited will be returned.
glistening :: (ViewableOptic k r, MonadWriter s m) => Optic' k is s r -> m a -> m (a, ViewResult k r)
-- | This is a generalized form of listen that only extracts the
-- portion of the log that is focused on by a Getter. If given a
-- Fold or a Traversal then a monoidal summary of the parts
-- of the log that are visited will be returned.
glistenings :: (ViewableOptic k r, MonadWriter s m) => Optic' k is s a -> (a -> r) -> m b -> m (b, ViewResult k r)
instance Optics.View.ViewableOptic Optics.Internal.Optic.Types.An_Iso r
instance Optics.View.ViewableOptic Optics.Internal.Optic.Types.A_Lens r
instance Optics.View.ViewableOptic Optics.Internal.Optic.Types.A_ReversedPrism r
instance Optics.View.ViewableOptic Optics.Internal.Optic.Types.A_Getter r
instance Optics.View.ViewableOptic Optics.Internal.Optic.Types.A_Prism r
instance Optics.View.ViewableOptic Optics.Internal.Optic.Types.An_AffineTraversal r
instance Optics.View.ViewableOptic Optics.Internal.Optic.Types.An_AffineFold r
instance GHC.Base.Monoid r => Optics.View.ViewableOptic Optics.Internal.Optic.Types.A_Traversal r
instance GHC.Base.Monoid r => Optics.View.ViewableOptic Optics.Internal.Optic.Types.A_Fold r
module Optics.Passthrough
class (Is k A_Traversal, ViewableOptic k r) => PermeableOptic k r
-- | Modify the target of an Optic returning extra information of
-- type r.
passthrough :: PermeableOptic k r => Optic k is s t a b -> (a -> (r, b)) -> s -> (ViewResult k r, t)
instance Optics.Passthrough.PermeableOptic Optics.Internal.Optic.Types.An_Iso r
instance Optics.Passthrough.PermeableOptic Optics.Internal.Optic.Types.A_Lens r
instance Optics.Passthrough.PermeableOptic Optics.Internal.Optic.Types.A_Prism r
instance Optics.Passthrough.PermeableOptic Optics.Internal.Optic.Types.An_AffineTraversal r
instance GHC.Base.Monoid r => Optics.Passthrough.PermeableOptic Optics.Internal.Optic.Types.A_Traversal r
-- | Defines infix operators for the operations in Optics.State.
-- These operators are not exposed by the main Optics module,
-- but must be imported explicitly.
module Optics.State.Operators
-- | Replace the target(s) of an Optic in our monadic state with a
-- new value, irrespective of the old.
--
-- This is an infix version of assign.
(.=) :: (Is k A_Setter, MonadState s m) => Optic k is s s a b -> b -> m ()
infix 4 .=
-- | Replace the target(s) of an Optic in our monadic state with
-- Just a new value, irrespective of the old.
(?=) :: (Is k A_Setter, MonadState s m) => Optic k is s s (Maybe a) (Maybe b) -> b -> m ()
infix 4 ?=
-- | Map over the target(s) of an Optic in our monadic state.
--
-- This is an infix version of modifying.
(%=) :: (Is k A_Setter, MonadState s m) => Optic k is s s a b -> (a -> b) -> m ()
infix 4 %=
-- | Modify the target of an PermeableOptic in the current state
-- returning some extra information of type depending on the optic
-- (r, Maybe r or monoidal summary).
(%%=) :: (PermeableOptic k r, MonadState s m) => Optic k is s s a b -> (a -> (r, b)) -> m (ViewResult k r)
infix 4 %%=
-- | Set with pass-through.
--
-- This is useful for chaining assignment without round-tripping through
-- your Monad stack.
(<.=) :: (PermeableOptic k b, MonadState s m) => Optic k is s s a b -> b -> m (ViewResult k b)
infix 4 <.=
-- | Set Just a value with pass-through.
--
-- This is useful for chaining assignment without round-tripping through
-- your Monad stack.
(=) :: (PermeableOptic k (Maybe b), MonadState s m) => Optic k is s s (Maybe a) (Maybe b) -> b -> m (ViewResult k (Maybe b))
infix 4 =
-- | Modify the target of a PermeableOptic into your
-- Monad's state by a user supplied function and return the
-- result.
(<%=) :: (PermeableOptic k b, MonadState s m) => Optic k is s s a b -> (a -> b) -> m (ViewResult k b)
infix 4 <%=
-- | Replace the target of a PermeableOptic into your
-- Monad's state with a user supplied value and return the
-- old value that was replaced.
(<<.=) :: (PermeableOptic k a, MonadState s m) => Optic k is s s a b -> b -> m (ViewResult k a)
infix 4 <<.=
-- | Replace the target of a PermeableOptic into your
-- Monad's state with Just a user supplied value and
-- return the old value that was replaced.
(<=) :: (PermeableOptic k (Maybe a), MonadState s m) => Optic k is s s (Maybe a) (Maybe b) -> b -> m (ViewResult k (Maybe a))
infix 4 <=
-- | Modify the target of a PermeableOptic into your
-- Monad's state by a user supplied function and return the
-- old value that was replaced.
(<<%=) :: (PermeableOptic k a, MonadState s m) => Optic k is s s a b -> (a -> b) -> m (ViewResult k a)
infix 4 <<%=
class (Is k A_Traversal, ViewableOptic k r) => PermeableOptic k r
-- | Modify the target of an Optic returning extra information of
-- type r.
passthrough :: PermeableOptic k r => Optic k is s t a b -> (a -> (r, b)) -> s -> (ViewResult k r, t)
module Optics.Zoom
-- | This class allows us to zoom in, changing the State
-- supplied by many different monad transformers, potentially quite deep
-- in a monad transformer stack.
--
-- Its functions can be used to run a monadic action in a larger
-- State than it was defined in, using a Lens', an
-- AffineTraversal' or a Traversal'.
--
-- This is commonly used to lift actions in a simpler State
-- Monad into a State Monad with a larger
-- State type.
--
-- When used with a Traversal' over multiple values, the actions
-- for each target are executed sequentially and the results are
-- aggregated.
--
-- This can be used to edit pretty much any Monad transformer
-- stack with a State in it!
--
--
-- >>> flip L.evalState ('a','b') $ zoom _1 $ use equality
-- 'a'
--
--
--
-- >>> flip S.execState ('a','b') $ zoom _1 $ equality .= 'c'
-- ('c','b')
--
--
-- -- >>> flip L.execState [(1,2),(3,4)] $ zoomMany traversed $ _2 %= (*10) -- [(1,20),(3,40)] ---- --
-- >>> flip S.runState [('a',"b"),('c',"d")] $ zoomMany traversed $ _2 <%= (\x -> x <> x)
-- ("bbdd",[('a',"bb"),('c',"dd")])
--
--
--
-- >>> flip S.evalState ("a","b") $ zoomMany each (use equality)
-- "ab"
--
class (MonadState s m, MonadState t n) => Zoom m n s t | m -> s, n -> t, m t -> n, n s -> m
zoom :: (Zoom m n s t, Is k A_Lens) => Optic' k is t s -> m c -> n c
zoomMaybe :: (Zoom m n s t, Is k An_AffineTraversal) => Optic' k is t s -> m c -> n (Maybe c)
zoomMany :: (Zoom m n s t, Is k A_Traversal, Monoid c) => Optic' k is t s -> m c -> n c
infixr 2 `zoom`
infixr 2 `zoomMaybe`
infixr 2 `zoomMany`
-- | This class allows us to magnify part of the environment,
-- changing the environment supplied by many different Monad
-- transformers. Unlike zoom this can change the environment of a
-- deeply nested Monad transformer.
--
-- Its functions can be used to run a monadic action in a larger
-- environment than it was defined in, using a Getter or an
-- AffineFold.
--
-- They act like local, but can in many cases change the type of
-- the environment as well.
--
-- They're commonly used to lift actions in a simpler Reader
-- Monad into a Monad with a larger environment type.
--
-- They can be used to edit pretty much any Monad transformer
-- stack with an environment in it:
--
-- -- >>> (1,2) & magnify _2 (+1) -- 3 ---- --
-- >>> flip runReader (1,2) $ magnify _1 ask -- 1 ---- --
-- >>> flip runReader (1,2,[10..20]) $ magnifyMaybe (_3 % _tail) ask -- Just [11,12,13,14,15,16,17,18,19,20] --class (MonadReader b m, MonadReader a n) => Magnify m n b a | m -> b, n -> a, m a -> n, n b -> m magnify :: (Magnify m n b a, Is k A_Getter) => Optic' k is a b -> m c -> n c magnifyMaybe :: (Magnify m n b a, Is k An_AffineFold) => Optic' k is a b -> m c -> n (Maybe c) infixr 2 `magnify` infixr 2 `magnifyMaybe` -- | Extends Magnify with an ability to magnify using a Fold -- over multiple targets so that actions for each one are executed -- sequentially and the results are aggregated. -- -- There is however no sensible instance of MagnifyMany for -- StateT. class (MonadReader b m, MonadReader a n, Magnify m n b a) => MagnifyMany m n b a | m -> b, n -> a, m a -> n, n b -> m magnifyMany :: (MagnifyMany m n b a, Is k A_Fold, Monoid c) => Optic' k is a b -> m c -> n c infixr 2 `magnifyMany` instance Optics.Zoom.MagnifyMany ((->) b) ((->) a) b a instance GHC.Base.Monad m => Optics.Zoom.MagnifyMany (Control.Monad.Trans.Reader.ReaderT b m) (Control.Monad.Trans.Reader.ReaderT a m) b a instance (GHC.Base.Monad m, GHC.Base.Monoid w) => Optics.Zoom.MagnifyMany (Control.Monad.Trans.RWS.Strict.RWST b w s m) (Control.Monad.Trans.RWS.Strict.RWST a w s m) b a instance (GHC.Base.Monad m, GHC.Base.Monoid w) => Optics.Zoom.MagnifyMany (Control.Monad.Trans.RWS.Lazy.RWST b w s m) (Control.Monad.Trans.RWS.Lazy.RWST a w s m) b a instance Optics.Zoom.MagnifyMany m n b a => Optics.Zoom.MagnifyMany (Control.Monad.Trans.Identity.IdentityT m) (Control.Monad.Trans.Identity.IdentityT n) b a instance (GHC.Base.Monoid w, Optics.Zoom.MagnifyMany m n b a) => Optics.Zoom.MagnifyMany (Control.Monad.Trans.Writer.Strict.WriterT w m) (Control.Monad.Trans.Writer.Strict.WriterT w n) b a instance (GHC.Base.Monoid w, Optics.Zoom.MagnifyMany m n b a) => Optics.Zoom.MagnifyMany (Control.Monad.Trans.Writer.Lazy.WriterT w m) (Control.Monad.Trans.Writer.Lazy.WriterT w n) b a instance Optics.Zoom.MagnifyMany m n b a => Optics.Zoom.MagnifyMany (Control.Monad.Trans.List.ListT m) (Control.Monad.Trans.List.ListT n) b a instance Optics.Zoom.MagnifyMany m n b a => Optics.Zoom.MagnifyMany (Control.Monad.Trans.Maybe.MaybeT m) (Control.Monad.Trans.Maybe.MaybeT n) b a instance (Control.Monad.Trans.Error.Error e, Optics.Zoom.MagnifyMany m n b a) => Optics.Zoom.MagnifyMany (Control.Monad.Trans.Error.ErrorT e m) (Control.Monad.Trans.Error.ErrorT e n) b a instance Optics.Zoom.MagnifyMany m n b a => Optics.Zoom.MagnifyMany (Control.Monad.Trans.Except.ExceptT e m) (Control.Monad.Trans.Except.ExceptT e n) b a instance Optics.Zoom.Magnify ((->) b) ((->) a) b a instance GHC.Base.Monad m => Optics.Zoom.Magnify (Control.Monad.Trans.Reader.ReaderT b m) (Control.Monad.Trans.Reader.ReaderT a m) b a instance (GHC.Base.Monad m, GHC.Base.Monoid w) => Optics.Zoom.Magnify (Control.Monad.Trans.RWS.Strict.RWST b w s m) (Control.Monad.Trans.RWS.Strict.RWST a w s m) b a instance (GHC.Base.Monad m, GHC.Base.Monoid w) => Optics.Zoom.Magnify (Control.Monad.Trans.RWS.Lazy.RWST b w s m) (Control.Monad.Trans.RWS.Lazy.RWST a w s m) b a instance Optics.Zoom.Magnify m n b a => Optics.Zoom.Magnify (Control.Monad.Trans.Identity.IdentityT m) (Control.Monad.Trans.Identity.IdentityT n) b a instance Optics.Zoom.Magnify m n b a => Optics.Zoom.Magnify (Control.Monad.Trans.State.Strict.StateT s m) (Control.Monad.Trans.State.Strict.StateT s n) b a instance Optics.Zoom.Magnify m n b a => Optics.Zoom.Magnify (Control.Monad.Trans.State.Lazy.StateT s m) (Control.Monad.Trans.State.Lazy.StateT s n) b a instance (GHC.Base.Monoid w, Optics.Zoom.Magnify m n b a) => Optics.Zoom.Magnify (Control.Monad.Trans.Writer.Strict.WriterT w m) (Control.Monad.Trans.Writer.Strict.WriterT w n) b a instance (GHC.Base.Monoid w, Optics.Zoom.Magnify m n b a) => Optics.Zoom.Magnify (Control.Monad.Trans.Writer.Lazy.WriterT w m) (Control.Monad.Trans.Writer.Lazy.WriterT w n) b a instance Optics.Zoom.Magnify m n b a => Optics.Zoom.Magnify (Control.Monad.Trans.List.ListT m) (Control.Monad.Trans.List.ListT n) b a instance Optics.Zoom.Magnify m n b a => Optics.Zoom.Magnify (Control.Monad.Trans.Maybe.MaybeT m) (Control.Monad.Trans.Maybe.MaybeT n) b a instance (Control.Monad.Trans.Error.Error e, Optics.Zoom.Magnify m n b a) => Optics.Zoom.Magnify (Control.Monad.Trans.Error.ErrorT e m) (Control.Monad.Trans.Error.ErrorT e n) b a instance Optics.Zoom.Magnify m n b a => Optics.Zoom.Magnify (Control.Monad.Trans.Except.ExceptT e m) (Control.Monad.Trans.Except.ExceptT e n) b a instance GHC.Base.Monad m => Optics.Zoom.Zoom (Control.Monad.Trans.State.Strict.StateT s m) (Control.Monad.Trans.State.Strict.StateT t m) s t instance GHC.Base.Monad m => Optics.Zoom.Zoom (Control.Monad.Trans.State.Lazy.StateT s m) (Control.Monad.Trans.State.Lazy.StateT t m) s t instance Optics.Zoom.Zoom m n s t => Optics.Zoom.Zoom (Control.Monad.Trans.Reader.ReaderT e m) (Control.Monad.Trans.Reader.ReaderT e n) s t instance Optics.Zoom.Zoom m n s t => Optics.Zoom.Zoom (Control.Monad.Trans.Identity.IdentityT m) (Control.Monad.Trans.Identity.IdentityT n) s t instance (GHC.Base.Monoid w, GHC.Base.Monad m) => Optics.Zoom.Zoom (Control.Monad.Trans.RWS.Strict.RWST r w s m) (Control.Monad.Trans.RWS.Strict.RWST r w t m) s t instance (GHC.Base.Monoid w, GHC.Base.Monad m) => Optics.Zoom.Zoom (Control.Monad.Trans.RWS.Lazy.RWST r w s m) (Control.Monad.Trans.RWS.Lazy.RWST r w t m) s t instance (GHC.Base.Monoid w, Optics.Zoom.Zoom m n s t) => Optics.Zoom.Zoom (Control.Monad.Trans.Writer.Strict.WriterT w m) (Control.Monad.Trans.Writer.Strict.WriterT w n) s t instance (GHC.Base.Monoid w, Optics.Zoom.Zoom m n s t) => Optics.Zoom.Zoom (Control.Monad.Trans.Writer.Lazy.WriterT w m) (Control.Monad.Trans.Writer.Lazy.WriterT w n) s t instance Optics.Zoom.Zoom m n s t => Optics.Zoom.Zoom (Control.Monad.Trans.List.ListT m) (Control.Monad.Trans.List.ListT n) s t instance Optics.Zoom.Zoom m n s t => Optics.Zoom.Zoom (Control.Monad.Trans.Maybe.MaybeT m) (Control.Monad.Trans.Maybe.MaybeT n) s t instance (Control.Monad.Trans.Error.Error e, Optics.Zoom.Zoom m n s t) => Optics.Zoom.Zoom (Control.Monad.Trans.Error.ErrorT e m) (Control.Monad.Trans.Error.ErrorT e n) s t instance Optics.Zoom.Zoom m n s t => Optics.Zoom.Zoom (Control.Monad.Trans.Except.ExceptT e m) (Control.Monad.Trans.Except.ExceptT e n) s t module Optics.Extra