| Copyright | (c) 2011-2015 diagrams-lib team (see LICENSE) |
|---|---|
| License | BSD-style (see LICENSE) |
| Maintainer | diagrams-discuss@googlegroups.com |
| Safe Haskell | None |
| Language | Haskell2010 |
Diagrams.Prelude
Description
A module to re-export most of the functionality of the diagrams core and standard library.
Synopsis
- module Diagrams
- class Default a where
- def :: a
- class ColourOps (f :: Type -> Type) where
- data AlphaColour a
- data Colour a
- colourConvert :: (Fractional b, Real a) => Colour a -> Colour b
- black :: Num a => Colour a
- transparent :: Num a => AlphaColour a
- alphaColourConvert :: (Fractional b, Real a) => AlphaColour a -> AlphaColour b
- opaque :: Num a => Colour a -> AlphaColour a
- dissolve :: Num a => a -> AlphaColour a -> AlphaColour a
- withOpacity :: Num a => Colour a -> a -> AlphaColour a
- blend :: (Num a, AffineSpace f) => a -> f a -> f a -> f a
- alphaChannel :: AlphaColour a -> a
- black :: Num a => Colour a
- readColourName :: (MonadFail m, Monad m, Ord a, Floating a) => String -> m (Colour a)
- aliceblue :: (Ord a, Floating a) => Colour a
- antiquewhite :: (Ord a, Floating a) => Colour a
- aqua :: (Ord a, Floating a) => Colour a
- aquamarine :: (Ord a, Floating a) => Colour a
- azure :: (Ord a, Floating a) => Colour a
- beige :: (Ord a, Floating a) => Colour a
- bisque :: (Ord a, Floating a) => Colour a
- blanchedalmond :: (Ord a, Floating a) => Colour a
- blue :: (Ord a, Floating a) => Colour a
- blueviolet :: (Ord a, Floating a) => Colour a
- brown :: (Ord a, Floating a) => Colour a
- burlywood :: (Ord a, Floating a) => Colour a
- cadetblue :: (Ord a, Floating a) => Colour a
- chartreuse :: (Ord a, Floating a) => Colour a
- chocolate :: (Ord a, Floating a) => Colour a
- coral :: (Ord a, Floating a) => Colour a
- cornflowerblue :: (Ord a, Floating a) => Colour a
- cornsilk :: (Ord a, Floating a) => Colour a
- crimson :: (Ord a, Floating a) => Colour a
- cyan :: (Ord a, Floating a) => Colour a
- darkblue :: (Ord a, Floating a) => Colour a
- darkcyan :: (Ord a, Floating a) => Colour a
- darkgoldenrod :: (Ord a, Floating a) => Colour a
- darkgray :: (Ord a, Floating a) => Colour a
- darkgreen :: (Ord a, Floating a) => Colour a
- darkgrey :: (Ord a, Floating a) => Colour a
- darkkhaki :: (Ord a, Floating a) => Colour a
- darkmagenta :: (Ord a, Floating a) => Colour a
- darkolivegreen :: (Ord a, Floating a) => Colour a
- darkorange :: (Ord a, Floating a) => Colour a
- darkorchid :: (Ord a, Floating a) => Colour a
- darkred :: (Ord a, Floating a) => Colour a
- darksalmon :: (Ord a, Floating a) => Colour a
- darkseagreen :: (Ord a, Floating a) => Colour a
- darkslateblue :: (Ord a, Floating a) => Colour a
- darkslategray :: (Ord a, Floating a) => Colour a
- darkslategrey :: (Ord a, Floating a) => Colour a
- darkturquoise :: (Ord a, Floating a) => Colour a
- darkviolet :: (Ord a, Floating a) => Colour a
- deeppink :: (Ord a, Floating a) => Colour a
- deepskyblue :: (Ord a, Floating a) => Colour a
- dimgray :: (Ord a, Floating a) => Colour a
- dimgrey :: (Ord a, Floating a) => Colour a
- dodgerblue :: (Ord a, Floating a) => Colour a
- firebrick :: (Ord a, Floating a) => Colour a
- floralwhite :: (Ord a, Floating a) => Colour a
- forestgreen :: (Ord a, Floating a) => Colour a
- fuchsia :: (Ord a, Floating a) => Colour a
- gainsboro :: (Ord a, Floating a) => Colour a
- ghostwhite :: (Ord a, Floating a) => Colour a
- gold :: (Ord a, Floating a) => Colour a
- goldenrod :: (Ord a, Floating a) => Colour a
- gray :: (Ord a, Floating a) => Colour a
- grey :: (Ord a, Floating a) => Colour a
- green :: (Ord a, Floating a) => Colour a
- greenyellow :: (Ord a, Floating a) => Colour a
- honeydew :: (Ord a, Floating a) => Colour a
- hotpink :: (Ord a, Floating a) => Colour a
- indianred :: (Ord a, Floating a) => Colour a
- indigo :: (Ord a, Floating a) => Colour a
- ivory :: (Ord a, Floating a) => Colour a
- khaki :: (Ord a, Floating a) => Colour a
- lavender :: (Ord a, Floating a) => Colour a
- lavenderblush :: (Ord a, Floating a) => Colour a
- lawngreen :: (Ord a, Floating a) => Colour a
- lemonchiffon :: (Ord a, Floating a) => Colour a
- lightblue :: (Ord a, Floating a) => Colour a
- lightcoral :: (Ord a, Floating a) => Colour a
- lightcyan :: (Ord a, Floating a) => Colour a
- lightgoldenrodyellow :: (Ord a, Floating a) => Colour a
- lightgray :: (Ord a, Floating a) => Colour a
- lightgreen :: (Ord a, Floating a) => Colour a
- lightgrey :: (Ord a, Floating a) => Colour a
- lightpink :: (Ord a, Floating a) => Colour a
- lightsalmon :: (Ord a, Floating a) => Colour a
- lightseagreen :: (Ord a, Floating a) => Colour a
- lightskyblue :: (Ord a, Floating a) => Colour a
- lightslategray :: (Ord a, Floating a) => Colour a
- lightslategrey :: (Ord a, Floating a) => Colour a
- lightsteelblue :: (Ord a, Floating a) => Colour a
- lightyellow :: (Ord a, Floating a) => Colour a
- lime :: (Ord a, Floating a) => Colour a
- limegreen :: (Ord a, Floating a) => Colour a
- linen :: (Ord a, Floating a) => Colour a
- magenta :: (Ord a, Floating a) => Colour a
- maroon :: (Ord a, Floating a) => Colour a
- mediumaquamarine :: (Ord a, Floating a) => Colour a
- mediumblue :: (Ord a, Floating a) => Colour a
- mediumorchid :: (Ord a, Floating a) => Colour a
- mediumpurple :: (Ord a, Floating a) => Colour a
- mediumseagreen :: (Ord a, Floating a) => Colour a
- mediumslateblue :: (Ord a, Floating a) => Colour a
- mediumspringgreen :: (Ord a, Floating a) => Colour a
- mediumturquoise :: (Ord a, Floating a) => Colour a
- mediumvioletred :: (Ord a, Floating a) => Colour a
- midnightblue :: (Ord a, Floating a) => Colour a
- mintcream :: (Ord a, Floating a) => Colour a
- mistyrose :: (Ord a, Floating a) => Colour a
- moccasin :: (Ord a, Floating a) => Colour a
- navajowhite :: (Ord a, Floating a) => Colour a
- navy :: (Ord a, Floating a) => Colour a
- oldlace :: (Ord a, Floating a) => Colour a
- olive :: (Ord a, Floating a) => Colour a
- olivedrab :: (Ord a, Floating a) => Colour a
- orange :: (Ord a, Floating a) => Colour a
- orangered :: (Ord a, Floating a) => Colour a
- orchid :: (Ord a, Floating a) => Colour a
- palegoldenrod :: (Ord a, Floating a) => Colour a
- palegreen :: (Ord a, Floating a) => Colour a
- paleturquoise :: (Ord a, Floating a) => Colour a
- palevioletred :: (Ord a, Floating a) => Colour a
- papayawhip :: (Ord a, Floating a) => Colour a
- peachpuff :: (Ord a, Floating a) => Colour a
- peru :: (Ord a, Floating a) => Colour a
- pink :: (Ord a, Floating a) => Colour a
- plum :: (Ord a, Floating a) => Colour a
- powderblue :: (Ord a, Floating a) => Colour a
- purple :: (Ord a, Floating a) => Colour a
- red :: (Ord a, Floating a) => Colour a
- rosybrown :: (Ord a, Floating a) => Colour a
- royalblue :: (Ord a, Floating a) => Colour a
- saddlebrown :: (Ord a, Floating a) => Colour a
- salmon :: (Ord a, Floating a) => Colour a
- sandybrown :: (Ord a, Floating a) => Colour a
- seagreen :: (Ord a, Floating a) => Colour a
- seashell :: (Ord a, Floating a) => Colour a
- sienna :: (Ord a, Floating a) => Colour a
- silver :: (Ord a, Floating a) => Colour a
- skyblue :: (Ord a, Floating a) => Colour a
- slateblue :: (Ord a, Floating a) => Colour a
- slategray :: (Ord a, Floating a) => Colour a
- slategrey :: (Ord a, Floating a) => Colour a
- snow :: (Ord a, Floating a) => Colour a
- springgreen :: (Ord a, Floating a) => Colour a
- steelblue :: (Ord a, Floating a) => Colour a
- teal :: (Ord a, Floating a) => Colour a
- thistle :: (Ord a, Floating a) => Colour a
- tomato :: (Ord a, Floating a) => Colour a
- turquoise :: (Ord a, Floating a) => Colour a
- violet :: (Ord a, Floating a) => Colour a
- wheat :: (Ord a, Floating a) => Colour a
- white :: (Ord a, Floating a) => Colour a
- whitesmoke :: (Ord a, Floating a) => Colour a
- yellow :: (Ord a, Floating a) => Colour a
- yellowgreen :: (Ord a, Floating a) => Colour a
- data Colour a
- data RGB a = RGB {
- channelRed :: !a
- channelGreen :: !a
- channelBlue :: !a
- sRGB :: (Ord b, Floating b) => b -> b -> b -> Colour b
- sRGBBounded :: (Ord b, Floating b, Integral a, Bounded a) => a -> a -> a -> Colour b
- sRGB24 :: (Ord b, Floating b) => Word8 -> Word8 -> Word8 -> Colour b
- toSRGB :: (Ord b, Floating b) => Colour b -> RGB b
- toSRGBBounded :: (RealFrac b, Floating b, Integral a, Bounded a) => Colour b -> RGB a
- toSRGB24 :: (RealFrac b, Floating b) => Colour b -> RGB Word8
- sRGB24shows :: (RealFrac b, Floating b) => Colour b -> ShowS
- sRGB24show :: (RealFrac b, Floating b) => Colour b -> String
- sRGB24reads :: (Ord b, Floating b) => ReadS (Colour b)
- sRGB24read :: (Ord b, Floating b) => String -> Colour b
- sRGBSpace :: (Ord a, Floating a) => RGBSpace a
- module Data.Semigroup
- module Linear.Vector
- module Linear.Affine
- module Linear.Metric
- module Data.Active
- lens :: (s -> a) -> (s -> b -> t) -> Lens s t a b
- strict :: Strict lazy strict => Iso' lazy strict
- type Traversal s t a b = forall (f :: Type -> Type). Applicative f => (a -> f b) -> s -> f t
- newtype ReifiedTraversal s t a b = Traversal {
- runTraversal :: Traversal s t a b
- pattern Empty :: AsEmpty s => s
- type Fold s a = forall (f :: Type -> Type). (Contravariant f, Applicative f) => (a -> f a) -> s -> f s
- newtype ReifiedFold s a = Fold {}
- pattern List :: IsList l => [Item l] -> l
- index :: (Indexable i p, Eq i, Applicative f) => i -> Optical' p (Indexed i) f a a
- class Contravariant (f :: Type -> Type) where
- class (forall a. Functor (p a)) => Bifunctor (p :: Type -> Type -> Type) where
- bimap :: (a -> b) -> (c -> d) -> p a c -> p b d
- lazy :: Strict lazy strict => Iso' strict lazy
- class (Functor t, Foldable t) => Traversable (t :: Type -> Type) where
- traverse :: Applicative f => (a -> f b) -> t a -> f (t b)
- uncons :: Cons s s a a => s -> Maybe (a, s)
- unsnoc :: Snoc s s a a => s -> Maybe (s, a)
- (<&>) :: Functor f => f a -> (a -> b) -> f b
- (&) :: a -> (a -> b) -> b
- data (a :: k) :~: (b :: k) where
- from :: AnIso s t a b -> Iso b a t s
- to :: (Profunctor p, Contravariant f) => (s -> a) -> Optic' p f s a
- newtype Const a (b :: k) = Const {
- getConst :: a
- newtype Identity a = Identity {
- runIdentity :: a
- (<|) :: Cons s s a a => a -> s -> s
- cons :: Cons s s a a => a -> s -> s
- snoc :: Snoc s s a a => s -> a -> s
- over :: ASetter s t a b -> (a -> b) -> s -> t
- pattern (:>) :: Snoc a a b b => a -> b -> a
- pattern (:<) :: Cons b b a a => a -> b -> b
- (|>) :: Snoc s s a a => s -> a -> s
- pattern Strict :: Strict s t => t -> s
- pattern Lazy :: Strict t s => t -> s
- type Iso s t a b = forall (p :: Type -> Type -> Type) (f :: Type -> Type). (Profunctor p, Functor f) => p a (f b) -> p s (f t)
- newtype ReifiedIso s t a b = Iso {}
- type IndexedTraversal i s t a b = forall (p :: Type -> Type -> Type) (f :: Type -> Type). (Indexable i p, Applicative f) => p a (f b) -> s -> f t
- newtype ReifiedIndexedTraversal i s t a b = IndexedTraversal {
- runIndexedTraversal :: IndexedTraversal i s t a b
- type IndexedFold i s a = forall (p :: Type -> Type -> Type) (f :: Type -> Type). (Indexable i p, Contravariant f, Applicative f) => p a (f a) -> s -> f s
- newtype ReifiedIndexedFold i s a = IndexedFold {
- runIndexedFold :: IndexedFold i s a
- type Prism s t a b = forall (p :: Type -> Type -> Type) (f :: Type -> Type). (Choice p, Applicative f) => p a (f b) -> p s (f t)
- newtype ReifiedPrism s t a b = Prism {}
- type Lens s t a b = forall (f :: Type -> Type). Functor f => (a -> f b) -> s -> f t
- newtype ReifiedLens s t a b = Lens {}
- type IndexedLens i s t a b = forall (f :: Type -> Type) (p :: Type -> Type -> Type). (Indexable i p, Functor f) => p a (f b) -> s -> f t
- newtype ReifiedIndexedLens i s t a b = IndexedLens {
- runIndexedLens :: IndexedLens i s t a b
- type Getter s a = forall (f :: Type -> Type). (Contravariant f, Functor f) => (a -> f a) -> s -> f s
- newtype ReifiedGetter s a = Getter {}
- type IndexedGetter i s a = forall (p :: Type -> Type -> Type) (f :: Type -> Type). (Indexable i p, Contravariant f, Functor f) => p a (f a) -> s -> f s
- newtype ReifiedIndexedGetter i s a = IndexedGetter {
- runIndexedGetter :: IndexedGetter i s a
- type LensLike (f :: k -> Type) s (t :: k) a (b :: k) = (a -> f b) -> s -> f t
- type Over (p :: k -> Type -> Type) (f :: k1 -> Type) s (t :: k1) (a :: k) (b :: k1) = p a (f b) -> s -> f t
- lastOf :: Getting (Rightmost a) s a -> s -> Maybe a
- firstOf :: Getting (Leftmost a) s a -> s -> Maybe a
- traverse1Of_ :: Functor f => Getting (TraversedF r f) s a -> (a -> f r) -> s -> f ()
- traverseOf_ :: Functor f => Getting (Traversed r f) s a -> (a -> f r) -> s -> f ()
- cloneLens :: ALens s t a b -> Lens s t a b
- newtype Bazaar (p :: Type -> Type -> Type) a b t = Bazaar {
- runBazaar :: forall (f :: Type -> Type). Applicative f => p a (f b) -> f t
- taking :: (Conjoined p, Applicative f) => Int -> Traversing p f s t a a -> Over p f s t a a
- type Setter s t a b = forall (f :: Type -> Type). Settable f => (a -> f b) -> s -> f t
- newtype ReifiedSetter s t a b = Setter {}
- class (MonadState s m, MonadState t n) => Zoom (m :: Type -> Type) (n :: Type -> Type) s t | m -> s, n -> t, m t -> n, n s -> m where
- traversed :: forall (f :: Type -> Type) a b. Traversable f => IndexedTraversal Int (f a) (f b) a b
- type Getting r s a = (a -> Const r a) -> s -> Const r s
- foldMapOf :: Getting r s a -> (a -> r) -> s -> r
- re :: AReview t b -> Getter b t
- review :: MonadReader b m => AReview t b -> m t
- preview :: MonadReader s m => Getting (First a) s a -> m (Maybe a)
- (^?) :: s -> Getting (First a) s a -> Maybe a
- matching :: APrism s t a b -> s -> Either t a
- lengthOf :: Getting (Endo (Endo Int)) s a -> s -> Int
- prism :: (b -> t) -> (s -> Either t a) -> Prism s t a b
- type Simple (f :: k1 -> k1 -> k2 -> k2 -> k) (s :: k1) (a :: k2) = f s s a a
- set :: ASetter s t a b -> b -> s -> t
- view :: MonadReader s m => Getting a s a -> m a
- cloneTraversal :: ATraversal s t a b -> Traversal s t a b
- use :: MonadState s m => Getting a s a -> m a
- class Field2 s t a b | s -> a, t -> b, s b -> t, t a -> s where
- class Functor f => FunctorWithIndex i (f :: Type -> Type) | f -> i where
- imap :: (i -> a -> b) -> f a -> f b
- type Traversal' s a = Traversal s s a a
- type Setter' s a = Setter s s a a
- (^.) :: s -> Getting a s a -> a
- (.~) :: ASetter s t a b -> b -> s -> t
- (%~) :: ASetter s t a b -> (a -> b) -> s -> t
- (+~) :: Num a => ASetter s t a a -> a -> s -> t
- type Iso' s a = Iso s s a a
- (-~) :: Num a => ASetter s t a a -> a -> s -> t
- (*~) :: Num a => ASetter s t a a -> a -> s -> t
- (//~) :: Fractional a => ASetter s t a a -> a -> s -> t
- (^~) :: (Num a, Integral e) => ASetter s t a a -> e -> s -> t
- (^^~) :: (Fractional a, Integral e) => ASetter s t a a -> e -> s -> t
- (**~) :: Floating a => ASetter s t a a -> a -> s -> t
- (||~) :: ASetter s t Bool Bool -> Bool -> s -> t
- (&&~) :: ASetter s t Bool Bool -> Bool -> s -> t
- (?~) :: ASetter s t a (Maybe b) -> b -> s -> t
- (<>~) :: Semigroup a => ASetter s t a a -> a -> s -> t
- (%=) :: MonadState s m => ASetter s s a b -> (a -> b) -> m ()
- (+=) :: (MonadState s m, Num a) => ASetter' s a -> a -> m ()
- (-=) :: (MonadState s m, Num a) => ASetter' s a -> a -> m ()
- (*=) :: (MonadState s m, Num a) => ASetter' s a -> a -> m ()
- (//=) :: (MonadState s m, Fractional a) => ASetter' s a -> a -> m ()
- (^=) :: (MonadState s m, Num a, Integral e) => ASetter' s a -> e -> m ()
- (^^=) :: (MonadState s m, Fractional a, Integral e) => ASetter' s a -> e -> m ()
- (**=) :: (MonadState s m, Floating a) => ASetter' s a -> a -> m ()
- (||=) :: MonadState s m => ASetter' s Bool -> Bool -> m ()
- (&&=) :: MonadState s m => ASetter' s Bool -> Bool -> m ()
- (.=) :: MonadState s m => ASetter s s a b -> b -> m ()
- (?=) :: MonadState s m => ASetter s s a (Maybe b) -> b -> m ()
- (<>=) :: (MonadState s m, Semigroup a) => ASetter' s a -> a -> m ()
- (<>:~) :: Semigroup b => ASetter s t b b -> b -> s -> t
- (<>:=) :: (MonadState s m, Semigroup a) => ASetter' s a -> a -> m ()
- (%@~) :: AnIndexedSetter i s t a b -> (i -> a -> b) -> s -> t
- withIndex :: (Indexable i p, Functor f) => p (i, s) (f (j, t)) -> Indexed i s (f t)
- (<.~) :: ASetter s t a b -> b -> s -> (b, t)
- (<.=) :: MonadState s m => ASetter s s a b -> b -> m b
- anyOf :: Getting Any s a -> (a -> Bool) -> s -> Bool
- ifoldMapOf :: IndexedGetting i m s a -> (i -> a -> m) -> s -> m
- alongside :: LensLike (AlongsideLeft f b') s t a b -> LensLike (AlongsideRight f t) s' t' a' b' -> LensLike f (s, s') (t, t') (a, a') (b, b')
- class AsEmpty a where
- dropping :: (Conjoined p, Applicative f) => Int -> Over p (Indexing f) s t a a -> Over p f s t a a
- class Field1 s t a b | s -> a, t -> b, s b -> t, t a -> s where
- traverseOf :: LensLike f s t a b -> (a -> f b) -> s -> f t
- _Left :: forall a c b p f. (Choice p, Applicative f) => p a (f b) -> p (Either a c) (f (Either b c))
- forOf :: LensLike f s t a b -> s -> (a -> f b) -> f t
- itraverseOf :: (Indexed i a (f b) -> s -> f t) -> (i -> a -> f b) -> s -> f t
- imapMOf :: Over (Indexed i) (WrappedMonad m) s t a b -> (i -> a -> m b) -> s -> m t
- iforMOf :: (Indexed i a (WrappedMonad m b) -> s -> WrappedMonad m t) -> s -> (i -> a -> m b) -> m t
- ifor :: (TraversableWithIndex i t, Applicative f) => t a -> (i -> a -> f b) -> f (t b)
- contextsOf :: ATraversal' a a -> a -> [Context a a a]
- class Each s t a b | s -> a, t -> b, s b -> t, t a -> s where
- mapMOf :: LensLike (WrappedMonad m) s t a b -> (a -> m b) -> s -> m t
- forMOf :: LensLike (WrappedMonad m) s t a b -> s -> (a -> m b) -> m t
- mapAccumROf :: LensLike (Backwards (State acc)) s t a b -> (acc -> a -> (acc, b)) -> acc -> s -> (acc, t)
- mapAccumLOf :: LensLike (State acc) s t a b -> (acc -> a -> (acc, b)) -> acc -> s -> (acc, t)
- fusing :: Functor f => LensLike (Yoneda f) s t a b -> LensLike f s t a b
- type Prism' s a = Prism s s a a
- type Lens' s a = Lens s s a a
- ala :: (Functor f, Rewrapping s t) => (Unwrapped s -> s) -> ((Unwrapped t -> t) -> f s) -> f (Unwrapped s)
- alaf :: (Functor f, Functor g, Rewrapping s t) => (Unwrapped s -> s) -> (f t -> g s) -> f (Unwrapped t) -> g (Unwrapped s)
- (<|~) :: Cons b b a a => ASetter s t b b -> a -> s -> t
- (<|=) :: (MonadState s m, Cons b b a a) => ASetter s s b b -> a -> m ()
- (|>~) :: Snoc b b a a => ASetter s t b b -> a -> s -> t
- (|>=) :: (MonadState s m, Snoc b b a a) => ASetter s s b b -> a -> m ()
- class (Magnified m ~ Magnified n, MonadReader b m, MonadReader a n) => Magnify (m :: Type -> Type) (n :: Type -> Type) b a | m -> b, n -> a, m a -> n, n b -> m where
- class Plated a where
- plate :: Traversal' a a
- newtype Indexed i a b = Indexed {
- runIndexed :: i -> a -> b
- folded :: forall (f :: Type -> Type) a. Foldable f => IndexedFold Int (f a) a
- both :: forall (r :: Type -> Type -> Type) a b. Bitraversable r => Traversal (r a a) (r b b) a b
- class Wrapped s where
- pattern Wrapped :: Rewrapped s s => Unwrapped s -> s
- without :: APrism s t a b -> APrism u v c d -> Prism (Either s u) (Either t v) (Either a c) (Either b d)
- failing :: (Conjoined p, Applicative f) => Traversing p f s t a b -> Over p f s t a b -> Over p f s t a b
- class Profunctor p => Choice (p :: Type -> Type -> Type) where
- class Profunctor (p :: Type -> Type -> Type) where
- class Reversing t where
- reversing :: t -> t
- class Foldable f => FoldableWithIndex i (f :: Type -> Type) | f -> i where
- class (FunctorWithIndex i t, FoldableWithIndex i t, Traversable t) => TraversableWithIndex i (t :: Type -> Type) | t -> i where
- itraverse :: Applicative f => (i -> a -> f b) -> t a -> f (t b)
- iall :: FoldableWithIndex i f => (i -> a -> Bool) -> f a -> Bool
- iany :: FoldableWithIndex i f => (i -> a -> Bool) -> f a -> Bool
- iconcatMap :: FoldableWithIndex i f => (i -> a -> [b]) -> f a -> [b]
- ifind :: FoldableWithIndex i f => (i -> a -> Bool) -> f a -> Maybe (i, a)
- ifoldlM :: (FoldableWithIndex i f, Monad m) => (i -> b -> a -> m b) -> b -> f a -> m b
- ifoldrM :: (FoldableWithIndex i f, Monad m) => (i -> a -> b -> m b) -> b -> f a -> m b
- iforM_ :: (FoldableWithIndex i t, Monad m) => t a -> (i -> a -> m b) -> m ()
- ifor_ :: (FoldableWithIndex i t, Applicative f) => t a -> (i -> a -> f b) -> f ()
- imapM_ :: (FoldableWithIndex i t, Monad m) => (i -> a -> m b) -> t a -> m ()
- inone :: FoldableWithIndex i f => (i -> a -> Bool) -> f a -> Bool
- itoList :: FoldableWithIndex i f => f a -> [(i, a)]
- itraverse_ :: (FoldableWithIndex i t, Applicative f) => (i -> a -> f b) -> t a -> f ()
- iforM :: (TraversableWithIndex i t, Monad m) => t a -> (i -> a -> m b) -> m (t b)
- imapAccumL :: TraversableWithIndex i t => (i -> s -> a -> (s, b)) -> s -> t a -> (s, t b)
- imapAccumR :: TraversableWithIndex i t => (i -> s -> a -> (s, b)) -> s -> t a -> (s, t b)
- imapM :: (TraversableWithIndex i t, Monad m) => (i -> a -> m b) -> t a -> m (t b)
- data Level i a
- class Conjoined p => Indexable i (p :: Type -> Type -> Type)
- class (Choice p, Corepresentable p, Comonad (Corep p), Traversable (Corep p), Strong p, Representable p, Monad (Rep p), MonadFix (Rep p), Distributive (Rep p), Costrong p, ArrowLoop p, ArrowApply p, ArrowChoice p, Closed p) => Conjoined (p :: Type -> Type -> Type) where
- indexing :: Indexable Int p => ((a -> Indexing f b) -> s -> Indexing f t) -> p a (f b) -> s -> f t
- indexing64 :: Indexable Int64 p => ((a -> Indexing64 f b) -> s -> Indexing64 f t) -> p a (f b) -> s -> f t
- asIndex :: (Indexable i p, Contravariant f, Functor f) => p i (f i) -> Indexed i s (f s)
- class (Foldable1 t, Traversable t) => Traversable1 (t :: Type -> Type) where
- traverse1 :: Apply f => (a -> f b) -> t a -> f (t b)
- foldBy :: Foldable t => (a -> a -> a) -> a -> t a -> a
- foldMapBy :: Foldable t => (r -> r -> r) -> r -> (a -> r) -> t a -> r
- sequenceBy :: Traversable t => (forall x. x -> f x) -> (forall x y. f (x -> y) -> f x -> f y) -> t (f a) -> f (t a)
- traverseBy :: Traversable t => (forall x. x -> f x) -> (forall x y. f (x -> y) -> f x -> f y) -> (a -> f b) -> t a -> f (t b)
- data Rightmost a
- data Leftmost a
- data Sequenced a (m :: Type -> Type)
- data Traversed a (f :: Type -> Type)
- type Context' a = Context a a
- data Context a b t = Context (b -> t) a
- type Bazaar1' (p :: Type -> Type -> Type) a = Bazaar1 p a a
- newtype Bazaar1 (p :: Type -> Type -> Type) a b t = Bazaar1 {
- runBazaar1 :: forall (f :: Type -> Type). Apply f => p a (f b) -> f t
- type Bazaar' (p :: Type -> Type -> Type) a = Bazaar p a a
- data Magma i t b a
- class (Profunctor p, Bifunctor p) => Reviewable (p :: Type -> Type -> Type)
- retagged :: (Profunctor p, Bifunctor p) => p a b -> p s b
- class (Applicative f, Distributive f, Traversable f) => Settable (f :: Type -> Type)
- type Over' (p :: Type -> Type -> Type) (f :: Type -> Type) s a = Over p f s s a a
- type IndexedLensLike' i (f :: Type -> Type) s a = IndexedLensLike i f s s a a
- type IndexedLensLike i (f :: k -> Type) s (t :: k) a (b :: k) = forall (p :: Type -> Type -> Type). Indexable i p => p a (f b) -> s -> f t
- type LensLike' (f :: Type -> Type) s a = LensLike f s s a a
- type Optical' (p :: k -> k1 -> Type) (q :: k -> k1 -> Type) (f :: k -> k1) (s :: k) (a :: k) = Optical p q f s s a a
- type Optical (p :: k -> k1 -> Type) (q :: k2 -> k1 -> Type) (f :: k3 -> k1) (s :: k2) (t :: k3) (a :: k) (b :: k3) = p a (f b) -> q s (f t)
- type Optic' (p :: k -> k1 -> Type) (f :: k -> k1) (s :: k) (a :: k) = Optic p f s s a a
- type Optic (p :: k -> k1 -> Type) (f :: k2 -> k1) (s :: k) (t :: k2) (a :: k) (b :: k2) = p a (f b) -> p s (f t)
- type IndexPreservingFold1 s a = forall (p :: Type -> Type -> Type) (f :: Type -> Type). (Conjoined p, Contravariant f, Apply f) => p a (f a) -> p s (f s)
- type IndexedFold1 i s a = forall (p :: Type -> Type -> Type) (f :: Type -> Type). (Indexable i p, Contravariant f, Apply f) => p a (f a) -> s -> f s
- type Fold1 s a = forall (f :: Type -> Type). (Contravariant f, Apply f) => (a -> f a) -> s -> f s
- type IndexPreservingFold s a = forall (p :: Type -> Type -> Type) (f :: Type -> Type). (Conjoined p, Contravariant f, Applicative f) => p a (f a) -> p s (f s)
- type IndexPreservingGetter s a = forall (p :: Type -> Type -> Type) (f :: Type -> Type). (Conjoined p, Contravariant f, Functor f) => p a (f a) -> p s (f s)
- type As (a :: k2) = Equality' a a
- type Equality' (s :: k2) (a :: k2) = Equality s s a a
- type Equality (s :: k1) (t :: k2) (a :: k1) (b :: k2) = forall k3 (p :: k1 -> k3 -> Type) (f :: k2 -> k3). p a (f b) -> p s (f t)
- type AReview t b = Optic' (Tagged :: Type -> Type -> Type) Identity t b
- type Review t b = forall (p :: Type -> Type -> Type) (f :: Type -> Type). (Choice p, Bifunctor p, Settable f) => Optic' p f t b
- type IndexPreservingSetter' s a = IndexPreservingSetter s s a a
- type IndexPreservingSetter s t a b = forall (p :: Type -> Type -> Type) (f :: Type -> Type). (Conjoined p, Settable f) => p a (f b) -> p s (f t)
- type IndexedSetter' i s a = IndexedSetter i s s a a
- type IndexedSetter i s t a b = forall (f :: Type -> Type) (p :: Type -> Type -> Type). (Indexable i p, Settable f) => p a (f b) -> s -> f t
- newtype ReifiedIndexedSetter i s t a b = IndexedSetter {
- runIndexedSetter :: IndexedSetter i s t a b
- type IndexPreservingTraversal1' s a = IndexPreservingTraversal1 s s a a
- type IndexPreservingTraversal1 s t a b = forall (p :: Type -> Type -> Type) (f :: Type -> Type). (Conjoined p, Apply f) => p a (f b) -> p s (f t)
- type IndexPreservingTraversal' s a = IndexPreservingTraversal s s a a
- type IndexPreservingTraversal s t a b = forall (p :: Type -> Type -> Type) (f :: Type -> Type). (Conjoined p, Applicative f) => p a (f b) -> p s (f t)
- type IndexedTraversal1' i s a = IndexedTraversal1 i s s a a
- type IndexedTraversal1 i s t a b = forall (p :: Type -> Type -> Type) (f :: Type -> Type). (Indexable i p, Apply f) => p a (f b) -> s -> f t
- type IndexedTraversal' i s a = IndexedTraversal i s s a a
- type Traversal1' s a = Traversal1 s s a a
- type Traversal1 s t a b = forall (f :: Type -> Type). Apply f => (a -> f b) -> s -> f t
- type IndexPreservingLens' s a = IndexPreservingLens s s a a
- type IndexPreservingLens s t a b = forall (p :: Type -> Type -> Type) (f :: Type -> Type). (Conjoined p, Functor f) => p a (f b) -> p s (f t)
- type IndexedLens' i s a = IndexedLens i s s a a
- type Setting' (p :: Type -> Type -> Type) s a = Setting p s s a a
- type Setting (p :: Type -> Type -> Type) s t a b = p a (Identity b) -> s -> Identity t
- type AnIndexedSetter' i s a = AnIndexedSetter i s s a a
- type AnIndexedSetter i s t a b = Indexed i a (Identity b) -> s -> Identity t
- type ASetter' s a = ASetter s s a a
- type ASetter s t a b = (a -> Identity b) -> s -> Identity t
- mapped :: forall (f :: Type -> Type) a b. Functor f => Setter (f a) (f b) a b
- lifted :: forall (m :: Type -> Type) a b. Monad m => Setter (m a) (m b) a b
- contramapped :: forall (f :: Type -> Type) b a. Contravariant f => Setter (f b) (f a) a b
- setting :: ((a -> b) -> s -> t) -> IndexPreservingSetter s t a b
- sets :: (Profunctor p, Profunctor q, Settable f) => (p a b -> q s t) -> Optical p q f s t a b
- cloneSetter :: ASetter s t a b -> Setter s t a b
- cloneIndexPreservingSetter :: ASetter s t a b -> IndexPreservingSetter s t a b
- cloneIndexedSetter :: AnIndexedSetter i s t a b -> IndexedSetter i s t a b
- set' :: ASetter' s a -> a -> s -> s
- (<?~) :: ASetter s t a (Maybe b) -> b -> s -> (b, t)
- assign :: MonadState s m => ASetter s s a b -> b -> m ()
- modifying :: MonadState s m => ASetter s s a b -> (a -> b) -> m ()
- (<~) :: MonadState s m => ASetter s s a b -> m b -> m ()
- (<?=) :: MonadState s m => ASetter s s a (Maybe b) -> b -> m b
- scribe :: (MonadWriter t m, Monoid s) => ASetter s t a b -> b -> m ()
- passing :: MonadWriter w m => Setter w w u v -> m (a, u -> v) -> m a
- ipassing :: MonadWriter w m => IndexedSetter i w w u v -> m (a, i -> u -> v) -> m a
- censoring :: MonadWriter w m => Setter w w u v -> (u -> v) -> m a -> m a
- icensoring :: MonadWriter w m => IndexedSetter i w w u v -> (i -> u -> v) -> m a -> m a
- locally :: MonadReader s m => ASetter s s a b -> (a -> b) -> m r -> m r
- ilocally :: MonadReader s m => AnIndexedSetter i s s a b -> (i -> a -> b) -> m r -> m r
- iover :: AnIndexedSetter i s t a b -> (i -> a -> b) -> s -> t
- iset :: AnIndexedSetter i s t a b -> (i -> b) -> s -> t
- isets :: ((i -> a -> b) -> s -> t) -> IndexedSetter i s t a b
- (.@~) :: AnIndexedSetter i s t a b -> (i -> b) -> s -> t
- (%@=) :: MonadState s m => AnIndexedSetter i s s a b -> (i -> a -> b) -> m ()
- imodifying :: MonadState s m => AnIndexedSetter i s s a b -> (i -> a -> b) -> m ()
- (.@=) :: MonadState s m => AnIndexedSetter i s s a b -> (i -> b) -> m ()
- assignA :: Arrow p => ASetter s t a b -> p s b -> p s t
- mapOf :: ASetter s t a b -> (a -> b) -> s -> t
- imapOf :: AnIndexedSetter i s t a b -> (i -> a -> b) -> s -> t
- type AnIndexedLens' i s a = AnIndexedLens i s s a a
- type AnIndexedLens i s t a b = Optical (Indexed i) (->) (Pretext (Indexed i) a b) s t a b
- type ALens' s a = ALens s s a a
- type ALens s t a b = LensLike (Pretext (->) a b) s t a b
- withLens :: ALens s t a b -> ((s -> a) -> (s -> b -> t) -> r) -> r
- iplens :: (s -> a) -> (s -> b -> t) -> IndexPreservingLens s t a b
- ilens :: (s -> (i, a)) -> (s -> b -> t) -> IndexedLens i s t a b
- (&~) :: s -> State s a -> s
- (%%~) :: forall {k} f s (t :: k) a (b :: k). LensLike f s t a b -> (a -> f b) -> s -> f t
- (%%=) :: forall {k} s m p r (a :: k) b. MonadState s m => Over p ((,) r) s s a b -> p a (r, b) -> m r
- (??) :: Functor f => f (a -> b) -> a -> f b
- choosing :: Functor f => LensLike f s t a b -> LensLike f s' t' a b -> LensLike f (Either s s') (Either t t') a b
- chosen :: forall a b p f. (Conjoined p, Functor f) => p a (f b) -> p (Either a a) (f (Either b b))
- locus :: forall (p :: Type -> Type -> Type -> Type) a c s b. IndexedComonadStore p => Lens (p a c s) (p b c s) a b
- cloneIndexPreservingLens :: ALens s t a b -> IndexPreservingLens s t a b
- cloneIndexedLens :: AnIndexedLens i s t a b -> IndexedLens i s t a b
- (<%~) :: LensLike ((,) b) s t a b -> (a -> b) -> s -> (b, t)
- (<+~) :: Num a => LensLike ((,) a) s t a a -> a -> s -> (a, t)
- (<-~) :: Num a => LensLike ((,) a) s t a a -> a -> s -> (a, t)
- (<*~) :: Num a => LensLike ((,) a) s t a a -> a -> s -> (a, t)
- (<//~) :: Fractional a => LensLike ((,) a) s t a a -> a -> s -> (a, t)
- (<^~) :: (Num a, Integral e) => LensLike ((,) a) s t a a -> e -> s -> (a, t)
- (<^^~) :: (Fractional a, Integral e) => LensLike ((,) a) s t a a -> e -> s -> (a, t)
- (<**~) :: Floating a => LensLike ((,) a) s t a a -> a -> s -> (a, t)
- (<||~) :: LensLike ((,) Bool) s t Bool Bool -> Bool -> s -> (Bool, t)
- (<&&~) :: LensLike ((,) Bool) s t Bool Bool -> Bool -> s -> (Bool, t)
- (<<%~) :: LensLike ((,) a) s t a b -> (a -> b) -> s -> (a, t)
- (<<.~) :: LensLike ((,) a) s t a b -> b -> s -> (a, t)
- (<<?~) :: LensLike ((,) a) s t a (Maybe b) -> b -> s -> (a, t)
- (<<+~) :: Num a => LensLike' ((,) a) s a -> a -> s -> (a, s)
- (<<-~) :: Num a => LensLike' ((,) a) s a -> a -> s -> (a, s)
- (<<*~) :: Num a => LensLike' ((,) a) s a -> a -> s -> (a, s)
- (<<//~) :: Fractional a => LensLike' ((,) a) s a -> a -> s -> (a, s)
- (<<^~) :: (Num a, Integral e) => LensLike' ((,) a) s a -> e -> s -> (a, s)
- (<<^^~) :: (Fractional a, Integral e) => LensLike' ((,) a) s a -> e -> s -> (a, s)
- (<<**~) :: Floating a => LensLike' ((,) a) s a -> a -> s -> (a, s)
- (<<||~) :: LensLike' ((,) Bool) s Bool -> Bool -> s -> (Bool, s)
- (<<&&~) :: LensLike' ((,) Bool) s Bool -> Bool -> s -> (Bool, s)
- (<<<>~) :: Semigroup r => LensLike' ((,) r) s r -> r -> s -> (r, s)
- (<%=) :: MonadState s m => LensLike ((,) b) s s a b -> (a -> b) -> m b
- (<+=) :: (MonadState s m, Num a) => LensLike' ((,) a) s a -> a -> m a
- (<-=) :: (MonadState s m, Num a) => LensLike' ((,) a) s a -> a -> m a
- (<*=) :: (MonadState s m, Num a) => LensLike' ((,) a) s a -> a -> m a
- (<//=) :: (MonadState s m, Fractional a) => LensLike' ((,) a) s a -> a -> m a
- (<^=) :: (MonadState s m, Num a, Integral e) => LensLike' ((,) a) s a -> e -> m a
- (<^^=) :: (MonadState s m, Fractional a, Integral e) => LensLike' ((,) a) s a -> e -> m a
- (<**=) :: (MonadState s m, Floating a) => LensLike' ((,) a) s a -> a -> m a
- (<||=) :: MonadState s m => LensLike' ((,) Bool) s Bool -> Bool -> m Bool
- (<&&=) :: MonadState s m => LensLike' ((,) Bool) s Bool -> Bool -> m Bool
- (<<%=) :: (Strong p, MonadState s m) => Over p ((,) a) s s a b -> p a b -> m a
- (<<.=) :: MonadState s m => LensLike ((,) a) s s a b -> b -> m a
- (<<?=) :: MonadState s m => LensLike ((,) a) s s a (Maybe b) -> b -> m a
- (<<+=) :: (MonadState s m, Num a) => LensLike' ((,) a) s a -> a -> m a
- (<<-=) :: (MonadState s m, Num a) => LensLike' ((,) a) s a -> a -> m a
- (<<*=) :: (MonadState s m, Num a) => LensLike' ((,) a) s a -> a -> m a
- (<<//=) :: (MonadState s m, Fractional a) => LensLike' ((,) a) s a -> a -> m a
- (<<^=) :: (MonadState s m, Num a, Integral e) => LensLike' ((,) a) s a -> e -> m a
- (<<^^=) :: (MonadState s m, Fractional a, Integral e) => LensLike' ((,) a) s a -> e -> m a
- (<<**=) :: (MonadState s m, Floating a) => LensLike' ((,) a) s a -> a -> m a
- (<<||=) :: MonadState s m => LensLike' ((,) Bool) s Bool -> Bool -> m Bool
- (<<&&=) :: MonadState s m => LensLike' ((,) Bool) s Bool -> Bool -> m Bool
- (<<<>=) :: (MonadState s m, Semigroup r) => LensLike' ((,) r) s r -> r -> m r
- (<<~) :: MonadState s m => ALens s s a b -> m b -> m b
- (<<>~) :: Semigroup m => LensLike ((,) m) s t m m -> m -> s -> (m, t)
- (<<>=) :: (MonadState s m, Semigroup r) => LensLike' ((,) r) s r -> r -> m r
- (<<>:~) :: Semigroup m => LensLike ((,) m) s t m m -> m -> s -> (m, t)
- (<<<>:~) :: Semigroup m => LensLike' ((,) m) s m -> m -> s -> (m, s)
- (<<>:=) :: (MonadState s m, Semigroup r) => LensLike' ((,) r) s r -> r -> m r
- (<<<>:=) :: (MonadState s m, Semigroup r) => LensLike' ((,) r) s r -> r -> m r
- overA :: Arrow ar => LensLike (Context a b) s t a b -> ar a b -> ar s t
- (<%@~) :: Over (Indexed i) ((,) b) s t a b -> (i -> a -> b) -> s -> (b, t)
- (<<%@~) :: Over (Indexed i) ((,) a) s t a b -> (i -> a -> b) -> s -> (a, t)
- (%%@~) :: forall {k1} i f s (t :: k1) a (b :: k1). Over (Indexed i) f s t a b -> (i -> a -> f b) -> s -> f t
- (%%@=) :: MonadState s m => Over (Indexed i) ((,) r) s s a b -> (i -> a -> (r, b)) -> m r
- (<%@=) :: MonadState s m => Over (Indexed i) ((,) b) s s a b -> (i -> a -> b) -> m b
- (<<%@=) :: MonadState s m => Over (Indexed i) ((,) a) s s a b -> (i -> a -> b) -> m a
- (^#) :: s -> ALens s t a b -> a
- storing :: ALens s t a b -> b -> s -> t
- (#~) :: ALens s t a b -> b -> s -> t
- (#%~) :: ALens s t a b -> (a -> b) -> s -> t
- (#%%~) :: Functor f => ALens s t a b -> (a -> f b) -> s -> f t
- (#=) :: MonadState s m => ALens s s a b -> b -> m ()
- (#%=) :: MonadState s m => ALens s s a b -> (a -> b) -> m ()
- (<#%~) :: ALens s t a b -> (a -> b) -> s -> (b, t)
- (<#%=) :: MonadState s m => ALens s s a b -> (a -> b) -> m b
- (#%%=) :: MonadState s m => ALens s s a b -> (a -> (r, b)) -> m r
- (<#~) :: ALens s t a b -> b -> s -> (b, t)
- (<#=) :: MonadState s m => ALens s s a b -> b -> m b
- devoid :: forall {k} p f (a :: k) b. Over p f Void Void a b
- united :: forall a f. Functor f => (() -> f ()) -> a -> f a
- head1 :: forall (t :: Type -> Type) a. Traversable1 t => Lens' (t a) a
- last1 :: forall (t :: Type -> Type) a. Traversable1 t => Lens' (t a) a
- class Field19 s t a b | s -> a, t -> b, s b -> t, t a -> s where
- class Field18 s t a b | s -> a, t -> b, s b -> t, t a -> s where
- class Field17 s t a b | s -> a, t -> b, s b -> t, t a -> s where
- class Field16 s t a b | s -> a, t -> b, s b -> t, t a -> s where
- class Field15 s t a b | s -> a, t -> b, s b -> t, t a -> s where
- class Field14 s t a b | s -> a, t -> b, s b -> t, t a -> s where
- class Field13 s t a b | s -> a, t -> b, s b -> t, t a -> s where
- class Field12 s t a b | s -> a, t -> b, s b -> t, t a -> s where
- class Field11 s t a b | s -> a, t -> b, s b -> t, t a -> s where
- class Field10 s t a b | s -> a, t -> b, s b -> t, t a -> s where
- class Field9 s t a b | s -> a, t -> b, s b -> t, t a -> s where
- class Field8 s t a b | s -> a, t -> b, s b -> t, t a -> s where
- class Field7 s t a b | s -> a, t -> b, s b -> t, t a -> s where
- class Field6 s t a b | s -> a, t -> b, s b -> t, t a -> s where
- class Field5 s t a b | s -> a, t -> b, s b -> t, t a -> s where
- class Field4 s t a b | s -> a, t -> b, s b -> t, t a -> s where
- class Field3 s t a b | s -> a, t -> b, s b -> t, t a -> s where
- _1' :: Field1 s t a b => Lens s t a b
- _2' :: Field2 s t a b => Lens s t a b
- _3' :: Field3 s t a b => Lens s t a b
- _4' :: Field4 s t a b => Lens s t a b
- _5' :: Field5 s t a b => Lens s t a b
- _6' :: Field6 s t a b => Lens s t a b
- _7' :: Field7 s t a b => Lens s t a b
- _8' :: Field8 s t a b => Lens s t a b
- _9' :: Field9 s t a b => Lens s t a b
- _10' :: Field10 s t a b => Lens s t a b
- _11' :: Field11 s t a b => Lens s t a b
- _12' :: Field12 s t a b => Lens s t a b
- _13' :: Field13 s t a b => Lens s t a b
- _14' :: Field14 s t a b => Lens s t a b
- _15' :: Field15 s t a b => Lens s t a b
- _16' :: Field16 s t a b => Lens s t a b
- _17' :: Field17 s t a b => Lens s t a b
- _18' :: Field18 s t a b => Lens s t a b
- _19' :: Field19 s t a b => Lens s t a b
- type Accessing (p :: Type -> Type -> Type) m s a = p a (Const m a) -> s -> Const m s
- type IndexedGetting i m s a = Indexed i a (Const m a) -> s -> Const m s
- ito :: (Indexable i p, Contravariant f) => (s -> (i, a)) -> Over' p f s a
- like :: (Profunctor p, Contravariant f, Functor f) => a -> Optic' p f s a
- ilike :: (Indexable i p, Contravariant f, Functor f) => i -> a -> Over' p f s a
- views :: MonadReader s m => LensLike' (Const r :: Type -> Type) s a -> (a -> r) -> m r
- uses :: MonadState s m => LensLike' (Const r :: Type -> Type) s a -> (a -> r) -> m r
- listening :: MonadWriter w m => Getting u w u -> m a -> m (a, u)
- ilistening :: MonadWriter w m => IndexedGetting i (i, u) w u -> m a -> m (a, (i, u))
- listenings :: MonadWriter w m => Getting v w u -> (u -> v) -> m a -> m (a, v)
- ilistenings :: MonadWriter w m => IndexedGetting i v w u -> (i -> u -> v) -> m a -> m (a, v)
- iview :: MonadReader s m => IndexedGetting i (i, a) s a -> m (i, a)
- iviews :: MonadReader s m => IndexedGetting i r s a -> (i -> a -> r) -> m r
- iuse :: MonadState s m => IndexedGetting i (i, a) s a -> m (i, a)
- iuses :: MonadState s m => IndexedGetting i r s a -> (i -> a -> r) -> m r
- (^@.) :: s -> IndexedGetting i (i, a) s a -> (i, a)
- getting :: (Profunctor p, Profunctor q, Functor f, Contravariant f) => Optical p q f s t a b -> Optical' p q f s a
- unto :: (Profunctor p, Bifunctor p, Functor f) => (b -> t) -> Optic p f s t a b
- un :: (Profunctor p, Bifunctor p, Functor f) => Getting a s a -> Optic' p f a s
- reviews :: MonadReader b m => AReview t b -> (t -> r) -> m r
- reuse :: MonadState b m => AReview t b -> m t
- reuses :: MonadState b m => AReview t b -> (t -> r) -> m r
- reviewing :: (Bifunctor p, Functor f) => Optic (Tagged :: Type -> Type -> Type) Identity s t a b -> Optic' p f t b
- class Suffixed t where
- class Prefixed t where
- type APrism' s a = APrism s s a a
- type APrism s t a b = Market a b a (Identity b) -> Market a b s (Identity t)
- withPrism :: APrism s t a b -> ((b -> t) -> (s -> Either t a) -> r) -> r
- clonePrism :: APrism s t a b -> Prism s t a b
- prism' :: (b -> s) -> (s -> Maybe a) -> Prism s s a b
- aside :: APrism s t a b -> Prism (e, s) (e, t) (e, a) (e, b)
- below :: forall (f :: Type -> Type) s a. Traversable f => APrism' s a -> Prism' (f s) (f a)
- isn't :: APrism s t a b -> s -> Bool
- matching' :: LensLike (Either a) s t a b -> s -> Either t a
- _Right :: forall c a b p f. (Choice p, Applicative f) => p a (f b) -> p (Either c a) (f (Either c b))
- _Just :: forall a b p f. (Choice p, Applicative f) => p a (f b) -> p (Maybe a) (f (Maybe b))
- _Nothing :: forall a p f. (Choice p, Applicative f) => p () (f ()) -> p (Maybe a) (f (Maybe a))
- _Void :: forall s a p f. (Choice p, Applicative f) => p a (f Void) -> p s (f s)
- only :: Eq a => a -> Prism' a ()
- nearly :: a -> (a -> Bool) -> Prism' a ()
- _Show :: (Read a, Show a) => Prism' String a
- folding :: Foldable f => (s -> f a) -> Fold s a
- ifolding :: (Foldable f, Indexable i p, Contravariant g, Applicative g) => (s -> f (i, a)) -> Over p g s t a b
- foldring :: (Contravariant f, Applicative f) => ((a -> f a -> f a) -> f a -> s -> f a) -> LensLike f s t a b
- ifoldring :: (Indexable i p, Contravariant f, Applicative f) => ((i -> a -> f a -> f a) -> f a -> s -> f a) -> Over p f s t a b
- folded64 :: forall (f :: Type -> Type) a. Foldable f => IndexedFold Int64 (f a) a
- repeated :: Apply f => LensLike' f a a
- replicated :: Int -> Fold a a
- cycled :: Apply f => LensLike f s t a b -> LensLike f s t a b
- unfolded :: (b -> Maybe (a, b)) -> Fold b a
- iterated :: Apply f => (a -> a) -> LensLike' f a a
- filtered :: (Choice p, Applicative f) => (a -> Bool) -> Optic' p f a a
- filteredBy :: (Indexable i p, Applicative f) => Getting (First i) a i -> p a (f a) -> a -> f a
- takingWhile :: (Conjoined p, Applicative f) => (a -> Bool) -> Over p (TakingWhile p f a a) s t a a -> Over p f s t a a
- droppingWhile :: (Conjoined p, Profunctor q, Applicative f) => (a -> Bool) -> Optical p q (Compose (State Bool) f) s t a a -> Optical p q f s t a a
- worded :: forall (f :: Type -> Type). Applicative f => IndexedLensLike' Int f String String
- lined :: forall (f :: Type -> Type). Applicative f => IndexedLensLike' Int f String String
- foldOf :: Getting a s a -> s -> a
- foldrOf :: Getting (Endo r) s a -> (a -> r -> r) -> r -> s -> r
- foldlOf :: Getting (Dual (Endo r)) s a -> (r -> a -> r) -> r -> s -> r
- toListOf :: Getting (Endo [a]) s a -> s -> [a]
- toNonEmptyOf :: Getting (NonEmptyDList a) s a -> s -> NonEmpty a
- altOf :: Applicative f => Getting (Alt f a) s a -> s -> f a
- (^..) :: s -> Getting (Endo [a]) s a -> [a]
- andOf :: Getting All s Bool -> s -> Bool
- orOf :: Getting Any s Bool -> s -> Bool
- allOf :: Getting All s a -> (a -> Bool) -> s -> Bool
- noneOf :: Getting Any s a -> (a -> Bool) -> s -> Bool
- productOf :: Num a => Getting (Endo (Endo a)) s a -> s -> a
- sumOf :: Num a => Getting (Endo (Endo a)) s a -> s -> a
- forOf_ :: Functor f => Getting (Traversed r f) s a -> s -> (a -> f r) -> f ()
- sequenceAOf_ :: Functor f => Getting (Traversed a f) s (f a) -> s -> f ()
- for1Of_ :: Functor f => Getting (TraversedF r f) s a -> s -> (a -> f r) -> f ()
- sequence1Of_ :: Functor f => Getting (TraversedF a f) s (f a) -> s -> f ()
- mapMOf_ :: Monad m => Getting (Sequenced r m) s a -> (a -> m r) -> s -> m ()
- forMOf_ :: Monad m => Getting (Sequenced r m) s a -> s -> (a -> m r) -> m ()
- sequenceOf_ :: Monad m => Getting (Sequenced a m) s (m a) -> s -> m ()
- asumOf :: Alternative f => Getting (Endo (f a)) s (f a) -> s -> f a
- msumOf :: MonadPlus m => Getting (Endo (m a)) s (m a) -> s -> m a
- elemOf :: Eq a => Getting Any s a -> a -> s -> Bool
- notElemOf :: Eq a => Getting All s a -> a -> s -> Bool
- concatMapOf :: Getting [r] s a -> (a -> [r]) -> s -> [r]
- concatOf :: Getting [r] s [r] -> s -> [r]
- (^?!) :: HasCallStack => s -> Getting (Endo a) s a -> a
- first1Of :: Getting (First a) s a -> s -> a
- last1Of :: Getting (Last a) s a -> s -> a
- nullOf :: Getting All s a -> s -> Bool
- notNullOf :: Getting Any s a -> s -> Bool
- maximumOf :: Ord a => Getting (Endo (Endo (Maybe a))) s a -> s -> Maybe a
- maximum1Of :: Ord a => Getting (Max a) s a -> s -> a
- minimumOf :: Ord a => Getting (Endo (Endo (Maybe a))) s a -> s -> Maybe a
- minimum1Of :: Ord a => Getting (Min a) s a -> s -> a
- maximumByOf :: Getting (Endo (Endo (Maybe a))) s a -> (a -> a -> Ordering) -> s -> Maybe a
- minimumByOf :: Getting (Endo (Endo (Maybe a))) s a -> (a -> a -> Ordering) -> s -> Maybe a
- findOf :: Getting (Endo (Maybe a)) s a -> (a -> Bool) -> s -> Maybe a
- findMOf :: Monad m => Getting (Endo (m (Maybe a))) s a -> (a -> m Bool) -> s -> m (Maybe a)
- lookupOf :: Eq k => Getting (Endo (Maybe v)) s (k, v) -> k -> s -> Maybe v
- foldr1Of :: HasCallStack => Getting (Endo (Maybe a)) s a -> (a -> a -> a) -> s -> a
- foldl1Of :: HasCallStack => Getting (Dual (Endo (Maybe a))) s a -> (a -> a -> a) -> s -> a
- foldrOf' :: Getting (Dual (Endo (Endo r))) s a -> (a -> r -> r) -> r -> s -> r
- foldlOf' :: Getting (Endo (Endo r)) s a -> (r -> a -> r) -> r -> s -> r
- foldr1Of' :: HasCallStack => Getting (Dual (Endo (Endo (Maybe a)))) s a -> (a -> a -> a) -> s -> a
- foldl1Of' :: HasCallStack => Getting (Endo (Endo (Maybe a))) s a -> (a -> a -> a) -> s -> a
- foldrMOf :: Monad m => Getting (Dual (Endo (r -> m r))) s a -> (a -> r -> m r) -> r -> s -> m r
- foldlMOf :: Monad m => Getting (Endo (r -> m r)) s a -> (r -> a -> m r) -> r -> s -> m r
- has :: Getting Any s a -> s -> Bool
- hasn't :: Getting All s a -> s -> Bool
- pre :: Getting (First a) s a -> IndexPreservingGetter s (Maybe a)
- ipre :: IndexedGetting i (First (i, a)) s a -> IndexPreservingGetter s (Maybe (i, a))
- ipreview :: MonadReader s m => IndexedGetting i (First (i, a)) s a -> m (Maybe (i, a))
- previews :: MonadReader s m => Getting (First r) s a -> (a -> r) -> m (Maybe r)
- ipreviews :: MonadReader s m => IndexedGetting i (First r) s a -> (i -> a -> r) -> m (Maybe r)
- preuse :: MonadState s m => Getting (First a) s a -> m (Maybe a)
- ipreuse :: MonadState s m => IndexedGetting i (First (i, a)) s a -> m (Maybe (i, a))
- preuses :: MonadState s m => Getting (First r) s a -> (a -> r) -> m (Maybe r)
- ipreuses :: MonadState s m => IndexedGetting i (First r) s a -> (i -> a -> r) -> m (Maybe r)
- ifoldrOf :: IndexedGetting i (Endo r) s a -> (i -> a -> r -> r) -> r -> s -> r
- ifoldlOf :: IndexedGetting i (Dual (Endo r)) s a -> (i -> r -> a -> r) -> r -> s -> r
- ianyOf :: IndexedGetting i Any s a -> (i -> a -> Bool) -> s -> Bool
- iallOf :: IndexedGetting i All s a -> (i -> a -> Bool) -> s -> Bool
- inoneOf :: IndexedGetting i Any s a -> (i -> a -> Bool) -> s -> Bool
- itraverseOf_ :: Functor f => IndexedGetting i (Traversed r f) s a -> (i -> a -> f r) -> s -> f ()
- iforOf_ :: Functor f => IndexedGetting i (Traversed r f) s a -> s -> (i -> a -> f r) -> f ()
- imapMOf_ :: Monad m => IndexedGetting i (Sequenced r m) s a -> (i -> a -> m r) -> s -> m ()
- iforMOf_ :: Monad m => IndexedGetting i (Sequenced r m) s a -> s -> (i -> a -> m r) -> m ()
- iconcatMapOf :: IndexedGetting i [r] s a -> (i -> a -> [r]) -> s -> [r]
- ifindOf :: IndexedGetting i (Endo (Maybe a)) s a -> (i -> a -> Bool) -> s -> Maybe a
- ifindMOf :: Monad m => IndexedGetting i (Endo (m (Maybe a))) s a -> (i -> a -> m Bool) -> s -> m (Maybe a)
- ifoldrOf' :: IndexedGetting i (Dual (Endo (r -> r))) s a -> (i -> a -> r -> r) -> r -> s -> r
- ifoldlOf' :: IndexedGetting i (Endo (r -> r)) s a -> (i -> r -> a -> r) -> r -> s -> r
- ifoldrMOf :: Monad m => IndexedGetting i (Dual (Endo (r -> m r))) s a -> (i -> a -> r -> m r) -> r -> s -> m r
- ifoldlMOf :: Monad m => IndexedGetting i (Endo (r -> m r)) s a -> (i -> r -> a -> m r) -> r -> s -> m r
- itoListOf :: IndexedGetting i (Endo [(i, a)]) s a -> s -> [(i, a)]
- (^@..) :: s -> IndexedGetting i (Endo [(i, a)]) s a -> [(i, a)]
- (^@?) :: s -> IndexedGetting i (Endo (Maybe (i, a))) s a -> Maybe (i, a)
- (^@?!) :: HasCallStack => s -> IndexedGetting i (Endo (i, a)) s a -> (i, a)
- elemIndexOf :: Eq a => IndexedGetting i (First i) s a -> a -> s -> Maybe i
- elemIndicesOf :: Eq a => IndexedGetting i (Endo [i]) s a -> a -> s -> [i]
- findIndexOf :: IndexedGetting i (First i) s a -> (a -> Bool) -> s -> Maybe i
- findIndicesOf :: IndexedGetting i (Endo [i]) s a -> (a -> Bool) -> s -> [i]
- ifiltered :: (Indexable i p, Applicative f) => (i -> a -> Bool) -> Optical' p (Indexed i) f a a
- itakingWhile :: (Indexable i p, Profunctor q, Contravariant f, Applicative f) => (i -> a -> Bool) -> Optical' (Indexed i) q (Const (Endo (f s)) :: Type -> Type) s a -> Optical' p q f s a
- idroppingWhile :: (Indexable i p, Profunctor q, Applicative f) => (i -> a -> Bool) -> Optical (Indexed i) q (Compose (State Bool) f) s t a a -> Optical p q f s t a a
- foldByOf :: Fold s a -> (a -> a -> a) -> a -> s -> a
- foldMapByOf :: Fold s a -> (r -> r -> r) -> r -> (a -> r) -> s -> r
- class Ord k => TraverseMax k (m :: Type -> Type) | m -> k where
- traverseMax :: IndexedTraversal' k (m v) v
- class Ord k => TraverseMin k (m :: Type -> Type) | m -> k where
- traverseMin :: IndexedTraversal' k (m v) v
- type Traversing1' (p :: Type -> Type -> Type) (f :: Type -> Type) s a = Traversing1 p f s s a a
- type Traversing' (p :: Type -> Type -> Type) (f :: Type -> Type) s a = Traversing p f s s a a
- type Traversing1 (p :: Type -> Type -> Type) (f :: Type -> Type) s t a b = Over p (BazaarT1 p f a b) s t a b
- type Traversing (p :: Type -> Type -> Type) (f :: Type -> Type) s t a b = Over p (BazaarT p f a b) s t a b
- type AnIndexedTraversal1' i s a = AnIndexedTraversal1 i s s a a
- type AnIndexedTraversal' i s a = AnIndexedTraversal i s s a a
- type AnIndexedTraversal1 i s t a b = Over (Indexed i) (Bazaar1 (Indexed i) a b) s t a b
- type AnIndexedTraversal i s t a b = Over (Indexed i) (Bazaar (Indexed i) a b) s t a b
- type ATraversal1' s a = ATraversal1 s s a a
- type ATraversal1 s t a b = LensLike (Bazaar1 (->) a b) s t a b
- type ATraversal' s a = ATraversal s s a a
- type ATraversal s t a b = LensLike (Bazaar (->) a b) s t a b
- traversal :: ((a -> f b) -> s -> f t) -> LensLike f s t a b
- sequenceAOf :: LensLike f s t (f b) b -> s -> f t
- sequenceOf :: LensLike (WrappedMonad m) s t (m b) b -> s -> m t
- transposeOf :: LensLike ZipList s t [a] a -> s -> [t]
- scanr1Of :: LensLike (Backwards (State (Maybe a))) s t a a -> (a -> a -> a) -> s -> t
- scanl1Of :: LensLike (State (Maybe a)) s t a a -> (a -> a -> a) -> s -> t
- loci :: forall a c s b f. Applicative f => (a -> f b) -> Bazaar (->) a c s -> f (Bazaar (->) b c s)
- iloci :: forall i a c s b p f. (Indexable i p, Applicative f) => p a (f b) -> Bazaar (Indexed i) a c s -> f (Bazaar (Indexed i) b c s)
- partsOf :: Functor f => Traversing (->) f s t a a -> LensLike f s t [a] [a]
- ipartsOf :: (Indexable [i] p, Functor f) => Traversing (Indexed i) f s t a a -> Over p f s t [a] [a]
- partsOf' :: ATraversal s t a a -> Lens s t [a] [a]
- ipartsOf' :: forall i p f s t a. (Indexable [i] p, Functor f) => Over (Indexed i) (Bazaar' (Indexed i) a) s t a a -> Over p f s t [a] [a]
- unsafePartsOf :: Functor f => Traversing (->) f s t a b -> LensLike f s t [a] [b]
- iunsafePartsOf :: (Indexable [i] p, Functor f) => Traversing (Indexed i) f s t a b -> Over p f s t [a] [b]
- unsafePartsOf' :: ATraversal s t a b -> Lens s t [a] [b]
- iunsafePartsOf' :: forall i s t a b. Over (Indexed i) (Bazaar (Indexed i) a b) s t a b -> IndexedLens [i] s t [a] [b]
- unsafeSingular :: (HasCallStack, Conjoined p, Functor f) => Traversing p f s t a b -> Over p f s t a b
- holesOf :: Conjoined p => Over p (Bazaar p a a) s t a a -> s -> [Pretext p a a t]
- holes1Of :: Conjoined p => Over p (Bazaar1 p a a) s t a a -> s -> NonEmpty (Pretext p a a t)
- both1 :: forall (r :: Type -> Type -> Type) a b. Bitraversable1 r => Traversal1 (r a a) (r b b) a b
- cloneIndexPreservingTraversal :: ATraversal s t a b -> IndexPreservingTraversal s t a b
- cloneIndexedTraversal :: AnIndexedTraversal i s t a b -> IndexedTraversal i s t a b
- cloneTraversal1 :: ATraversal1 s t a b -> Traversal1 s t a b
- cloneIndexPreservingTraversal1 :: ATraversal1 s t a b -> IndexPreservingTraversal1 s t a b
- cloneIndexedTraversal1 :: AnIndexedTraversal1 i s t a b -> IndexedTraversal1 i s t a b
- iforOf :: (Indexed i a (f b) -> s -> f t) -> s -> (i -> a -> f b) -> f t
- imapAccumROf :: Over (Indexed i) (Backwards (State acc)) s t a b -> (i -> acc -> a -> (acc, b)) -> acc -> s -> (acc, t)
- imapAccumLOf :: Over (Indexed i) (State acc) s t a b -> (i -> acc -> a -> (acc, b)) -> acc -> s -> (acc, t)
- traversed1 :: forall (f :: Type -> Type) a b. Traversable1 f => IndexedTraversal1 Int (f a) (f b) a b
- traversed64 :: forall (f :: Type -> Type) a b. Traversable f => IndexedTraversal Int64 (f a) (f b) a b
- ignored :: Applicative f => pafb -> s -> f s
- elementOf :: forall (f :: Type -> Type) s t a. Applicative f => LensLike (Indexing f) s t a a -> Int -> IndexedLensLike Int f s t a a
- element :: forall (t :: Type -> Type) a. Traversable t => Int -> IndexedTraversal' Int (t a) a
- elementsOf :: forall (f :: Type -> Type) s t a. Applicative f => LensLike (Indexing f) s t a a -> (Int -> Bool) -> IndexedLensLike Int f s t a a
- elements :: forall (t :: Type -> Type) a. Traversable t => (Int -> Bool) -> IndexedTraversal' Int (t a) a
- failover :: Alternative m => LensLike ((,) Any) s t a b -> (a -> b) -> s -> m t
- ifailover :: Alternative m => Over (Indexed i) ((,) Any) s t a b -> (i -> a -> b) -> s -> m t
- deepOf :: (Conjoined p, Applicative f) => LensLike f s t s t -> Traversing p f s t a b -> Over p f s t a b
- confusing :: Applicative f => LensLike (Curried (Yoneda f) (Yoneda f)) s t a b -> LensLike f s t a b
- traverseByOf :: Traversal s t a b -> (forall x. x -> f x) -> (forall x y. f (x -> y) -> f x -> f y) -> (a -> f b) -> s -> f t
- sequenceByOf :: Traversal s t (f b) b -> (forall x. x -> f x) -> (forall x y. f (x -> y) -> f x -> f y) -> s -> f t
- ilevels :: forall (f :: Type -> Type) i s t a b j. Applicative f => Traversing (Indexed i) f s t a b -> IndexedLensLike Int f s t (Level i a) (Level j b)
- type ReifiedPrism' s a = ReifiedPrism s s a a
- type ReifiedIso' s a = ReifiedIso s s a a
- type ReifiedIndexedSetter' i s a = ReifiedIndexedSetter i s s a a
- type ReifiedSetter' s a = ReifiedSetter s s a a
- type ReifiedTraversal' s a = ReifiedTraversal s s a a
- type ReifiedIndexedTraversal' i s a = ReifiedIndexedTraversal i s s a a
- type ReifiedIndexedLens' i s a = ReifiedIndexedLens i s s a a
- type ReifiedLens' s a = ReifiedLens s s a a
- (<.) :: Indexable i p => (Indexed i s t -> r) -> ((a -> b) -> s -> t) -> p a b -> r
- selfIndex :: Indexable a p => p a fb -> a -> fb
- reindexed :: Indexable j p => (i -> j) -> (Indexed i a b -> r) -> p a b -> r
- icompose :: Indexable p c => (i -> j -> p) -> (Indexed i s t -> r) -> (Indexed j a b -> s -> t) -> c a b -> r
- imapped :: forall i (f :: Type -> Type) a b. FunctorWithIndex i f => IndexedSetter i (f a) (f b) a b
- ifolded :: forall i (f :: Type -> Type) a. FoldableWithIndex i f => IndexedFold i (f a) a
- itraversed :: forall i (t :: Type -> Type) a b. TraversableWithIndex i t => IndexedTraversal i (t a) (t b) a b
- ifoldMapBy :: FoldableWithIndex i t => (r -> r -> r) -> r -> (i -> a -> r) -> t a -> r
- ifoldMapByOf :: IndexedFold i t a -> (r -> r -> r) -> r -> (i -> a -> r) -> t -> r
- itraverseBy :: TraversableWithIndex i t => (forall x. x -> f x) -> (forall x y. f (x -> y) -> f x -> f y) -> (i -> a -> f b) -> t a -> f (t b)
- itraverseByOf :: IndexedTraversal i s t a b -> (forall x. x -> f x) -> (forall x y. f (x -> y) -> f x -> f y) -> (i -> a -> f b) -> s -> f t
- type AnEquality' (s :: k) (a :: k) = AnEquality s s a a
- type AnEquality (s :: k) (t :: k1) (a :: k) (b :: k2) = Identical a (Proxy b) a (Proxy b) -> Identical a (Proxy b) s (Proxy t)
- data Identical (a :: k) (b :: k1) (s :: k) (t :: k1) where
- runEq :: forall {k1} {k2} (s :: k1) (t :: k2) (a :: k1) (b :: k2). AnEquality s t a b -> Identical s t a b
- substEq :: forall {k1} {k2} (s :: k1) (t :: k2) (a :: k1) (b :: k2) r. AnEquality s t a b -> ((s ~ a, t ~ b) => r) -> r
- mapEq :: forall k1 k2 (s :: k1) (t :: k2) (a :: k1) (b :: k2) f. AnEquality s t a b -> f s -> f a
- fromEq :: forall {k2} {k1} (s :: k2) (t :: k1) (a :: k2) (b :: k1). AnEquality s t a b -> Equality b a t s
- simply :: forall {k} {k1} p (f :: k -> k1) (s :: k) (a :: k) r. (Optic' p f s a -> r) -> Optic' p f s a -> r
- simple :: forall {k2} (a :: k2) k3 p (f :: k2 -> k3). p a (f a) -> p a (f a)
- cloneEquality :: forall {k1} {k2} (s :: k1) (t :: k2) (a :: k1) (b :: k2). AnEquality s t a b -> Equality s t a b
- equality :: forall {k1} {k2} (s :: k1) (a :: k1) (b :: k2) (t :: k2). (s :~: a) -> (b :~: t) -> Equality s t a b
- equality' :: forall {k2} (a :: k2) (b :: k2). (a :~: b) -> Equality' a b
- overEquality :: forall {k1} {k2} (s :: k1) (t :: k2) (a :: k1) (b :: k2) p. AnEquality s t a b -> p a b -> p s t
- underEquality :: forall {k1} {k2} (s :: k1) (t :: k2) (a :: k1) (b :: k2) p. AnEquality s t a b -> p t s -> p b a
- fromLeibniz :: forall {k1} {k2} (a :: k1) (b :: k2) (s :: k1) (t :: k2). (Identical a b a b -> Identical a b s t) -> Equality s t a b
- fromLeibniz' :: forall {k2} (s :: k2) (a :: k2). ((s :~: s) -> s :~: a) -> Equality' s a
- withEquality :: forall {k1} {k2} (s :: k1) (t :: k2) (a :: k1) (b :: k2) r. AnEquality s t a b -> ((s :~: a) -> (b :~: t) -> r) -> r
- type AnIso' s a = AnIso s s a a
- type AnIso s t a b = Exchange a b a (Identity b) -> Exchange a b s (Identity t)
- pattern Reversed :: Reversing t => t -> t
- pattern Swapped :: Swap p => p b a -> p a b
- iso :: (s -> a) -> (b -> t) -> Iso s t a b
- withIso :: AnIso s t a b -> ((s -> a) -> (b -> t) -> r) -> r
- cloneIso :: AnIso s t a b -> Iso s t a b
- au :: Functor f => AnIso s t a b -> ((b -> t) -> f s) -> f a
- auf :: (Functor f, Functor g) => AnIso s t a b -> (f t -> g s) -> f b -> g a
- xplat :: forall {k2} s g (t :: k2) a (b :: k2). Optic (Costar ((->) s)) g s t a b -> ((s -> a) -> g b) -> g t
- xplatf :: forall {k} {k2} f g (s :: k) (t :: k2) (a :: k) (b :: k2). Optic (Costar f) g s t a b -> (f a -> g b) -> f s -> g t
- under :: AnIso s t a b -> (t -> s) -> b -> a
- enum :: Enum a => Iso' Int a
- mapping :: forall (f :: Type -> Type) (g :: Type -> Type) s t a b. (Functor f, Functor g) => AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
- non :: Eq a => a -> Iso' (Maybe a) a
- non' :: APrism' a () -> Iso' (Maybe a) a
- anon :: a -> (a -> Bool) -> Iso' (Maybe a) a
- curried :: forall a b c d e f1 p f2. (Profunctor p, Functor f2) => p (a -> b -> c) (f2 (d -> e -> f1)) -> p ((a, b) -> c) (f2 ((d, e) -> f1))
- uncurried :: forall a b c d e f1 p f2. (Profunctor p, Functor f2) => p ((a, b) -> c) (f2 ((d, e) -> f1)) -> p (a -> b -> c) (f2 (d -> e -> f1))
- flipped :: forall a b c a' b' c' p f. (Profunctor p, Functor f) => p (b -> a -> c) (f (b' -> a' -> c')) -> p (a -> b -> c) (f (a' -> b' -> c'))
- swapped :: forall (p :: Type -> Type -> Type) a b c d. Swap p => Iso (p a b) (p c d) (p b a) (p d c)
- reversed :: Reversing a => Iso' a a
- involuted :: (a -> a) -> Iso' a a
- magma :: LensLike (Mafic a b) s t a b -> Iso s u (Magma Int t b a) (Magma j u c c)
- imagma :: Over (Indexed i) (Molten i a b) s t a b -> Iso s t' (Magma i t b a) (Magma j t' c c)
- contramapping :: forall (f :: Type -> Type) s t a b. Contravariant f => AnIso s t a b -> Iso (f a) (f b) (f s) (f t)
- dimapping :: forall (p :: Type -> Type -> Type) (q :: Type -> Type -> Type) s t a b s' t' a' b'. (Profunctor p, Profunctor q) => AnIso s t a b -> AnIso s' t' a' b' -> Iso (p a s') (q b t') (p s a') (q t b')
- lmapping :: forall (p :: Type -> Type -> Type) (q :: Type -> Type -> Type) s t a b x y. (Profunctor p, Profunctor q) => AnIso s t a b -> Iso (p a x) (q b y) (p s x) (q t y)
- rmapping :: forall (p :: Type -> Type -> Type) (q :: Type -> Type -> Type) s t a b x y. (Profunctor p, Profunctor q) => AnIso s t a b -> Iso (p x s) (q y t) (p x a) (q y b)
- bimapping :: forall (f :: Type -> Type -> Type) (g :: Type -> Type -> Type) s t a b s' t' a' b'. (Bifunctor f, Bifunctor g) => AnIso s t a b -> AnIso s' t' a' b' -> Iso (f s s') (g t t') (f a a') (g b b')
- firsting :: forall (f :: Type -> Type -> Type) (g :: Type -> Type -> Type) s t a b x y. (Bifunctor f, Bifunctor g) => AnIso s t a b -> Iso (f s x) (g t y) (f a x) (g b y)
- seconding :: forall (f :: Type -> Type -> Type) (g :: Type -> Type -> Type) s t a b x y. (Bifunctor f, Bifunctor g) => AnIso s t a b -> Iso (f x s) (g y t) (f x a) (g y b)
- coerced :: forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
- class Snoc s t a b | s -> a, t -> b, s b -> t, t a -> s where
- class Cons s t a b | s -> a, t -> b, s b -> t, t a -> s where
- _head :: Cons s s a a => Traversal' s a
- _tail :: Cons s s a a => Traversal' s s
- (<<|~) :: Cons b b a a => LensLike ((,) b) s t b b -> a -> s -> (b, t)
- (<<<|~) :: Cons b b a a => LensLike' ((,) b) s b -> a -> s -> (b, s)
- (<<|=) :: (MonadState s m, Cons b b a a) => LensLike ((,) b) s s b b -> a -> m b
- (<<<|=) :: (MonadState s m, Cons b b a a) => LensLike ((,) b) s s b b -> a -> m b
- _init :: Snoc s s a a => Traversal' s s
- _last :: Snoc s s a a => Traversal' s a
- (<|>~) :: Snoc b b p p => LensLike ((,) b) s t b b -> p -> s -> (b, t)
- (<<|>~) :: Snoc b b p p => LensLike' ((,) b) s b -> p -> s -> (b, s)
- (<|>=) :: (MonadState s m, Snoc b b p p) => LensLike ((,) b) s s b b -> p -> m b
- (<<|>=) :: (MonadState s m, Snoc b b p p) => LensLike ((,) b) s s b b -> p -> m b
- class (Rewrapped s t, Rewrapped t s) => Rewrapping s t
- class Wrapped s => Rewrapped s t
- type family Unwrapped s
- pattern Unwrapped :: Rewrapped t t => t -> Unwrapped t
- _GWrapped' :: forall s (d :: Meta) (c :: Meta) (s' :: Meta) a. (Generic s, D1 d (C1 c (S1 s' (Rec0 a))) ~ Rep s, Unwrapped s ~ GUnwrapped (Rep s)) => Iso' s (Unwrapped s)
- _Unwrapped' :: Wrapped s => Iso' (Unwrapped s) s
- _Wrapped :: Rewrapping s t => Iso s t (Unwrapped s) (Unwrapped t)
- _Unwrapped :: Rewrapping s t => Iso (Unwrapped t) (Unwrapped s) t s
- op :: Wrapped s => (Unwrapped s -> s) -> s -> Unwrapped s
- _Wrapping' :: Wrapped s => (Unwrapped s -> s) -> Iso' s (Unwrapped s)
- _Unwrapping' :: Wrapped s => (Unwrapped s -> s) -> Iso' (Unwrapped s) s
- _Wrapping :: Rewrapping s t => (Unwrapped s -> s) -> Iso s t (Unwrapped s) (Unwrapped t)
- _Unwrapping :: Rewrapping s t => (Unwrapped s -> s) -> Iso (Unwrapped t) (Unwrapped s) t s
- type family Magnified (m :: Type -> Type) :: Type -> Type -> Type
- type family Zoomed (m :: Type -> Type) :: Type -> Type -> Type
- class GPlated1 (f :: k -> Type) (g :: k -> Type)
- class GPlated a (g :: k -> Type)
- deep :: (Conjoined p, Applicative f, Plated s) => Traversing p f s s a b -> Over p f s s a b
- rewrite :: Plated a => (a -> Maybe a) -> a -> a
- rewriteOf :: ASetter a b a b -> (b -> Maybe a) -> a -> b
- rewriteOn :: Plated a => ASetter s t a a -> (a -> Maybe a) -> s -> t
- rewriteOnOf :: ASetter s t a b -> ASetter a b a b -> (b -> Maybe a) -> s -> t
- rewriteM :: (Monad m, Plated a) => (a -> m (Maybe a)) -> a -> m a
- rewriteMOf :: Monad m => LensLike (WrappedMonad m) a b a b -> (b -> m (Maybe a)) -> a -> m b
- rewriteMOn :: (Monad m, Plated a) => LensLike (WrappedMonad m) s t a a -> (a -> m (Maybe a)) -> s -> m t
- rewriteMOnOf :: Monad m => LensLike (WrappedMonad m) s t a b -> LensLike (WrappedMonad m) a b a b -> (b -> m (Maybe a)) -> s -> m t
- universe :: Plated a => a -> [a]
- universeOf :: Getting (Endo [a]) a a -> a -> [a]
- universeOn :: Plated a => Getting (Endo [a]) s a -> s -> [a]
- universeOnOf :: Getting (Endo [a]) s a -> Getting (Endo [a]) a a -> s -> [a]
- cosmos :: Plated a => Fold a a
- cosmosOf :: (Applicative f, Contravariant f) => LensLike' f a a -> LensLike' f a a
- cosmosOn :: (Applicative f, Contravariant f, Plated a) => LensLike' f s a -> LensLike' f s a
- cosmosOnOf :: (Applicative f, Contravariant f) => LensLike' f s a -> LensLike' f a a -> LensLike' f s a
- transformOn :: Plated a => ASetter s t a a -> (a -> a) -> s -> t
- transformOf :: ASetter a b a b -> (b -> b) -> a -> b
- transformOnOf :: ASetter s t a b -> ASetter a b a b -> (b -> b) -> s -> t
- transformM :: (Monad m, Plated a) => (a -> m a) -> a -> m a
- transformMOn :: (Monad m, Plated a) => LensLike (WrappedMonad m) s t a a -> (a -> m a) -> s -> m t
- transformMOf :: Monad m => LensLike (WrappedMonad m) a b a b -> (b -> m b) -> a -> m b
- transformMOnOf :: Monad m => LensLike (WrappedMonad m) s t a b -> LensLike (WrappedMonad m) a b a b -> (b -> m b) -> s -> m t
- contexts :: Plated a => a -> [Context a a a]
- contextsOn :: Plated a => ATraversal s t a a -> s -> [Context a a t]
- contextsOnOf :: ATraversal s t a a -> ATraversal' a a -> s -> [Context a a t]
- holes :: Plated a => a -> [Pretext (->) a a a]
- holesOn :: Conjoined p => Over p (Bazaar p a a) s t a a -> s -> [Pretext p a a t]
- holesOnOf :: Conjoined p => LensLike (Bazaar p r r) s t a b -> Over p (Bazaar p r r) a b r r -> s -> [Pretext p r r t]
- paraOf :: Getting (Endo [a]) a a -> (a -> [r] -> r) -> a -> r
- para :: Plated a => (a -> [r] -> r) -> a -> r
- composOpFold :: Plated a => b -> (b -> b -> b) -> (a -> b) -> a -> b
- parts :: Plated a => Lens' a [a]
- gplate :: (Generic a, GPlated a (Rep a)) => Traversal' a a
- gplate1 :: forall {k} (f :: k -> Type) (a :: k). (Generic1 f, GPlated1 f (Rep1 f)) => Traversal' (f a) (f a)
- class Ixed m => At m
- class Ixed m where
- ix :: Index m -> Traversal' m (IxValue m)
- type family IxValue m
- class Contains m
- type family Index s
- icontains :: Contains m => Index m -> IndexedLens' (Index m) m Bool
- iix :: Ixed m => Index m -> IndexedTraversal' (Index m) m (IxValue m)
- ixAt :: At m => Index m -> Traversal' m (IxValue m)
- sans :: At m => Index m -> m -> m
- iat :: At m => Index m -> IndexedLens' (Index m) m (Maybe (IxValue m))
- makePrisms :: Name -> DecsQ
- makeClassyPrisms :: Name -> DecsQ
- type ClassyNamer = Name -> Maybe (Name, Name)
- data DefName
- type FieldNamer = Name -> [Name] -> Name -> [DefName]
- data LensRules
- simpleLenses :: Lens' LensRules Bool
- generateSignatures :: Lens' LensRules Bool
- generateUpdateableOptics :: Lens' LensRules Bool
- generateLazyPatterns :: Lens' LensRules Bool
- generateRecordSyntax :: Lens' LensRules Bool
- createClass :: Lens' LensRules Bool
- lensField :: Lens' LensRules FieldNamer
- lensClass :: Lens' LensRules ClassyNamer
- lensRules :: LensRules
- underscoreNoPrefixNamer :: FieldNamer
- lensRulesFor :: [(String, String)] -> LensRules
- lookingupNamer :: [(String, String)] -> FieldNamer
- mappingNamer :: (String -> [String]) -> FieldNamer
- classyRules :: LensRules
- classyRules_ :: LensRules
- makeLenses :: Name -> DecsQ
- makeClassy :: Name -> DecsQ
- makeClassy_ :: Name -> DecsQ
- makeLensesFor :: [(String, String)] -> Name -> DecsQ
- makeClassyFor :: String -> String -> [(String, String)] -> Name -> DecsQ
- makeLensesWith :: LensRules -> Name -> DecsQ
- declareLenses :: DecsQ -> DecsQ
- declareLensesFor :: [(String, String)] -> DecsQ -> DecsQ
- declareClassy :: DecsQ -> DecsQ
- declareClassyFor :: [(String, (String, String))] -> [(String, String)] -> DecsQ -> DecsQ
- declarePrisms :: DecsQ -> DecsQ
- declareWrapped :: DecsQ -> DecsQ
- declareFields :: DecsQ -> DecsQ
- declareLensesWith :: LensRules -> DecsQ -> DecsQ
- makeWrapped :: Name -> DecsQ
- underscoreFields :: LensRules
- underscoreNamer :: FieldNamer
- camelCaseFields :: LensRules
- camelCaseNamer :: FieldNamer
- classUnderscoreNoPrefixFields :: LensRules
- classUnderscoreNoPrefixNamer :: FieldNamer
- classIdFields :: LensRules
- classIdNamer :: FieldNamer
- abbreviatedFields :: LensRules
- abbreviatedNamer :: FieldNamer
- makeFields :: Name -> DecsQ
- makeFieldsNoPrefix :: Name -> DecsQ
- makeFieldsId :: Name -> DecsQ
- defaultFieldRules :: LensRules
- class Functor f => Applicative (f :: Type -> Type) where
- (*>) :: Applicative f => f a -> f b -> f b
- (<*) :: Applicative f => f a -> f b -> f a
- (<$>) :: Functor f => (a -> b) -> f a -> f b
- (<$) :: Functor f => a -> f b -> f a
- liftA :: Applicative f => (a -> b) -> f a -> f b
- liftA2 :: Applicative f => (a -> b -> c) -> f a -> f b -> f c
- liftA3 :: Applicative f => (a -> b -> c -> d) -> f a -> f b -> f c -> f d
Diagrams library
Exports from this library for working with diagrams.
module Diagrams
Convenience re-exports from other packages
Minimal complete definition
Nothing
Instances
For representing and operating on colors.
class ColourOps (f :: Type -> Type) where #
Minimal complete definition
over, darken
Instances
| ColourOps AlphaColour | |
Defined in Data.Colour.Internal Methods over :: Num a => AlphaColour a -> AlphaColour a -> AlphaColour a darken :: Num a => a -> AlphaColour a -> AlphaColour a # | |
| ColourOps Colour | |
data AlphaColour a #
Instances
Instances
| AffineSpace Colour | |
Defined in Data.Colour.Internal Methods affineCombo :: Num a => [(a, Colour a)] -> Colour a -> Colour a | |
| ColourOps Colour | |
| a ~ Double => Color (Colour a) Source # | |
Defined in Diagrams.Attributes Methods toAlphaColour :: Colour a -> AlphaColour Double Source # fromAlphaColour :: AlphaColour Double -> Colour a Source # | |
| Parseable (Colour Double) Source # | Parse |
| Num a => Monoid (Colour a) | |
| Num a => Semigroup (Colour a) | |
| (Fractional a, Read a) => Read (Colour a) | |
| (Fractional a, Show a) => Show (Colour a) | |
| Eq a => Eq (Colour a) | |
colourConvert :: (Fractional b, Real a) => Colour a -> Colour b #
transparent :: Num a => AlphaColour a #
alphaColourConvert :: (Fractional b, Real a) => AlphaColour a -> AlphaColour b #
opaque :: Num a => Colour a -> AlphaColour a #
dissolve :: Num a => a -> AlphaColour a -> AlphaColour a #
withOpacity :: Num a => Colour a -> a -> AlphaColour a #
alphaChannel :: AlphaColour a -> a #
A large list of color names.
antiquewhite :: (Ord a, Floating a) => Colour a #
aquamarine :: (Ord a, Floating a) => Colour a #
blanchedalmond :: (Ord a, Floating a) => Colour a #
blueviolet :: (Ord a, Floating a) => Colour a #
chartreuse :: (Ord a, Floating a) => Colour a #
cornflowerblue :: (Ord a, Floating a) => Colour a #
darkgoldenrod :: (Ord a, Floating a) => Colour a #
darkmagenta :: (Ord a, Floating a) => Colour a #
darkolivegreen :: (Ord a, Floating a) => Colour a #
darkorange :: (Ord a, Floating a) => Colour a #
darkorchid :: (Ord a, Floating a) => Colour a #
darksalmon :: (Ord a, Floating a) => Colour a #
darkseagreen :: (Ord a, Floating a) => Colour a #
darkslateblue :: (Ord a, Floating a) => Colour a #
darkslategray :: (Ord a, Floating a) => Colour a #
darkslategrey :: (Ord a, Floating a) => Colour a #
darkturquoise :: (Ord a, Floating a) => Colour a #
darkviolet :: (Ord a, Floating a) => Colour a #
deepskyblue :: (Ord a, Floating a) => Colour a #
dodgerblue :: (Ord a, Floating a) => Colour a #
floralwhite :: (Ord a, Floating a) => Colour a #
forestgreen :: (Ord a, Floating a) => Colour a #
ghostwhite :: (Ord a, Floating a) => Colour a #
greenyellow :: (Ord a, Floating a) => Colour a #
lavenderblush :: (Ord a, Floating a) => Colour a #
lemonchiffon :: (Ord a, Floating a) => Colour a #
lightcoral :: (Ord a, Floating a) => Colour a #
lightgoldenrodyellow :: (Ord a, Floating a) => Colour a #
lightgreen :: (Ord a, Floating a) => Colour a #
lightsalmon :: (Ord a, Floating a) => Colour a #
lightseagreen :: (Ord a, Floating a) => Colour a #
lightskyblue :: (Ord a, Floating a) => Colour a #
lightslategray :: (Ord a, Floating a) => Colour a #
lightslategrey :: (Ord a, Floating a) => Colour a #
lightsteelblue :: (Ord a, Floating a) => Colour a #
lightyellow :: (Ord a, Floating a) => Colour a #
mediumaquamarine :: (Ord a, Floating a) => Colour a #
mediumblue :: (Ord a, Floating a) => Colour a #
mediumorchid :: (Ord a, Floating a) => Colour a #
mediumpurple :: (Ord a, Floating a) => Colour a #
mediumseagreen :: (Ord a, Floating a) => Colour a #
mediumslateblue :: (Ord a, Floating a) => Colour a #
mediumspringgreen :: (Ord a, Floating a) => Colour a #
mediumturquoise :: (Ord a, Floating a) => Colour a #
mediumvioletred :: (Ord a, Floating a) => Colour a #
midnightblue :: (Ord a, Floating a) => Colour a #
navajowhite :: (Ord a, Floating a) => Colour a #
palegoldenrod :: (Ord a, Floating a) => Colour a #
paleturquoise :: (Ord a, Floating a) => Colour a #
palevioletred :: (Ord a, Floating a) => Colour a #
papayawhip :: (Ord a, Floating a) => Colour a #
powderblue :: (Ord a, Floating a) => Colour a #
saddlebrown :: (Ord a, Floating a) => Colour a #
sandybrown :: (Ord a, Floating a) => Colour a #
springgreen :: (Ord a, Floating a) => Colour a #
whitesmoke :: (Ord a, Floating a) => Colour a #
yellowgreen :: (Ord a, Floating a) => Colour a #
Specify your own colours.
Instances
| AffineSpace Colour | |
Defined in Data.Colour.Internal Methods affineCombo :: Num a => [(a, Colour a)] -> Colour a -> Colour a | |
| ColourOps Colour | |
| a ~ Double => Color (Colour a) Source # | |
Defined in Diagrams.Attributes Methods toAlphaColour :: Colour a -> AlphaColour Double Source # fromAlphaColour :: AlphaColour Double -> Colour a Source # | |
| Parseable (Colour Double) Source # | Parse |
| Num a => Monoid (Colour a) | |
| Num a => Semigroup (Colour a) | |
| (Fractional a, Read a) => Read (Colour a) | |
| (Fractional a, Show a) => Show (Colour a) | |
| Eq a => Eq (Colour a) | |
Constructors
| RGB | |
Fields
| |
Semigroups and monoids show up all over the place, so things from Data.Semigroup and Data.Monoid often come in handy.
module Data.Semigroup
For computing with vectors.
module Linear.Vector
For computing with points and vectors.
module Linear.Affine
For computing with dot products and norm.
module Linear.Metric
For working with Active (i.e. animated) things.
module Data.Active
Most of the lens package. The following functions are not exported from lens because they either conflict with diagrams or may conflict with other libraries:
type Traversal s t a b = forall (f :: Type -> Type). Applicative f => (a -> f b) -> s -> f t Source #
A Traversal can be used directly as a Setter or a Fold (but not as a Lens) and provides
the ability to both read and update multiple fields, subject to some relatively weak Traversal laws.
These have also been known as multilenses, but they have the signature and spirit of
traverse::Traversablef =>Traversal(f a) (f b) a b
and the more evocative name suggests their application.
Most of the time the Traversal you will want to use is just traverse, but you can also pass any
Lens or Iso as a Traversal, and composition of a Traversal (or Lens or Iso) with a Traversal (or Lens or Iso)
using (.) forms a valid Traversal.
The laws for a Traversal t follow from the laws for Traversable as stated in "The Essence of the Iterator Pattern".
tpure≡purefmap(t f).t g ≡getCompose.t (Compose.fmapf.g)
One consequence of this requirement is that a Traversal needs to leave the same number of elements as a
candidate for subsequent Traversal that it started with. Another testament to the strength of these laws
is that the caveat expressed in section 5.5 of the "Essence of the Iterator Pattern" about exotic
Traversable instances that traverse the same entry multiple times was actually already ruled out by the
second law in that same paper!
newtype ReifiedTraversal s t a b Source #
A form of Traversal that can be stored monomorphically in a container.
Constructors
| Traversal | |
Fields
| |
type Fold s a = forall (f :: Type -> Type). (Contravariant f, Applicative f) => (a -> f a) -> s -> f s Source #
A Fold describes how to retrieve multiple values in a way that can be composed
with other LensLike constructions.
A provides a structure with operations very similar to those of the Fold s aFoldable
typeclass, see foldMapOf and the other Fold combinators.
By convention, if there exists a foo method that expects a , then there should be a
Foldable (f a)fooOf method that takes a and a value of type Fold s as.
A Getter is a legal Fold that just ignores the supplied Monoid.
Unlike a Traversal a Fold is read-only. Since a Fold cannot be used to write back
there are no Lens laws that apply.
newtype ReifiedFold s a Source #
Reify a Fold so it can be stored safely in a container.
This can also be useful for creatively combining folds as
is isomorphic to ReifiedFold sReaderT s [] and provides similar
instances.
>>>("hello","world")^..runFold ((,) <$> Fold _2 <*> Fold both)[("world","hello"),("world","world")]
Instances
index :: (Indexable i p, Eq i, Applicative f) => i -> Optical' p (Indexed i) f a a Source #
This allows you to filter an IndexedFold, IndexedGetter, IndexedTraversal or IndexedLens based on an index.
>>>["hello","the","world","!!!"]^?traversed.index 2Just "world"
class Contravariant (f :: Type -> Type) where Source #
The class of contravariant functors.
Whereas in Haskell, one can think of a Functor as containing or producing
values, a contravariant functor is a functor that can be thought of as
consuming values.
As an example, consider the type of predicate functions a -> Bool. One
such predicate might be negative x = x < 0, which
classifies integers as to whether they are negative. However, given this
predicate, we can re-use it in other situations, providing we have a way to
map values to integers. For instance, we can use the negative predicate
on a person's bank balance to work out if they are currently overdrawn:
newtype Predicate a = Predicate { getPredicate :: a -> Bool }
instance Contravariant Predicate where
contramap :: (a' -> a) -> (Predicate a -> Predicate a')
contramap f (Predicate p) = Predicate (p . f)
| `- First, map the input...
`----- then apply the predicate.
overdrawn :: Predicate Person
overdrawn = contramap personBankBalance negative
Any instance should be subject to the following laws:
Note, that the second law follows from the free theorem of the type of
contramap and the first law, so you need only check that the former
condition holds.
Minimal complete definition
Instances
| Contravariant Comparison | A |
Defined in Data.Functor.Contravariant Methods contramap :: (a' -> a) -> Comparison a -> Comparison a' Source # (>$) :: b -> Comparison b -> Comparison a Source # | |
| Contravariant Equivalence | Equivalence relations are |
Defined in Data.Functor.Contravariant Methods contramap :: (a' -> a) -> Equivalence a -> Equivalence a' Source # (>$) :: b -> Equivalence b -> Equivalence a Source # | |
| Contravariant Predicate | A Without newtypes contramap :: (a' -> a) -> (Predicate a -> Predicate a') contramap f (Predicate g) = Predicate (g . f) |
| Contravariant (Op a) | |
| Contravariant (Proxy :: Type -> Type) | |
| Contravariant (U1 :: Type -> Type) | |
| Contravariant (V1 :: Type -> Type) | |
| Contravariant f => Contravariant (Indexing f) | |
| Contravariant f => Contravariant (Indexing64 f) | |
Defined in Control.Lens.Internal.Indexed Methods contramap :: (a' -> a) -> Indexing64 f a -> Indexing64 f a' Source # (>$) :: b -> Indexing64 f b -> Indexing64 f a Source # | |
| Contravariant m => Contravariant (MaybeT m) | |
| Contravariant (Const a :: Type -> Type) | |
| Contravariant f => Contravariant (Alt f) | |
| Contravariant f => Contravariant (Rec1 f) | |
| Contravariant f => Contravariant (AlongsideLeft f b) | |
Defined in Control.Lens.Internal.Getter Methods contramap :: (a' -> a) -> AlongsideLeft f b a -> AlongsideLeft f b a' Source # (>$) :: b0 -> AlongsideLeft f b b0 -> AlongsideLeft f b a Source # | |
| Contravariant f => Contravariant (AlongsideRight f a) | |
Defined in Control.Lens.Internal.Getter Methods contramap :: (a' -> a0) -> AlongsideRight f a a0 -> AlongsideRight f a a' Source # (>$) :: b -> AlongsideRight f a b -> AlongsideRight f a a0 Source # | |
| Contravariant (Effect m r) | |
| Contravariant f => Contravariant (Backwards f) | Derived instance. |
| Contravariant m => Contravariant (ExceptT e m) | |
| Contravariant f => Contravariant (IdentityT f) | |
| Contravariant m => Contravariant (ReaderT r m) | |
| Contravariant m => Contravariant (StateT s m) | |
| Contravariant m => Contravariant (StateT s m) | |
| Contravariant m => Contravariant (WriterT w m) | |
| Contravariant m => Contravariant (WriterT w m) | |
| Contravariant (Constant a :: Type -> Type) | |
| Contravariant f => Contravariant (Reverse f) | Derived instance. |
| (Contravariant f, Contravariant g) => Contravariant (Product f g) | |
| (Contravariant f, Contravariant g) => Contravariant (Sum f g) | |
| (Contravariant f, Contravariant g) => Contravariant (f :*: g) | |
| (Contravariant f, Contravariant g) => Contravariant (f :+: g) | |
| Contravariant (K1 i c :: Type -> Type) | |
| Contravariant (Forget r a :: Type -> Type) | |
| Contravariant f => Contravariant (Star f a) | |
| (Functor f, Contravariant g) => Contravariant (Compose f g) | |
| (Functor f, Contravariant g) => Contravariant (f :.: g) | |
| Contravariant f => Contravariant (M1 i c f) | |
| (Profunctor p, Contravariant g) => Contravariant (BazaarT p g a b) | |
| (Profunctor p, Contravariant g) => Contravariant (BazaarT1 p g a b) | |
| (Profunctor p, Contravariant g) => Contravariant (PretextT p g a b) | |
| Contravariant f => Contravariant (TakingWhile p f a b) | |
Defined in Control.Lens.Internal.Magma Methods contramap :: (a' -> a0) -> TakingWhile p f a b a0 -> TakingWhile p f a b a' Source # (>$) :: b0 -> TakingWhile p f a b b0 -> TakingWhile p f a b a0 Source # | |
| Contravariant (EffectRWS w st m s) | |
| Contravariant m => Contravariant (RWST r w s m) | |
| Contravariant m => Contravariant (RWST r w s m) | |
class (forall a. Functor (p a)) => Bifunctor (p :: Type -> Type -> Type) where Source #
A bifunctor is a type constructor that takes
two type arguments and is a functor in both arguments. That
is, unlike with Functor, a type constructor such as Either
does not need to be partially applied for a Bifunctor
instance, and the methods in this class permit mapping
functions over the Left value or the Right value,
or both at the same time.
Formally, the class Bifunctor represents a bifunctor
from Hask -> Hask.
Intuitively it is a bifunctor where both the first and second arguments are covariant.
The class definition of a Bifunctor p uses the
QuantifiedConstraints
language extension to quantify over the first type
argument a in its context. The context requires that p a
must be a Functor for all a. In other words a partially
applied Bifunctor must be a Functor. This makes Functor a
superclass of Bifunctor such that a function with a
Bifunctor constraint may use fmap in its implementation.
Functor has been a quantified superclass of
Bifunctor since base-4.18.0.0.
You can define a Bifunctor by either defining bimap or by
defining both first and second. The second method must
agree with fmap:
second≡fmap
From this it follows that:
secondid≡id
If you supply bimap, you should ensure that:
bimapidid≡id
If you supply first and second, ensure:
firstid≡idsecondid≡id
If you supply both, you should also ensure:
bimapf g ≡firstf.secondg
These ensure by parametricity:
bimap(f.g) (h.i) ≡bimapf h.bimapg ifirst(f.g) ≡firstf.firstgsecond(f.g) ≡secondf.secondg
Since: base-4.8.0.0
Methods
Instances
| Bifunctor Arg | Since: base-4.9.0.0 |
| Bifunctor Either | Since: base-4.8.0.0 |
| Bifunctor Either | |
| Bifunctor These | |
| Bifunctor Pair | |
| Bifunctor These | |
| Bifunctor (,) | Class laws for tuples hold only up to laziness. Both
Since: base-4.8.0.0 |
| Functor f => Bifunctor (CofreeF f) | |
| Functor f => Bifunctor (FreeF f) | |
| Bifunctor (Const :: Type -> Type -> Type) | Since: base-4.8.0.0 |
| Functor f => Bifunctor (AlongsideLeft f) | |
Defined in Control.Lens.Internal.Getter Methods bimap :: (a -> b) -> (c -> d) -> AlongsideLeft f a c -> AlongsideLeft f b d Source # first :: (a -> b) -> AlongsideLeft f a c -> AlongsideLeft f b c Source # second :: (b -> c) -> AlongsideLeft f a b -> AlongsideLeft f a c Source # | |
| Functor f => Bifunctor (AlongsideRight f) | |
Defined in Control.Lens.Internal.Getter Methods bimap :: (a -> b) -> (c -> d) -> AlongsideRight f a c -> AlongsideRight f b d Source # first :: (a -> b) -> AlongsideRight f a c -> AlongsideRight f b c Source # second :: (b -> c) -> AlongsideRight f a b -> AlongsideRight f a c Source # | |
| Bifunctor (Tagged :: Type -> Type -> Type) | |
| Bifunctor (Constant :: Type -> Type -> Type) | |
| Bifunctor ((,,) x1) | Since: base-4.8.0.0 |
| Bifunctor (K1 i :: Type -> Type -> Type) | Since: base-4.9.0.0 |
| Bifunctor ((,,,) x1 x2) | Since: base-4.8.0.0 |
| Functor f => Bifunctor (Clown f :: Type -> Type -> Type) | |
| Bifunctor p => Bifunctor (Flip p) | |
| Functor g => Bifunctor (Joker g :: Type -> Type -> Type) | |
| Bifunctor p => Bifunctor (WrappedBifunctor p) | |
| Bifunctor ((,,,,) x1 x2 x3) | Since: base-4.8.0.0 |
| (Bifunctor f, Bifunctor g) => Bifunctor (Product f g) | |
| (Bifunctor p, Bifunctor q) => Bifunctor (Sum p q) | |
| Bifunctor ((,,,,,) x1 x2 x3 x4) | Since: base-4.8.0.0 |
| (Functor f, Bifunctor p) => Bifunctor (Tannen f p) | |
| Bifunctor ((,,,,,,) x1 x2 x3 x4 x5) | Since: base-4.8.0.0 |
Defined in Data.Bifunctor | |
| (Bifunctor p, Functor f, Functor g) => Bifunctor (Biff p f g) | |
class (Functor t, Foldable t) => Traversable (t :: Type -> Type) where Source #
Functors representing data structures that can be transformed to
structures of the same shape by performing an Applicative (or,
therefore, Monad) action on each element from left to right.
A more detailed description of what same shape means, the various methods, how traversals are constructed, and example advanced use-cases can be found in the Overview section of Data.Traversable.
For the class laws see the Laws section of Data.Traversable.
Methods
traverse :: Applicative f => (a -> f b) -> t a -> f (t b) Source #
Map each element of a structure to an action, evaluate these actions
from left to right, and collect the results. For a version that ignores
the results see traverse_.
Examples
Basic usage:
In the first two examples we show each evaluated action mapping to the output structure.
>>>traverse Just [1,2,3,4]Just [1,2,3,4]
>>>traverse id [Right 1, Right 2, Right 3, Right 4]Right [1,2,3,4]
In the next examples, we show that Nothing and Left values short
circuit the created structure.
>>>traverse (const Nothing) [1,2,3,4]Nothing
>>>traverse (\x -> if odd x then Just x else Nothing) [1,2,3,4]Nothing
>>>traverse id [Right 1, Right 2, Right 3, Right 4, Left 0]Left 0
Instances
| Traversable Complex | Since: base-4.9.0.0 |
Defined in Data.Complex | |
| Traversable First | Since: base-4.9.0.0 |
| Traversable Last | Since: base-4.9.0.0 |
| Traversable Max | Since: base-4.9.0.0 |
| Traversable Min | Since: base-4.9.0.0 |
| Traversable SCC | Since: containers-0.5.9 |
| Traversable IntMap | Traverses in order of increasing key. |
Defined in Data.IntMap.Internal | |
| Traversable Digit | |
Defined in Data.Sequence.Internal | |
| Traversable Elem | |
| Traversable FingerTree | |
Defined in Data.Sequence.Internal Methods traverse :: Applicative f => (a -> f b) -> FingerTree a -> f (FingerTree b) Source # sequenceA :: Applicative f => FingerTree (f a) -> f (FingerTree a) Source # mapM :: Monad m => (a -> m b) -> FingerTree a -> m (FingerTree b) Source # sequence :: Monad m => FingerTree (m a) -> m (FingerTree a) Source # | |
| Traversable Node | |
| Traversable Seq | |
| Traversable ViewL | |
Defined in Data.Sequence.Internal | |
| Traversable ViewR | |
Defined in Data.Sequence.Internal | |
| Traversable Tree | |
| Traversable NonEmpty | Since: base-4.9.0.0 |
Defined in GHC.Internal.Data.Traversable | |
| Traversable Identity | Since: base-4.9.0.0 |
Defined in GHC.Internal.Data.Traversable | |
| Traversable First | Since: base-4.8.0.0 |
Defined in GHC.Internal.Data.Traversable | |
| Traversable Last | Since: base-4.8.0.0 |
Defined in GHC.Internal.Data.Traversable | |
| Traversable Down | Since: base-4.12.0.0 |
Defined in GHC.Internal.Data.Traversable | |
| Traversable Dual | Since: base-4.8.0.0 |
Defined in GHC.Internal.Data.Traversable | |
| Traversable Product | Since: base-4.8.0.0 |
Defined in GHC.Internal.Data.Traversable | |
| Traversable Sum | Since: base-4.8.0.0 |
| Traversable ZipList | Since: base-4.9.0.0 |
Defined in GHC.Internal.Functor.ZipList | |
| Traversable Par1 | Since: base-4.9.0.0 |
Defined in GHC.Internal.Data.Traversable | |
| Traversable Interval | |
Defined in Numeric.Interval.Kaucher | |
| Traversable Deque | |
Defined in Control.Lens.Internal.Deque | |
| Traversable Plucker | |
Defined in Linear.Plucker | |
| Traversable Quaternion | |
Defined in Linear.Quaternion Methods traverse :: Applicative f => (a -> f b) -> Quaternion a -> f (Quaternion b) Source # sequenceA :: Applicative f => Quaternion (f a) -> f (Quaternion a) Source # mapM :: Monad m => (a -> m b) -> Quaternion a -> m (Quaternion b) Source # sequence :: Monad m => Quaternion (m a) -> m (Quaternion a) Source # | |
| Traversable V0 | |
| Traversable V1 | |
| Traversable V2 | |
| Traversable V3 | |
| Traversable V4 | |
| Traversable Cut | |
| Traversable Deletable | |
Defined in Data.Monoid.Deletable Methods traverse :: Applicative f => (a -> f b) -> Deletable a -> f (Deletable b) Source # sequenceA :: Applicative f => Deletable (f a) -> f (Deletable a) Source # mapM :: Monad m => (a -> m b) -> Deletable a -> m (Deletable b) Source # sequence :: Monad m => Deletable (m a) -> m (Deletable a) Source # | |
| Traversable Recommend | |
Defined in Data.Monoid.Recommend Methods traverse :: Applicative f => (a -> f b) -> Recommend a -> f (Recommend b) Source # sequenceA :: Applicative f => Recommend (f a) -> f (Recommend a) Source # mapM :: Monad m => (a -> m b) -> Recommend a -> m (Recommend b) Source # sequence :: Monad m => Recommend (m a) -> m (Recommend a) Source # | |
| Traversable Split | |
| Traversable SimpleDocStream | |
Defined in Prettyprinter.Internal Methods traverse :: Applicative f => (a -> f b) -> SimpleDocStream a -> f (SimpleDocStream b) Source # sequenceA :: Applicative f => SimpleDocStream (f a) -> f (SimpleDocStream a) Source # mapM :: Monad m => (a -> m b) -> SimpleDocStream a -> m (SimpleDocStream b) Source # sequence :: Monad m => SimpleDocStream (m a) -> m (SimpleDocStream a) Source # | |
| Traversable Array | |
Defined in Data.Primitive.Array | |
| Traversable SmallArray | |
Defined in Data.Primitive.SmallArray Methods traverse :: Applicative f => (a -> f b) -> SmallArray a -> f (SmallArray b) Source # sequenceA :: Applicative f => SmallArray (f a) -> f (SmallArray a) Source # mapM :: Monad m => (a -> m b) -> SmallArray a -> m (SmallArray b) Source # sequence :: Monad m => SmallArray (m a) -> m (SmallArray a) Source # | |
| Traversable Maybe | |
| Traversable TyVarBndr | |
Defined in Language.Haskell.TH.Syntax Methods traverse :: Applicative f => (a -> f b) -> TyVarBndr a -> f (TyVarBndr b) Source # sequenceA :: Applicative f => TyVarBndr (f a) -> f (TyVarBndr a) Source # mapM :: Monad m => (a -> m b) -> TyVarBndr a -> m (TyVarBndr b) Source # sequence :: Monad m => TyVarBndr (m a) -> m (TyVarBndr a) Source # | |
| Traversable Vector | |
| Traversable Vector | |
Defined in Data.Vector.Strict | |
| Traversable Maybe | Since: base-2.1 |
Defined in GHC.Internal.Data.Traversable | |
| Traversable Solo | Since: base-4.15 |
Defined in GHC.Internal.Data.Traversable | |
| Traversable [] | Since: base-2.1 |
| Traversable (Arg a) | Since: base-4.9.0.0 |
Defined in Data.Semigroup | |
| Traversable (Map k) | Traverses in order of increasing key. |
| (Monad m, Traversable m) => Traversable (CatchT m) | |
Defined in Control.Monad.Catch.Pure | |
| Traversable (IntervalMap v) | |
Defined in Data.IntervalMap.FingerTree Methods traverse :: Applicative f => (a -> f b) -> IntervalMap v a -> f (IntervalMap v b) Source # sequenceA :: Applicative f => IntervalMap v (f a) -> f (IntervalMap v a) Source # mapM :: Monad m => (a -> m b) -> IntervalMap v a -> m (IntervalMap v b) Source # sequence :: Monad m => IntervalMap v (m a) -> m (IntervalMap v a) Source # | |
| Traversable (Node v) | |
Defined in Data.IntervalMap.FingerTree | |
| Traversable f => Traversable (Cofree f) | |
Defined in Control.Comonad.Cofree | |
| Traversable f => Traversable (Free f) | |
Defined in Control.Monad.Free | |
| Ix i => Traversable (Array i) | Since: base-2.1 |
Defined in GHC.Internal.Data.Traversable | |
| Traversable (Either a) | Since: base-4.7.0.0 |
Defined in GHC.Internal.Data.Traversable Methods traverse :: Applicative f => (a0 -> f b) -> Either a a0 -> f (Either a b) Source # sequenceA :: Applicative f => Either a (f a0) -> f (Either a a0) Source # mapM :: Monad m => (a0 -> m b) -> Either a a0 -> m (Either a b) Source # sequence :: Monad m => Either a (m a0) -> m (Either a a0) Source # | |
| Traversable (Proxy :: Type -> Type) | Since: base-4.7.0.0 |
Defined in GHC.Internal.Data.Traversable | |
| Traversable (U1 :: Type -> Type) | Since: base-4.9.0.0 |
| Traversable (UAddr :: Type -> Type) | Since: base-4.9.0.0 |
Defined in GHC.Internal.Data.Traversable | |
| Traversable (UChar :: Type -> Type) | Since: base-4.9.0.0 |
Defined in GHC.Internal.Data.Traversable | |
| Traversable (UDouble :: Type -> Type) | Since: base-4.9.0.0 |
Defined in GHC.Internal.Data.Traversable | |
| Traversable (UFloat :: Type -> Type) | Since: base-4.9.0.0 |
Defined in GHC.Internal.Data.Traversable | |
| Traversable (UInt :: Type -> Type) | Since: base-4.9.0.0 |
Defined in GHC.Internal.Data.Traversable | |
| Traversable (UWord :: Type -> Type) | Since: base-4.9.0.0 |
Defined in GHC.Internal.Data.Traversable | |
| Traversable (V1 :: Type -> Type) | Since: base-4.9.0.0 |
| Traversable f => Traversable (Yoneda f) | |
Defined in Data.Functor.Yoneda | |
| Traversable (Level i) | |
Defined in Control.Lens.Internal.Level | |
| Traversable f => Traversable (Point f) | |
Defined in Linear.Affine | |
| Traversable (Inf p) | |
| Traversable (Either e) | |
Defined in Data.Strict.Either | |
| Traversable (These a) | |
Defined in Data.Strict.These | |
| Traversable (Pair e) | |
Defined in Data.Strict.Tuple | |
| Traversable (These a) | |
Defined in Data.These | |
| Traversable f => Traversable (Lift f) | |
Defined in Control.Applicative.Lift | |
| Traversable f => Traversable (MaybeT f) | |
Defined in Control.Monad.Trans.Maybe | |
| Traversable (HashMap k) | |
Defined in Data.HashMap.Internal Methods traverse :: Applicative f => (a -> f b) -> HashMap k a -> f (HashMap k b) Source # sequenceA :: Applicative f => HashMap k (f a) -> f (HashMap k a) Source # mapM :: Monad m => (a -> m b) -> HashMap k a -> m (HashMap k b) Source # sequence :: Monad m => HashMap k (m a) -> m (HashMap k a) Source # | |
| Traversable ((,) a) | Since: base-4.7.0.0 |
| (Traversable f, Traversable m) => Traversable (ReaderT f m) | |
Defined in Control.Monad.Representable.Reader Methods traverse :: Applicative f0 => (a -> f0 b) -> ReaderT f m a -> f0 (ReaderT f m b) Source # sequenceA :: Applicative f0 => ReaderT f m (f0 a) -> f0 (ReaderT f m a) Source # mapM :: Monad m0 => (a -> m0 b) -> ReaderT f m a -> m0 (ReaderT f m b) Source # sequence :: Monad m0 => ReaderT f m (m0 a) -> m0 (ReaderT f m a) Source # | |
| Bitraversable p => Traversable (Fix p) | |
| Bitraversable p => Traversable (Join p) | |
Defined in Data.Bifunctor.Join | |
| Traversable f => Traversable (CofreeF f a) | |
Defined in Control.Comonad.Trans.Cofree Methods traverse :: Applicative f0 => (a0 -> f0 b) -> CofreeF f a a0 -> f0 (CofreeF f a b) Source # sequenceA :: Applicative f0 => CofreeF f a (f0 a0) -> f0 (CofreeF f a a0) Source # mapM :: Monad m => (a0 -> m b) -> CofreeF f a a0 -> m (CofreeF f a b) Source # sequence :: Monad m => CofreeF f a (m a0) -> m (CofreeF f a a0) Source # | |
| (Traversable f, Traversable w) => Traversable (CofreeT f w) | |
Defined in Control.Comonad.Trans.Cofree Methods traverse :: Applicative f0 => (a -> f0 b) -> CofreeT f w a -> f0 (CofreeT f w b) Source # sequenceA :: Applicative f0 => CofreeT f w (f0 a) -> f0 (CofreeT f w a) Source # mapM :: Monad m => (a -> m b) -> CofreeT f w a -> m (CofreeT f w b) Source # sequence :: Monad m => CofreeT f w (m a) -> m (CofreeT f w a) Source # | |
| Traversable f => Traversable (FreeF f a) | |
Defined in Control.Monad.Trans.Free Methods traverse :: Applicative f0 => (a0 -> f0 b) -> FreeF f a a0 -> f0 (FreeF f a b) Source # sequenceA :: Applicative f0 => FreeF f a (f0 a0) -> f0 (FreeF f a a0) Source # mapM :: Monad m => (a0 -> m b) -> FreeF f a a0 -> m (FreeF f a b) Source # sequence :: Monad m => FreeF f a (m a0) -> m (FreeF f a a0) Source # | |
| (Monad m, Traversable m, Traversable f) => Traversable (FreeT f m) | |
Defined in Control.Monad.Trans.Free Methods traverse :: Applicative f0 => (a -> f0 b) -> FreeT f m a -> f0 (FreeT f m b) Source # sequenceA :: Applicative f0 => FreeT f m (f0 a) -> f0 (FreeT f m a) Source # mapM :: Monad m0 => (a -> m0 b) -> FreeT f m a -> m0 (FreeT f m b) Source # sequence :: Monad m0 => FreeT f m (m0 a) -> m0 (FreeT f m a) Source # | |
| Traversable (Const m :: Type -> Type) | Since: base-4.7.0.0 |
Defined in GHC.Internal.Data.Traversable | |
| Traversable f => Traversable (Ap f) | Since: base-4.12.0.0 |
Defined in GHC.Internal.Data.Traversable | |
| Traversable f => Traversable (Alt f) | Since: base-4.12.0.0 |
Defined in GHC.Internal.Data.Traversable | |
| Traversable f => Traversable (Rec1 f) | Since: base-4.9.0.0 |
Defined in GHC.Internal.Data.Traversable | |
| Traversable f => Traversable (AlongsideLeft f b) | |
Defined in Control.Lens.Internal.Getter Methods traverse :: Applicative f0 => (a -> f0 b0) -> AlongsideLeft f b a -> f0 (AlongsideLeft f b b0) Source # sequenceA :: Applicative f0 => AlongsideLeft f b (f0 a) -> f0 (AlongsideLeft f b a) Source # mapM :: Monad m => (a -> m b0) -> AlongsideLeft f b a -> m (AlongsideLeft f b b0) Source # sequence :: Monad m => AlongsideLeft f b (m a) -> m (AlongsideLeft f b a) Source # | |
| Traversable f => Traversable (AlongsideRight f a) | |
Defined in Control.Lens.Internal.Getter Methods traverse :: Applicative f0 => (a0 -> f0 b) -> AlongsideRight f a a0 -> f0 (AlongsideRight f a b) Source # sequenceA :: Applicative f0 => AlongsideRight f a (f0 a0) -> f0 (AlongsideRight f a a0) Source # mapM :: Monad m => (a0 -> m b) -> AlongsideRight f a a0 -> m (AlongsideRight f a b) Source # sequence :: Monad m => AlongsideRight f a (m a0) -> m (AlongsideRight f a a0) Source # | |
| Traversable (V n) | |
| Traversable (Baz t b) | |
Defined in Data.Profunctor.Traversing | |
| Traversable (Tagged s) | |
Defined in Data.Tagged | |
| Traversable f => Traversable (Backwards f) | Derived instance. |
Defined in Control.Applicative.Backwards Methods traverse :: Applicative f0 => (a -> f0 b) -> Backwards f a -> f0 (Backwards f b) Source # sequenceA :: Applicative f0 => Backwards f (f0 a) -> f0 (Backwards f a) Source # mapM :: Monad m => (a -> m b) -> Backwards f a -> m (Backwards f b) Source # sequence :: Monad m => Backwards f (m a) -> m (Backwards f a) Source # | |
| Traversable f => Traversable (ExceptT e f) | |
Defined in Control.Monad.Trans.Except Methods traverse :: Applicative f0 => (a -> f0 b) -> ExceptT e f a -> f0 (ExceptT e f b) Source # sequenceA :: Applicative f0 => ExceptT e f (f0 a) -> f0 (ExceptT e f a) Source # mapM :: Monad m => (a -> m b) -> ExceptT e f a -> m (ExceptT e f b) Source # sequence :: Monad m => ExceptT e f (m a) -> m (ExceptT e f a) Source # | |
| Traversable f => Traversable (IdentityT f) | |
Defined in Control.Monad.Trans.Identity Methods traverse :: Applicative f0 => (a -> f0 b) -> IdentityT f a -> f0 (IdentityT f b) Source # sequenceA :: Applicative f0 => IdentityT f (f0 a) -> f0 (IdentityT f a) Source # mapM :: Monad m => (a -> m b) -> IdentityT f a -> m (IdentityT f b) Source # sequence :: Monad m => IdentityT f (m a) -> m (IdentityT f a) Source # | |
| Traversable f => Traversable (WriterT w f) | |
Defined in Control.Monad.Trans.Writer.Lazy Methods traverse :: Applicative f0 => (a -> f0 b) -> WriterT w f a -> f0 (WriterT w f b) Source # sequenceA :: Applicative f0 => WriterT w f (f0 a) -> f0 (WriterT w f a) Source # mapM :: Monad m => (a -> m b) -> WriterT w f a -> m (WriterT w f b) Source # sequence :: Monad m => WriterT w f (m a) -> m (WriterT w f a) Source # | |
| Traversable f => Traversable (WriterT w f) | |
Defined in Control.Monad.Trans.Writer.Strict Methods traverse :: Applicative f0 => (a -> f0 b) -> WriterT w f a -> f0 (WriterT w f b) Source # sequenceA :: Applicative f0 => WriterT w f (f0 a) -> f0 (WriterT w f a) Source # mapM :: Monad m => (a -> m b) -> WriterT w f a -> m (WriterT w f b) Source # sequence :: Monad m => WriterT w f (m a) -> m (WriterT w f a) Source # | |
| Traversable (Constant a :: Type -> Type) | |
Defined in Data.Functor.Constant Methods traverse :: Applicative f => (a0 -> f b) -> Constant a a0 -> f (Constant a b) Source # sequenceA :: Applicative f => Constant a (f a0) -> f (Constant a a0) Source # mapM :: Monad m => (a0 -> m b) -> Constant a a0 -> m (Constant a b) Source # sequence :: Monad m => Constant a (m a0) -> m (Constant a a0) Source # | |
| Traversable f => Traversable (Reverse f) | Traverse from right to left. |
Defined in Data.Functor.Reverse Methods traverse :: Applicative f0 => (a -> f0 b) -> Reverse f a -> f0 (Reverse f b) Source # sequenceA :: Applicative f0 => Reverse f (f0 a) -> f0 (Reverse f a) Source # mapM :: Monad m => (a -> m b) -> Reverse f a -> m (Reverse f b) Source # sequence :: Monad m => Reverse f (m a) -> m (Reverse f a) Source # | |
| (Traversable f, Traversable g) => Traversable (Product f g) | Since: base-4.9.0.0 |
Defined in Data.Functor.Product Methods traverse :: Applicative f0 => (a -> f0 b) -> Product f g a -> f0 (Product f g b) Source # sequenceA :: Applicative f0 => Product f g (f0 a) -> f0 (Product f g a) Source # mapM :: Monad m => (a -> m b) -> Product f g a -> m (Product f g b) Source # sequence :: Monad m => Product f g (m a) -> m (Product f g a) Source # | |
| (Traversable f, Traversable g) => Traversable (Sum f g) | Since: base-4.9.0.0 |
Defined in Data.Functor.Sum | |
| (Traversable f, Traversable g) => Traversable (f :*: g) | Since: base-4.9.0.0 |
Defined in GHC.Internal.Data.Traversable Methods traverse :: Applicative f0 => (a -> f0 b) -> (f :*: g) a -> f0 ((f :*: g) b) Source # sequenceA :: Applicative f0 => (f :*: g) (f0 a) -> f0 ((f :*: g) a) Source # mapM :: Monad m => (a -> m b) -> (f :*: g) a -> m ((f :*: g) b) Source # sequence :: Monad m => (f :*: g) (m a) -> m ((f :*: g) a) Source # | |
| (Traversable f, Traversable g) => Traversable (f :+: g) | Since: base-4.9.0.0 |
Defined in GHC.Internal.Data.Traversable Methods traverse :: Applicative f0 => (a -> f0 b) -> (f :+: g) a -> f0 ((f :+: g) b) Source # sequenceA :: Applicative f0 => (f :+: g) (f0 a) -> f0 ((f :+: g) a) Source # mapM :: Monad m => (a -> m b) -> (f :+: g) a -> m ((f :+: g) b) Source # sequence :: Monad m => (f :+: g) (m a) -> m ((f :+: g) a) Source # | |
| Traversable (K1 i c :: Type -> Type) | Since: base-4.9.0.0 |
Defined in GHC.Internal.Data.Traversable | |
| Traversable (Magma i t b) | |
Defined in Control.Lens.Internal.Magma Methods traverse :: Applicative f => (a -> f b0) -> Magma i t b a -> f (Magma i t b b0) Source # sequenceA :: Applicative f => Magma i t b (f a) -> f (Magma i t b a) Source # mapM :: Monad m => (a -> m b0) -> Magma i t b a -> m (Magma i t b b0) Source # sequence :: Monad m => Magma i t b (m a) -> m (Magma i t b a) Source # | |
| Traversable (Forget r a :: Type -> Type) | |
Defined in Data.Profunctor.Types Methods traverse :: Applicative f => (a0 -> f b) -> Forget r a a0 -> f (Forget r a b) Source # sequenceA :: Applicative f => Forget r a (f a0) -> f (Forget r a a0) Source # mapM :: Monad m => (a0 -> m b) -> Forget r a a0 -> m (Forget r a b) Source # sequence :: Monad m => Forget r a (m a0) -> m (Forget r a a0) Source # | |
| (Traversable f, Traversable g) => Traversable (Compose f g) | Since: base-4.9.0.0 |
Defined in Data.Functor.Compose Methods traverse :: Applicative f0 => (a -> f0 b) -> Compose f g a -> f0 (Compose f g b) Source # sequenceA :: Applicative f0 => Compose f g (f0 a) -> f0 (Compose f g a) Source # mapM :: Monad m => (a -> m b) -> Compose f g a -> m (Compose f g b) Source # sequence :: Monad m => Compose f g (m a) -> m (Compose f g a) Source # | |
| Traversable (Clown f a :: Type -> Type) | |
Defined in Data.Bifunctor.Clown Methods traverse :: Applicative f0 => (a0 -> f0 b) -> Clown f a a0 -> f0 (Clown f a b) Source # sequenceA :: Applicative f0 => Clown f a (f0 a0) -> f0 (Clown f a a0) Source # mapM :: Monad m => (a0 -> m b) -> Clown f a a0 -> m (Clown f a b) Source # sequence :: Monad m => Clown f a (m a0) -> m (Clown f a a0) Source # | |
| Bitraversable p => Traversable (Flip p a) | |
Defined in Data.Bifunctor.Flip Methods traverse :: Applicative f => (a0 -> f b) -> Flip p a a0 -> f (Flip p a b) Source # sequenceA :: Applicative f => Flip p a (f a0) -> f (Flip p a a0) Source # mapM :: Monad m => (a0 -> m b) -> Flip p a a0 -> m (Flip p a b) Source # sequence :: Monad m => Flip p a (m a0) -> m (Flip p a a0) Source # | |
| Traversable g => Traversable (Joker g a) | |
Defined in Data.Bifunctor.Joker Methods traverse :: Applicative f => (a0 -> f b) -> Joker g a a0 -> f (Joker g a b) Source # sequenceA :: Applicative f => Joker g a (f a0) -> f (Joker g a a0) Source # mapM :: Monad m => (a0 -> m b) -> Joker g a a0 -> m (Joker g a b) Source # sequence :: Monad m => Joker g a (m a0) -> m (Joker g a a0) Source # | |
| Bitraversable p => Traversable (WrappedBifunctor p a) | |
Defined in Data.Bifunctor.Wrapped Methods traverse :: Applicative f => (a0 -> f b) -> WrappedBifunctor p a a0 -> f (WrappedBifunctor p a b) Source # sequenceA :: Applicative f => WrappedBifunctor p a (f a0) -> f (WrappedBifunctor p a a0) Source # mapM :: Monad m => (a0 -> m b) -> WrappedBifunctor p a a0 -> m (WrappedBifunctor p a b) Source # sequence :: Monad m => WrappedBifunctor p a (m a0) -> m (WrappedBifunctor p a a0) Source # | |
| (Traversable f, Traversable g) => Traversable (f :.: g) | Since: base-4.9.0.0 |
Defined in GHC.Internal.Data.Traversable Methods traverse :: Applicative f0 => (a -> f0 b) -> (f :.: g) a -> f0 ((f :.: g) b) Source # sequenceA :: Applicative f0 => (f :.: g) (f0 a) -> f0 ((f :.: g) a) Source # mapM :: Monad m => (a -> m b) -> (f :.: g) a -> m ((f :.: g) b) Source # sequence :: Monad m => (f :.: g) (m a) -> m ((f :.: g) a) Source # | |
| Traversable f => Traversable (M1 i c f) | Since: base-4.9.0.0 |
Defined in GHC.Internal.Data.Traversable | |
| (Traversable (f a), Traversable (g a)) => Traversable (Product f g a) | |
Defined in Data.Bifunctor.Product Methods traverse :: Applicative f0 => (a0 -> f0 b) -> Product f g a a0 -> f0 (Product f g a b) Source # sequenceA :: Applicative f0 => Product f g a (f0 a0) -> f0 (Product f g a a0) Source # mapM :: Monad m => (a0 -> m b) -> Product f g a a0 -> m (Product f g a b) Source # sequence :: Monad m => Product f g a (m a0) -> m (Product f g a a0) Source # | |
| (Traversable (f a), Traversable (g a)) => Traversable (Sum f g a) | |
Defined in Data.Bifunctor.Sum Methods traverse :: Applicative f0 => (a0 -> f0 b) -> Sum f g a a0 -> f0 (Sum f g a b) Source # sequenceA :: Applicative f0 => Sum f g a (f0 a0) -> f0 (Sum f g a a0) Source # mapM :: Monad m => (a0 -> m b) -> Sum f g a a0 -> m (Sum f g a b) Source # sequence :: Monad m => Sum f g a (m a0) -> m (Sum f g a a0) Source # | |
| (Traversable f, Bitraversable p) => Traversable (Tannen f p a) | |
Defined in Data.Bifunctor.Tannen Methods traverse :: Applicative f0 => (a0 -> f0 b) -> Tannen f p a a0 -> f0 (Tannen f p a b) Source # sequenceA :: Applicative f0 => Tannen f p a (f0 a0) -> f0 (Tannen f p a a0) Source # mapM :: Monad m => (a0 -> m b) -> Tannen f p a a0 -> m (Tannen f p a b) Source # sequence :: Monad m => Tannen f p a (m a0) -> m (Tannen f p a a0) Source # | |
| (Bitraversable p, Traversable g) => Traversable (Biff p f g a) | |
Defined in Data.Bifunctor.Biff Methods traverse :: Applicative f0 => (a0 -> f0 b) -> Biff p f g a a0 -> f0 (Biff p f g a b) Source # sequenceA :: Applicative f0 => Biff p f g a (f0 a0) -> f0 (Biff p f g a a0) Source # mapM :: Monad m => (a0 -> m b) -> Biff p f g a a0 -> m (Biff p f g a b) Source # sequence :: Monad m => Biff p f g a (m a0) -> m (Biff p f g a a0) Source # | |
uncons :: Cons s s a a => s -> Maybe (a, s) Source #
Attempt to extract the left-most element from a container, and a version of the container without that element.
>>>uncons []Nothing
>>>uncons [a, b, c]Just (a,[b,c])
unsnoc :: Snoc s s a a => s -> Maybe (s, a) Source #
Attempt to extract the right-most element from a container, and a version of the container without that element.
>>>unsnoc (LazyT.pack "hello!")Just ("hello",'!')
>>>unsnoc (LazyT.pack "")Nothing
>>>unsnoc (Seq.fromList [b,c,a])Just (fromList [b,c],a)
>>>unsnoc (Seq.fromList [])Nothing
(&) :: a -> (a -> b) -> b infixl 1 Source #
& is a reverse application operator. This provides notational
convenience. Its precedence is one higher than that of the forward
application operator $, which allows & to be nested in $.
This is a version of , where flip idid is specialized from a -> a to (a -> b) -> (a -> b)
which by the associativity of (->) is (a -> b) -> a -> b.
flipping this yields a -> (a -> b) -> b which is the type signature of &
Examples
>>>5 & (+1) & show"6"
>>>sqrt $ [1 / n^2 | n <- [1..1000]] & sum & (*6)3.1406380562059946
Since: base-4.8.0.0
data (a :: k) :~: (b :: k) where infix 4 Source #
Propositional equality. If a :~: b is inhabited by some terminating
value, then the type a is the same as the type b. To use this equality
in practice, pattern-match on the a :~: b to get out the Refl constructor;
in the body of the pattern-match, the compiler knows that a ~ b.
Since: base-4.7.0.0
Instances
| Category ((:~:) :: k -> k -> Type) | Since: base-4.7.0.0 |
| TestEquality ((:~:) a :: k -> Type) | Since: base-4.7.0.0 |
Defined in GHC.Internal.Data.Type.Equality | |
| NFData2 ((:~:) :: Type -> Type -> Type) | Since: deepseq-1.4.3.0 |
Defined in Control.DeepSeq | |
| NFData1 ((:~:) a) | Since: deepseq-1.4.3.0 |
Defined in Control.DeepSeq | |
| NFData (a :~: b) | Since: deepseq-1.4.3.0 |
Defined in Control.DeepSeq | |
| (a ~ b, Data a) => Data (a :~: b) | Since: base-4.7.0.0 |
Defined in GHC.Internal.Data.Data Methods gfoldl :: (forall d b0. Data d => c (d -> b0) -> d -> c b0) -> (forall g. g -> c g) -> (a :~: b) -> c (a :~: b) Source # gunfold :: (forall b0 r. Data b0 => c (b0 -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (a :~: b) Source # toConstr :: (a :~: b) -> Constr Source # dataTypeOf :: (a :~: b) -> DataType Source # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (a :~: b)) Source # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (a :~: b)) Source # gmapT :: (forall b0. Data b0 => b0 -> b0) -> (a :~: b) -> a :~: b Source # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> (a :~: b) -> r Source # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> (a :~: b) -> r Source # gmapQ :: (forall d. Data d => d -> u) -> (a :~: b) -> [u] Source # gmapQi :: Int -> (forall d. Data d => d -> u) -> (a :~: b) -> u Source # gmapM :: Monad m => (forall d. Data d => d -> m d) -> (a :~: b) -> m (a :~: b) Source # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> (a :~: b) -> m (a :~: b) Source # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> (a :~: b) -> m (a :~: b) Source # | |
| a ~ b => Bounded (a :~: b) | Since: base-4.7.0.0 |
| a ~ b => Enum (a :~: b) | Since: base-4.7.0.0 |
Defined in GHC.Internal.Data.Type.Equality Methods succ :: (a :~: b) -> a :~: b Source # pred :: (a :~: b) -> a :~: b Source # toEnum :: Int -> a :~: b Source # fromEnum :: (a :~: b) -> Int Source # enumFrom :: (a :~: b) -> [a :~: b] Source # enumFromThen :: (a :~: b) -> (a :~: b) -> [a :~: b] Source # enumFromTo :: (a :~: b) -> (a :~: b) -> [a :~: b] Source # enumFromThenTo :: (a :~: b) -> (a :~: b) -> (a :~: b) -> [a :~: b] Source # | |
| a ~ b => Read (a :~: b) | Since: base-4.7.0.0 |
| Show (a :~: b) | Since: base-4.7.0.0 |
| Eq (a :~: b) | Since: base-4.7.0.0 |
| Ord (a :~: b) | Since: base-4.7.0.0 |
Defined in GHC.Internal.Data.Type.Equality | |
to :: (Profunctor p, Contravariant f) => (s -> a) -> Optic' p f s a Source #
newtype Const a (b :: k) Source #
The Const functor.
Examples
>>>fmap (++ "World") (Const "Hello")Const "Hello"
Because we ignore the second type parameter to Const,
the Applicative instance, which has
essentially turns into (<*>) :: Monoid m => Const m (a -> b) -> Const m a -> Const m bMonoid m => m -> m -> m, which is (<>)
>>>Const [1, 2, 3] <*> Const [4, 5, 6]Const [1,2,3,4,5,6]
Instances
| Generic1 (Const a :: k -> Type) | |||||
Defined in GHC.Internal.Data.Functor.Const Associated Types
| |||||
| FoldableWithIndex Void (Const e :: Type -> Type) | |||||
Defined in WithIndex | |||||
| FunctorWithIndex Void (Const e :: Type -> Type) | |||||
| TraversableWithIndex Void (Const e :: Type -> Type) | |||||
| Unbox a => Vector Vector (Const a b) | |||||
Defined in Data.Vector.Unboxed.Base Methods basicUnsafeFreeze :: Mutable Vector s (Const a b) -> ST s (Vector (Const a b)) basicUnsafeThaw :: Vector (Const a b) -> ST s (Mutable Vector s (Const a b)) basicLength :: Vector (Const a b) -> Int basicUnsafeSlice :: Int -> Int -> Vector (Const a b) -> Vector (Const a b) basicUnsafeIndexM :: Vector (Const a b) -> Int -> Box (Const a b) basicUnsafeCopy :: Mutable Vector s (Const a b) -> Vector (Const a b) -> ST s () | |||||
| Unbox a => MVector MVector (Const a b) | |||||
Defined in Data.Vector.Unboxed.Base Methods basicLength :: MVector s (Const a b) -> Int basicUnsafeSlice :: Int -> Int -> MVector s (Const a b) -> MVector s (Const a b) basicOverlaps :: MVector s (Const a b) -> MVector s (Const a b) -> Bool basicUnsafeNew :: Int -> ST s (MVector s (Const a b)) basicInitialize :: MVector s (Const a b) -> ST s () basicUnsafeReplicate :: Int -> Const a b -> ST s (MVector s (Const a b)) basicUnsafeRead :: MVector s (Const a b) -> Int -> ST s (Const a b) basicUnsafeWrite :: MVector s (Const a b) -> Int -> Const a b -> ST s () basicClear :: MVector s (Const a b) -> ST s () basicSet :: MVector s (Const a b) -> Const a b -> ST s () basicUnsafeCopy :: MVector s (Const a b) -> MVector s (Const a b) -> ST s () basicUnsafeMove :: MVector s (Const a b) -> MVector s (Const a b) -> ST s () basicUnsafeGrow :: MVector s (Const a b) -> Int -> ST s (MVector s (Const a b)) | |||||
| Bifoldable (Const :: Type -> Type -> Type) | Since: base-4.10.0.0 | ||||
| Bifoldable1 (Const :: Type -> Type -> Type) | |||||
| Bifunctor (Const :: Type -> Type -> Type) | Since: base-4.8.0.0 | ||||
| Bitraversable (Const :: Type -> Type -> Type) | Since: base-4.10.0.0 | ||||
Defined in Data.Bitraversable Methods bitraverse :: Applicative f => (a -> f c) -> (b -> f d) -> Const a b -> f (Const c d) Source # | |||||
| Eq2 (Const :: Type -> Type -> Type) | Since: base-4.9.0.0 | ||||
| Ord2 (Const :: Type -> Type -> Type) | Since: base-4.9.0.0 | ||||
Defined in Data.Functor.Classes | |||||
| Read2 (Const :: Type -> Type -> Type) | Since: base-4.9.0.0 | ||||
Defined in Data.Functor.Classes Methods liftReadsPrec2 :: (Int -> ReadS a) -> ReadS [a] -> (Int -> ReadS b) -> ReadS [b] -> Int -> ReadS (Const a b) Source # liftReadList2 :: (Int -> ReadS a) -> ReadS [a] -> (Int -> ReadS b) -> ReadS [b] -> ReadS [Const a b] Source # liftReadPrec2 :: ReadPrec a -> ReadPrec [a] -> ReadPrec b -> ReadPrec [b] -> ReadPrec (Const a b) Source # liftReadListPrec2 :: ReadPrec a -> ReadPrec [a] -> ReadPrec b -> ReadPrec [b] -> ReadPrec [Const a b] Source # | |||||
| Show2 (Const :: Type -> Type -> Type) | Since: base-4.9.0.0 | ||||
Defined in Data.Functor.Classes | |||||
| NFData2 (Const :: Type -> Type -> Type) | Since: deepseq-1.4.3.0 | ||||
Defined in Control.DeepSeq | |||||
| Hashable2 (Const :: Type -> Type -> Type) | |||||
Defined in Data.Hashable.Class | |||||
| Biapply (Const :: Type -> Type -> Type) | |||||
| Bitraversable1 (Const :: Type -> Type -> Type) | |||||
Defined in Data.Semigroup.Traversable.Class Methods bitraverse1 :: Apply f => (a -> f b) -> (c -> f d) -> Const a c -> f (Const b d) bisequence1 :: Apply f => Const (f a) (f b) -> f (Const a b) | |||||
| Eq a => Eq1 (Const a :: Type -> Type) | Since: base-4.9.0.0 | ||||
| Ord a => Ord1 (Const a :: Type -> Type) | Since: base-4.9.0.0 | ||||
Defined in Data.Functor.Classes | |||||
| Read a => Read1 (Const a :: Type -> Type) | Since: base-4.9.0.0 | ||||
Defined in Data.Functor.Classes Methods liftReadsPrec :: (Int -> ReadS a0) -> ReadS [a0] -> Int -> ReadS (Const a a0) Source # liftReadList :: (Int -> ReadS a0) -> ReadS [a0] -> ReadS [Const a a0] Source # liftReadPrec :: ReadPrec a0 -> ReadPrec [a0] -> ReadPrec (Const a a0) Source # liftReadListPrec :: ReadPrec a0 -> ReadPrec [a0] -> ReadPrec [Const a a0] Source # | |||||
| Show a => Show1 (Const a :: Type -> Type) | Since: base-4.9.0.0 | ||||
| Contravariant (Const a :: Type -> Type) | |||||
| NFData a => NFData1 (Const a :: Type -> Type) | Since: deepseq-1.4.3.0 | ||||
Defined in Control.DeepSeq | |||||
| Monoid m => Applicative (Const m :: Type -> Type) | Since: base-2.0.1 | ||||
Defined in GHC.Internal.Data.Functor.Const | |||||
| Functor (Const m :: Type -> Type) | Since: base-2.1 | ||||
| Foldable (Const m :: Type -> Type) | Since: base-4.7.0.0 | ||||
Defined in GHC.Internal.Data.Functor.Const Methods fold :: Monoid m0 => Const m m0 -> m0 Source # foldMap :: Monoid m0 => (a -> m0) -> Const m a -> m0 Source # foldMap' :: Monoid m0 => (a -> m0) -> Const m a -> m0 Source # foldr :: (a -> b -> b) -> b -> Const m a -> b Source # foldr' :: (a -> b -> b) -> b -> Const m a -> b Source # foldl :: (b -> a -> b) -> b -> Const m a -> b Source # foldl' :: (b -> a -> b) -> b -> Const m a -> b Source # foldr1 :: (a -> a -> a) -> Const m a -> a Source # foldl1 :: (a -> a -> a) -> Const m a -> a Source # toList :: Const m a -> [a] Source # null :: Const m a -> Bool Source # length :: Const m a -> Int Source # elem :: Eq a => a -> Const m a -> Bool Source # maximum :: Ord a => Const m a -> a Source # minimum :: Ord a => Const m a -> a Source # | |||||
| Traversable (Const m :: Type -> Type) | Since: base-4.7.0.0 | ||||
Defined in GHC.Internal.Data.Traversable | |||||
| Hashable a => Hashable1 (Const a :: Type -> Type) | |||||
Defined in Data.Hashable.Class | |||||
| Semigroup m => Apply (Const m :: Type -> Type) | |||||
| Sieve (Forget r :: Type -> Type -> Type) (Const r :: Type -> Type) | |||||
Defined in Data.Profunctor.Sieve | |||||
| Default a => Default (Const a b) | |||||
Defined in Data.Default.Internal | |||||
| NFData a => NFData (Const a b) | Since: deepseq-1.4.0.0 | ||||
Defined in Control.DeepSeq | |||||
| Monoid a => Monoid (Const a b) | Since: base-4.9.0.0 | ||||
| Semigroup a => Semigroup (Const a b) | Since: base-4.9.0.0 | ||||
| Bits a => Bits (Const a b) | Since: base-4.9.0.0 | ||||
Defined in GHC.Internal.Data.Functor.Const Methods (.&.) :: Const a b -> Const a b -> Const a b Source # (.|.) :: Const a b -> Const a b -> Const a b Source # xor :: Const a b -> Const a b -> Const a b Source # complement :: Const a b -> Const a b Source # shift :: Const a b -> Int -> Const a b Source # rotate :: Const a b -> Int -> Const a b Source # zeroBits :: Const a b Source # bit :: Int -> Const a b Source # setBit :: Const a b -> Int -> Const a b Source # clearBit :: Const a b -> Int -> Const a b Source # complementBit :: Const a b -> Int -> Const a b Source # testBit :: Const a b -> Int -> Bool Source # bitSizeMaybe :: Const a b -> Maybe Int Source # bitSize :: Const a b -> Int Source # isSigned :: Const a b -> Bool Source # shiftL :: Const a b -> Int -> Const a b Source # unsafeShiftL :: Const a b -> Int -> Const a b Source # shiftR :: Const a b -> Int -> Const a b Source # unsafeShiftR :: Const a b -> Int -> Const a b Source # rotateL :: Const a b -> Int -> Const a b Source # | |||||
| FiniteBits a => FiniteBits (Const a b) | Since: base-4.9.0.0 | ||||
Defined in GHC.Internal.Data.Functor.Const Methods finiteBitSize :: Const a b -> Int Source # countLeadingZeros :: Const a b -> Int Source # countTrailingZeros :: Const a b -> Int Source # | |||||
| (Typeable k, Data a, Typeable b) => Data (Const a b) | Since: base-4.10.0.0 | ||||
Defined in GHC.Internal.Data.Data Methods gfoldl :: (forall d b0. Data d => c (d -> b0) -> d -> c b0) -> (forall g. g -> c g) -> Const a b -> c (Const a b) Source # gunfold :: (forall b0 r. Data b0 => c (b0 -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Const a b) Source # toConstr :: Const a b -> Constr Source # dataTypeOf :: Const a b -> DataType Source # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (Const a b)) Source # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Const a b)) Source # gmapT :: (forall b0. Data b0 => b0 -> b0) -> Const a b -> Const a b Source # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Const a b -> r Source # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Const a b -> r Source # gmapQ :: (forall d. Data d => d -> u) -> Const a b -> [u] Source # gmapQi :: Int -> (forall d. Data d => d -> u) -> Const a b -> u Source # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Const a b -> m (Const a b) Source # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Const a b -> m (Const a b) Source # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Const a b -> m (Const a b) Source # | |||||
| IsString a => IsString (Const a b) | Since: base-4.9.0.0 | ||||
Defined in GHC.Internal.Data.String Methods fromString :: String -> Const a b Source # | |||||
| Bounded a => Bounded (Const a b) | Since: base-4.9.0.0 | ||||
| Enum a => Enum (Const a b) | Since: base-4.9.0.0 | ||||
Defined in GHC.Internal.Data.Functor.Const Methods succ :: Const a b -> Const a b Source # pred :: Const a b -> Const a b Source # toEnum :: Int -> Const a b Source # fromEnum :: Const a b -> Int Source # enumFrom :: Const a b -> [Const a b] Source # enumFromThen :: Const a b -> Const a b -> [Const a b] Source # enumFromTo :: Const a b -> Const a b -> [Const a b] Source # enumFromThenTo :: Const a b -> Const a b -> Const a b -> [Const a b] Source # | |||||
| Floating a => Floating (Const a b) | Since: base-4.9.0.0 | ||||
Defined in GHC.Internal.Data.Functor.Const Methods exp :: Const a b -> Const a b Source # log :: Const a b -> Const a b Source # sqrt :: Const a b -> Const a b Source # (**) :: Const a b -> Const a b -> Const a b Source # logBase :: Const a b -> Const a b -> Const a b Source # sin :: Const a b -> Const a b Source # cos :: Const a b -> Const a b Source # tan :: Const a b -> Const a b Source # asin :: Const a b -> Const a b Source # acos :: Const a b -> Const a b Source # atan :: Const a b -> Const a b Source # sinh :: Const a b -> Const a b Source # cosh :: Const a b -> Const a b Source # tanh :: Const a b -> Const a b Source # asinh :: Const a b -> Const a b Source # acosh :: Const a b -> Const a b Source # atanh :: Const a b -> Const a b Source # log1p :: Const a b -> Const a b Source # expm1 :: Const a b -> Const a b Source # | |||||
| RealFloat a => RealFloat (Const a b) | Since: base-4.9.0.0 | ||||
Defined in GHC.Internal.Data.Functor.Const Methods floatRadix :: Const a b -> Integer Source # floatDigits :: Const a b -> Int Source # floatRange :: Const a b -> (Int, Int) Source # decodeFloat :: Const a b -> (Integer, Int) Source # encodeFloat :: Integer -> Int -> Const a b Source # exponent :: Const a b -> Int Source # significand :: Const a b -> Const a b Source # scaleFloat :: Int -> Const a b -> Const a b Source # isNaN :: Const a b -> Bool Source # isInfinite :: Const a b -> Bool Source # isDenormalized :: Const a b -> Bool Source # isNegativeZero :: Const a b -> Bool Source # | |||||
| Storable a => Storable (Const a b) | Since: base-4.9.0.0 | ||||
Defined in GHC.Internal.Data.Functor.Const Methods sizeOf :: Const a b -> Int Source # alignment :: Const a b -> Int Source # peekElemOff :: Ptr (Const a b) -> Int -> IO (Const a b) Source # pokeElemOff :: Ptr (Const a b) -> Int -> Const a b -> IO () Source # peekByteOff :: Ptr b0 -> Int -> IO (Const a b) Source # pokeByteOff :: Ptr b0 -> Int -> Const a b -> IO () Source # | |||||
| Generic (Const a b) | |||||
Defined in GHC.Internal.Data.Functor.Const Associated Types
| |||||
| Ix a => Ix (Const a b) | Since: base-4.9.0.0 | ||||
Defined in GHC.Internal.Data.Functor.Const Methods range :: (Const a b, Const a b) -> [Const a b] Source # index :: (Const a b, Const a b) -> Const a b -> Int Source # unsafeIndex :: (Const a b, Const a b) -> Const a b -> Int Source # inRange :: (Const a b, Const a b) -> Const a b -> Bool Source # | |||||
| Num a => Num (Const a b) | Since: base-4.9.0.0 | ||||
Defined in GHC.Internal.Data.Functor.Const Methods (+) :: Const a b -> Const a b -> Const a b Source # (-) :: Const a b -> Const a b -> Const a b Source # (*) :: Const a b -> Const a b -> Const a b Source # negate :: Const a b -> Const a b Source # abs :: Const a b -> Const a b Source # signum :: Const a b -> Const a b Source # fromInteger :: Integer -> Const a b Source # | |||||
| Read a => Read (Const a b) | This instance would be equivalent to the derived instances of the
Since: base-4.8.0.0 | ||||
| Fractional a => Fractional (Const a b) | Since: base-4.9.0.0 | ||||
| Integral a => Integral (Const a b) | Since: base-4.9.0.0 | ||||
Defined in GHC.Internal.Data.Functor.Const Methods quot :: Const a b -> Const a b -> Const a b Source # rem :: Const a b -> Const a b -> Const a b Source # div :: Const a b -> Const a b -> Const a b Source # mod :: Const a b -> Const a b -> Const a b Source # quotRem :: Const a b -> Const a b -> (Const a b, Const a b) Source # divMod :: Const a b -> Const a b -> (Const a b, Const a b) Source # | |||||
| Real a => Real (Const a b) | Since: base-4.9.0.0 | ||||
Defined in GHC.Internal.Data.Functor.Const Methods toRational :: Const a b -> Rational Source # | |||||
| RealFrac a => RealFrac (Const a b) | Since: base-4.9.0.0 | ||||
Defined in GHC.Internal.Data.Functor.Const | |||||
| Show a => Show (Const a b) | This instance would be equivalent to the derived instances of the
Since: base-4.8.0.0 | ||||
| Eq a => Eq (Const a b) | Since: base-4.9.0.0 | ||||
| Ord a => Ord (Const a b) | Since: base-4.9.0.0 | ||||
Defined in GHC.Internal.Data.Functor.Const | |||||
| Hashable a => Hashable (Const a b) | |||||
Defined in Data.Hashable.Class | |||||
| Wrapped (Const a x) | |||||
| Pretty a => Pretty (Const a b) | |||||
Defined in Prettyprinter.Internal | |||||
| Unbox a => Unbox (Const a b) | |||||
Defined in Data.Vector.Unboxed.Base | |||||
| t ~ Const a' x' => Rewrapped (Const a x) t | |||||
Defined in Control.Lens.Wrapped | |||||
| type Rep1 (Const a :: k -> Type) | Since: base-4.9.0.0 | ||||
Defined in GHC.Internal.Data.Functor.Const | |||||
| newtype MVector s (Const a b) | |||||
Defined in Data.Vector.Unboxed.Base | |||||
| type Rep (Const a b) | Since: base-4.9.0.0 | ||||
Defined in GHC.Internal.Data.Functor.Const | |||||
| type Unwrapped (Const a x) | |||||
Defined in Control.Lens.Wrapped | |||||
| newtype Vector (Const a b) | |||||
Defined in Data.Vector.Unboxed.Base | |||||
Identity functor and monad. (a non-strict monad)
Examples
>>>fmap (+1) (Identity 0)Identity 1
>>>Identity [1, 2, 3] <> Identity [4, 5, 6]Identity [1,2,3,4,5,6]
>>> do
x <- Identity 10
y <- Identity (x + 5)
pure (x + y)
Identity 25
Since: base-4.8.0.0
Constructors
| Identity | |
Fields
| |
Instances
| Representable Identity | |||||
Defined in Data.Functor.Rep Associated Types
| |||||
| MonadZip Identity | Since: base-4.8.0.0 | ||||
| Foldable1 Identity | Since: base-4.18.0.0 | ||||
Defined in Data.Foldable1 Methods fold1 :: Semigroup m => Identity m -> m Source # foldMap1 :: Semigroup m => (a -> m) -> Identity a -> m Source # foldMap1' :: Semigroup m => (a -> m) -> Identity a -> m Source # toNonEmpty :: Identity a -> NonEmpty a Source # maximum :: Ord a => Identity a -> a Source # minimum :: Ord a => Identity a -> a Source # head :: Identity a -> a Source # last :: Identity a -> a Source # foldrMap1 :: (a -> b) -> (a -> b -> b) -> Identity a -> b Source # foldlMap1' :: (a -> b) -> (b -> a -> b) -> Identity a -> b Source # foldlMap1 :: (a -> b) -> (b -> a -> b) -> Identity a -> b Source # foldrMap1' :: (a -> b) -> (a -> b -> b) -> Identity a -> b Source # | |||||
| Eq1 Identity | Since: base-4.9.0.0 | ||||
| Ord1 Identity | Since: base-4.9.0.0 | ||||
Defined in Data.Functor.Classes | |||||
| Read1 Identity | Since: base-4.9.0.0 | ||||
Defined in Data.Functor.Classes Methods liftReadsPrec :: (Int -> ReadS a) -> ReadS [a] -> Int -> ReadS (Identity a) Source # liftReadList :: (Int -> ReadS a) -> ReadS [a] -> ReadS [Identity a] Source # liftReadPrec :: ReadPrec a -> ReadPrec [a] -> ReadPrec (Identity a) Source # liftReadListPrec :: ReadPrec a -> ReadPrec [a] -> ReadPrec [Identity a] Source # | |||||
| Show1 Identity | Since: base-4.9.0.0 | ||||
| Comonad Identity | |||||
| ComonadApply Identity | |||||
| NFData1 Identity | Since: deepseq-1.4.3.0 | ||||
Defined in Control.DeepSeq | |||||
| Distributive Identity | |||||
| Applicative Identity | Since: base-4.8.0.0 | ||||
Defined in GHC.Internal.Data.Functor.Identity | |||||
| Functor Identity | Since: base-4.8.0.0 | ||||
| Monad Identity | Since: base-4.8.0.0 | ||||
| MonadFix Identity | Since: base-4.8.0.0 | ||||
| Foldable Identity | Since: base-4.8.0.0 | ||||
Defined in GHC.Internal.Data.Functor.Identity Methods fold :: Monoid m => Identity m -> m Source # foldMap :: Monoid m => (a -> m) -> Identity a -> m Source # foldMap' :: Monoid m => (a -> m) -> Identity a -> m Source # foldr :: (a -> b -> b) -> b -> Identity a -> b Source # foldr' :: (a -> b -> b) -> b -> Identity a -> b Source # foldl :: (b -> a -> b) -> b -> Identity a -> b Source # foldl' :: (b -> a -> b) -> b -> Identity a -> b Source # foldr1 :: (a -> a -> a) -> Identity a -> a Source # foldl1 :: (a -> a -> a) -> Identity a -> a Source # toList :: Identity a -> [a] Source # null :: Identity a -> Bool Source # length :: Identity a -> Int Source # elem :: Eq a => a -> Identity a -> Bool Source # maximum :: Ord a => Identity a -> a Source # minimum :: Ord a => Identity a -> a Source # | |||||
| Traversable Identity | Since: base-4.9.0.0 | ||||
Defined in GHC.Internal.Data.Traversable | |||||
| Hashable1 Identity | |||||
Defined in Data.Hashable.Class | |||||
| Settable Identity | So you can pass our | ||||
Defined in Control.Lens.Internal.Setter Methods untainted :: Identity a -> a Source # untaintedDot :: Profunctor p => p a (Identity b) -> p a b Source # taintedDot :: Profunctor p => p a b -> p a (Identity b) Source # | |||||
| Affine Identity | |||||
Defined in Linear.Affine | |||||
| Metric Identity | |||||
| R1 Identity | |||||
| Additive Identity | |||||
Defined in Linear.Vector Methods zero :: Num a => Identity a Source # (^+^) :: Num a => Identity a -> Identity a -> Identity a Source # (^-^) :: Num a => Identity a -> Identity a -> Identity a Source # lerp :: Num a => a -> Identity a -> Identity a -> Identity a Source # liftU2 :: (a -> a -> a) -> Identity a -> Identity a -> Identity a Source # liftI2 :: (a -> b -> c) -> Identity a -> Identity b -> Identity c Source # | |||||
| Apply Identity | |||||
| Bind Identity | |||||
| Traversable1 Identity | |||||
| Adjunction Identity Identity | |||||
Defined in Data.Functor.Adjunction | |||||
| Generic1 Identity | |||||
Defined in GHC.Internal.Data.Functor.Identity Associated Types
| |||||
| FoldableWithIndex () Identity | |||||
Defined in WithIndex | |||||
| FunctorWithIndex () Identity | |||||
| TraversableWithIndex () Identity | |||||
| Cosieve ReifiedGetter Identity | |||||
Defined in Control.Lens.Reified Methods cosieve :: ReifiedGetter a b -> Identity a -> b | |||||
| Sieve ReifiedGetter Identity | |||||
Defined in Control.Lens.Reified Methods sieve :: ReifiedGetter a b -> a -> Identity b | |||||
| Unbox a => Vector Vector (Identity a) | |||||
Defined in Data.Vector.Unboxed.Base Methods basicUnsafeFreeze :: Mutable Vector s (Identity a) -> ST s (Vector (Identity a)) basicUnsafeThaw :: Vector (Identity a) -> ST s (Mutable Vector s (Identity a)) basicLength :: Vector (Identity a) -> Int basicUnsafeSlice :: Int -> Int -> Vector (Identity a) -> Vector (Identity a) basicUnsafeIndexM :: Vector (Identity a) -> Int -> Box (Identity a) basicUnsafeCopy :: Mutable Vector s (Identity a) -> Vector (Identity a) -> ST s () | |||||
| Unbox a => MVector MVector (Identity a) | |||||
Defined in Data.Vector.Unboxed.Base Methods basicLength :: MVector s (Identity a) -> Int basicUnsafeSlice :: Int -> Int -> MVector s (Identity a) -> MVector s (Identity a) basicOverlaps :: MVector s (Identity a) -> MVector s (Identity a) -> Bool basicUnsafeNew :: Int -> ST s (MVector s (Identity a)) basicInitialize :: MVector s (Identity a) -> ST s () basicUnsafeReplicate :: Int -> Identity a -> ST s (MVector s (Identity a)) basicUnsafeRead :: MVector s (Identity a) -> Int -> ST s (Identity a) basicUnsafeWrite :: MVector s (Identity a) -> Int -> Identity a -> ST s () basicClear :: MVector s (Identity a) -> ST s () basicSet :: MVector s (Identity a) -> Identity a -> ST s () basicUnsafeCopy :: MVector s (Identity a) -> MVector s (Identity a) -> ST s () basicUnsafeMove :: MVector s (Identity a) -> MVector s (Identity a) -> ST s () basicUnsafeGrow :: MVector s (Identity a) -> Int -> ST s (MVector s (Identity a)) | |||||
| Monoid w => MonadAccum w (AccumT w Identity) | Since: mtl-2.3 | ||||
| MonadSelect r (SelectT r Identity) | Since: mtl-2.3 | ||||
| Default a => Default (Identity a) | |||||
Defined in Data.Default.Internal | |||||
| NFData a => NFData (Identity a) | Since: deepseq-1.4.0.0 | ||||
Defined in Control.DeepSeq | |||||
| Monoid a => Monoid (Identity a) | Since: base-4.9.0.0 | ||||
| Semigroup a => Semigroup (Identity a) | Since: base-4.9.0.0 | ||||
| Bits a => Bits (Identity a) | Since: base-4.9.0.0 | ||||
Defined in GHC.Internal.Data.Functor.Identity Methods (.&.) :: Identity a -> Identity a -> Identity a Source # (.|.) :: Identity a -> Identity a -> Identity a Source # xor :: Identity a -> Identity a -> Identity a Source # complement :: Identity a -> Identity a Source # shift :: Identity a -> Int -> Identity a Source # rotate :: Identity a -> Int -> Identity a Source # zeroBits :: Identity a Source # bit :: Int -> Identity a Source # setBit :: Identity a -> Int -> Identity a Source # clearBit :: Identity a -> Int -> Identity a Source # complementBit :: Identity a -> Int -> Identity a Source # testBit :: Identity a -> Int -> Bool Source # bitSizeMaybe :: Identity a -> Maybe Int Source # bitSize :: Identity a -> Int Source # isSigned :: Identity a -> Bool Source # shiftL :: Identity a -> Int -> Identity a Source # unsafeShiftL :: Identity a -> Int -> Identity a Source # shiftR :: Identity a -> Int -> Identity a Source # unsafeShiftR :: Identity a -> Int -> Identity a Source # rotateL :: Identity a -> Int -> Identity a Source # | |||||
| FiniteBits a => FiniteBits (Identity a) | Since: base-4.9.0.0 | ||||
Defined in GHC.Internal.Data.Functor.Identity Methods finiteBitSize :: Identity a -> Int Source # countLeadingZeros :: Identity a -> Int Source # countTrailingZeros :: Identity a -> Int Source # | |||||
| Data a => Data (Identity a) | Since: base-4.9.0.0 | ||||
Defined in GHC.Internal.Data.Data Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Identity a -> c (Identity a) Source # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Identity a) Source # toConstr :: Identity a -> Constr Source # dataTypeOf :: Identity a -> DataType Source # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (Identity a)) Source # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Identity a)) Source # gmapT :: (forall b. Data b => b -> b) -> Identity a -> Identity a Source # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Identity a -> r Source # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Identity a -> r Source # gmapQ :: (forall d. Data d => d -> u) -> Identity a -> [u] Source # gmapQi :: Int -> (forall d. Data d => d -> u) -> Identity a -> u Source # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Identity a -> m (Identity a) Source # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Identity a -> m (Identity a) Source # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Identity a -> m (Identity a) Source # | |||||
| IsString a => IsString (Identity a) | Since: base-4.9.0.0 | ||||
Defined in GHC.Internal.Data.String Methods fromString :: String -> Identity a Source # | |||||
| Bounded a => Bounded (Identity a) | Since: base-4.9.0.0 | ||||
| Enum a => Enum (Identity a) | Since: base-4.9.0.0 | ||||
Defined in GHC.Internal.Data.Functor.Identity Methods succ :: Identity a -> Identity a Source # pred :: Identity a -> Identity a Source # toEnum :: Int -> Identity a Source # fromEnum :: Identity a -> Int Source # enumFrom :: Identity a -> [Identity a] Source # enumFromThen :: Identity a -> Identity a -> [Identity a] Source # enumFromTo :: Identity a -> Identity a -> [Identity a] Source # enumFromThenTo :: Identity a -> Identity a -> Identity a -> [Identity a] Source # | |||||
| Floating a => Floating (Identity a) | Since: base-4.9.0.0 | ||||
Defined in GHC.Internal.Data.Functor.Identity Methods exp :: Identity a -> Identity a Source # log :: Identity a -> Identity a Source # sqrt :: Identity a -> Identity a Source # (**) :: Identity a -> Identity a -> Identity a Source # logBase :: Identity a -> Identity a -> Identity a Source # sin :: Identity a -> Identity a Source # cos :: Identity a -> Identity a Source # tan :: Identity a -> Identity a Source # asin :: Identity a -> Identity a Source # acos :: Identity a -> Identity a Source # atan :: Identity a -> Identity a Source # sinh :: Identity a -> Identity a Source # cosh :: Identity a -> Identity a Source # tanh :: Identity a -> Identity a Source # asinh :: Identity a -> Identity a Source # acosh :: Identity a -> Identity a Source # atanh :: Identity a -> Identity a Source # log1p :: Identity a -> Identity a Source # expm1 :: Identity a -> Identity a Source # | |||||
| RealFloat a => RealFloat (Identity a) | Since: base-4.9.0.0 | ||||
Defined in GHC.Internal.Data.Functor.Identity Methods floatRadix :: Identity a -> Integer Source # floatDigits :: Identity a -> Int Source # floatRange :: Identity a -> (Int, Int) Source # decodeFloat :: Identity a -> (Integer, Int) Source # encodeFloat :: Integer -> Int -> Identity a Source # exponent :: Identity a -> Int Source # significand :: Identity a -> Identity a Source # scaleFloat :: Int -> Identity a -> Identity a Source # isNaN :: Identity a -> Bool Source # isInfinite :: Identity a -> Bool Source # isDenormalized :: Identity a -> Bool Source # isNegativeZero :: Identity a -> Bool Source # | |||||
| Storable a => Storable (Identity a) | Since: base-4.9.0.0 | ||||
Defined in GHC.Internal.Data.Functor.Identity Methods sizeOf :: Identity a -> Int Source # alignment :: Identity a -> Int Source # peekElemOff :: Ptr (Identity a) -> Int -> IO (Identity a) Source # pokeElemOff :: Ptr (Identity a) -> Int -> Identity a -> IO () Source # peekByteOff :: Ptr b -> Int -> IO (Identity a) Source # pokeByteOff :: Ptr b -> Int -> Identity a -> IO () Source # | |||||
| Generic (Identity a) | |||||
Defined in GHC.Internal.Data.Functor.Identity Associated Types
| |||||
| Ix a => Ix (Identity a) | Since: base-4.9.0.0 | ||||
Defined in GHC.Internal.Data.Functor.Identity Methods range :: (Identity a, Identity a) -> [Identity a] Source # index :: (Identity a, Identity a) -> Identity a -> Int Source # unsafeIndex :: (Identity a, Identity a) -> Identity a -> Int Source # inRange :: (Identity a, Identity a) -> Identity a -> Bool Source # | |||||
| Num a => Num (Identity a) | Since: base-4.9.0.0 | ||||
Defined in GHC.Internal.Data.Functor.Identity Methods (+) :: Identity a -> Identity a -> Identity a Source # (-) :: Identity a -> Identity a -> Identity a Source # (*) :: Identity a -> Identity a -> Identity a Source # negate :: Identity a -> Identity a Source # abs :: Identity a -> Identity a Source # signum :: Identity a -> Identity a Source # fromInteger :: Integer -> Identity a Source # | |||||
| Read a => Read (Identity a) | This instance would be equivalent to the derived instances of the
Since: base-4.8.0.0 | ||||
| Fractional a => Fractional (Identity a) | Since: base-4.9.0.0 | ||||
| Integral a => Integral (Identity a) | Since: base-4.9.0.0 | ||||
Defined in GHC.Internal.Data.Functor.Identity Methods quot :: Identity a -> Identity a -> Identity a Source # rem :: Identity a -> Identity a -> Identity a Source # div :: Identity a -> Identity a -> Identity a Source # mod :: Identity a -> Identity a -> Identity a Source # quotRem :: Identity a -> Identity a -> (Identity a, Identity a) Source # divMod :: Identity a -> Identity a -> (Identity a, Identity a) Source # | |||||
| Real a => Real (Identity a) | Since: base-4.9.0.0 | ||||
Defined in GHC.Internal.Data.Functor.Identity Methods toRational :: Identity a -> Rational Source # | |||||
| RealFrac a => RealFrac (Identity a) | Since: base-4.9.0.0 | ||||
Defined in GHC.Internal.Data.Functor.Identity | |||||
| Show a => Show (Identity a) | This instance would be equivalent to the derived instances of the
Since: base-4.8.0.0 | ||||
| Eq a => Eq (Identity a) | Since: base-4.8.0.0 | ||||
| Ord a => Ord (Identity a) | Since: base-4.8.0.0 | ||||
Defined in GHC.Internal.Data.Functor.Identity Methods compare :: Identity a -> Identity a -> Ordering Source # (<) :: Identity a -> Identity a -> Bool Source # (<=) :: Identity a -> Identity a -> Bool Source # (>) :: Identity a -> Identity a -> Bool Source # (>=) :: Identity a -> Identity a -> Bool Source # | |||||
| Hashable a => Hashable (Identity a) | |||||
Defined in Data.Hashable.Class | |||||
| Ixed (Identity a) | |||||
Defined in Control.Lens.At | |||||
| Wrapped (Identity a) | |||||
| Pretty a => Pretty (Identity a) | |||||
Defined in Prettyprinter.Internal | |||||
| Unbox a => Unbox (Identity a) | |||||
Defined in Data.Vector.Unboxed.Base | |||||
| t ~ Identity b => Rewrapped (Identity a) t | |||||
Defined in Control.Lens.Wrapped | |||||
| Action m s => Action (Identity m) s | |||||
Defined in Data.Monoid.Action | |||||
| Each (Identity a) (Identity b) a b |
| ||||
| Field1 (Identity a) (Identity b) a b | |||||
| Cosieve (->) Identity | |||||
Defined in Data.Profunctor.Sieve | |||||
| Sieve (->) Identity | |||||
Defined in Data.Profunctor.Sieve | |||||
| type Rep Identity | |||||
Defined in Data.Functor.Rep type Rep Identity = () | |||||
| type Diff Identity | |||||
Defined in Linear.Affine | |||||
| type Rep1 Identity | Since: base-4.8.0.0 | ||||
Defined in GHC.Internal.Data.Functor.Identity | |||||
| newtype MVector s (Identity a) | |||||
Defined in Data.Vector.Unboxed.Base | |||||
| type Rep (Identity a) | Since: base-4.8.0.0 | ||||
Defined in GHC.Internal.Data.Functor.Identity | |||||
| type Index (Identity a) | |||||
Defined in Control.Lens.At | |||||
| type IxValue (Identity a) | |||||
Defined in Control.Lens.At | |||||
| type Unwrapped (Identity a) | |||||
Defined in Control.Lens.Wrapped | |||||
| newtype Vector (Identity a) | |||||
Defined in Data.Vector.Unboxed.Base | |||||
cons :: Cons s s a a => a -> s -> s infixr 5 Source #
cons an element onto a container.
>>>cons a [][a]
>>>cons a [b, c][a,b,c]
>>>cons a (Seq.fromList [])fromList [a]
>>>cons a (Seq.fromList [b, c])fromList [a,b,c]
snoc :: Snoc s s a a => s -> a -> s infixl 5 Source #
snoc an element onto a container.
>>>snoc (Seq.fromList []) afromList [a]
>>>snoc (Seq.fromList [b, c]) afromList [b,c,a]
>>>snoc (LazyT.pack "hello") '!'"hello!"
over :: ASetter s t a b -> (a -> b) -> s -> t Source #
Modify the target of a Lens or all the targets of a Setter or Traversal
with a function.
fmap≡overmappedfmapDefault≡overtraversesets.over≡idover.sets≡id
Given any valid Setter l, you can also rely on the law:
overl f.overl g =overl (f.g)
e.g.
>>>over mapped f (over mapped g [a,b,c]) == over mapped (f . g) [a,b,c]True
Another way to view over is to say that it transforms a Setter into a
"semantic editor combinator".
>>>over mapped f (Just a)Just (f a)
>>>over mapped (*10) [1,2,3][10,20,30]
>>>over _1 f (a,b)(f a,b)
>>>over _1 show (10,20)("10",20)
over::Setters t a b -> (a -> b) -> s -> tover::ASetters t a b -> (a -> b) -> s -> t
type Iso s t a b = forall (p :: Type -> Type -> Type) (f :: Type -> Type). (Profunctor p, Functor f) => p a (f b) -> p s (f t) Source #
newtype ReifiedIso s t a b Source #
Reify an Iso so it can be stored safely in a container.
type IndexedTraversal i s t a b = forall (p :: Type -> Type -> Type) (f :: Type -> Type). (Indexable i p, Applicative f) => p a (f b) -> s -> f t Source #
Every IndexedTraversal is a valid Traversal or
IndexedFold.
The Indexed constraint is used to allow an IndexedTraversal to be used
directly as a Traversal.
The Traversal laws are still required to hold.
In addition, the index i should satisfy the requirement that it stays
unchanged even when modifying the value a, otherwise traversals like
indices break the Traversal laws.
newtype ReifiedIndexedTraversal i s t a b Source #
Reify an IndexedTraversal so it can be stored safely in a container.
Constructors
| IndexedTraversal | |
Fields
| |
type IndexedFold i s a = forall (p :: Type -> Type -> Type) (f :: Type -> Type). (Indexable i p, Contravariant f, Applicative f) => p a (f a) -> s -> f s Source #
Every IndexedFold is a valid Fold and can be used for Getting.
newtype ReifiedIndexedFold i s a Source #
Constructors
| IndexedFold | |
Fields
| |
Instances
| Representable (ReifiedIndexedFold i) | |||||
Defined in Control.Lens.Reified Associated Types
Methods tabulate :: (d -> Rep (ReifiedIndexedFold i) c) -> ReifiedIndexedFold i d c | |||||
| Strong (ReifiedIndexedFold i) | |||||
Defined in Control.Lens.Reified Methods first' :: ReifiedIndexedFold i a b -> ReifiedIndexedFold i (a, c) (b, c) second' :: ReifiedIndexedFold i a b -> ReifiedIndexedFold i (c, a) (c, b) | |||||
| Profunctor (ReifiedIndexedFold i) | |||||
Defined in Control.Lens.Reified Methods dimap :: (a -> b) -> (c -> d) -> ReifiedIndexedFold i b c -> ReifiedIndexedFold i a d # lmap :: (a -> b) -> ReifiedIndexedFold i b c -> ReifiedIndexedFold i a c # rmap :: (b -> c) -> ReifiedIndexedFold i a b -> ReifiedIndexedFold i a c # (#.) :: forall a b c q. Coercible c b => q b c -> ReifiedIndexedFold i a b -> ReifiedIndexedFold i a c (.#) :: forall a b c q. Coercible b a => ReifiedIndexedFold i b c -> q a b -> ReifiedIndexedFold i a c | |||||
| Sieve (ReifiedIndexedFold i) (Compose [] ((,) i)) | |||||
Defined in Control.Lens.Reified Methods sieve :: ReifiedIndexedFold i a b -> a -> Compose [] ((,) i) b | |||||
| Functor (ReifiedIndexedFold i s) | |||||
Defined in Control.Lens.Reified Methods fmap :: (a -> b) -> ReifiedIndexedFold i s a -> ReifiedIndexedFold i s b Source # (<$) :: a -> ReifiedIndexedFold i s b -> ReifiedIndexedFold i s a Source # | |||||
| Alt (ReifiedIndexedFold i s) | |||||
Defined in Control.Lens.Reified Methods (<!>) :: ReifiedIndexedFold i s a -> ReifiedIndexedFold i s a -> ReifiedIndexedFold i s a some :: Applicative (ReifiedIndexedFold i s) => ReifiedIndexedFold i s a -> ReifiedIndexedFold i s [a] many :: Applicative (ReifiedIndexedFold i s) => ReifiedIndexedFold i s a -> ReifiedIndexedFold i s [a] | |||||
| Plus (ReifiedIndexedFold i s) | |||||
Defined in Control.Lens.Reified Methods zero :: ReifiedIndexedFold i s a | |||||
| Monoid (ReifiedIndexedFold i s a) | |||||
Defined in Control.Lens.Reified Methods mempty :: ReifiedIndexedFold i s a Source # mappend :: ReifiedIndexedFold i s a -> ReifiedIndexedFold i s a -> ReifiedIndexedFold i s a Source # mconcat :: [ReifiedIndexedFold i s a] -> ReifiedIndexedFold i s a Source # | |||||
| Semigroup (ReifiedIndexedFold i s a) | |||||
Defined in Control.Lens.Reified Methods (<>) :: ReifiedIndexedFold i s a -> ReifiedIndexedFold i s a -> ReifiedIndexedFold i s a Source # sconcat :: NonEmpty (ReifiedIndexedFold i s a) -> ReifiedIndexedFold i s a Source # stimes :: Integral b => b -> ReifiedIndexedFold i s a -> ReifiedIndexedFold i s a Source # | |||||
| type Rep (ReifiedIndexedFold i) | |||||
Defined in Control.Lens.Reified | |||||
type Prism s t a b = forall (p :: Type -> Type -> Type) (f :: Type -> Type). (Choice p, Applicative f) => p a (f b) -> p s (f t) Source #
A Prism l is a Traversal that can also be turned
around with re to obtain a Getter in the
opposite direction.
There are three laws that a Prism should satisfy:
First, if I re or review a value with a Prism and then preview or use (^?), I will get it back:
previewl (reviewl b) ≡Justb
Second, if you can extract a value a using a Prism l from a value s, then the value s is completely described by l and a:
previewl s ≡Justa ⟹reviewl a ≡ s
Third, if you get non-match t, you can convert it result back to s:
matchingl s ≡Leftt ⟹matchingl t ≡Lefts
The first two laws imply that the Traversal laws hold for every Prism and that we traverse at most 1 element:
lengthOfl x<=1
It may help to think of this as an Iso that can be partial in one direction.
Every Prism is a valid Traversal.
For example, you might have a allows you to always
go from a Prism' Integer NaturalNatural to an Integer, and provide you with tools to check if an Integer is
a Natural and/or to edit one if it is.
nat::Prism'IntegerNaturalnat=prismtoInteger$\ i -> if i<0 thenLefti elseRight(fromIntegeri)
Now we can ask if an Integer is a Natural.
>>>5^?natJust 5
>>>(-5)^?natNothing
We can update the ones that are:
>>>(-3,4) & both.nat *~ 2(-3,8)
And we can then convert from a Natural to an Integer.
>>>5 ^. re nat -- :: Natural5
Similarly we can use a Prism to traverse the Left half of an Either:
>>>Left "hello" & _Left %~ lengthLeft 5
or to construct an Either:
>>>5^.re _LeftLeft 5
such that if you query it with the Prism, you will get your original input back.
>>>5^.re _Left ^? _LeftJust 5
Another interesting way to think of a Prism is as the categorical dual of a Lens
-- a co-Lens, so to speak. This is what permits the construction of outside.
Note: Composition with a Prism is index-preserving.
newtype ReifiedPrism s t a b Source #
Reify a Prism so it can be stored safely in a container.
type Lens s t a b = forall (f :: Type -> Type). Functor f => (a -> f b) -> s -> f t Source #
A Lens is actually a lens family as described in
http://comonad.com/reader/2012/mirrored-lenses/.
With great power comes great responsibility and a Lens is subject to the
three common sense Lens laws:
1) You get back what you put in:
viewl (setl v s) ≡ v
2) Putting back what you got doesn't change anything:
setl (viewl s) s ≡ s
3) Setting twice is the same as setting once:
setl v' (setl v s) ≡setl v' s
These laws are strong enough that the 4 type parameters of a Lens cannot
vary fully independently. For more on how they interact, read the "Why is
it a Lens Family?" section of
http://comonad.com/reader/2012/mirrored-lenses/.
There are some emergent properties of these laws:
1) must be injective for every set l ss This is a consequence of law #1
2) must be surjective, because of law #2, which indicates that it is possible to obtain any set lv from some s such that set s v = s
3) Given just the first two laws you can prove a weaker form of law #3 where the values v that you are setting match:
setl v (setl v s) ≡setl v s
Every Lens can be used directly as a Setter or Traversal.
You can also use a Lens for Getting as if it were a
Fold or Getter.
Since every Lens is a valid Traversal, the
Traversal laws are required of any Lens you create:
lpure≡purefmap(l f).l g ≡getCompose.l (Compose.fmapf.g)
typeLenss t a b = forall f.Functorf =>LensLikef s t a b
newtype ReifiedLens s t a b Source #
Reify a Lens so it can be stored safely in a container.
type IndexedLens i s t a b = forall (f :: Type -> Type) (p :: Type -> Type -> Type). (Indexable i p, Functor f) => p a (f b) -> s -> f t Source #
Every IndexedLens is a valid Lens and a valid IndexedTraversal.
newtype ReifiedIndexedLens i s t a b Source #
Reify an IndexedLens so it can be stored safely in a container.
Constructors
| IndexedLens | |
Fields
| |
type Getter s a = forall (f :: Type -> Type). (Contravariant f, Functor f) => (a -> f a) -> s -> f s Source #
A Getter describes how to retrieve a single value in a way that can be
composed with other LensLike constructions.
Unlike a Lens a Getter is read-only. Since a Getter
cannot be used to write back there are no Lens laws that can be applied to
it. In fact, it is isomorphic to an arbitrary function from (s -> a).
Moreover, a Getter can be used directly as a Fold,
since it just ignores the Applicative.
newtype ReifiedGetter s a Source #
Reify a Getter so it can be stored safely in a container.
This can also be useful when combining getters in novel ways, as
ReifiedGetter is isomorphic to (->) and provides similar instances.
>>>("hello","world","!!!")^.runGetter ((,) <$> Getter _2 <*> Getter (_1.to length))("world",5)
Instances
| Arrow ReifiedGetter | |||||
Defined in Control.Lens.Reified Methods arr :: (b -> c) -> ReifiedGetter b c Source # first :: ReifiedGetter b c -> ReifiedGetter (b, d) (c, d) Source # second :: ReifiedGetter b c -> ReifiedGetter (d, b) (d, c) Source # (***) :: ReifiedGetter b c -> ReifiedGetter b' c' -> ReifiedGetter (b, b') (c, c') Source # (&&&) :: ReifiedGetter b c -> ReifiedGetter b c' -> ReifiedGetter b (c, c') Source # | |||||
| ArrowApply ReifiedGetter | |||||
Defined in Control.Lens.Reified Methods app :: ReifiedGetter (ReifiedGetter b c, b) c Source # | |||||
| ArrowChoice ReifiedGetter | |||||
Defined in Control.Lens.Reified Methods left :: ReifiedGetter b c -> ReifiedGetter (Either b d) (Either c d) Source # right :: ReifiedGetter b c -> ReifiedGetter (Either d b) (Either d c) Source # (+++) :: ReifiedGetter b c -> ReifiedGetter b' c' -> ReifiedGetter (Either b b') (Either c c') Source # (|||) :: ReifiedGetter b d -> ReifiedGetter c d -> ReifiedGetter (Either b c) d Source # | |||||
| ArrowLoop ReifiedGetter | |||||
Defined in Control.Lens.Reified Methods loop :: ReifiedGetter (b, d) (c, d) -> ReifiedGetter b c Source # | |||||
| Conjoined ReifiedGetter | |||||
Defined in Control.Lens.Reified Methods distrib :: Functor f => ReifiedGetter a b -> ReifiedGetter (f a) (f b) Source # conjoined :: (ReifiedGetter ~ (->) => q (a -> b) r) -> q (ReifiedGetter a b) r -> q (ReifiedGetter a b) r Source # | |||||
| Choice ReifiedGetter | |||||
Defined in Control.Lens.Reified Methods left' :: ReifiedGetter a b -> ReifiedGetter (Either a c) (Either b c) # right' :: ReifiedGetter a b -> ReifiedGetter (Either c a) (Either c b) # | |||||
| Closed ReifiedGetter | |||||
Defined in Control.Lens.Reified Methods closed :: ReifiedGetter a b -> ReifiedGetter (x -> a) (x -> b) | |||||
| Corepresentable ReifiedGetter | |||||
Defined in Control.Lens.Reified Associated Types
Methods cotabulate :: (Corep ReifiedGetter d -> c) -> ReifiedGetter d c | |||||
| Representable ReifiedGetter | |||||
Defined in Control.Lens.Reified Associated Types
Methods tabulate :: (d -> Rep ReifiedGetter c) -> ReifiedGetter d c | |||||
| Costrong ReifiedGetter | |||||
Defined in Control.Lens.Reified Methods unfirst :: ReifiedGetter (a, d) (b, d) -> ReifiedGetter a b unsecond :: ReifiedGetter (d, a) (d, b) -> ReifiedGetter a b | |||||
| Strong ReifiedGetter | |||||
Defined in Control.Lens.Reified Methods first' :: ReifiedGetter a b -> ReifiedGetter (a, c) (b, c) second' :: ReifiedGetter a b -> ReifiedGetter (c, a) (c, b) | |||||
| Profunctor ReifiedGetter | |||||
Defined in Control.Lens.Reified Methods dimap :: (a -> b) -> (c -> d) -> ReifiedGetter b c -> ReifiedGetter a d # lmap :: (a -> b) -> ReifiedGetter b c -> ReifiedGetter a c # rmap :: (b -> c) -> ReifiedGetter a b -> ReifiedGetter a c # (#.) :: forall a b c q. Coercible c b => q b c -> ReifiedGetter a b -> ReifiedGetter a c (.#) :: forall a b c q. Coercible b a => ReifiedGetter b c -> q a b -> ReifiedGetter a c | |||||
| Category ReifiedGetter | |||||
Defined in Control.Lens.Reified Methods id :: ReifiedGetter a a Source # (.) :: ReifiedGetter b c -> ReifiedGetter a b -> ReifiedGetter a c Source # | |||||
| Cosieve ReifiedGetter Identity | |||||
Defined in Control.Lens.Reified Methods cosieve :: ReifiedGetter a b -> Identity a -> b | |||||
| Sieve ReifiedGetter Identity | |||||
Defined in Control.Lens.Reified Methods sieve :: ReifiedGetter a b -> a -> Identity b | |||||
| MonadReader s (ReifiedGetter s) | |||||
Defined in Control.Lens.Reified Methods ask :: ReifiedGetter s s Source # local :: (s -> s) -> ReifiedGetter s a -> ReifiedGetter s a Source # reader :: (s -> a) -> ReifiedGetter s a Source # | |||||
| Monoid s => Comonad (ReifiedGetter s) | |||||
Defined in Control.Lens.Reified Methods extract :: ReifiedGetter s a -> a duplicate :: ReifiedGetter s a -> ReifiedGetter s (ReifiedGetter s a) extend :: (ReifiedGetter s a -> b) -> ReifiedGetter s a -> ReifiedGetter s b | |||||
| Monoid s => ComonadApply (ReifiedGetter s) | |||||
Defined in Control.Lens.Reified Methods (<@>) :: ReifiedGetter s (a -> b) -> ReifiedGetter s a -> ReifiedGetter s b (@>) :: ReifiedGetter s a -> ReifiedGetter s b -> ReifiedGetter s b (<@) :: ReifiedGetter s a -> ReifiedGetter s b -> ReifiedGetter s a | |||||
| Distributive (ReifiedGetter s) | |||||
Defined in Control.Lens.Reified Methods distribute :: Functor f => f (ReifiedGetter s a) -> ReifiedGetter s (f a) collect :: Functor f => (a -> ReifiedGetter s b) -> f a -> ReifiedGetter s (f b) distributeM :: Monad m => m (ReifiedGetter s a) -> ReifiedGetter s (m a) collectM :: Monad m => (a -> ReifiedGetter s b) -> m a -> ReifiedGetter s (m b) | |||||
| Applicative (ReifiedGetter s) | |||||
Defined in Control.Lens.Reified Methods pure :: a -> ReifiedGetter s a Source # (<*>) :: ReifiedGetter s (a -> b) -> ReifiedGetter s a -> ReifiedGetter s b Source # liftA2 :: (a -> b -> c) -> ReifiedGetter s a -> ReifiedGetter s b -> ReifiedGetter s c Source # (*>) :: ReifiedGetter s a -> ReifiedGetter s b -> ReifiedGetter s b Source # (<*) :: ReifiedGetter s a -> ReifiedGetter s b -> ReifiedGetter s a Source # | |||||
| Functor (ReifiedGetter s) | |||||
Defined in Control.Lens.Reified Methods fmap :: (a -> b) -> ReifiedGetter s a -> ReifiedGetter s b Source # (<$) :: a -> ReifiedGetter s b -> ReifiedGetter s a Source # | |||||
| Monad (ReifiedGetter s) | |||||
Defined in Control.Lens.Reified Methods (>>=) :: ReifiedGetter s a -> (a -> ReifiedGetter s b) -> ReifiedGetter s b Source # (>>) :: ReifiedGetter s a -> ReifiedGetter s b -> ReifiedGetter s b Source # return :: a -> ReifiedGetter s a Source # | |||||
| Apply (ReifiedGetter s) | |||||
Defined in Control.Lens.Reified Methods (<.>) :: ReifiedGetter s (a -> b) -> ReifiedGetter s a -> ReifiedGetter s b (.>) :: ReifiedGetter s a -> ReifiedGetter s b -> ReifiedGetter s b (<.) :: ReifiedGetter s a -> ReifiedGetter s b -> ReifiedGetter s a liftF2 :: (a -> b -> c) -> ReifiedGetter s a -> ReifiedGetter s b -> ReifiedGetter s c | |||||
| Bind (ReifiedGetter s) | |||||
Defined in Control.Lens.Reified Methods (>>-) :: ReifiedGetter s a -> (a -> ReifiedGetter s b) -> ReifiedGetter s b join :: ReifiedGetter s (ReifiedGetter s a) -> ReifiedGetter s a | |||||
| Semigroup s => Extend (ReifiedGetter s) | |||||
Defined in Control.Lens.Reified Methods duplicated :: ReifiedGetter s a -> ReifiedGetter s (ReifiedGetter s a) extended :: (ReifiedGetter s a -> b) -> ReifiedGetter s a -> ReifiedGetter s b | |||||
| type Corep ReifiedGetter | |||||
Defined in Control.Lens.Reified | |||||
| type Rep ReifiedGetter | |||||
Defined in Control.Lens.Reified | |||||
type IndexedGetter i s a = forall (p :: Type -> Type -> Type) (f :: Type -> Type). (Indexable i p, Contravariant f, Functor f) => p a (f a) -> s -> f s Source #
Every IndexedGetter is a valid IndexedFold and can be used for Getting like a Getter.
newtype ReifiedIndexedGetter i s a Source #
Reify an IndexedGetter so it can be stored safely in a container.
Constructors
| IndexedGetter | |
Fields
| |
Instances
| Representable (ReifiedIndexedGetter i) | |||||
Defined in Control.Lens.Reified Associated Types
Methods tabulate :: (d -> Rep (ReifiedIndexedGetter i) c) -> ReifiedIndexedGetter i d c | |||||
| Strong (ReifiedIndexedGetter i) | |||||
Defined in Control.Lens.Reified Methods first' :: ReifiedIndexedGetter i a b -> ReifiedIndexedGetter i (a, c) (b, c) second' :: ReifiedIndexedGetter i a b -> ReifiedIndexedGetter i (c, a) (c, b) | |||||
| Profunctor (ReifiedIndexedGetter i) | |||||
Defined in Control.Lens.Reified Methods dimap :: (a -> b) -> (c -> d) -> ReifiedIndexedGetter i b c -> ReifiedIndexedGetter i a d # lmap :: (a -> b) -> ReifiedIndexedGetter i b c -> ReifiedIndexedGetter i a c # rmap :: (b -> c) -> ReifiedIndexedGetter i a b -> ReifiedIndexedGetter i a c # (#.) :: forall a b c q. Coercible c b => q b c -> ReifiedIndexedGetter i a b -> ReifiedIndexedGetter i a c (.#) :: forall a b c q. Coercible b a => ReifiedIndexedGetter i b c -> q a b -> ReifiedIndexedGetter i a c | |||||
| Sieve (ReifiedIndexedGetter i) ((,) i) | |||||
Defined in Control.Lens.Reified Methods sieve :: ReifiedIndexedGetter i a b -> a -> (i, b) | |||||
| Functor (ReifiedIndexedGetter i s) | |||||
Defined in Control.Lens.Reified Methods fmap :: (a -> b) -> ReifiedIndexedGetter i s a -> ReifiedIndexedGetter i s b Source # (<$) :: a -> ReifiedIndexedGetter i s b -> ReifiedIndexedGetter i s a Source # | |||||
| Semigroup i => Apply (ReifiedIndexedGetter i s) | |||||
Defined in Control.Lens.Reified Methods (<.>) :: ReifiedIndexedGetter i s (a -> b) -> ReifiedIndexedGetter i s a -> ReifiedIndexedGetter i s b (.>) :: ReifiedIndexedGetter i s a -> ReifiedIndexedGetter i s b -> ReifiedIndexedGetter i s b (<.) :: ReifiedIndexedGetter i s a -> ReifiedIndexedGetter i s b -> ReifiedIndexedGetter i s a liftF2 :: (a -> b -> c) -> ReifiedIndexedGetter i s a -> ReifiedIndexedGetter i s b -> ReifiedIndexedGetter i s c | |||||
| type Rep (ReifiedIndexedGetter i) | |||||
Defined in Control.Lens.Reified | |||||
type LensLike (f :: k -> Type) s (t :: k) a (b :: k) = (a -> f b) -> s -> f t Source #
Many combinators that accept a Lens can also accept a
Traversal in limited situations.
They do so by specializing the type of Functor that they require of the
caller.
If a function accepts a for some LensLike f s t a bFunctor f,
then they may be passed a Lens.
Further, if f is an Applicative, they may also be passed a
Traversal.
type Over (p :: k -> Type -> Type) (f :: k1 -> Type) s (t :: k1) (a :: k) (b :: k1) = p a (f b) -> s -> f t Source #
This is a convenient alias for use when you need to consume either indexed or non-indexed lens-likes based on context.
lastOf :: Getting (Rightmost a) s a -> s -> Maybe a Source #
Retrieve the Last entry of a Fold or Traversal or retrieve Just the result
from a Getter or Lens.
The answer is computed in a manner that leaks space less than
and gives you back access to the outermost ala Last . foldMapOfJust constructor more quickly, but may have worse
constant factors.
>>>lastOf traverse [1..10]Just 10
>>>lastOf both (1,2)Just 2
>>>lastOf ignored ()Nothing
lastOf::Getters a -> s ->MaybealastOf::Folds a -> s ->MaybealastOf::Lens's a -> s ->MaybealastOf::Iso's a -> s ->MaybealastOf::Traversal's a -> s ->Maybea
firstOf :: Getting (Leftmost a) s a -> s -> Maybe a Source #
Retrieve the First entry of a Fold or Traversal or retrieve Just the result
from a Getter or Lens.
The answer is computed in a manner that leaks space less than or preview^?'
and gives you back access to the outermost Just constructor more quickly, but does so
in a way that builds an intermediate structure, and thus may have worse
constant factors. This also means that it can not be used in any MonadReader,
but must instead have s passed as its last argument, unlike preview.
Note: this could been named headOf.
>>>firstOf traverse [1..10]Just 1
>>>firstOf both (1,2)Just 1
>>>firstOf ignored ()Nothing
firstOf::Getters a -> s ->MaybeafirstOf::Folds a -> s ->MaybeafirstOf::Lens's a -> s ->MaybeafirstOf::Iso's a -> s ->MaybeafirstOf::Traversal's a -> s ->Maybea
traverse1Of_ :: Functor f => Getting (TraversedF r f) s a -> (a -> f r) -> s -> f () Source #
Traverse over all of the targets of a Fold1, computing an Apply based answer.
As long as you have Applicative or Functor effect you are better using traverseOf_.
The traverse1Of_ is useful only when you have genuine Apply effect.
>>>traverse1Of_ both1 (\ks -> Map.fromList [ (k, ()) | k <- ks ]) ("abc", "bcd")fromList [('b',()),('c',())]
traverse1Of_::Applyf =>Fold1s a -> (a -> f r) -> s -> f ()
Since: lens-4.16
traverseOf_ :: Functor f => Getting (Traversed r f) s a -> (a -> f r) -> s -> f () Source #
Traverse over all of the targets of a Fold (or Getter), computing an Applicative (or Functor)-based answer,
but unlike traverseOf do not construct a new structure. traverseOf_ generalizes
traverse_ to work over any Fold.
When passed a Getter, traverseOf_ can work over any Functor, but when passed a Fold, traverseOf_ requires
an Applicative.
>>>traverseOf_ both putStrLn ("hello","world")hello world
traverse_≡traverseOf_folded
traverseOf__2::Functorf => (c -> f r) -> (d, c) -> f ()traverseOf__Left::Applicativef => (a -> f b) ->Eithera c -> f ()
itraverseOf_l ≡traverseOf_l.Indexed
The rather specific signature of traverseOf_ allows it to be used as if the signature was any of:
traverseOf_::Functorf =>Getters a -> (a -> f r) -> s -> f ()traverseOf_::Applicativef =>Folds a -> (a -> f r) -> s -> f ()traverseOf_::Functorf =>Lens's a -> (a -> f r) -> s -> f ()traverseOf_::Functorf =>Iso's a -> (a -> f r) -> s -> f ()traverseOf_::Applicativef =>Traversal's a -> (a -> f r) -> s -> f ()traverseOf_::Applicativef =>Prism's a -> (a -> f r) -> s -> f ()
cloneLens :: ALens s t a b -> Lens s t a b Source #
Cloning a Lens is one way to make sure you aren't given
something weaker, such as a Traversal and can be
used as a way to pass around lenses that have to be monomorphic in f.
Note: This only accepts a proper Lens.
>>>let example l x = set (cloneLens l) (x^.cloneLens l + 1) x in example _2 ("hello",1,"you")("hello",2,"you")
newtype Bazaar (p :: Type -> Type -> Type) a b t Source #
This is used to characterize a Traversal.
a.k.a. indexed Cartesian store comonad, indexed Kleene store comonad, or an indexed FunList.
http://twanvl.nl/blog/haskell/non-regular1
A Bazaar is like a Traversal that has already been applied to some structure.
Where a holds an Context a b ta and a function from b to
t, a holds Bazaar a b tN as and a function from N
bs to t, (where N might be infinite).
Mnemonically, a Bazaar holds many stores and you can easily add more.
This is a final encoding of Bazaar.
Constructors
| Bazaar | |
Fields
| |
Instances
| Profunctor p => Bizarre p (Bazaar p) | |
Defined in Control.Lens.Internal.Bazaar Methods bazaar :: Applicative f => p a (f b) -> Bazaar p a b t -> f t Source # | |
| Corepresentable p => Sellable p (Bazaar p) | |
Defined in Control.Lens.Internal.Bazaar | |
| Conjoined p => IndexedComonad (Bazaar p) | |
| IndexedFunctor (Bazaar p) | |
| (a ~ b, Conjoined p) => Comonad (Bazaar p a b) | |
| (a ~ b, Conjoined p) => ComonadApply (Bazaar p a b) | |
| Applicative (Bazaar p a b) | |
Defined in Control.Lens.Internal.Bazaar Methods pure :: a0 -> Bazaar p a b a0 Source # (<*>) :: Bazaar p a b (a0 -> b0) -> Bazaar p a b a0 -> Bazaar p a b b0 Source # liftA2 :: (a0 -> b0 -> c) -> Bazaar p a b a0 -> Bazaar p a b b0 -> Bazaar p a b c Source # (*>) :: Bazaar p a b a0 -> Bazaar p a b b0 -> Bazaar p a b b0 Source # (<*) :: Bazaar p a b a0 -> Bazaar p a b b0 -> Bazaar p a b a0 Source # | |
| Functor (Bazaar p a b) | |
| Apply (Bazaar p a b) | |
Defined in Control.Lens.Internal.Bazaar | |
taking :: (Conjoined p, Applicative f) => Int -> Traversing p f s t a a -> Over p f s t a a Source #
Visit the first n targets of a Traversal, Fold, Getter or Lens.
>>>[("hello","world"),("!!!","!!!")]^.. taking 2 (traverse.both)["hello","world"]
>>>timingOut $ [1..] ^.. taking 3 traverse[1,2,3]
>>>over (taking 5 traverse) succ "hello world""ifmmp world"
taking::Int->Traversal's a ->Traversal's ataking::Int->Lens's a ->Traversal's ataking::Int->Iso's a ->Traversal's ataking::Int->Prism's a ->Traversal's ataking::Int->Getters a ->Folds ataking::Int->Folds a ->Folds ataking::Int->IndexedTraversal'i s a ->IndexedTraversal'i s ataking::Int->IndexedLens'i s a ->IndexedTraversal'i s ataking::Int->IndexedGetteri s a ->IndexedFoldi s ataking::Int->IndexedFoldi s a ->IndexedFoldi s a
type Setter s t a b = forall (f :: Type -> Type). Settable f => (a -> f b) -> s -> f t Source #
The only LensLike law that can apply to a Setter l is that
setl y (setl x a) ≡setl y a
You can't view a Setter in general, so the other two laws are irrelevant.
However, two Functor laws apply to a Setter:
overlid≡idoverl f.overl g ≡overl (f.g)
These can be stated more directly:
lpure≡purel f.untainted.l g ≡ l (f.untainted.g)
You can compose a Setter with a Lens or a Traversal using (.) from the Prelude
and the result is always only a Setter and nothing more.
>>>over traverse f [a,b,c,d][f a,f b,f c,f d]
>>>over _1 f (a,b)(f a,b)
>>>over (traverse._1) f [(a,b),(c,d)][(f a,b),(f c,d)]
>>>over both f (a,b)(f a,f b)
>>>over (traverse.both) f [(a,b),(c,d)][(f a,f b),(f c,f d)]
newtype ReifiedSetter s t a b Source #
Reify a Setter so it can be stored safely in a container.
class (MonadState s m, MonadState t n) => Zoom (m :: Type -> Type) (n :: Type -> Type) s t | m -> s, n -> t, m t -> n, n s -> m where Source #
This class allows us to use zoom in, changing the State supplied by
many different Monad transformers, potentially quite
deep in a Monad transformer stack.
Methods
zoom :: LensLike' (Zoomed m c) t s -> m c -> n c infixr 2 Source #
Run a monadic action in a larger State than it was defined in,
using a Lens' or Traversal'.
This is commonly used to lift actions in a simpler State
Monad into a State Monad with a larger State type.
When applied to 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 State.evalState (a,b) $ zoom _1 $ use ida
>>>flip State.execState (a,b) $ zoom _1 $ id .= c(c,b)
>>>flip State.execState [(a,b),(c,d)] $ zoom traverse $ _2 %= f[(a,f b),(c,f d)]
>>>flip State.runState [(a,b),(c,d)] $ zoom traverse $ _2 <%= f(f b <> f d <> mempty,[(a,f b),(c,f d)])
>>>flip State.evalState (a,b) $ zoom both (use id)a <> b
zoom::Monadm =>Lens's t ->StateTt m a ->StateTs m azoom:: (Monadm,Monoidc) =>Traversal's t ->StateTt m c ->StateTs m czoom:: (Monadm,Monoidw) =>Lens's t ->RWSTr w t m c ->RWSTr w s m czoom:: (Monadm,Monoidw,Monoidc) =>Traversal's t ->RWSTr w t m c ->RWSTr w s m czoom:: (Monadm,Monoidw,Errore) =>Lens's t ->ErrorTe (RWSTr w t m) c ->ErrorTe (RWSTr w s m) czoom:: (Monadm,Monoidw,Monoidc,Errore) =>Traversal's t ->ErrorTe (RWSTr w t m) c ->ErrorTe (RWSTr w s m) c ...
Instances
| Zoom m n s t => Zoom (MaybeT m) (MaybeT n) s t | |
| (Functor f, Zoom m n s t) => Zoom (FreeT f m) (FreeT f n) s t | |
| Zoom m n s t => Zoom (ExceptT e m) (ExceptT e n) s t | |
| Zoom m n s t => Zoom (IdentityT m) (IdentityT n) s t | |
| Zoom m n s t => Zoom (ReaderT e m) (ReaderT e n) s t | |
| Monad z => Zoom (StateT s z) (StateT t z) s t | |
| Monad z => Zoom (StateT s z) (StateT t z) s t | |
| (Monoid w, Zoom m n s t) => Zoom (WriterT w m) (WriterT w n) s t | |
| (Monoid w, Zoom m n s t) => Zoom (WriterT w m) (WriterT w n) s t | |
| (Monoid w, Monad z) => Zoom (RWST r w s z) (RWST r w t z) s t | |
| (Monoid w, Monad z) => Zoom (RWST r w s z) (RWST r w t z) s t | |
traversed :: forall (f :: Type -> Type) a b. Traversable f => IndexedTraversal Int (f a) (f b) a b Source #
Traverse any Traversable container. This is an IndexedTraversal that is indexed by ordinal position.
type Getting r s a = (a -> Const r a) -> s -> Const r s Source #
When you see this in a type signature it indicates that you can
pass the function a Lens, Getter,
Traversal, Fold,
Prism, Iso, or one of
the indexed variants, and it will just "do the right thing".
Most Getter combinators are able to be used with both a Getter or a
Fold in limited situations, to do so, they need to be
monomorphic in what we are going to extract with Const. To be compatible
with Lens, Traversal and
Iso we also restricted choices of the irrelevant t and
b parameters.
If a function accepts a , then when Getting r s ar is a Monoid, then
you can pass a Fold (or
Traversal), otherwise you can only pass this a
Getter or Lens.
foldMapOf :: Getting r s a -> (a -> r) -> s -> r Source #
Map each part of a structure viewed through a Lens, Getter,
Fold or Traversal to a monoid and combine the results.
>>>foldMapOf (folded . both . _Just) Sum [(Just 21, Just 21)]Sum {getSum = 42}
foldMap=foldMapOffolded
foldMapOf≡viewsifoldMapOfl =foldMapOfl.Indexed
foldMapOf::Getters a -> (a -> r) -> s -> rfoldMapOf::Monoidr =>Folds a -> (a -> r) -> s -> rfoldMapOf::Semigroupr =>Fold1s a -> (a -> r) -> s -> rfoldMapOf::Lens's a -> (a -> r) -> s -> rfoldMapOf::Iso's a -> (a -> r) -> s -> rfoldMapOf::Monoidr =>Traversal's a -> (a -> r) -> s -> rfoldMapOf::Semigroupr =>Traversal1's a -> (a -> r) -> s -> rfoldMapOf::Monoidr =>Prism's a -> (a -> r) -> s -> r
foldMapOf::Gettingr s a -> (a -> r) -> s -> r
re :: AReview t b -> Getter b t Source #
Turn a Prism or Iso around to build a Getter.
If you have an Iso, from is a more powerful version of this function
that will return an Iso instead of a mere Getter.
>>>5 ^.re _LeftLeft 5
>>>6 ^.re (_Left.unto succ)Left 7
review≡view.rereviews≡views.rereuse≡use.rereuses≡uses.re
re::Prisms t a b ->Getterb tre::Isos t a b ->Getterb t
review :: MonadReader b m => AReview t b -> m t Source #
This can be used to turn an Iso or Prism around and view a value (or the current environment) through it the other way.
review≡view.rereview.unto≡id
>>>review _Left "mustard"Left "mustard"
>>>review (unto succ) 56
Usually review is used in the (->) Monad with a Prism or Iso, in which case it may be useful to think of
it as having one of these more restricted type signatures:
review::Iso's a -> a -> sreview::Prism's a -> a -> s
However, when working with a Monad transformer stack, it is sometimes useful to be able to review the current environment, in which case
it may be beneficial to think of it as having one of these slightly more liberal type signatures:
review::MonadReadera m =>Iso's a -> m sreview::MonadReadera m =>Prism's a -> m s
preview :: MonadReader s m => Getting (First a) s a -> m (Maybe a) Source #
Retrieve the first value targeted by a Fold or Traversal (or Just the result
from a Getter or Lens). See also firstOf and ^?, which are similar with
some subtle differences (explained below).
listToMaybe.toList≡previewfolded
preview=view.pre
Unlike ^?, this function uses a
MonadReader to read the value to be focused in on.
This allows one to pass the value as the last argument by using the
MonadReader instance for (->) s
However, it may also be used as part of some deeply nested transformer stack.
preview uses a monoidal value to obtain the result.
This means that it generally has good performance, but can occasionally cause space leaks
or even stack overflows on some data types.
There is another function, firstOf, which avoids these issues at the cost of
a slight constant performance cost and a little less flexibility.
It may be helpful to think of preview as having one of the following
more specialized types:
preview::Getters a -> s ->Maybeapreview::Folds a -> s ->Maybeapreview::Lens's a -> s ->Maybeapreview::Iso's a -> s ->Maybeapreview::Traversal's a -> s ->Maybea
preview::MonadReaders m =>Getters a -> m (Maybea)preview::MonadReaders m =>Folds a -> m (Maybea)preview::MonadReaders m =>Lens's a -> m (Maybea)preview::MonadReaders m =>Iso's a -> m (Maybea)preview::MonadReaders m =>Traversal's a -> m (Maybea)
(^?) :: s -> Getting (First a) s a -> Maybe a infixl 8 Source #
Perform a safe head of a Fold or Traversal or retrieve Just the result
from a Getter or Lens.
When using a Traversal as a partial Lens, or a Fold as a partial Getter this can be a convenient
way to extract the optional value.
Note: if you get stack overflows due to this, you may want to use firstOf instead, which can deal
more gracefully with heavily left-biased trees. This is because ^? works by using the
First monoid, which can occasionally cause space leaks.
>>>Left 4 ^?_LeftJust 4
>>>Right 4 ^?_LeftNothing
>>>"world" ^? ix 3Just 'l'
>>>"world" ^? ix 20Nothing
This operator works as an infix version of preview.
(^?) ≡flippreview
It may be helpful to think of ^? as having one of the following
more specialized types:
(^?) :: s ->Getters a ->Maybea (^?) :: s ->Folds a ->Maybea (^?) :: s ->Lens's a ->Maybea (^?) :: s ->Iso's a ->Maybea (^?) :: s ->Traversal's a ->Maybea
matching :: APrism s t a b -> s -> Either t a Source #
Retrieve the value targeted by a Prism or return the
original value while allowing the type to change if it does
not match.
>>>matching _Just (Just 12)Right 12
>>>matching _Just (Nothing :: Maybe Int) :: Either (Maybe Bool) IntLeft Nothing
lengthOf :: Getting (Endo (Endo Int)) s a -> s -> Int Source #
Calculate the number of targets there are for a Fold in a given container.
Note: This can be rather inefficient for large containers and just like length,
this will not terminate for infinite folds.
length≡lengthOffolded
>>>lengthOf _1 ("hello",())1
>>>lengthOf traverse [1..10]10
>>>lengthOf (traverse.traverse) [[1,2],[3,4],[5,6]]6
lengthOf(folded.folded) :: (Foldablef,Foldableg) => f (g a) ->Int
lengthOf::Getters a -> s ->IntlengthOf::Folds a -> s ->IntlengthOf::Lens's a -> s ->IntlengthOf::Iso's a -> s ->IntlengthOf::Traversal's a -> s ->Int
type Simple (f :: k1 -> k1 -> k2 -> k2 -> k) (s :: k1) (a :: k2) = f s s a a Source #
A Simple Lens, Simple Traversal, ... can
be used instead of a Lens,Traversal, ...
whenever the type variables don't change upon setting a value.
_imagPart::SimpleLens(Complexa) atraversed::Simple(IndexedTraversalInt) [a] a
Note: To use this alias in your own code with or
LensLike fSetter, you may have to turn on LiberalTypeSynonyms.
This is commonly abbreviated as a "prime" marker, e.g. Lens' = Simple Lens.
set :: ASetter s t a b -> b -> s -> t Source #
Replace the target of a Lens or all of the targets of a Setter
or Traversal with a constant value.
(<$) ≡setmapped
>>>set _2 "hello" (1,())(1,"hello")
>>>set mapped () [1,2,3,4][(),(),(),()]
Note: Attempting to set a Fold or Getter will fail at compile time with an
relatively nice error message.
set::Setters t a b -> b -> s -> tset::Isos t a b -> b -> s -> tset::Lenss t a b -> b -> s -> tset::Traversals t a b -> b -> s -> t
view :: MonadReader s m => Getting a s a -> m a Source #
View the value pointed to by a Getter, Iso or
Lens or the result of folding over all the results of a
Fold or Traversal that points
at a monoidal value.
view.to≡id
>>>view (to f) af a
>>>view _2 (1,"hello")"hello"
>>>view (to succ) 56
>>>view (_2._1) ("hello",("world","!!!"))"world"
As view is commonly used to access the target of a Getter or obtain a monoidal summary of the targets of a Fold,
It may be useful to think of it as having one of these more restricted signatures:
view::Getters a -> s -> aview::Monoidm =>Folds m -> s -> mview::Iso's a -> s -> aview::Lens's a -> s -> aview::Monoidm =>Traversal's m -> s -> m
In a more general setting, such as when working with a Monad transformer stack you can use:
view::MonadReaders m =>Getters a -> m aview:: (MonadReaders m,Monoida) =>Folds a -> m aview::MonadReaders m =>Iso's a -> m aview::MonadReaders m =>Lens's a -> m aview:: (MonadReaders m,Monoida) =>Traversal's a -> m a
cloneTraversal :: ATraversal s t a b -> Traversal s t a b Source #
A Traversal is completely characterized by its behavior on a Bazaar.
Cloning a Traversal is one way to make sure you aren't given
something weaker, such as a Fold and can be
used as a way to pass around traversals that have to be monomorphic in f.
Note: This only accepts a proper Traversal (or Lens). To clone a Lens
as such, use cloneLens.
Note: It is usually better to use ReifiedTraversal and
runTraversal than to cloneTraversal. The
former can execute at full speed, while the latter needs to round trip through
the Bazaar.
>>>let foo l a = (view (getting (cloneTraversal l)) a, set (cloneTraversal l) 10 a)>>>foo both ("hello","world")("helloworld",(10,10))
cloneTraversal::LensLike(Bazaar(->) a b) s t a b ->Traversals t a b
use :: MonadState s m => Getting a s a -> m a Source #
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 (use _1) (a,b)a
>>>evalState (use _1) ("hello","world")"hello"
use::MonadStates m =>Getters a -> m ause:: (MonadStates m,Monoidr) =>Folds r -> m ruse::MonadStates m =>Iso's a -> m ause::MonadStates m =>Lens's a -> m ause:: (MonadStates m,Monoidr) =>Traversal's r -> m r
class Field2 s t a b | s -> a, t -> b, s b -> t, t a -> s where Source #
Provides access to the 2nd field of a tuple.
Minimal complete definition
Nothing
Methods
Access the 2nd field of a tuple.
>>>_2 .~ "hello" $ (1,(),3,4)(1,"hello",3,4)
>>>(1,2,3,4) & _2 *~ 3(1,6,3,4)
>>>_2 print (1,2)2 (1,())
anyOf_2:: (s ->Bool) -> (a, s) ->Booltraverse._2:: (Applicativef,Traversablet) => (a -> f b) -> t (s, a) -> f (t (s, b))foldMapOf(traverse._2) :: (Traversablet,Monoidm) => (s -> m) -> t (b, s) -> m
Instances
| Field2 (Plucker a) (Plucker a) a a | |
| Field2 (Quaternion a) (Quaternion a) a a | |
Defined in Linear.Quaternion Methods _2 :: Lens (Quaternion a) (Quaternion a) a a Source # | |
| Field2 (V2 a) (V2 a) a a | |
| Field2 (V3 a) (V3 a) a a | |
| Field2 (V4 a) (V4 a) a a | |
| Field2 (Pair a b) (Pair a b') b b' | Since: lens-4.20 |
Defined in Control.Lens.Tuple | |
| Field2 (a, b) (a, b') b b' |
|
Defined in Control.Lens.Tuple | |
| 2 <= n => Field2 (V n a) (V n a) a a | |
| Field2 (a, b, c) (a, b', c) b b' | |
Defined in Control.Lens.Tuple | |
| Field2 (a, b, c, d) (a, b', c, d) b b' | |
Defined in Control.Lens.Tuple | |
| Field2 (Product f g a) (Product f g' a) (g a) (g' a) | |
| Field2 ((f :*: g) p) ((f :*: g') p) (g p) (g' p) | |
| Field2 (a, b, c, d, e) (a, b', c, d, e) b b' | |
Defined in Control.Lens.Tuple | |
| Field2 (a, b, c, d, e, f) (a, b', c, d, e, f) b b' | |
Defined in Control.Lens.Tuple | |
| Field2 (a, b, c, d, e, f, g) (a, b', c, d, e, f, g) b b' | |
Defined in Control.Lens.Tuple | |
| Field2 (a, b, c, d, e, f, g, h) (a, b', c, d, e, f, g, h) b b' | |
Defined in Control.Lens.Tuple | |
| Field2 (a, b, c, d, e, f, g, h, i) (a, b', c, d, e, f, g, h, i) b b' | |
Defined in Control.Lens.Tuple | |
| Field2 (a, b, c, d, e, f, g, h, i, j) (a, b', c, d, e, f, g, h, i, j) b b' | |
Defined in Control.Lens.Tuple | |
| Field2 (a, b, c, d, e, f, g, h, i, j, kk) (a, b', c, d, e, f, g, h, i, j, kk) b b' | |
Defined in Control.Lens.Tuple | |
| Field2 (a, b, c, d, e, f, g, h, i, j, kk, l) (a, b', c, d, e, f, g, h, i, j, kk, l) b b' | |
Defined in Control.Lens.Tuple | |
| Field2 (a, b, c, d, e, f, g, h, i, j, kk, l, m) (a, b', c, d, e, f, g, h, i, j, kk, l, m) b b' | |
Defined in Control.Lens.Tuple | |
| Field2 (a, b, c, d, e, f, g, h, i, j, kk, l, m, n) (a, b', c, d, e, f, g, h, i, j, kk, l, m, n) b b' | |
Defined in Control.Lens.Tuple | |
| Field2 (a, b, c, d, e, f, g, h, i, j, kk, l, m, n, o) (a, b', c, d, e, f, g, h, i, j, kk, l, m, n, o) b b' | |
Defined in Control.Lens.Tuple | |
| Field2 (a, b, c, d, e, f, g, h, i, j, kk, l, m, n, o, p) (a, b', c, d, e, f, g, h, i, j, kk, l, m, n, o, p) b b' | |
Defined in Control.Lens.Tuple | |
| Field2 (a, b, c, d, e, f, g, h, i, j, kk, l, m, n, o, p, q) (a, b', c, d, e, f, g, h, i, j, kk, l, m, n, o, p, q) b b' | |
Defined in Control.Lens.Tuple | |
| Field2 (a, b, c, d, e, f, g, h, i, j, kk, l, m, n, o, p, q, r) (a, b', c, d, e, f, g, h, i, j, kk, l, m, n, o, p, q, r) b b' | |
Defined in Control.Lens.Tuple | |
| Field2 (a, b, c, d, e, f, g, h, i, j, kk, l, m, n, o, p, q, r, s) (a, b', c, d, e, f, g, h, i, j, kk, l, m, n, o, p, q, r, s) b b' | |
Defined in Control.Lens.Tuple | |
class Functor f => FunctorWithIndex i (f :: Type -> Type) | f -> i where #
Minimal complete definition
Nothing
Instances
| FunctorWithIndex () Identity | |
| FunctorWithIndex () Par1 | |
| FunctorWithIndex () Maybe | |
| FunctorWithIndex () Solo | |
Defined in Data.Functor.WithIndex.Instances | |
| FunctorWithIndex Int IntMap | |
| FunctorWithIndex Int Seq | |
| FunctorWithIndex Int NonEmpty | |
| FunctorWithIndex Int ZipList | |
| FunctorWithIndex Int Deque | |
| FunctorWithIndex Int Vector | |
Defined in Data.Functor.WithIndex.Instances | |
| FunctorWithIndex Int [] | |
| FunctorWithIndex Void (Proxy :: Type -> Type) | |
| FunctorWithIndex Void (U1 :: Type -> Type) | |
| FunctorWithIndex Void (V1 :: Type -> Type) | |
| Ix i => FunctorWithIndex i (Array i) | |
| FunctorWithIndex i (Level i) | |
Defined in Control.Lens.Internal.Level | |
| FunctorWithIndex k (Map k) | |
| FunctorWithIndex k (HashMap k) | |
Defined in Data.Functor.WithIndex.Instances | |
| FunctorWithIndex k ((,) k) | |
| FunctorWithIndex Void (Const e :: Type -> Type) | |
| FunctorWithIndex Void (Constant e :: Type -> Type) | |
| FunctorWithIndex () (Tagged a) | |
Defined in Data.Functor.WithIndex.Instances | |
| FunctorWithIndex Int (V n) | |
| FunctorWithIndex i f => FunctorWithIndex i (Rec1 f) | |
| FunctorWithIndex i f => FunctorWithIndex i (Backwards f) | |
| FunctorWithIndex i m => FunctorWithIndex i (IdentityT m) | |
| FunctorWithIndex i f => FunctorWithIndex i (Reverse f) | |
| FunctorWithIndex Void (K1 i c :: Type -> Type) | |
| FunctorWithIndex i (Magma i t b) | |
Defined in Control.Lens.Internal.Magma | |
| FunctorWithIndex r ((->) r) | |
| FunctorWithIndex (E Plucker) Plucker | |
| FunctorWithIndex (E Quaternion) Quaternion | |
Defined in Linear.Quaternion Methods imap :: (E Quaternion -> a -> b) -> Quaternion a -> Quaternion b # | |
| FunctorWithIndex (E V0) V0 | |
| FunctorWithIndex (E V1) V1 | |
| FunctorWithIndex (E V2) V2 | |
| FunctorWithIndex (E V3) V3 | |
| FunctorWithIndex (E V4) V4 | |
| FunctorWithIndex [Int] Tree | |
| FunctorWithIndex i f => FunctorWithIndex [i] (Cofree f) | |
Defined in Control.Comonad.Cofree | |
| FunctorWithIndex i f => FunctorWithIndex [i] (Free f) | |
Defined in Control.Monad.Free | |
| FunctorWithIndex i m => FunctorWithIndex (e, i) (ReaderT e m) | |
| (FunctorWithIndex i f, FunctorWithIndex j g) => FunctorWithIndex (Either i j) (Product f g) | |
| (FunctorWithIndex i f, FunctorWithIndex j g) => FunctorWithIndex (Either i j) (Sum f g) | |
| (FunctorWithIndex i f, FunctorWithIndex j g) => FunctorWithIndex (Either i j) (f :*: g) | |
| (FunctorWithIndex i f, FunctorWithIndex j g) => FunctorWithIndex (Either i j) (f :+: g) | |
| (FunctorWithIndex i f, FunctorWithIndex j g) => FunctorWithIndex (i, j) (Compose f g) | |
| (FunctorWithIndex i f, FunctorWithIndex j g) => FunctorWithIndex (i, j) (f :.: g) | |
type Traversal' s a = Traversal s s a a Source #
typeTraversal'=SimpleTraversal
(^.) :: s -> Getting a s a -> a infixl 8 Source #
View the value pointed to by a Getter or Lens or the
result of folding over all the results of a Fold or
Traversal that points at a monoidal values.
This is the same operation as view with the arguments flipped.
The fixity and semantics are such that subsequent field accesses can be
performed with (.).
>>>(a,b)^._2b
>>>("hello","world")^._2"world"
>>>import Data.Complex>>>((0, 1 :+ 2), 3)^._1._2.to magnitude2.23606797749979
(^.) :: s ->Getters a -> a (^.) ::Monoidm => s ->Folds m -> m (^.) :: s ->Iso's a -> a (^.) :: s ->Lens's a -> a (^.) ::Monoidm => s ->Traversal's m -> m
(.~) :: ASetter s t a b -> b -> s -> t infixr 4 Source #
Replace the target of a Lens or all of the targets of a Setter
or Traversal with a constant value.
This is an infix version of set, provided for consistency with (.=).
f<$a ≡mapped.~f$a
>>>(a,b,c,d) & _4 .~ e(a,b,c,e)
>>>(42,"world") & _1 .~ "hello"("hello","world")
>>>(a,b) & both .~ c(c,c)
(.~) ::Setters t a b -> b -> s -> t (.~) ::Isos t a b -> b -> s -> t (.~) ::Lenss t a b -> b -> s -> t (.~) ::Traversals t a b -> b -> s -> t
(%~) :: ASetter s t a b -> (a -> b) -> s -> t infixr 4 Source #
Modifies the target of a Lens or all of the targets of a Setter or
Traversal with a user supplied function.
This is an infix version of over.
fmapf ≡mapped%~ffmapDefaultf ≡traverse%~f
>>>(a,b,c) & _3 %~ f(a,b,f c)
>>>(a,b) & both %~ f(f a,f b)
>>>_2 %~ length $ (1,"hello")(1,5)
>>>traverse %~ f $ [a,b,c][f a,f b,f c]
>>>traverse %~ even $ [1,2,3][False,True,False]
>>>traverse.traverse %~ length $ [["hello","world"],["!!!"]][[5,5],[3]]
(%~) ::Setters t a b -> (a -> b) -> s -> t (%~) ::Isos t a b -> (a -> b) -> s -> t (%~) ::Lenss t a b -> (a -> b) -> s -> t (%~) ::Traversals t a b -> (a -> b) -> s -> t
(+~) :: Num a => ASetter s t a a -> a -> s -> t infixr 4 Source #
Increment the target(s) of a numerically valued Lens, Setter or Traversal.
>>>(a,b) & _1 +~ c(a + c,b)
>>>(a,b) & both +~ c(a + c,b + c)
>>>(1,2) & _2 +~ 1(1,3)
>>>[(a,b),(c,d)] & traverse.both +~ e[(a + e,b + e),(c + e,d + e)]
(+~) ::Numa =>Setter's a -> a -> s -> s (+~) ::Numa =>Iso's a -> a -> s -> s (+~) ::Numa =>Lens's a -> a -> s -> s (+~) ::Numa =>Traversal's a -> a -> s -> s
(-~) :: Num a => ASetter s t a a -> a -> s -> t infixr 4 Source #
Decrement the target(s) of a numerically valued Lens, Iso, Setter or Traversal.
>>>(a,b) & _1 -~ c(a - c,b)
>>>(a,b) & both -~ c(a - c,b - c)
>>>_1 -~ 2 $ (1,2)(-1,2)
>>>mapped.mapped -~ 1 $ [[4,5],[6,7]][[3,4],[5,6]]
(-~) ::Numa =>Setter's a -> a -> s -> s (-~) ::Numa =>Iso's a -> a -> s -> s (-~) ::Numa =>Lens's a -> a -> s -> s (-~) ::Numa =>Traversal's a -> a -> s -> s
(*~) :: Num a => ASetter s t a a -> a -> s -> t infixr 4 Source #
Multiply the target(s) of a numerically valued Lens, Iso, Setter or Traversal.
>>>(a,b) & _1 *~ c(a * c,b)
>>>(a,b) & both *~ c(a * c,b * c)
>>>(1,2) & _2 *~ 4(1,8)
>>>Just 24 & mapped *~ 2Just 48
(*~) ::Numa =>Setter's a -> a -> s -> s (*~) ::Numa =>Iso's a -> a -> s -> s (*~) ::Numa =>Lens's a -> a -> s -> s (*~) ::Numa =>Traversal's a -> a -> s -> s
(//~) :: Fractional a => ASetter s t a a -> a -> s -> t infixr 4 Source #
Divide the target(s) of a numerically valued Lens, Iso, Setter or Traversal.
>>>(a,b) & _1 //~ c(a / c,b)
>>>(a,b) & both //~ c(a / c,b / c)
>>>("Hawaii",10) & _2 //~ 2("Hawaii",5.0)
(//~) ::Fractionala =>Setter's a -> a -> s -> s (//~) ::Fractionala =>Iso's a -> a -> s -> s (//~) ::Fractionala =>Lens's a -> a -> s -> s (//~) ::Fractionala =>Traversal's a -> a -> s -> s
(^~) :: (Num a, Integral e) => ASetter s t a a -> e -> s -> t infixr 4 Source #
Raise the target(s) of a numerically valued Lens, Setter or Traversal to a non-negative integral power.
>>>(1,3) & _2 ^~ 2(1,9)
(^~) :: (Numa,Integrale) =>Setter's a -> e -> s -> s (^~) :: (Numa,Integrale) =>Iso's a -> e -> s -> s (^~) :: (Numa,Integrale) =>Lens's a -> e -> s -> s (^~) :: (Numa,Integrale) =>Traversal's a -> e -> s -> s
(^^~) :: (Fractional a, Integral e) => ASetter s t a a -> e -> s -> t infixr 4 Source #
Raise the target(s) of a fractionally valued Lens, Setter or Traversal to an integral power.
>>>(1,2) & _2 ^^~ (-1)(1,0.5)
(^^~) :: (Fractionala,Integrale) =>Setter's a -> e -> s -> s (^^~) :: (Fractionala,Integrale) =>Iso's a -> e -> s -> s (^^~) :: (Fractionala,Integrale) =>Lens's a -> e -> s -> s (^^~) :: (Fractionala,Integrale) =>Traversal's a -> e -> s -> s
(**~) :: Floating a => ASetter s t a a -> a -> s -> t infixr 4 Source #
Raise the target(s) of a floating-point valued Lens, Setter or Traversal to an arbitrary power.
>>>(a,b) & _1 **~ c(a**c,b)
>>>(a,b) & both **~ c(a**c,b**c)
>>>_2 **~ 10 $ (3,2)(3,1024.0)
(**~) ::Floatinga =>Setter's a -> a -> s -> s (**~) ::Floatinga =>Iso's a -> a -> s -> s (**~) ::Floatinga =>Lens's a -> a -> s -> s (**~) ::Floatinga =>Traversal's a -> a -> s -> s
(||~) :: ASetter s t Bool Bool -> Bool -> s -> t infixr 4 Source #
Logically || the target(s) of a Bool-valued Lens or Setter.
>>>both ||~ True $ (False,True)(True,True)
>>>both ||~ False $ (False,True)(False,True)
(||~) ::Setter'sBool->Bool-> s -> s (||~) ::Iso'sBool->Bool-> s -> s (||~) ::Lens'sBool->Bool-> s -> s (||~) ::Traversal'sBool->Bool-> s -> s
(&&~) :: ASetter s t Bool Bool -> Bool -> s -> t infixr 4 Source #
Logically && the target(s) of a Bool-valued Lens or Setter.
>>>both &&~ True $ (False, True)(False,True)
>>>both &&~ False $ (False, True)(False,False)
(&&~) ::Setter'sBool->Bool-> s -> s (&&~) ::Iso'sBool->Bool-> s -> s (&&~) ::Lens'sBool->Bool-> s -> s (&&~) ::Traversal'sBool->Bool-> s -> s
(?~) :: ASetter s t a (Maybe b) -> b -> s -> t infixr 4 Source #
Set the target of a Lens, Traversal or Setter to Just a value.
l?~t ≡setl (Justt)
>>>Nothing & id ?~ aJust a
>>>Map.empty & at 3 ?~ xfromList [(3,x)]
?~ can be used type-changily:
>>>('a', ('b', 'c')) & _2.both ?~ 'x'('a',(Just 'x',Just 'x'))
(?~) ::Setters t a (Maybeb) -> b -> s -> t (?~) ::Isos t a (Maybeb) -> b -> s -> t (?~) ::Lenss t a (Maybeb) -> b -> s -> t (?~) ::Traversals t a (Maybeb) -> b -> s -> t
(<>~) :: Semigroup a => ASetter s t a a -> a -> s -> t infixr 4 Source #
Modify the target of a Semigroup value by using (.<>)
>>>(Sum a,b) & _1 <>~ Sum c(Sum {getSum = a + c},b)
>>>(Sum a,Sum b) & both <>~ Sum c(Sum {getSum = a + c},Sum {getSum = b + c})
>>>both <>~ "!!!" $ ("hello","world")("hello!!!","world!!!")
(<>~) ::Semigroupa =>Setters t a a -> a -> s -> t (<>~) ::Semigroupa =>Isos t a a -> a -> s -> t (<>~) ::Semigroupa =>Lenss t a a -> a -> s -> t (<>~) ::Semigroupa =>Traversals t a a -> a -> s -> t
(%=) :: MonadState s m => ASetter s s a b -> (a -> b) -> m () infix 4 Source #
Map over the target of a Lens or all of the targets of a Setter or Traversal in our monadic state.
>>>execState (do _1 %= f;_2 %= g) (a,b)(f a,g b)
>>>execState (do both %= f) (a,b)(f a,f b)
(%=) ::MonadStates m =>Iso's a -> (a -> a) -> m () (%=) ::MonadStates m =>Lens's a -> (a -> a) -> m () (%=) ::MonadStates m =>Traversal's a -> (a -> a) -> m () (%=) ::MonadStates m =>Setter's a -> (a -> a) -> m ()
(%=) ::MonadStates m =>ASetters s a b -> (a -> b) -> m ()
(+=) :: (MonadState s m, Num a) => ASetter' s a -> a -> m () infix 4 Source #
Modify the target(s) of a Lens', Iso, Setter or Traversal by adding a value.
Example:
fresh::MonadStateIntm => mIntfresh= doid+=1useid
>>>execState (do _1 += c; _2 += d) (a,b)(a + c,b + d)
>>>execState (do _1.at 1.non 0 += 10) (Map.fromList [(2,100)],"hello")(fromList [(1,10),(2,100)],"hello")
(+=) :: (MonadStates m,Numa) =>Setter's a -> a -> m () (+=) :: (MonadStates m,Numa) =>Iso's a -> a -> m () (+=) :: (MonadStates m,Numa) =>Lens's a -> a -> m () (+=) :: (MonadStates m,Numa) =>Traversal's a -> a -> m ()
(-=) :: (MonadState s m, Num a) => ASetter' s a -> a -> m () infix 4 Source #
Modify the target(s) of a Lens', Iso, Setter or Traversal by subtracting a value.
>>>execState (do _1 -= c; _2 -= d) (a,b)(a - c,b - d)
(-=) :: (MonadStates m,Numa) =>Setter's a -> a -> m () (-=) :: (MonadStates m,Numa) =>Iso's a -> a -> m () (-=) :: (MonadStates m,Numa) =>Lens's a -> a -> m () (-=) :: (MonadStates m,Numa) =>Traversal's a -> a -> m ()
(*=) :: (MonadState s m, Num a) => ASetter' s a -> a -> m () infix 4 Source #
Modify the target(s) of a Lens', Iso, Setter or Traversal by multiplying by value.
>>>execState (do _1 *= c; _2 *= d) (a,b)(a * c,b * d)
(*=) :: (MonadStates m,Numa) =>Setter's a -> a -> m () (*=) :: (MonadStates m,Numa) =>Iso's a -> a -> m () (*=) :: (MonadStates m,Numa) =>Lens's a -> a -> m () (*=) :: (MonadStates m,Numa) =>Traversal's a -> a -> m ()
(//=) :: (MonadState s m, Fractional a) => ASetter' s a -> a -> m () infix 4 Source #
Modify the target(s) of a Lens', Iso, Setter or Traversal by dividing by a value.
>>>execState (do _1 //= c; _2 //= d) (a,b)(a / c,b / d)
(//=) :: (MonadStates m,Fractionala) =>Setter's a -> a -> m () (//=) :: (MonadStates m,Fractionala) =>Iso's a -> a -> m () (//=) :: (MonadStates m,Fractionala) =>Lens's a -> a -> m () (//=) :: (MonadStates m,Fractionala) =>Traversal's a -> a -> m ()
(^=) :: (MonadState s m, Num a, Integral e) => ASetter' s a -> e -> m () infix 4 Source #
Raise the target(s) of a numerically valued Lens, Setter or Traversal to a non-negative integral power.
(^=) :: (MonadStates m,Numa,Integrale) =>Setter's a -> e -> m () (^=) :: (MonadStates m,Numa,Integrale) =>Iso's a -> e -> m () (^=) :: (MonadStates m,Numa,Integrale) =>Lens's a -> e -> m () (^=) :: (MonadStates m,Numa,Integrale) =>Traversal's a -> e -> m ()
(^^=) :: (MonadState s m, Fractional a, Integral e) => ASetter' s a -> e -> m () infix 4 Source #
Raise the target(s) of a numerically valued Lens, Setter or Traversal to an integral power.
(^^=) :: (MonadStates m,Fractionala,Integrale) =>Setter's a -> e -> m () (^^=) :: (MonadStates m,Fractionala,Integrale) =>Iso's a -> e -> m () (^^=) :: (MonadStates m,Fractionala,Integrale) =>Lens's a -> e -> m () (^^=) :: (MonadStates m,Fractionala,Integrale) =>Traversal's a -> e -> m ()
(**=) :: (MonadState s m, Floating a) => ASetter' s a -> a -> m () infix 4 Source #
Raise the target(s) of a numerically valued Lens, Setter or Traversal to an arbitrary power
>>>execState (do _1 **= c; _2 **= d) (a,b)(a**c,b**d)
(**=) :: (MonadStates m,Floatinga) =>Setter's a -> a -> m () (**=) :: (MonadStates m,Floatinga) =>Iso's a -> a -> m () (**=) :: (MonadStates m,Floatinga) =>Lens's a -> a -> m () (**=) :: (MonadStates m,Floatinga) =>Traversal's a -> a -> m ()
(||=) :: MonadState s m => ASetter' s Bool -> Bool -> m () infix 4 Source #
Modify the target(s) of a Lens', 'Iso, Setter or Traversal by taking their logical || with a value.
>>>execState (do _1 ||= True; _2 ||= False; _3 ||= True; _4 ||= False) (True,True,False,False)(True,True,True,False)
(||=) ::MonadStates m =>Setter'sBool->Bool-> m () (||=) ::MonadStates m =>Iso'sBool->Bool-> m () (||=) ::MonadStates m =>Lens'sBool->Bool-> m () (||=) ::MonadStates m =>Traversal'sBool->Bool-> m ()
(&&=) :: MonadState s m => ASetter' s Bool -> Bool -> m () infix 4 Source #
Modify the target(s) of a Lens', Iso, Setter or Traversal by taking their logical && with a value.
>>>execState (do _1 &&= True; _2 &&= False; _3 &&= True; _4 &&= False) (True,True,False,False)(True,False,False,False)
(&&=) ::MonadStates m =>Setter'sBool->Bool-> m () (&&=) ::MonadStates m =>Iso'sBool->Bool-> m () (&&=) ::MonadStates m =>Lens'sBool->Bool-> m () (&&=) ::MonadStates m =>Traversal'sBool->Bool-> m ()
(.=) :: MonadState s m => ASetter s s a b -> b -> m () infix 4 Source #
Replace the target of a Lens or all of the targets of a Setter
or Traversal in our monadic state with a new value, irrespective of the
old.
This is an infix version of assign.
>>>execState (do _1 .= c; _2 .= d) (a,b)(c,d)
>>>execState (both .= c) (a,b)(c,c)
(.=) ::MonadStates m =>Iso's a -> a -> m () (.=) ::MonadStates m =>Lens's a -> a -> m () (.=) ::MonadStates m =>Traversal's a -> a -> m () (.=) ::MonadStates m =>Setter's a -> a -> m ()
It puts the state in the monad or it gets the hose again.
(?=) :: MonadState s m => ASetter s s a (Maybe b) -> b -> m () infix 4 Source #
Replace the target of a Lens or all of the targets of a Setter or Traversal in our monadic
state with Just a new value, irrespective of the old.
>>>execState (do at 1 ?= a; at 2 ?= b) Map.emptyfromList [(1,a),(2,b)]
>>>execState (do _1 ?= b; _2 ?= c) (Just a, Nothing)(Just b,Just c)
(?=) ::MonadStates m =>Iso's (Maybea) -> a -> m () (?=) ::MonadStates m =>Lens's (Maybea) -> a -> m () (?=) ::MonadStates m =>Traversal's (Maybea) -> a -> m () (?=) ::MonadStates m =>Setter's (Maybea) -> a -> m ()
(<>=) :: (MonadState s m, Semigroup a) => ASetter' s a -> a -> m () infix 4 Source #
Modify the target(s) of a Lens', Iso, Setter or Traversal by using (.<>)
>>>execState (do _1 <>= Sum c; _2 <>= Product d) (Sum a,Product b)(Sum {getSum = a + c},Product {getProduct = b * d})
>>>execState (both <>= "!!!") ("hello","world")("hello!!!","world!!!")
(<>=) :: (MonadStates m,Semigroupa) =>Setter's a -> a -> m () (<>=) :: (MonadStates m,Semigroupa) =>Iso's a -> a -> m () (<>=) :: (MonadStates m,Semigroupa) =>Lens's a -> a -> m () (<>=) :: (MonadStates m,Semigroupa) =>Traversal's a -> a -> m ()
(%@~) :: AnIndexedSetter i s t a b -> (i -> a -> b) -> s -> t infixr 4 Source #
Adjust every target of an IndexedSetter, IndexedLens or IndexedTraversal
with access to the index.
(%@~) ≡iover
When you do not need access to the index then (%~) is more liberal in what it can accept.
l%~f ≡ l%@~constf
(%@~) ::IndexedSetteri s t a b -> (i -> a -> b) -> s -> t (%@~) ::IndexedLensi s t a b -> (i -> a -> b) -> s -> t (%@~) ::IndexedTraversali s t a b -> (i -> a -> b) -> s -> t
withIndex :: (Indexable i p, Functor f) => p (i, s) (f (j, t)) -> Indexed i s (f t) Source #
Fold a container with indices returning both the indices and the values.
The result is only valid to compose in a Traversal, if you don't edit the
index as edits to the index have no effect.
>>>[10, 20, 30] ^.. ifolded . withIndex[(0,10),(1,20),(2,30)]
>>>[10, 20, 30] ^.. ifolded . withIndex . alongside negated (re _Show)[(0,"10"),(-1,"20"),(-2,"30")]
(<.~) :: ASetter s t a b -> b -> s -> (b, t) infixr 4 Source #
Set with pass-through.
This is mostly present for consistency, but may be useful for chaining assignments.
If you do not need a copy of the intermediate result, then using l directly is a good idea..~ t
>>>(a,b) & _1 <.~ c(c,(c,b))
>>>("good","morning","vietnam") & _3 <.~ "world"("world",("good","morning","world"))
>>>(42,Map.fromList [("goodnight","gracie")]) & _2.at "hello" <.~ Just "world"(Just "world",(42,fromList [("goodnight","gracie"),("hello","world")]))
(<.~) ::Setters t a b -> b -> s -> (b, t) (<.~) ::Isos t a b -> b -> s -> (b, t) (<.~) ::Lenss t a b -> b -> s -> (b, t) (<.~) ::Traversals t a b -> b -> s -> (b, t)
(<.=) :: MonadState s m => ASetter s s a b -> b -> m b infix 4 Source #
Set with pass-through
This is useful for chaining assignment without round-tripping through your Monad stack.
do x <-_2<.=ninety_nine_bottles_of_beer_on_the_wall
If you do not need a copy of the intermediate result, then using l will avoid unused binding warnings..= d
(<.=) ::MonadStates m =>Setters s a b -> b -> m b (<.=) ::MonadStates m =>Isos s a b -> b -> m b (<.=) ::MonadStates m =>Lenss s a b -> b -> m b (<.=) ::MonadStates m =>Traversals s a b -> b -> m b
anyOf :: Getting Any s a -> (a -> Bool) -> s -> Bool Source #
Returns True if any target of a Fold satisfies a predicate.
>>>anyOf both (=='x') ('x','y')True>>>import Data.Data.Lens>>>anyOf biplate (== "world") (((),2::Int),"hello",("world",11::Int))True
any≡anyOffolded
ianyOfl ≡anyOfl.Indexed
anyOf::Getters a -> (a ->Bool) -> s ->BoolanyOf::Folds a -> (a ->Bool) -> s ->BoolanyOf::Lens's a -> (a ->Bool) -> s ->BoolanyOf::Iso's a -> (a ->Bool) -> s ->BoolanyOf::Traversal's a -> (a ->Bool) -> s ->BoolanyOf::Prism's a -> (a ->Bool) -> s ->Bool
ifoldMapOf :: IndexedGetting i m s a -> (i -> a -> m) -> s -> m Source #
Fold an IndexedFold or IndexedTraversal by mapping indices and values to an arbitrary Monoid with access
to the i.
When you don't need access to the index then foldMapOf is more flexible in what it accepts.
foldMapOfl ≡ifoldMapOfl.const
ifoldMapOf::IndexedGetteri s a -> (i -> a -> m) -> s -> mifoldMapOf::Monoidm =>IndexedFoldi s a -> (i -> a -> m) -> s -> mifoldMapOf::IndexedLens'i s a -> (i -> a -> m) -> s -> mifoldMapOf::Monoidm =>IndexedTraversal'i s a -> (i -> a -> m) -> s -> m
alongside :: LensLike (AlongsideLeft f b') s t a b -> LensLike (AlongsideRight f t) s' t' a' b' -> LensLike f (s, s') (t, t') (a, a') (b, b') Source #
alongside makes a Lens from two other lenses or a Getter from two other getters
by executing them on their respective halves of a product.
>>>(Left a, Right b)^.alongside chosen chosen(a,b)
>>>(Left a, Right b) & alongside chosen chosen .~ (c,d)(Left c,Right d)
alongside::Lenss t a b ->Lenss' t' a' b' ->Lens(s,s') (t,t') (a,a') (b,b')alongside::Getters a ->Getters' a' ->Getter(s,s') (a,a')
class AsEmpty a where Source #
Minimal complete definition
Nothing
Instances
| AsEmpty ByteString | |
Defined in Control.Lens.Empty Methods _Empty :: Prism' ByteString () Source # | |
| AsEmpty ByteString | |
Defined in Control.Lens.Empty Methods _Empty :: Prism' ByteString () Source # | |
| AsEmpty IntSet | |
| AsEmpty All | |
| AsEmpty Any | |
| AsEmpty Event | |
| AsEmpty Ordering | |
| AsEmpty Text | |
| AsEmpty Text | |
| AsEmpty () | |
Defined in Control.Lens.Empty | |
| AsEmpty (IntMap a) | |
| AsEmpty (Seq a) | |
| AsEmpty (Set a) | |
| AsEmpty (Clip n) Source # | |
| AsEmpty (First a) | |
| AsEmpty (Last a) | |
| AsEmpty a => AsEmpty (Dual a) | |
| (Eq a, Num a) => AsEmpty (Product a) | |
| (Eq a, Num a) => AsEmpty (Sum a) | |
| AsEmpty (ZipList a) | |
| AsEmpty (HashSet a) | |
Defined in Control.Lens.Empty | |
| AsEmpty (Vector a) | |
Defined in Control.Lens.Empty | |
| Prim a => AsEmpty (Vector a) | |
Defined in Control.Lens.Empty | |
| Storable a => AsEmpty (Vector a) | |
Defined in Control.Lens.Empty | |
| AsEmpty (Vector a) | |
Defined in Control.Lens.Empty | |
| Unbox a => AsEmpty (Vector a) | |
Defined in Control.Lens.Empty | |
| AsEmpty (Maybe a) | |
| AsEmpty [a] | |
Defined in Control.Lens.Empty | |
| AsEmpty (Map k a) | |
| AsEmpty (BoundingBox v n) Source # | |
Defined in Diagrams.BoundingBox Methods _Empty :: Prism' (BoundingBox v n) () Source # | |
| AsEmpty (Path v n) Source # | |
| (Metric v, OrderedField n) => AsEmpty (Trail v n) Source # | |
| AsEmpty (HashMap k a) | |
Defined in Control.Lens.Empty | |
| (AsEmpty a, AsEmpty b) => AsEmpty (a, b) | |
Defined in Control.Lens.Empty | |
| (Metric v, OrderedField n) => AsEmpty (Trail' Line v n) Source # | |
| (AsEmpty a, AsEmpty b, AsEmpty c) => AsEmpty (a, b, c) | |
Defined in Control.Lens.Empty | |
dropping :: (Conjoined p, Applicative f) => Int -> Over p (Indexing f) s t a a -> Over p f s t a a Source #
Visit all but the first n targets of a Traversal, Fold, Getter or Lens.
>>>("hello","world") ^? dropping 1 bothJust "world"
Dropping works on infinite traversals as well:
>>>[1..] ^? dropping 1 foldedJust 2
dropping::Int->Traversal's a ->Traversal's adropping::Int->Lens's a ->Traversal's adropping::Int->Iso's a ->Traversal's adropping::Int->Prism's a ->Traversal's adropping::Int->Getters a ->Folds adropping::Int->Folds a ->Folds adropping::Int->IndexedTraversal'i s a ->IndexedTraversal'i s adropping::Int->IndexedLens'i s a ->IndexedTraversal'i s adropping::Int->IndexedGetteri s a ->IndexedFoldi s adropping::Int->IndexedFoldi s a ->IndexedFoldi s a
class Field1 s t a b | s -> a, t -> b, s b -> t, t a -> s where Source #
Provides access to 1st field of a tuple.
Minimal complete definition
Nothing
Methods
Access the 1st field of a tuple (and possibly change its type).
>>>(1,2)^._11
>>>_1 .~ "hello" $ (1,2)("hello",2)
>>>(1,2) & _1 .~ "hello"("hello",2)
>>>_1 putStrLn ("hello","world")hello ((),"world")
This can also be used on larger tuples as well:
>>>(1,2,3,4,5) & _1 +~ 41(42,2,3,4,5)
_1::Lens(a,b) (a',b) a a'_1::Lens(a,b,c) (a',b,c) a a'_1::Lens(a,b,c,d) (a',b,c,d) a a' ..._1::Lens(a,b,c,d,e,f,g,h,i) (a',b,c,d,e,f,g,h,i) a a'
Instances
| Field1 (Identity a) (Identity b) a b | |
| Field1 (Plucker a) (Plucker a) a a | |
| Field1 (Quaternion a) (Quaternion a) a a | |
Defined in Linear.Quaternion Methods _1 :: Lens (Quaternion a) (Quaternion a) a a Source # | |
| Field1 (V1 a) (V1 b) a b | |
| Field1 (V2 a) (V2 a) a a | |
| Field1 (V3 a) (V3 a) a a | |
| Field1 (V4 a) (V4 a) a a | |
| Field1 (Pair a b) (Pair a' b) a a' | Since: lens-4.20 |
Defined in Control.Lens.Tuple | |
| Field1 (a, b) (a', b) a a' |
|
Defined in Control.Lens.Tuple | |
| 1 <= n => Field1 (V n a) (V n a) a a | |
| Field1 (a, b, c) (a', b, c) a a' | |
Defined in Control.Lens.Tuple | |
| Field1 (a, b, c, d) (a', b, c, d) a a' | |
Defined in Control.Lens.Tuple | |
| Field1 (Product f g a) (Product f' g a) (f a) (f' a) | |
| Field1 ((f :*: g) p) ((f' :*: g) p) (f p) (f' p) | |
| Field1 (a, b, c, d, e) (a', b, c, d, e) a a' | |
Defined in Control.Lens.Tuple | |
| Field1 (a, b, c, d, e, f) (a', b, c, d, e, f) a a' | |
Defined in Control.Lens.Tuple | |
| Field1 (a, b, c, d, e, f, g) (a', b, c, d, e, f, g) a a' | |
Defined in Control.Lens.Tuple | |
| Field1 (a, b, c, d, e, f, g, h) (a', b, c, d, e, f, g, h) a a' | |
Defined in Control.Lens.Tuple | |
| Field1 (a, b, c, d, e, f, g, h, i) (a', b, c, d, e, f, g, h, i) a a' | |
Defined in Control.Lens.Tuple | |
| Field1 (a, b, c, d, e, f, g, h, i, j) (a', b, c, d, e, f, g, h, i, j) a a' | |
Defined in Control.Lens.Tuple | |
| Field1 (a, b, c, d, e, f, g, h, i, j, kk) (a', b, c, d, e, f, g, h, i, j, kk) a a' | |
Defined in Control.Lens.Tuple | |
| Field1 (a, b, c, d, e, f, g, h, i, j, kk, l) (a', b, c, d, e, f, g, h, i, j, kk, l) a a' | |
Defined in Control.Lens.Tuple | |
| Field1 (a, b, c, d, e, f, g, h, i, j, kk, l, m) (a', b, c, d, e, f, g, h, i, j, kk, l, m) a a' | |
Defined in Control.Lens.Tuple | |
| Field1 (a, b, c, d, e, f, g, h, i, j, kk, l, m, n) (a', b, c, d, e, f, g, h, i, j, kk, l, m, n) a a' | |
Defined in Control.Lens.Tuple | |
| Field1 (a, b, c, d, e, f, g, h, i, j, kk, l, m, n, o) (a', b, c, d, e, f, g, h, i, j, kk, l, m, n, o) a a' | |
Defined in Control.Lens.Tuple | |
| Field1 (a, b, c, d, e, f, g, h, i, j, kk, l, m, n, o, p) (a', b, c, d, e, f, g, h, i, j, kk, l, m, n, o, p) a a' | |
Defined in Control.Lens.Tuple | |
| Field1 (a, b, c, d, e, f, g, h, i, j, kk, l, m, n, o, p, q) (a', b, c, d, e, f, g, h, i, j, kk, l, m, n, o, p, q) a a' | |
Defined in Control.Lens.Tuple | |
| Field1 (a, b, c, d, e, f, g, h, i, j, kk, l, m, n, o, p, q, r) (a', b, c, d, e, f, g, h, i, j, kk, l, m, n, o, p, q, r) a a' | |
Defined in Control.Lens.Tuple | |
| Field1 (a, b, c, d, e, f, g, h, i, j, kk, l, m, n, o, p, q, r, s) (a', b, c, d, e, f, g, h, i, j, kk, l, m, n, o, p, q, r, s) a a' | |
Defined in Control.Lens.Tuple | |
traverseOf :: LensLike f s t a b -> (a -> f b) -> s -> f t Source #
Map each element of a structure targeted by a Lens or Traversal,
evaluate these actions from left to right, and collect the results.
This function is only provided for consistency, id is strictly more general.
>>>traverseOf each print (1,2,3)1 2 3 ((),(),())
traverseOf≡iditraverseOfl ≡traverseOfl.IndexeditraverseOfitraversed≡itraverse
This yields the obvious law:
traverse≡traverseOftraverse
traverseOf::Functorf =>Isos t a b -> (a -> f b) -> s -> f ttraverseOf::Functorf =>Lenss t a b -> (a -> f b) -> s -> f ttraverseOf::Applyf =>Traversal1s t a b -> (a -> f b) -> s -> f ttraverseOf::Applicativef =>Traversals t a b -> (a -> f b) -> s -> f t
_Left :: forall a c b p f. (Choice p, Applicative f) => p a (f b) -> p (Either a c) (f (Either b c)) Source #
This Prism provides a Traversal for tweaking the Left half of an Either:
>>>over _Left (+1) (Left 2)Left 3
>>>over _Left (+1) (Right 2)Right 2
>>>Right 42 ^._Left :: String""
>>>Left "hello" ^._Left"hello"
It also can be turned around to obtain the embedding into the Left half of an Either:
>>>_Left # 5Left 5
>>>5^.re _LeftLeft 5
forOf :: LensLike f s t a b -> s -> (a -> f b) -> f t Source #
A version of traverseOf with the arguments flipped, such that:
>>>forOf each (1,2,3) print1 2 3 ((),(),())
This function is only provided for consistency, flip is strictly more general.
forOf≡flipforOf≡flip.traverseOf
for≡forOftraverseiforl s ≡forl s.Indexed
forOf::Functorf =>Isos t a b -> s -> (a -> f b) -> f tforOf::Functorf =>Lenss t a b -> s -> (a -> f b) -> f tforOf::Applicativef =>Traversals t a b -> s -> (a -> f b) -> f t
itraverseOf :: (Indexed i a (f b) -> s -> f t) -> (i -> a -> f b) -> s -> f t Source #
Traversal with an index.
NB: When you don't need access to the index then you can just apply your IndexedTraversal
directly as a function!
itraverseOf≡withIndextraverseOfl =itraverseOfl.const=id
itraverseOf::Functorf =>IndexedLensi s t a b -> (i -> a -> f b) -> s -> f titraverseOf::Applicativef =>IndexedTraversali s t a b -> (i -> a -> f b) -> s -> f titraverseOf::Applyf =>IndexedTraversal1i s t a b -> (i -> a -> f b) -> s -> f t
imapMOf :: Over (Indexed i) (WrappedMonad m) s t a b -> (i -> a -> m b) -> s -> m t Source #
Map each element of a structure targeted by a Lens to a monadic action,
evaluate these actions from left to right, and collect the results, with access
its position.
When you don't need access to the index mapMOf is more liberal in what it can accept.
mapMOfl ≡imapMOfl.const
imapMOf::Monadm =>IndexedLensi s t a b -> (i -> a -> m b) -> s -> m timapMOf::Monadm =>IndexedTraversali s t a b -> (i -> a -> m b) -> s -> m timapMOf::Bindm =>IndexedTraversal1i s t a b -> (i -> a -> m b) -> s -> m t
iforMOf :: (Indexed i a (WrappedMonad m b) -> s -> WrappedMonad m t) -> s -> (i -> a -> m b) -> m t Source #
Map each element of a structure targeted by a Lens to a monadic action,
evaluate these actions from left to right, and collect the results, with access
its position (and the arguments flipped).
forMOfl a ≡iforMOfl a.constiforMOf≡flip.imapMOf
iforMOf::Monadm =>IndexedLensi s t a b -> s -> (i -> a -> m b) -> m tiforMOf::Monadm =>IndexedTraversali s t a b -> s -> (i -> a -> m b) -> m t
ifor :: (TraversableWithIndex i t, Applicative f) => t a -> (i -> a -> f b) -> f (t b) #
contextsOf :: ATraversal' a a -> a -> [Context a a a] Source #
Return a list of all of the editable contexts for every location in the structure, recursively, using a user-specified Traversal to walk each layer.
propUniverse l x =universeOfl x==mappos(contextsOfl x) propId l x =all(==x) [extractw | w <-contextsOfl x]
contextsOf::Traversal'a a -> a -> [Contexta a a]
class Each s t a b | s -> a, t -> b, s b -> t, t a -> s where Source #
Extract each element of a (potentially monomorphic) container.
Notably, when applied to a tuple, this generalizes both to arbitrary homogeneous tuples.
>>>(1,2,3) & each *~ 10(10,20,30)
It can also be used on monomorphic containers like Text or ByteString.
>>>over each Char.toUpper ("hello"^.Text.packed)"HELLO"
>>>("hello","world") & each.each %~ Char.toUpper("HELLO","WORLD")
Minimal complete definition
Nothing
Methods
Instances
| (a ~ Word8, b ~ Word8) => Each ByteString ByteString a b |
|
Defined in Control.Lens.Each Methods each :: Traversal ByteString ByteString a b Source # | |
| (a ~ Word8, b ~ Word8) => Each ByteString ByteString a b |
|
Defined in Control.Lens.Each Methods each :: Traversal ByteString ByteString a b Source # | |
| Each Name Name AName AName | |
| (a ~ Char, b ~ Char) => Each Text Text a b |
|
| (a ~ Char, b ~ Char) => Each Text Text a b |
|
| Each (Complex a) (Complex b) a b |
|
| Each (IntMap a) (IntMap b) a b |
|
| Each (Seq a) (Seq b) a b |
|
| Each (Tree a) (Tree b) a b |
|
| Each (NonEmpty a) (NonEmpty b) a b |
|
| Each (Identity a) (Identity b) a b |
|
| Each (Plucker a) (Plucker b) a b | |
| Each (Quaternion a) (Quaternion b) a b | |
Defined in Linear.Quaternion Methods each :: Traversal (Quaternion a) (Quaternion b) a b Source # | |
| Each (V0 a) (V0 b) a b | |
| Each (V1 a) (V1 b) a b | |
| Each (V2 a) (V2 b) a b | |
| Each (V3 a) (V3 b) a b | |
| Each (V4 a) (V4 b) a b | |
| Each (Maybe a) (Maybe b) a b | Since: lens-4.20 |
Defined in Control.Lens.Each | |
| Each (Vector a) (Vector b) a b |
|
Defined in Control.Lens.Each | |
| (Prim a, Prim b) => Each (Vector a) (Vector b) a b |
|
Defined in Control.Lens.Each | |
| (Storable a, Storable b) => Each (Vector a) (Vector b) a b |
|
Defined in Control.Lens.Each | |
| Each (Vector a) (Vector b) a b |
|
Defined in Control.Lens.Each | |
| (Unbox a, Unbox b) => Each (Vector a) (Vector b) a b |
|
Defined in Control.Lens.Each | |
| Each (Maybe a) (Maybe b) a b |
|
| Each [a] [b] a b |
|
Defined in Control.Lens.Each | |
| (Ix i, IArray UArray a, IArray UArray b, i ~ j) => Each (UArray i a) (UArray j b) a b |
|
| c ~ d => Each (Map c a) (Map d b) a b |
|
| (Ix i, i ~ j) => Each (Array i a) (Array j b) a b |
|
| (a ~ a', b ~ b') => Each (Either a a') (Either b b') a b |
Since: lens-4.18 |
| Traversable f => Each (Point f a) (Point f b) a b | |
| (a ~ a', b ~ b') => Each (Either a a') (Either b b') a b | Since: lens-4.20 |
Defined in Control.Lens.Each | |
| (a ~ a', b ~ b') => Each (These a a') (These b b') a b | Since: lens-4.20 |
Defined in Control.Lens.Each | |
| (a ~ a', b ~ b') => Each (Pair a a') (Pair b b') a b | Since: lens-4.20 |
Defined in Control.Lens.Each | |
| (a ~ a', b ~ b') => Each (These a a') (These b b') a b | Since: lens-4.20 |
Defined in Control.Lens.Each | |
| c ~ d => Each (HashMap c a) (HashMap d b) a b |
|
Defined in Control.Lens.Each | |
| (a ~ a', b ~ b') => Each (a, a') (b, b') a b |
|
Defined in Control.Lens.Each | |
| Each (Path v n) (Path v' n') (Located (Trail v n)) (Located (Trail v' n')) Source # | |
| Each (Style v n) (Style v' n') (Attribute v n) (Attribute v' n') | |
| (Additive v', Foldable v', Ord n') => Each (BoundingBox v n) (BoundingBox v' n') (Point v n) (Point v' n') Source # | Only valid if the second point is not smaller than the first. |
Defined in Diagrams.BoundingBox Methods each :: Traversal (BoundingBox v n) (BoundingBox v' n') (Point v n) (Point v' n') Source # | |
| Each (FixedSegment v n) (FixedSegment v' n') (Point v n) (Point v' n') Source # | |
Defined in Diagrams.Segment Methods each :: Traversal (FixedSegment v n) (FixedSegment v' n') (Point v n) (Point v' n') Source # | |
| Each (V n a) (V n b) a b | |
| (a ~ a2, a ~ a3, b ~ b2, b ~ b3) => Each (a, a2, a3) (b, b2, b3) a b |
|
Defined in Control.Lens.Each | |
| Each (Offset c v n) (Offset c v' n') (v n) (v' n') Source # | |
| Each (Segment c v n) (Segment c v' n') (v n) (v' n') Source # | |
| (a ~ a2, a ~ a3, a ~ a4, b ~ b2, b ~ b3, b ~ b4) => Each (a, a2, a3, a4) (b, b2, b3, b4) a b |
|
Defined in Control.Lens.Each | |
| (a ~ a2, a ~ a3, a ~ a4, a ~ a5, b ~ b2, b ~ b3, b ~ b4, b ~ b5) => Each (a, a2, a3, a4, a5) (b, b2, b3, b4, b5) a b |
|
Defined in Control.Lens.Each | |
| (a ~ a2, a ~ a3, a ~ a4, a ~ a5, a ~ a6, b ~ b2, b ~ b3, b ~ b4, b ~ b5, b ~ b6) => Each (a, a2, a3, a4, a5, a6) (b, b2, b3, b4, b5, b6) a b |
|
Defined in Control.Lens.Each | |
| (a ~ a2, a ~ a3, a ~ a4, a ~ a5, a ~ a6, a ~ a7, b ~ b2, b ~ b3, b ~ b4, b ~ b5, b ~ b6, b ~ b7) => Each (a, a2, a3, a4, a5, a6, a7) (b, b2, b3, b4, b5, b6, b7) a b |
|
Defined in Control.Lens.Each | |
| (a ~ a2, a ~ a3, a ~ a4, a ~ a5, a ~ a6, a ~ a7, a ~ a8, b ~ b2, b ~ b3, b ~ b4, b ~ b5, b ~ b6, b ~ b7, b ~ b8) => Each (a, a2, a3, a4, a5, a6, a7, a8) (b, b2, b3, b4, b5, b6, b7, b8) a b |
|
Defined in Control.Lens.Each | |
| (a ~ a2, a ~ a3, a ~ a4, a ~ a5, a ~ a6, a ~ a7, a ~ a8, a ~ a9, b ~ b2, b ~ b3, b ~ b4, b ~ b5, b ~ b6, b ~ b7, b ~ b8, b ~ b9) => Each (a, a2, a3, a4, a5, a6, a7, a8, a9) (b, b2, b3, b4, b5, b6, b7, b8, b9) a b |
|
Defined in Control.Lens.Each | |
mapMOf :: LensLike (WrappedMonad m) s t a b -> (a -> m b) -> s -> m t Source #
Map each element of a structure targeted by a Lens to a monadic action,
evaluate these actions from left to right, and collect the results.
>>>mapMOf both (\x -> [x, x + 1]) (1,3)[(1,3),(1,4),(2,3),(2,4)]
mapM≡mapMOftraverseimapMOfl ≡forMl.Indexed
mapMOf::Monadm =>Isos t a b -> (a -> m b) -> s -> m tmapMOf::Monadm =>Lenss t a b -> (a -> m b) -> s -> m tmapMOf::Monadm =>Traversals t a b -> (a -> m b) -> s -> m t
forMOf :: LensLike (WrappedMonad m) s t a b -> s -> (a -> m b) -> m t Source #
forMOf is a flipped version of mapMOf, consistent with the definition of forM.
>>>forMOf both (1,3) $ \x -> [x, x + 1][(1,3),(1,4),(2,3),(2,4)]
forM≡forMOftraverseforMOfl ≡flip(mapMOfl)iforMOfl s ≡forMl s.Indexed
forMOf::Monadm =>Isos t a b -> s -> (a -> m b) -> m tforMOf::Monadm =>Lenss t a b -> s -> (a -> m b) -> m tforMOf::Monadm =>Traversals t a b -> s -> (a -> m b) -> m t
mapAccumROf :: LensLike (Backwards (State acc)) s t a b -> (acc -> a -> (acc, b)) -> acc -> s -> (acc, t) Source #
This generalizes mapAccumR to an arbitrary Traversal.
mapAccumR≡mapAccumROftraverse
mapAccumROf accumulates State from right to left.
mapAccumROf::Isos t a b -> (acc -> a -> (acc, b)) -> acc -> s -> (acc, t)mapAccumROf::Lenss t a b -> (acc -> a -> (acc, b)) -> acc -> s -> (acc, t)mapAccumROf::Traversals t a b -> (acc -> a -> (acc, b)) -> acc -> s -> (acc, t)
mapAccumROf::LensLike(Backwards(Stateacc)) s t a b -> (acc -> a -> (acc, b)) -> acc -> s -> (acc, t)
mapAccumLOf :: LensLike (State acc) s t a b -> (acc -> a -> (acc, b)) -> acc -> s -> (acc, t) Source #
This generalizes mapAccumL to an arbitrary Traversal.
mapAccumL≡mapAccumLOftraverse
mapAccumLOf accumulates State from left to right.
mapAccumLOf::Isos t a b -> (acc -> a -> (acc, b)) -> acc -> s -> (acc, t)mapAccumLOf::Lenss t a b -> (acc -> a -> (acc, b)) -> acc -> s -> (acc, t)mapAccumLOf::Traversals t a b -> (acc -> a -> (acc, b)) -> acc -> s -> (acc, t)
mapAccumLOf::LensLike(Stateacc) s t a b -> (acc -> a -> (acc, b)) -> acc -> s -> (acc, t)mapAccumLOfl f acc0 s =swap(runState(l (a ->state(acc ->swap(f acc a))) s) acc0)
fusing :: Functor f => LensLike (Yoneda f) s t a b -> LensLike f s t a b Source #
Fuse a composition of lenses using Yoneda to provide fmap fusion.
In general, given a pair of lenses foo and bar
fusing (foo.bar) = foo.bar
however, foo and bar are either going to fmap internally or they are trivial.
fusing exploits the Yoneda lemma to merge these separate uses into a single fmap.
This is particularly effective when the choice of functor f is unknown at compile
time or when the Lens foo.bar in the above description is recursive or complex
enough to prevent inlining.
fusing::Lenss t a b ->Lenss t a b
ala :: (Functor f, Rewrapping s t) => (Unwrapped s -> s) -> ((Unwrapped t -> t) -> f s) -> f (Unwrapped s) Source #
This combinator is based on ala from Conor McBride's work on Epigram.
As with _Wrapping, the user supplied function for the newtype is ignored.
>>>ala Sum foldMap [1,2,3,4]10
>>>ala All foldMap [True,True]True
>>>ala All foldMap [True,False]False
>>>ala Any foldMap [False,False]False
>>>ala Any foldMap [True,False]True
>>>ala Product foldMap [1,2,3,4]24
You may want to think of this combinator as having the following, simpler, type.
ala :: Rewrapping s t => (Unwrapped s -> s) -> ((Unwrapped t -> t) -> e -> s) -> e -> Unwrapped s
alaf :: (Functor f, Functor g, Rewrapping s t) => (Unwrapped s -> s) -> (f t -> g s) -> f (Unwrapped t) -> g (Unwrapped s) Source #
This combinator is based on ala' from Conor McBride's work on Epigram.
As with _Wrapping, the user supplied function for the newtype is ignored.
alaf :: Rewrapping s t => (Unwrapped s -> s) -> ((r -> t) -> e -> s) -> (r -> Unwrapped t) -> e -> Unwrapped s
>>>alaf Sum foldMap Prelude.length ["hello","world"]10
class (Magnified m ~ Magnified n, MonadReader b m, MonadReader a n) => Magnify (m :: Type -> Type) (n :: Type -> Type) b a | m -> b, n -> a, m a -> n, n b -> m where Source #
This class allows us to use 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.
Also, unlike zoom, this can be used with any valid Getter, but cannot be used with a Traversal or Fold.
Methods
magnify :: ((Functor (Magnified m c), Contravariant (Magnified m c)) => LensLike' (Magnified m c) a b) -> m c -> n c infixr 2 Source #
Run a monadic action in a larger environment than it was defined in, using a Getter.
This acts like local, but can in many cases change the type of the environment as well.
This is commonly used to lift actions in a simpler Reader Monad into a Monad with a larger environment type.
This can be used to edit pretty much any Monad transformer stack with an environment in it:
>>>(1,2) & magnify _2 (+1)3
>>>flip Reader.runReader (1,2) $ magnify _1 Reader.ask1
>>>flip Reader.runReader (1,2,[10..20]) $ magnify (_3._tail) Reader.ask[11,12,13,14,15,16,17,18,19,20]
The type can be read as
magnify :: LensLike' (Magnified m c) a b -> m c -> n c
but the higher-rank constraints make it easier to apply magnify to a
Getter in highly-polymorphic code.
magnify::Getters a -> (a -> r) -> s -> rmagnify::Monoidr =>Folds a -> (a -> r) -> s -> r
magnify::Monoidw =>Getters t ->RWSt w st c ->RWSs w st cmagnify:: (Monoidw,Monoidc) =>Folds a ->RWSa w st c ->RWSs w st c ...
Instances
| Magnify m n b a => Magnify (IdentityT m) (IdentityT n) b a | |
| Monad m => Magnify (ReaderT b m) (ReaderT a m) b a | |
| Magnify ((->) b) ((->) a) b a |
|
Defined in Control.Lens.Zoom | |
| (Monad m, Monoid w, MonadReader b (RWST b w s m)) => Magnify (RWST b w s m) (RWST a w s m) b a | |
| (Monad m, Monoid w) => Magnify (RWST b w s m) (RWST a w s m) b a | |
| (Monad m, Monoid w) => Magnify (RWST b w s m) (RWST a w s m) b a | |
A Plated type is one where we know how to extract its immediate self-similar children.
Example 1:
import Control.Applicative
import Control.Lens
import Control.Lens.Plated
import Data.Data
import Data.Data.Lens (uniplate)
data Expr = ValInt| Neg Expr | Add Expr Expr deriving (Eq,Ord,Show,Read,Data)
instancePlatedExpr whereplatef (Neg e) = Neg<$>f eplatef (Add a b) = Add<$>f a<*>f bplate_ a =purea
or
instancePlatedExpr whereplate=uniplate
Example 2:
import Control.Applicative
import Control.Lens
import Control.Lens.Plated
import Data.Data
import Data.Data.Lens (uniplate)
data Tree a = Bin (Tree a) (Tree a) | Tip a deriving (Eq,Ord,Show,Read,Data)
instancePlated(Tree a) whereplatef (Bin l r) = Bin<$>f l<*>f rplate_ t =puret
or
instanceDataa =>Plated(Tree a) whereplate=uniplate
Note the big distinction between these two implementations.
The former will only treat children directly in this tree as descendents, the latter will treat trees contained in the values under the tips also as descendants!
When in doubt, pick a Traversal and just use the various ...Of combinators
rather than pollute Plated with orphan instances!
If you want to find something unplated and non-recursive with biplate
use the ...OnOf variant with ignored, though those usecases are much better served
in most cases by using the existing Lens combinators! e.g.
toListOfbiplate≡universeOnOfbiplateignored
This same ability to explicitly pass the Traversal in question is why there is no
analogue to uniplate's Biplate.
Moreover, since we can allow custom traversals, we implement reasonable defaults for
polymorphic data types, that only traverse into themselves, and not their
polymorphic arguments.
Minimal complete definition
Nothing
Methods
plate :: Traversal' a a Source #
Traversal of the immediate children of this structure.
If you're using GHC 7.2 or newer and your type has a Data instance,
plate will default to uniplate and you can choose to not override
it with your own definition.
default plate :: Data a => Traversal' a a Source #
Instances
| Plated Con | |
Defined in Control.Lens.Plated | |
| Plated Dec | |
Defined in Control.Lens.Plated | |
| Plated Exp | |
Defined in Control.Lens.Plated | |
| Plated Pat | |
Defined in Control.Lens.Plated | |
| Plated Stmt | |
Defined in Control.Lens.Plated | |
| Plated Type | |
Defined in Control.Lens.Plated | |
| Plated (Tree a) | |
Defined in Control.Lens.Plated | |
| Plated [a] | |
Defined in Control.Lens.Plated Methods plate :: Traversal' [a] [a] Source # | |
| Traversable f => Plated (Cofree f a) | |
Defined in Control.Lens.Plated Methods plate :: Traversal' (Cofree f a) (Cofree f a) Source # | |
| Traversable f => Plated (Free f a) | |
Defined in Control.Lens.Plated Methods plate :: Traversal' (Free f a) (Free f a) Source # | |
| Traversable f => Plated (F f a) | |
Defined in Control.Lens.Plated Methods plate :: Traversal' (F f a) (F f a) Source # | |
| (Traversable f, Traversable w) => Plated (CofreeT f w a) | |
Defined in Control.Lens.Plated Methods plate :: Traversal' (CofreeT f w a) (CofreeT f w a) Source # | |
| (Traversable f, Traversable m) => Plated (FreeT f m a) | |
Defined in Control.Lens.Plated Methods plate :: Traversal' (FreeT f m a) (FreeT f m a) Source # | |
newtype Indexed i a b Source #
A function with access to a index. This constructor may be useful when you need to store
an Indexable in a container to avoid ImpredicativeTypes.
index :: Indexed i a b -> i -> a -> b
Constructors
| Indexed | |
Fields
| |
Instances
| Category (Indexed i :: Type -> Type -> Type) | |||||
| i ~ j => Indexable i (Indexed j) | |||||
Defined in Control.Lens.Internal.Indexed | |||||
| Arrow (Indexed i) | |||||
Defined in Control.Lens.Internal.Indexed Methods arr :: (b -> c) -> Indexed i b c Source # first :: Indexed i b c -> Indexed i (b, d) (c, d) Source # second :: Indexed i b c -> Indexed i (d, b) (d, c) Source # (***) :: Indexed i b c -> Indexed i b' c' -> Indexed i (b, b') (c, c') Source # (&&&) :: Indexed i b c -> Indexed i b c' -> Indexed i b (c, c') Source # | |||||
| ArrowApply (Indexed i) | |||||
| ArrowChoice (Indexed i) | |||||
Defined in Control.Lens.Internal.Indexed Methods left :: Indexed i b c -> Indexed i (Either b d) (Either c d) Source # right :: Indexed i b c -> Indexed i (Either d b) (Either d c) Source # (+++) :: Indexed i b c -> Indexed i b' c' -> Indexed i (Either b b') (Either c c') Source # (|||) :: Indexed i b d -> Indexed i c d -> Indexed i (Either b c) d Source # | |||||
| ArrowLoop (Indexed i) | |||||
| Conjoined (Indexed i) | |||||
| Choice (Indexed i) | |||||
| Closed (Indexed i) | |||||
Defined in Control.Lens.Internal.Indexed | |||||
| Corepresentable (Indexed i) | |||||
Defined in Control.Lens.Internal.Indexed Associated Types
Methods cotabulate :: (Corep (Indexed i) d -> c) -> Indexed i d c | |||||
| Representable (Indexed i) | |||||
Defined in Control.Lens.Internal.Indexed Associated Types
| |||||
| Costrong (Indexed i) | |||||
| Strong (Indexed i) | |||||
| Profunctor (Indexed i) | |||||
Defined in Control.Lens.Internal.Indexed Methods dimap :: (a -> b) -> (c -> d) -> Indexed i b c -> Indexed i a d # lmap :: (a -> b) -> Indexed i b c -> Indexed i a c # rmap :: (b -> c) -> Indexed i a b -> Indexed i a c # (#.) :: forall a b c q. Coercible c b => q b c -> Indexed i a b -> Indexed i a c (.#) :: forall a b c q. Coercible b a => Indexed i b c -> q a b -> Indexed i a c | |||||
| Bizarre (Indexed Int) Mafic | |||||
Defined in Control.Lens.Internal.Magma | |||||
| Bizarre (Indexed i) (Molten i) | |||||
Defined in Control.Lens.Internal.Magma | |||||
| Sellable (Indexed i) (Molten i) | |||||
| Cosieve (Indexed i) ((,) i) | |||||
Defined in Control.Lens.Internal.Indexed | |||||
| Sieve (Indexed i) ((->) i) | |||||
Defined in Control.Lens.Internal.Indexed | |||||
| Applicative (Indexed i a) | |||||
Defined in Control.Lens.Internal.Indexed Methods pure :: a0 -> Indexed i a a0 Source # (<*>) :: Indexed i a (a0 -> b) -> Indexed i a a0 -> Indexed i a b Source # liftA2 :: (a0 -> b -> c) -> Indexed i a a0 -> Indexed i a b -> Indexed i a c Source # (*>) :: Indexed i a a0 -> Indexed i a b -> Indexed i a b Source # (<*) :: Indexed i a a0 -> Indexed i a b -> Indexed i a a0 Source # | |||||
| Functor (Indexed i a) | |||||
| Monad (Indexed i a) | |||||
| MonadFix (Indexed i a) | |||||
| Apply (Indexed i a) | |||||
Defined in Control.Lens.Internal.Indexed | |||||
| Bind (Indexed i a) | |||||
| type Corep (Indexed i) | |||||
Defined in Control.Lens.Internal.Indexed | |||||
| type Rep (Indexed i) | |||||
Defined in Control.Lens.Internal.Indexed type Rep (Indexed i) = (->) i | |||||
both :: forall (r :: Type -> Type -> Type) a b. Bitraversable r => Traversal (r a a) (r b b) a b Source #
Traverse both parts of a Bitraversable container with matching types.
Usually that type will be a pair. Use each to traverse
the elements of arbitrary homogeneous tuples.
>>>(1,2) & both *~ 10(10,20)
>>>over both length ("hello","world")(5,5)
>>>("hello","world")^.both"helloworld"
both::Traversal(a, a) (b, b) a bboth::Traversal(Eithera a) (Eitherb b) a b
class Wrapped s where Source #
Wrapped provides isomorphisms to wrap and unwrap newtypes or
data types with one constructor.
Minimal complete definition
Nothing
Methods
_Wrapped' :: Iso' s (Unwrapped s) Source #
An isomorphism between s and a.
If your type has a Generic instance, _Wrapped' will default to _GWrapped',
and you can choose to not override it with your own definition.
Instances
| Wrapped IntSet | |||||
| Wrapped Name | |||||
| Wrapped SegCount Source # | |||||
| Wrapped NoMethodError | |||||
Defined in Control.Lens.Wrapped Associated Types
Methods _Wrapped' :: Iso' NoMethodError (Unwrapped NoMethodError) Source # | |||||
| Wrapped PatternMatchFail | |||||
Defined in Control.Lens.Wrapped Associated Types
Methods _Wrapped' :: Iso' PatternMatchFail (Unwrapped PatternMatchFail) Source # | |||||
| Wrapped RecConError | |||||
Defined in Control.Lens.Wrapped Associated Types
Methods _Wrapped' :: Iso' RecConError (Unwrapped RecConError) Source # | |||||
| Wrapped RecSelError | |||||
Defined in Control.Lens.Wrapped Associated Types
Methods _Wrapped' :: Iso' RecSelError (Unwrapped RecSelError) Source # | |||||
| Wrapped RecUpdError | |||||
Defined in Control.Lens.Wrapped Associated Types
Methods _Wrapped' :: Iso' RecUpdError (Unwrapped RecUpdError) Source # | |||||
| Wrapped TypeError | |||||
| Wrapped All | |||||
| Wrapped Any | |||||
| Wrapped ErrorCall | |||||
| Wrapped Errno | |||||
| Wrapped CBool | |||||
| Wrapped CChar | |||||
| Wrapped CClock | |||||
| Wrapped CDouble | |||||
| Wrapped CFloat | |||||
| Wrapped CInt | |||||
| Wrapped CIntMax | |||||
| Wrapped CIntPtr | |||||
| Wrapped CLLong | |||||
| Wrapped CLong | |||||
| Wrapped CPtrdiff | |||||
| Wrapped CSChar | |||||
| Wrapped CSUSeconds | |||||
Defined in Control.Lens.Wrapped Associated Types
Methods _Wrapped' :: Iso' CSUSeconds (Unwrapped CSUSeconds) Source # | |||||
| Wrapped CShort | |||||
| Wrapped CSigAtomic | |||||
Defined in Control.Lens.Wrapped Associated Types
Methods _Wrapped' :: Iso' CSigAtomic (Unwrapped CSigAtomic) Source # | |||||
| Wrapped CSize | |||||
| Wrapped CTime | |||||
| Wrapped CUChar | |||||
| Wrapped CUInt | |||||
| Wrapped CUIntMax | |||||
| Wrapped CUIntPtr | |||||
| Wrapped CULLong | |||||
| Wrapped CULong | |||||
| Wrapped CUSeconds | |||||
| Wrapped CUShort | |||||
| Wrapped CWchar | |||||
| Wrapped AssertionFailed | |||||
Defined in Control.Lens.Wrapped Associated Types
Methods _Wrapped' :: Iso' AssertionFailed (Unwrapped AssertionFailed) Source # | |||||
| Wrapped CompactionFailed | |||||
Defined in Control.Lens.Wrapped Associated Types
Methods _Wrapped' :: Iso' CompactionFailed (Unwrapped CompactionFailed) Source # | |||||
| Wrapped CBlkCnt | |||||
| Wrapped CBlkSize | |||||
| Wrapped CCc | |||||
| Wrapped CClockId | |||||
| Wrapped CDev | |||||
| Wrapped CFsBlkCnt | |||||
| Wrapped CFsFilCnt | |||||
| Wrapped CGid | |||||
| Wrapped CId | |||||
| Wrapped CIno | |||||
| Wrapped CKey | |||||
| Wrapped CMode | |||||
| Wrapped CNlink | |||||
| Wrapped COff | |||||
| Wrapped CPid | |||||
| Wrapped CRLim | |||||
| Wrapped CSpeed | |||||
| Wrapped CSsize | |||||
| Wrapped CTcflag | |||||
| Wrapped CTimer | |||||
| Wrapped CUid | |||||
| Wrapped Fd | |||||
| Wrapped (Active a) | |||||
| Wrapped (Duration a) | |||||
| Wrapped (Time a) | |||||
| Wrapped (Comparison a) | |||||
Defined in Control.Lens.Wrapped Associated Types
Methods _Wrapped' :: Iso' (Comparison a) (Unwrapped (Comparison a)) Source # | |||||
| Wrapped (Equivalence a) | |||||
Defined in Control.Lens.Wrapped Associated Types
Methods _Wrapped' :: Iso' (Equivalence a) (Unwrapped (Equivalence a)) Source # | |||||
| Wrapped (Predicate a) | |||||
| Wrapped (First a) | |||||
| Wrapped (Last a) | |||||
| Wrapped (Max a) | |||||
| Wrapped (Min a) | |||||
| Wrapped (WrappedMonoid a) | |||||
Defined in Control.Lens.Wrapped Associated Types
Methods _Wrapped' :: Iso' (WrappedMonoid a) (Unwrapped (WrappedMonoid a)) Source # | |||||
| Wrapped (IntMap a) | |||||
| Wrapped (Seq a) | |||||
| Ord a => Wrapped (Set a) | |||||
| Wrapped (TransInv t) | |||||
| Wrapped (ArcLength n) Source # | |||||
| Wrapped (Clip n) Source # | |||||
| Wrapped (NonEmpty a) | |||||
| Wrapped (Identity a) | |||||
| Wrapped (First a) | |||||
| Wrapped (Last a) | |||||
| Wrapped (Down a) | |||||
| Wrapped (Dual a) | |||||
| Wrapped (Endo a) | |||||
| Wrapped (Product a) | |||||
| Wrapped (Sum a) | |||||
| Wrapped (ZipList a) | |||||
| Wrapped (Par1 p) | |||||
| (Hashable a, Eq a) => Wrapped (HashSet a) | |||||
Defined in Control.Lens.Wrapped Associated Types
| |||||
| Wrapped (Vector a) | |||||
Defined in Control.Lens.Wrapped Associated Types
| |||||
| Prim a => Wrapped (Vector a) | |||||
Defined in Control.Lens.Wrapped Associated Types
| |||||
| Storable a => Wrapped (Vector a) | |||||
Defined in Control.Lens.Wrapped Associated Types
| |||||
| Wrapped (Vector a) | |||||
Defined in Control.Lens.Wrapped Associated Types
| |||||
| Unbox a => Wrapped (Vector a) | |||||
Defined in Control.Lens.Wrapped Associated Types
| |||||
| Wrapped (WrappedMonad m a) | |||||
Defined in Control.Lens.Wrapped Associated Types
Methods _Wrapped' :: Iso' (WrappedMonad m a) (Unwrapped (WrappedMonad m a)) Source # | |||||
| Wrapped (Op a b) | |||||
| Ord k => Wrapped (Map k a) | |||||
| Wrapped (Envelope v n) | |||||
| Wrapped (Style v n) | |||||
| Wrapped (Trace v n) | |||||
Defined in Diagrams.Core.Trace Associated Types
| |||||
| Wrapped (Path v n) Source # | |||||
| Wrapped (TotalOffset v n) Source # | |||||
Defined in Diagrams.Segment Associated Types
Methods _Wrapped' :: Iso' (TotalOffset v n) (Unwrapped (TotalOffset v n)) Source # | |||||
| Wrapped (SegTree v n) Source # | |||||
| Wrapped (Trail v n) Source # | |||||
| Wrapped (CatchT m a) | |||||
Defined in Control.Lens.Wrapped Associated Types
| |||||
| Wrapped (Alt f a) | |||||
Defined in Control.Lens.Wrapped Associated Types
| |||||
| Wrapped (CoiterT w a) | |||||
Defined in Control.Lens.Wrapped Associated Types
| |||||
| Wrapped (IterT m a) | |||||
Defined in Control.Lens.Wrapped Associated Types
| |||||
| Wrapped (ArrowMonad m a) | |||||
Defined in Control.Lens.Wrapped Associated Types
Methods _Wrapped' :: Iso' (ArrowMonad m a) (Unwrapped (ArrowMonad m a)) Source # | |||||
| Wrapped (Point f a) | |||||
| Wrapped (MaybeApply f a) | |||||
Defined in Control.Lens.Wrapped Associated Types
| |||||
| Wrapped (WrappedApplicative f a) | |||||
Defined in Control.Lens.Wrapped Associated Types
| |||||
| Wrapped (MaybeT m a) | |||||
| (Hashable k, Eq k) => Wrapped (HashMap k a) | |||||
Defined in Control.Lens.Wrapped Associated Types
| |||||
| Wrapped (WrappedArrow a b c) | |||||
Defined in Control.Lens.Wrapped Associated Types
Methods _Wrapped' :: Iso' (WrappedArrow a b c) (Unwrapped (WrappedArrow a b c)) Source # | |||||
| Wrapped (Fix p a) | |||||
Defined in Control.Lens.Wrapped Associated Types
| |||||
| Wrapped (Join p a) | |||||
Defined in Control.Lens.Wrapped Associated Types
| |||||
| Wrapped (TracedT m w a) | |||||
Defined in Control.Lens.Wrapped Associated Types
| |||||
| Wrapped (Compose f g a) | |||||
Defined in Control.Lens.Wrapped Associated Types
| |||||
| Wrapped (ComposeCF f g a) | |||||
Defined in Control.Lens.Wrapped Associated Types
| |||||
| Wrapped (ComposeFC f g a) | |||||
Defined in Control.Lens.Wrapped Associated Types
| |||||
| Wrapped (Query v n m) | |||||
| Wrapped (Trail' Line v n) Source # | |||||
| Wrapped (ApT f g a) | |||||
Defined in Control.Lens.Wrapped Associated Types
| |||||
| Wrapped (CofreeT f w a) | |||||
Defined in Control.Lens.Wrapped Associated Types
| |||||
| Wrapped (FreeT f m a) | |||||
Defined in Control.Lens.Wrapped Associated Types
| |||||
| Wrapped (Kleisli m a b) | |||||
| Wrapped (Const a x) | |||||
| Wrapped (Ap f a) | |||||
| Wrapped (Alt f a) | |||||
| Wrapped (Rec1 f p) | |||||
| Wrapped (Static f a b) | |||||
Defined in Control.Lens.Wrapped Associated Types
| |||||
| Wrapped (Tagged s a) | |||||
Defined in Control.Lens.Wrapped Associated Types
| |||||
| Wrapped (Backwards f a) | |||||
| Wrapped (ExceptT e m a) | |||||
| Wrapped (IdentityT m a) | |||||
| Wrapped (ReaderT r m a) | |||||
| Wrapped (StateT s m a) | |||||
| Wrapped (StateT s m a) | |||||
| Wrapped (WriterT w m a) | |||||
| Wrapped (WriterT w m a) | |||||
| Wrapped (Constant a b) | |||||
| Wrapped (Reverse f a) | |||||
| Wrapped (QDiagram b v n m) | |||||
Defined in Diagrams.Core.Types Associated Types
| |||||
| Wrapped (SubMap b v n m) | |||||
| Wrapped (K1 i c p) | |||||
| Wrapped (Costar f d c) | |||||
Defined in Control.Lens.Wrapped Associated Types
| |||||
| Wrapped (Forget r a b) | |||||
Defined in Control.Lens.Wrapped Associated Types
| |||||
| Wrapped (Star f d c) | |||||
Defined in Control.Lens.Wrapped Associated Types
| |||||
| Wrapped (ContT r m a) | |||||
| Wrapped (Compose f g a) | |||||
| Wrapped (Clown f a b) | |||||
Defined in Control.Lens.Wrapped Associated Types
| |||||
| Wrapped (Flip p a b) | |||||
Defined in Control.Lens.Wrapped Associated Types
| |||||
| Wrapped (Joker g a b) | |||||
Defined in Control.Lens.Wrapped Associated Types
| |||||
| Wrapped (WrappedBifunctor p a b) | |||||
Defined in Control.Lens.Wrapped Associated Types
| |||||
| Wrapped ((f :.: g) p) | |||||
| Wrapped (M1 i c f p) | |||||
| Wrapped (WrappedArrow p a b) | |||||
Defined in Control.Lens.Wrapped Associated Types
| |||||
| Wrapped (Semi m a b) | |||||
Defined in Control.Lens.Wrapped Associated Types
| |||||
| Wrapped (WrappedCategory k3 a b) | |||||
Defined in Control.Lens.Wrapped Associated Types
| |||||
| Wrapped (Dual k3 a b) | |||||
Defined in Control.Lens.Wrapped Associated Types
| |||||
| Wrapped (RWST r w s m a) | |||||
| Wrapped (RWST r w s m a) | |||||
| Wrapped (Tannen f p a b) | |||||
Defined in Control.Lens.Wrapped Associated Types
| |||||
| Wrapped (Cayley f p a b) | |||||
Defined in Control.Lens.Wrapped Associated Types
| |||||
| Wrapped (Biff p f g a b) | |||||
Defined in Control.Lens.Wrapped Associated Types
| |||||
without :: APrism s t a b -> APrism u v c d -> Prism (Either s u) (Either t v) (Either a c) (Either b d) Source #
failing :: (Conjoined p, Applicative f) => Traversing p f s t a b -> Over p f s t a b -> Over p f s t a b infixl 5 Source #
Try the first Traversal (or Fold), falling back on the second Traversal (or Fold) if it returns no entries.
This is only a valid Traversal if the second Traversal is disjoint from the result of the first or returns
exactly the same results. These conditions are trivially met when given a Lens, Iso, Getter, Prism or "affine" Traversal -- one that
has 0 or 1 target.
Mutatis mutandis for Fold.
>>>[0,1,2,3] ^? failing (ix 1) (ix 2)Just 1
>>>[0,1,2,3] ^? failing (ix 42) (ix 2)Just 2
failing::Traversals t a b ->Traversals t a b ->Traversals t a bfailing::Prisms t a b ->Prisms t a b ->Traversals t a bfailing::Folds a ->Folds a ->Folds a
These cases are also supported, trivially, but are boring, because the left hand side always succeeds.
failing::Lenss t a b ->Traversals t a b ->Traversals t a bfailing::Isos t a b ->Traversals t a b ->Traversals t a bfailing::Equalitys t a b ->Traversals t a b ->Traversals t a bfailing::Getters a ->Folds a ->Folds a
If both of the inputs are indexed, the result is also indexed, so you can apply this to a pair of indexed traversals or indexed folds, obtaining an indexed traversal or indexed fold.
failing::IndexedTraversali s t a b ->IndexedTraversali s t a b ->IndexedTraversali s t a bfailing::IndexedFoldi s a ->IndexedFoldi s a ->IndexedFoldi s a
These cases are also supported, trivially, but are boring, because the left hand side always succeeds.
failing::IndexedLensi s t a b ->IndexedTraversali s t a b ->IndexedTraversali s t a bfailing::IndexedGetteri s a ->IndexedGetteri s a ->IndexedFoldi s a
class Profunctor p => Choice (p :: Type -> Type -> Type) where #
Instances
| Choice ReifiedFold | |
Defined in Control.Lens.Reified Methods left' :: ReifiedFold a b -> ReifiedFold (Either a c) (Either b c) # right' :: ReifiedFold a b -> ReifiedFold (Either c a) (Either c b) # | |
| Choice ReifiedGetter | |
Defined in Control.Lens.Reified Methods left' :: ReifiedGetter a b -> ReifiedGetter (Either a c) (Either b c) # right' :: ReifiedGetter a b -> ReifiedGetter (Either c a) (Either c b) # | |
| Monad m => Choice (Kleisli m) | |
| Choice (Indexed i) | |
| Choice (PastroSum p) | |
| Profunctor p => Choice (TambaraSum p) | |
| Profunctor p => Choice (CofreeMapping p) | |
| Choice (FreeMapping p) | |
| Choice p => Choice (Tambara p) | |
| Profunctor p => Choice (CofreeTraversing p) | |
| Choice (FreeTraversing p) | |
| Choice p => Choice (Coyoneda p) | |
| Choice p => Choice (Yoneda p) | |
| Choice (Tagged :: Type -> Type -> Type) | |
| Comonad w => Choice (Cokleisli w) | |
| Choice (Market a b) | |
| (Applicative f, Choice p) => Choice (WrappedPafb f p) | |
Defined in Control.Lens.Internal.Profunctor Methods left' :: WrappedPafb f p a b -> WrappedPafb f p (Either a c) (Either b c) # right' :: WrappedPafb f p a b -> WrappedPafb f p (Either c a) (Either c b) # | |
| Monoid r => Choice (Forget r :: Type -> Type -> Type) | |
| Applicative f => Choice (Star f) | |
| Choice (->) | |
| Functor f => Choice (Joker f :: Type -> Type -> Type) | |
| ArrowChoice p => Choice (WrappedArrow p) | |
| (Choice p, Choice q) => Choice (Product p q) | |
| (Choice p, Choice q) => Choice (Sum p q) | |
| (Functor f, Choice p) => Choice (Tannen f p) | |
| (Functor f, Choice p) => Choice (Cayley f p) | |
| (Choice p, Choice q) => Choice (Procompose p q) | |
class Profunctor (p :: Type -> Type -> Type) where #
Instances
| Profunctor Measured | |
Defined in Diagrams.Core.Measure Methods dimap :: (a -> b) -> (c -> d) -> Measured b c -> Measured a d # lmap :: (a -> b) -> Measured b c -> Measured a c # rmap :: (b -> c) -> Measured a b -> Measured a c # (#.) :: forall a b c q. Coercible c b => q b c -> Measured a b -> Measured a c (.#) :: forall a b c q. Coercible b a => Measured b c -> q a b -> Measured a c | |
| Profunctor ReifiedFold | |
Defined in Control.Lens.Reified Methods dimap :: (a -> b) -> (c -> d) -> ReifiedFold b c -> ReifiedFold a d # lmap :: (a -> b) -> ReifiedFold b c -> ReifiedFold a c # rmap :: (b -> c) -> ReifiedFold a b -> ReifiedFold a c # (#.) :: forall a b c q. Coercible c b => q b c -> ReifiedFold a b -> ReifiedFold a c (.#) :: forall a b c q. Coercible b a => ReifiedFold b c -> q a b -> ReifiedFold a c | |
| Profunctor ReifiedGetter | |
Defined in Control.Lens.Reified Methods dimap :: (a -> b) -> (c -> d) -> ReifiedGetter b c -> ReifiedGetter a d # lmap :: (a -> b) -> ReifiedGetter b c -> ReifiedGetter a c # rmap :: (b -> c) -> ReifiedGetter a b -> ReifiedGetter a c # (#.) :: forall a b c q. Coercible c b => q b c -> ReifiedGetter a b -> ReifiedGetter a c (.#) :: forall a b c q. Coercible b a => ReifiedGetter b c -> q a b -> ReifiedGetter a c | |
| Functor v => Profunctor (Query v) | |
Defined in Diagrams.Core.Query Methods dimap :: (a -> b) -> (c -> d) -> Query v b c -> Query v a d # lmap :: (a -> b) -> Query v b c -> Query v a c # rmap :: (b -> c) -> Query v a b -> Query v a c # (#.) :: forall a b c q. Coercible c b => q b c -> Query v a b -> Query v a c (.#) :: forall a b c q. Coercible b a => Query v b c -> q a b -> Query v a c | |
| Monad m => Profunctor (Kleisli m) | |
Defined in Data.Profunctor.Unsafe Methods dimap :: (a -> b) -> (c -> d) -> Kleisli m b c -> Kleisli m a d # lmap :: (a -> b) -> Kleisli m b c -> Kleisli m a c # rmap :: (b -> c) -> Kleisli m a b -> Kleisli m a c # (#.) :: forall a b c q. Coercible c b => q b c -> Kleisli m a b -> Kleisli m a c (.#) :: forall a b c q. Coercible b a => Kleisli m b c -> q a b -> Kleisli m a c | |
| Profunctor (Indexed i) | |
Defined in Control.Lens.Internal.Indexed Methods dimap :: (a -> b) -> (c -> d) -> Indexed i b c -> Indexed i a d # lmap :: (a -> b) -> Indexed i b c -> Indexed i a c # rmap :: (b -> c) -> Indexed i a b -> Indexed i a c # (#.) :: forall a b c q. Coercible c b => q b c -> Indexed i a b -> Indexed i a c (.#) :: forall a b c q. Coercible b a => Indexed i b c -> q a b -> Indexed i a c | |
| Profunctor (ReifiedIndexedFold i) | |
Defined in Control.Lens.Reified Methods dimap :: (a -> b) -> (c -> d) -> ReifiedIndexedFold i b c -> ReifiedIndexedFold i a d # lmap :: (a -> b) -> ReifiedIndexedFold i b c -> ReifiedIndexedFold i a c # rmap :: (b -> c) -> ReifiedIndexedFold i a b -> ReifiedIndexedFold i a c # (#.) :: forall a b c q. Coercible c b => q b c -> ReifiedIndexedFold i a b -> ReifiedIndexedFold i a c (.#) :: forall a b c q. Coercible b a => ReifiedIndexedFold i b c -> q a b -> ReifiedIndexedFold i a c | |
| Profunctor (ReifiedIndexedGetter i) | |
Defined in Control.Lens.Reified Methods dimap :: (a -> b) -> (c -> d) -> ReifiedIndexedGetter i b c -> ReifiedIndexedGetter i a d # lmap :: (a -> b) -> ReifiedIndexedGetter i b c -> ReifiedIndexedGetter i a c # rmap :: (b -> c) -> ReifiedIndexedGetter i a b -> ReifiedIndexedGetter i a c # (#.) :: forall a b c q. Coercible c b => q b c -> ReifiedIndexedGetter i a b -> ReifiedIndexedGetter i a c (.#) :: forall a b c q. Coercible b a => ReifiedIndexedGetter i b c -> q a b -> ReifiedIndexedGetter i a c | |
| Profunctor (CopastroSum p) | |
Defined in Data.Profunctor.Choice Methods dimap :: (a -> b) -> (c -> d) -> CopastroSum p b c -> CopastroSum p a d # lmap :: (a -> b) -> CopastroSum p b c -> CopastroSum p a c # rmap :: (b -> c) -> CopastroSum p a b -> CopastroSum p a c # (#.) :: forall a b c q. Coercible c b => q b c -> CopastroSum p a b -> CopastroSum p a c (.#) :: forall a b c q. Coercible b a => CopastroSum p b c -> q a b -> CopastroSum p a c | |
| Profunctor (CotambaraSum p) | |
Defined in Data.Profunctor.Choice Methods dimap :: (a -> b) -> (c -> d) -> CotambaraSum p b c -> CotambaraSum p a d # lmap :: (a -> b) -> CotambaraSum p b c -> CotambaraSum p a c # rmap :: (b -> c) -> CotambaraSum p a b -> CotambaraSum p a c # (#.) :: forall a b c q. Coercible c b => q b c -> CotambaraSum p a b -> CotambaraSum p a c (.#) :: forall a b c q. Coercible b a => CotambaraSum p b c -> q a b -> CotambaraSum p a c | |
| Profunctor (PastroSum p) | |
Defined in Data.Profunctor.Choice Methods dimap :: (a -> b) -> (c -> d) -> PastroSum p b c -> PastroSum p a d # lmap :: (a -> b) -> PastroSum p b c -> PastroSum p a c # rmap :: (b -> c) -> PastroSum p a b -> PastroSum p a c # (#.) :: forall a b c q. Coercible c b => q b c -> PastroSum p a b -> PastroSum p a c (.#) :: forall a b c q. Coercible b a => PastroSum p b c -> q a b -> PastroSum p a c | |
| Profunctor p => Profunctor (TambaraSum p) | |
Defined in Data.Profunctor.Choice Methods dimap :: (a -> b) -> (c -> d) -> TambaraSum p b c -> TambaraSum p a d # lmap :: (a -> b) -> TambaraSum p b c -> TambaraSum p a c # rmap :: (b -> c) -> TambaraSum p a b -> TambaraSum p a c # (#.) :: forall a b c q. Coercible c b => q b c -> TambaraSum p a b -> TambaraSum p a c (.#) :: forall a b c q. Coercible b a => TambaraSum p b c -> q a b -> TambaraSum p a c | |
| Profunctor p => Profunctor (Closure p) | |
Defined in Data.Profunctor.Closed Methods dimap :: (a -> b) -> (c -> d) -> Closure p b c -> Closure p a d # lmap :: (a -> b) -> Closure p b c -> Closure p a c # rmap :: (b -> c) -> Closure p a b -> Closure p a c # (#.) :: forall a b c q. Coercible c b => q b c -> Closure p a b -> Closure p a c (.#) :: forall a b c q. Coercible b a => Closure p b c -> q a b -> Closure p a c | |
| Profunctor (Environment p) | |
Defined in Data.Profunctor.Closed Methods dimap :: (a -> b) -> (c -> d) -> Environment p b c -> Environment p a d # lmap :: (a -> b) -> Environment p b c -> Environment p a c # rmap :: (b -> c) -> Environment p a b -> Environment p a c # (#.) :: forall a b c q. Coercible c b => q b c -> Environment p a b -> Environment p a c (.#) :: forall a b c q. Coercible b a => Environment p b c -> q a b -> Environment p a c | |
| Profunctor p => Profunctor (CofreeMapping p) | |
Defined in Data.Profunctor.Mapping Methods dimap :: (a -> b) -> (c -> d) -> CofreeMapping p b c -> CofreeMapping p a d # lmap :: (a -> b) -> CofreeMapping p b c -> CofreeMapping p a c # rmap :: (b -> c) -> CofreeMapping p a b -> CofreeMapping p a c # (#.) :: forall a b c q. Coercible c b => q b c -> CofreeMapping p a b -> CofreeMapping p a c (.#) :: forall a b c q. Coercible b a => CofreeMapping p b c -> q a b -> CofreeMapping p a c | |
| Profunctor (FreeMapping p) | |
Defined in Data.Profunctor.Mapping Methods dimap :: (a -> b) -> (c -> d) -> FreeMapping p b c -> FreeMapping p a d # lmap :: (a -> b) -> FreeMapping p b c -> FreeMapping p a c # rmap :: (b -> c) -> FreeMapping p a b -> FreeMapping p a c # (#.) :: forall a b c q. Coercible c b => q b c -> FreeMapping p a b -> FreeMapping p a c (.#) :: forall a b c q. Coercible b a => FreeMapping p b c -> q a b -> FreeMapping p a c | |
| Profunctor (Copastro p) | |
Defined in Data.Profunctor.Strong Methods dimap :: (a -> b) -> (c -> d) -> Copastro p b c -> Copastro p a d # lmap :: (a -> b) -> Copastro p b c -> Copastro p a c # rmap :: (b -> c) -> Copastro p a b -> Copastro p a c # (#.) :: forall a b c q. Coercible c b => q b c -> Copastro p a b -> Copastro p a c (.#) :: forall a b c q. Coercible b a => Copastro p b c -> q a b -> Copastro p a c | |
| Profunctor (Cotambara p) | |
Defined in Data.Profunctor.Strong Methods dimap :: (a -> b) -> (c -> d) -> Cotambara p b c -> Cotambara p a d # lmap :: (a -> b) -> Cotambara p b c -> Cotambara p a c # rmap :: (b -> c) -> Cotambara p a b -> Cotambara p a c # (#.) :: forall a b c q. Coercible c b => q b c -> Cotambara p a b -> Cotambara p a c (.#) :: forall a b c q. Coercible b a => Cotambara p b c -> q a b -> Cotambara p a c | |
| Profunctor (Pastro p) | |
Defined in Data.Profunctor.Strong Methods dimap :: (a -> b) -> (c -> d) -> Pastro p b c -> Pastro p a d # lmap :: (a -> b) -> Pastro p b c -> Pastro p a c # rmap :: (b -> c) -> Pastro p a b -> Pastro p a c # (#.) :: forall a b c q. Coercible c b => q b c -> Pastro p a b -> Pastro p a c (.#) :: forall a b c q. Coercible b a => Pastro p b c -> q a b -> Pastro p a c | |
| Profunctor p => Profunctor (Tambara p) | |
Defined in Data.Profunctor.Strong Methods dimap :: (a -> b) -> (c -> d) -> Tambara p b c -> Tambara p a d # lmap :: (a -> b) -> Tambara p b c -> Tambara p a c # rmap :: (b -> c) -> Tambara p a b -> Tambara p a c # (#.) :: forall a b c q. Coercible c b => q b c -> Tambara p a b -> Tambara p a c (.#) :: forall a b c q. Coercible b a => Tambara p b c -> q a b -> Tambara p a c | |
| Profunctor (Baz t) | |
Defined in Data.Profunctor.Traversing | |
| Profunctor (Bazaar a) | |
Defined in Data.Profunctor.Traversing Methods dimap :: (a0 -> b) -> (c -> d) -> Bazaar a b c -> Bazaar a a0 d # lmap :: (a0 -> b) -> Bazaar a b c -> Bazaar a a0 c # rmap :: (b -> c) -> Bazaar a a0 b -> Bazaar a a0 c # (#.) :: forall a0 b c q. Coercible c b => q b c -> Bazaar a a0 b -> Bazaar a a0 c (.#) :: forall a0 b c q. Coercible b a0 => Bazaar a b c -> q a0 b -> Bazaar a a0 c | |
| Profunctor p => Profunctor (CofreeTraversing p) | |
Defined in Data.Profunctor.Traversing Methods dimap :: (a -> b) -> (c -> d) -> CofreeTraversing p b c -> CofreeTraversing p a d # lmap :: (a -> b) -> CofreeTraversing p b c -> CofreeTraversing p a c # rmap :: (b -> c) -> CofreeTraversing p a b -> CofreeTraversing p a c # (#.) :: forall a b c q. Coercible c b => q b c -> CofreeTraversing p a b -> CofreeTraversing p a c (.#) :: forall a b c q. Coercible b a => CofreeTraversing p b c -> q a b -> CofreeTraversing p a c | |
| Profunctor (FreeTraversing p) | |
Defined in Data.Profunctor.Traversing Methods dimap :: (a -> b) -> (c -> d) -> FreeTraversing p b c -> FreeTraversing p a d # lmap :: (a -> b) -> FreeTraversing p b c -> FreeTraversing p a c # rmap :: (b -> c) -> FreeTraversing p a b -> FreeTraversing p a c # (#.) :: forall a b c q. Coercible c b => q b c -> FreeTraversing p a b -> FreeTraversing p a c (.#) :: forall a b c q. Coercible b a => FreeTraversing p b c -> q a b -> FreeTraversing p a c | |
| Profunctor (Coyoneda p) | |
Defined in Data.Profunctor.Yoneda Methods dimap :: (a -> b) -> (c -> d) -> Coyoneda p b c -> Coyoneda p a d # lmap :: (a -> b) -> Coyoneda p b c -> Coyoneda p a c # rmap :: (b -> c) -> Coyoneda p a b -> Coyoneda p a c # (#.) :: forall a b c q. Coercible c b => q b c -> Coyoneda p a b -> Coyoneda p a c (.#) :: forall a b c q. Coercible b a => Coyoneda p b c -> q a b -> Coyoneda p a c | |
| Profunctor (Yoneda p) | |
Defined in Data.Profunctor.Yoneda Methods dimap :: (a -> b) -> (c -> d) -> Yoneda p b c -> Yoneda p a d # lmap :: (a -> b) -> Yoneda p b c -> Yoneda p a c # rmap :: (b -> c) -> Yoneda p a b -> Yoneda p a c # (#.) :: forall a b c q. Coercible c b => q b c -> Yoneda p a b -> Yoneda p a c (.#) :: forall a b c q. Coercible b a => Yoneda p b c -> q a b -> Yoneda p a c | |
| Profunctor (Tagged :: Type -> Type -> Type) | |
Defined in Data.Profunctor.Unsafe Methods dimap :: (a -> b) -> (c -> d) -> Tagged b c -> Tagged a d # lmap :: (a -> b) -> Tagged b c -> Tagged a c # rmap :: (b -> c) -> Tagged a b -> Tagged a c # (#.) :: forall a b c q. Coercible c b => q b c -> Tagged a b -> Tagged a c (.#) :: forall a b c q. Coercible b a => Tagged b c -> q a b -> Tagged a c | |
| Functor w => Profunctor (Cokleisli w) | |
Defined in Data.Profunctor.Unsafe Methods dimap :: (a -> b) -> (c -> d) -> Cokleisli w b c -> Cokleisli w a d # lmap :: (a -> b) -> Cokleisli w b c -> Cokleisli w a c # rmap :: (b -> c) -> Cokleisli w a b -> Cokleisli w a c # (#.) :: forall a b c q. Coercible c b => q b c -> Cokleisli w a b -> Cokleisli w a c (.#) :: forall a b c q. Coercible b a => Cokleisli w b c -> q a b -> Cokleisli w a c | |
| Profunctor (Exchange a b) | |
Defined in Control.Lens.Internal.Iso Methods dimap :: (a0 -> b0) -> (c -> d) -> Exchange a b b0 c -> Exchange a b a0 d # lmap :: (a0 -> b0) -> Exchange a b b0 c -> Exchange a b a0 c # rmap :: (b0 -> c) -> Exchange a b a0 b0 -> Exchange a b a0 c # (#.) :: forall a0 b0 c q. Coercible c b0 => q b0 c -> Exchange a b a0 b0 -> Exchange a b a0 c (.#) :: forall a0 b0 c q. Coercible b0 a0 => Exchange a b b0 c -> q a0 b0 -> Exchange a b a0 c | |
| Profunctor (Market a b) | |
Defined in Control.Lens.Internal.Prism Methods dimap :: (a0 -> b0) -> (c -> d) -> Market a b b0 c -> Market a b a0 d # lmap :: (a0 -> b0) -> Market a b b0 c -> Market a b a0 c # rmap :: (b0 -> c) -> Market a b a0 b0 -> Market a b a0 c # (#.) :: forall a0 b0 c q. Coercible c b0 => q b0 c -> Market a b a0 b0 -> Market a b a0 c (.#) :: forall a0 b0 c q. Coercible b0 a0 => Market a b b0 c -> q a0 b0 -> Market a b a0 c | |
| (Functor f, Profunctor p) => Profunctor (WrappedPafb f p) | |
Defined in Control.Lens.Internal.Profunctor Methods dimap :: (a -> b) -> (c -> d) -> WrappedPafb f p b c -> WrappedPafb f p a d # lmap :: (a -> b) -> WrappedPafb f p b c -> WrappedPafb f p a c # rmap :: (b -> c) -> WrappedPafb f p a b -> WrappedPafb f p a c # (#.) :: forall a b c q. Coercible c b => q b c -> WrappedPafb f p a b -> WrappedPafb f p a c (.#) :: forall a b c q. Coercible b a => WrappedPafb f p b c -> q a b -> WrappedPafb f p a c | |
| Functor f => Profunctor (Costar f) | |
Defined in Data.Profunctor.Types Methods dimap :: (a -> b) -> (c -> d) -> Costar f b c -> Costar f a d # lmap :: (a -> b) -> Costar f b c -> Costar f a c # rmap :: (b -> c) -> Costar f a b -> Costar f a c # (#.) :: forall a b c q. Coercible c b => q b c -> Costar f a b -> Costar f a c (.#) :: forall a b c q. Coercible b a => Costar f b c -> q a b -> Costar f a c | |
| Profunctor (Forget r :: Type -> Type -> Type) | |
Defined in Data.Profunctor.Types Methods dimap :: (a -> b) -> (c -> d) -> Forget r b c -> Forget r a d # lmap :: (a -> b) -> Forget r b c -> Forget r a c # rmap :: (b -> c) -> Forget r a b -> Forget r a c # (#.) :: forall a b c q. Coercible c b => q b c -> Forget r a b -> Forget r a c (.#) :: forall a b c q. Coercible b a => Forget r b c -> q a b -> Forget r a c | |
| Functor f => Profunctor (Star f) | |
Defined in Data.Profunctor.Types Methods dimap :: (a -> b) -> (c -> d) -> Star f b c -> Star f a d # lmap :: (a -> b) -> Star f b c -> Star f a c # rmap :: (b -> c) -> Star f a b -> Star f a c # (#.) :: forall a b c q. Coercible c b => q b c -> Star f a b -> Star f a c (.#) :: forall a b c q. Coercible b a => Star f b c -> q a b -> Star f a c | |
| Profunctor (->) | |
Defined in Data.Profunctor.Unsafe | |
| Contravariant f => Profunctor (Clown f :: Type -> Type -> Type) | |
Defined in Data.Profunctor.Unsafe Methods dimap :: (a -> b) -> (c -> d) -> Clown f b c -> Clown f a d # lmap :: (a -> b) -> Clown f b c -> Clown f a c # rmap :: (b -> c) -> Clown f a b -> Clown f a c # (#.) :: forall a b c q. Coercible c b => q b c -> Clown f a b -> Clown f a c (.#) :: forall a b c q. Coercible b a => Clown f b c -> q a b -> Clown f a c | |
| Functor f => Profunctor (Joker f :: Type -> Type -> Type) | |
Defined in Data.Profunctor.Unsafe Methods dimap :: (a -> b) -> (c -> d) -> Joker f b c -> Joker f a d # lmap :: (a -> b) -> Joker f b c -> Joker f a c # rmap :: (b -> c) -> Joker f a b -> Joker f a c # (#.) :: forall a b c q. Coercible c b => q b c -> Joker f a b -> Joker f a c (.#) :: forall a b c q. Coercible b a => Joker f b c -> q a b -> Joker f a c | |
| Profunctor p => Profunctor (Codensity p) | |
Defined in Data.Profunctor.Ran Methods dimap :: (a -> b) -> (c -> d) -> Codensity p b c -> Codensity p a d # lmap :: (a -> b) -> Codensity p b c -> Codensity p a c # rmap :: (b -> c) -> Codensity p a b -> Codensity p a c # (#.) :: forall a b c q. Coercible c b => q b c -> Codensity p a b -> Codensity p a c (.#) :: forall a b c q. Coercible b a => Codensity p b c -> q a b -> Codensity p a c | |
| Arrow p => Profunctor (WrappedArrow p) | |
Defined in Data.Profunctor.Types Methods dimap :: (a -> b) -> (c -> d) -> WrappedArrow p b c -> WrappedArrow p a d # lmap :: (a -> b) -> WrappedArrow p b c -> WrappedArrow p a c # rmap :: (b -> c) -> WrappedArrow p a b -> WrappedArrow p a c # (#.) :: forall a b c q. Coercible c b => q b c -> WrappedArrow p a b -> WrappedArrow p a c (.#) :: forall a b c q. Coercible b a => WrappedArrow p b c -> q a b -> WrappedArrow p a c | |
| (Profunctor p, Profunctor q) => Profunctor (Product p q) | |
Defined in Data.Profunctor.Unsafe Methods dimap :: (a -> b) -> (c -> d) -> Product p q b c -> Product p q a d # lmap :: (a -> b) -> Product p q b c -> Product p q a c # rmap :: (b -> c) -> Product p q a b -> Product p q a c # (#.) :: forall a b c q0. Coercible c b => q0 b c -> Product p q a b -> Product p q a c (.#) :: forall a b c q0. Coercible b a => Product p q b c -> q0 a b -> Product p q a c | |
| (Profunctor p, Profunctor q) => Profunctor (Sum p q) | |
Defined in Data.Profunctor.Unsafe Methods dimap :: (a -> b) -> (c -> d) -> Sum p q b c -> Sum p q a d # lmap :: (a -> b) -> Sum p q b c -> Sum p q a c # rmap :: (b -> c) -> Sum p q a b -> Sum p q a c # (#.) :: forall a b c q0. Coercible c b => q0 b c -> Sum p q a b -> Sum p q a c (.#) :: forall a b c q0. Coercible b a => Sum p q b c -> q0 a b -> Sum p q a c | |
| (Functor f, Profunctor p) => Profunctor (Tannen f p) | |
Defined in Data.Profunctor.Unsafe Methods dimap :: (a -> b) -> (c -> d) -> Tannen f p b c -> Tannen f p a d # lmap :: (a -> b) -> Tannen f p b c -> Tannen f p a c # rmap :: (b -> c) -> Tannen f p a b -> Tannen f p a c # (#.) :: forall a b c q. Coercible c b => q b c -> Tannen f p a b -> Tannen f p a c (.#) :: forall a b c q. Coercible b a => Tannen f p b c -> q a b -> Tannen f p a c | |
| (Functor f, Profunctor p) => Profunctor (Cayley f p) | |
Defined in Data.Profunctor.Cayley Methods dimap :: (a -> b) -> (c -> d) -> Cayley f p b c -> Cayley f p a d # lmap :: (a -> b) -> Cayley f p b c -> Cayley f p a c # rmap :: (b -> c) -> Cayley f p a b -> Cayley f p a c # (#.) :: forall a b c q. Coercible c b => q b c -> Cayley f p a b -> Cayley f p a c (.#) :: forall a b c q. Coercible b a => Cayley f p b c -> q a b -> Cayley f p a c | |
| (Profunctor p, Profunctor q) => Profunctor (Procompose p q) | |
Defined in Data.Profunctor.Composition Methods dimap :: (a -> b) -> (c -> d) -> Procompose p q b c -> Procompose p q a d # lmap :: (a -> b) -> Procompose p q b c -> Procompose p q a c # rmap :: (b -> c) -> Procompose p q a b -> Procompose p q a c # (#.) :: forall a b c q0. Coercible c b => q0 b c -> Procompose p q a b -> Procompose p q a c (.#) :: forall a b c q0. Coercible b a => Procompose p q b c -> q0 a b -> Procompose p q a c | |
| (Profunctor p, Profunctor q) => Profunctor (Rift p q) | |
Defined in Data.Profunctor.Composition Methods dimap :: (a -> b) -> (c -> d) -> Rift p q b c -> Rift p q a d # lmap :: (a -> b) -> Rift p q b c -> Rift p q a c # rmap :: (b -> c) -> Rift p q a b -> Rift p q a c # (#.) :: forall a b c q0. Coercible c b => q0 b c -> Rift p q a b -> Rift p q a c (.#) :: forall a b c q0. Coercible b a => Rift p q b c -> q0 a b -> Rift p q a c | |
| (Profunctor p, Profunctor q) => Profunctor (Ran p q) | |
Defined in Data.Profunctor.Ran Methods dimap :: (a -> b) -> (c -> d) -> Ran p q b c -> Ran p q a d # lmap :: (a -> b) -> Ran p q b c -> Ran p q a c # rmap :: (b -> c) -> Ran p q a b -> Ran p q a c # (#.) :: forall a b c q0. Coercible c b => q0 b c -> Ran p q a b -> Ran p q a c (.#) :: forall a b c q0. Coercible b a => Ran p q b c -> q0 a b -> Ran p q a c | |
| (Profunctor p, Functor f, Functor g) => Profunctor (Biff p f g) | |
Defined in Data.Profunctor.Unsafe Methods dimap :: (a -> b) -> (c -> d) -> Biff p f g b c -> Biff p f g a d # lmap :: (a -> b) -> Biff p f g b c -> Biff p f g a c # rmap :: (b -> c) -> Biff p f g a b -> Biff p f g a c # (#.) :: forall a b c q. Coercible c b => q b c -> Biff p f g a b -> Biff p f g a c (.#) :: forall a b c q. Coercible b a => Biff p f g b c -> q a b -> Biff p f g a c | |
class Reversing t where Source #
This class provides a generalized notion of list reversal extended to other containers.
Instances
| Reversing ByteString | |
Defined in Control.Lens.Internal.Iso Methods reversing :: ByteString -> ByteString Source # | |
| Reversing ByteString | |
Defined in Control.Lens.Internal.Iso Methods reversing :: ByteString -> ByteString Source # | |
| Reversing Text | |
| Reversing Text | |
| Reversing (Seq a) | |
| (Metric v, OrderedField n) => Reversing (Located (Trail v n)) Source # | Same as |
| (Metric v, OrderedField n) => Reversing (Located (Trail' l v n)) Source # | Same as |
| Reversing (NonEmpty a) | |
| Reversing (Deque a) | |
| Reversing (Vector a) | |
Defined in Control.Lens.Internal.Iso | |
| Prim a => Reversing (Vector a) | |
Defined in Control.Lens.Internal.Iso | |
| Storable a => Reversing (Vector a) | |
Defined in Control.Lens.Internal.Iso | |
| Reversing (Vector a) | |
Defined in Control.Lens.Internal.Iso | |
| Unbox a => Reversing (Vector a) | |
Defined in Control.Lens.Internal.Iso | |
| Reversing [a] | |
Defined in Control.Lens.Internal.Iso | |
| (Metric v, OrderedField n) => Reversing (Path v n) Source # | Same as |
| Reversing (FixedSegment v n) Source # | Reverses the control points. |
Defined in Diagrams.Segment Methods reversing :: FixedSegment v n -> FixedSegment v n Source # | |
| (Metric v, OrderedField n) => Reversing (Trail v n) Source # | Same as |
| (Additive v, Num n) => Reversing (Offset c v n) Source # | Reverses the direction of closed offsets. |
| (Additive v, Num n) => Reversing (Segment Closed v n) Source # | Reverse the direction of a segment. |
| (Metric v, OrderedField n) => Reversing (Trail' l v n) Source # | Same as |
class Foldable f => FoldableWithIndex i (f :: Type -> Type) | f -> i where #
Minimal complete definition
Nothing
Methods
ifoldMap :: Monoid m => (i -> a -> m) -> f a -> m #
ifoldMap' :: Monoid m => (i -> a -> m) -> f a -> m #
ifoldr :: (i -> a -> b -> b) -> b -> f a -> b #
ifoldl :: (i -> b -> a -> b) -> b -> f a -> b #
Instances
| FoldableWithIndex () Identity | |
Defined in WithIndex | |
| FoldableWithIndex () Par1 | |
| FoldableWithIndex () Maybe | |
| FoldableWithIndex () Solo | |
Defined in Data.Functor.WithIndex.Instances | |
| FoldableWithIndex Int IntMap | |
Defined in WithIndex | |
| FoldableWithIndex Int Seq | |
| FoldableWithIndex Int NonEmpty | |
Defined in WithIndex | |
| FoldableWithIndex Int ZipList | |
Defined in WithIndex | |
| FoldableWithIndex Int Deque | |
Defined in Control.Lens.Internal.Deque | |
| FoldableWithIndex Int Vector | |
Defined in Data.Functor.WithIndex.Instances | |
| FoldableWithIndex Int [] | |
| FoldableWithIndex Void (Proxy :: Type -> Type) | |
Defined in WithIndex | |
| FoldableWithIndex Void (U1 :: Type -> Type) | |
| FoldableWithIndex Void (V1 :: Type -> Type) | |
| Ix i => FoldableWithIndex i (Array i) | |
Defined in WithIndex | |
| FoldableWithIndex i (Level i) | |
Defined in Control.Lens.Internal.Level | |
| FoldableWithIndex k (Map k) | |
| FoldableWithIndex k (HashMap k) | |
Defined in Data.Functor.WithIndex.Instances | |
| FoldableWithIndex k ((,) k) | |
| FoldableWithIndex Void (Const e :: Type -> Type) | |
Defined in WithIndex | |
| FoldableWithIndex Void (Constant e :: Type -> Type) | |
Defined in WithIndex Methods ifoldMap :: Monoid m => (Void -> a -> m) -> Constant e a -> m # ifoldMap' :: Monoid m => (Void -> a -> m) -> Constant e a -> m # ifoldr :: (Void -> a -> b -> b) -> b -> Constant e a -> b # ifoldl :: (Void -> b -> a -> b) -> b -> Constant e a -> b # ifoldr' :: (Void -> a -> b -> b) -> b -> Constant e a -> b # ifoldl' :: (Void -> b -> a -> b) -> b -> Constant e a -> b # | |
| FoldableWithIndex () (Tagged a) | |
Defined in Data.Functor.WithIndex.Instances Methods ifoldMap :: Monoid m => (() -> a0 -> m) -> Tagged a a0 -> m # ifoldMap' :: Monoid m => (() -> a0 -> m) -> Tagged a a0 -> m # ifoldr :: (() -> a0 -> b -> b) -> b -> Tagged a a0 -> b # ifoldl :: (() -> b -> a0 -> b) -> b -> Tagged a a0 -> b # | |
| FoldableWithIndex Int (V n) | |
| FoldableWithIndex i f => FoldableWithIndex i (Rec1 f) | |
| FoldableWithIndex i f => FoldableWithIndex i (Backwards f) | |
Defined in WithIndex Methods ifoldMap :: Monoid m => (i -> a -> m) -> Backwards f a -> m # ifoldMap' :: Monoid m => (i -> a -> m) -> Backwards f a -> m # ifoldr :: (i -> a -> b -> b) -> b -> Backwards f a -> b # ifoldl :: (i -> b -> a -> b) -> b -> Backwards f a -> b # | |
| FoldableWithIndex i m => FoldableWithIndex i (IdentityT m) | |
Defined in WithIndex Methods ifoldMap :: Monoid m0 => (i -> a -> m0) -> IdentityT m a -> m0 # ifoldMap' :: Monoid m0 => (i -> a -> m0) -> IdentityT m a -> m0 # ifoldr :: (i -> a -> b -> b) -> b -> IdentityT m a -> b # ifoldl :: (i -> b -> a -> b) -> b -> IdentityT m a -> b # | |
| FoldableWithIndex i f => FoldableWithIndex i (Reverse f) | |
Defined in WithIndex | |
| FoldableWithIndex Void (K1 i c :: Type -> Type) | |
Defined in WithIndex | |
| FoldableWithIndex i (Magma i t b) | |
Defined in Control.Lens.Internal.Magma Methods ifoldMap :: Monoid m => (i -> a -> m) -> Magma i t b a -> m # ifoldMap' :: Monoid m => (i -> a -> m) -> Magma i t b a -> m # 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 # | |
| FoldableWithIndex (E Plucker) Plucker | |
Defined in Linear.Plucker Methods ifoldMap :: Monoid m => (E Plucker -> a -> m) -> Plucker a -> m # ifoldMap' :: Monoid m => (E Plucker -> a -> m) -> Plucker a -> m # ifoldr :: (E Plucker -> a -> b -> b) -> b -> Plucker a -> b # ifoldl :: (E Plucker -> b -> a -> b) -> b -> Plucker a -> b # ifoldr' :: (E Plucker -> a -> b -> b) -> b -> Plucker a -> b # ifoldl' :: (E Plucker -> b -> a -> b) -> b -> Plucker a -> b # | |
| FoldableWithIndex (E Quaternion) Quaternion | |
Defined in Linear.Quaternion Methods ifoldMap :: Monoid m => (E Quaternion -> a -> m) -> Quaternion a -> m # ifoldMap' :: Monoid m => (E Quaternion -> a -> m) -> Quaternion a -> m # ifoldr :: (E Quaternion -> a -> b -> b) -> b -> Quaternion a -> b # ifoldl :: (E Quaternion -> b -> a -> b) -> b -> Quaternion a -> b # ifoldr' :: (E Quaternion -> a -> b -> b) -> b -> Quaternion a -> b # ifoldl' :: (E Quaternion -> b -> a -> b) -> b -> Quaternion a -> b # | |
| FoldableWithIndex (E V0) V0 | |
| FoldableWithIndex (E V1) V1 | |
| FoldableWithIndex (E V2) V2 | |
| FoldableWithIndex (E V3) V3 | |
| FoldableWithIndex (E V4) V4 | |
| FoldableWithIndex [Int] Tree | |
Defined in WithIndex | |
| FoldableWithIndex i f => FoldableWithIndex [i] (Cofree f) | |
Defined in Control.Comonad.Cofree | |
| FoldableWithIndex i f => FoldableWithIndex [i] (Free f) | |
Defined in Control.Monad.Free | |
| (FoldableWithIndex i f, FoldableWithIndex j g) => FoldableWithIndex (Either i j) (Product f g) | |
Defined in WithIndex Methods ifoldMap :: Monoid m => (Either i j -> a -> m) -> Product f g a -> m # ifoldMap' :: Monoid m => (Either i j -> a -> m) -> Product f g a -> m # ifoldr :: (Either i j -> a -> b -> b) -> b -> Product f g a -> b # ifoldl :: (Either i j -> b -> a -> b) -> b -> Product f g a -> b # ifoldr' :: (Either i j -> a -> b -> b) -> b -> Product f g a -> b # ifoldl' :: (Either i j -> b -> a -> b) -> b -> Product f g a -> b # | |
| (FoldableWithIndex i f, FoldableWithIndex j g) => FoldableWithIndex (Either i j) (Sum f g) | |
Defined in WithIndex Methods ifoldMap :: Monoid m => (Either i j -> a -> m) -> Sum f g a -> m # ifoldMap' :: Monoid m => (Either i j -> a -> m) -> Sum f g a -> m # ifoldr :: (Either i j -> a -> b -> b) -> b -> Sum f g a -> b # ifoldl :: (Either i j -> b -> a -> b) -> b -> Sum f g a -> b # ifoldr' :: (Either i j -> a -> b -> b) -> b -> Sum f g a -> b # ifoldl' :: (Either i j -> b -> a -> b) -> b -> Sum f g a -> b # | |
| (FoldableWithIndex i f, FoldableWithIndex j g) => FoldableWithIndex (Either i j) (f :*: g) | |
Defined in WithIndex Methods ifoldMap :: Monoid m => (Either i j -> a -> m) -> (f :*: g) a -> m # ifoldMap' :: Monoid m => (Either i j -> a -> m) -> (f :*: g) a -> m # ifoldr :: (Either i j -> a -> b -> b) -> b -> (f :*: g) a -> b # ifoldl :: (Either i j -> b -> a -> b) -> b -> (f :*: g) a -> b # ifoldr' :: (Either i j -> a -> b -> b) -> b -> (f :*: g) a -> b # ifoldl' :: (Either i j -> b -> a -> b) -> b -> (f :*: g) a -> b # | |
| (FoldableWithIndex i f, FoldableWithIndex j g) => FoldableWithIndex (Either i j) (f :+: g) | |
Defined in WithIndex Methods ifoldMap :: Monoid m => (Either i j -> a -> m) -> (f :+: g) a -> m # ifoldMap' :: Monoid m => (Either i j -> a -> m) -> (f :+: g) a -> m # ifoldr :: (Either i j -> a -> b -> b) -> b -> (f :+: g) a -> b # ifoldl :: (Either i j -> b -> a -> b) -> b -> (f :+: g) a -> b # ifoldr' :: (Either i j -> a -> b -> b) -> b -> (f :+: g) a -> b # ifoldl' :: (Either i j -> b -> a -> b) -> b -> (f :+: g) a -> b # | |
| (FoldableWithIndex i f, FoldableWithIndex j g) => FoldableWithIndex (i, j) (Compose f g) | |
Defined in WithIndex Methods ifoldMap :: Monoid m => ((i, j) -> a -> m) -> Compose f g a -> m # ifoldMap' :: Monoid m => ((i, j) -> a -> m) -> Compose f g a -> m # ifoldr :: ((i, j) -> a -> b -> b) -> b -> Compose f g a -> b # ifoldl :: ((i, j) -> b -> a -> b) -> b -> Compose f g a -> b # ifoldr' :: ((i, j) -> a -> b -> b) -> b -> Compose f g a -> b # ifoldl' :: ((i, j) -> b -> a -> b) -> b -> Compose f g a -> b # | |
| (FoldableWithIndex i f, FoldableWithIndex j g) => FoldableWithIndex (i, j) (f :.: g) | |
Defined in WithIndex Methods ifoldMap :: Monoid m => ((i, j) -> a -> m) -> (f :.: g) a -> m # ifoldMap' :: Monoid m => ((i, j) -> a -> m) -> (f :.: g) a -> m # ifoldr :: ((i, j) -> a -> b -> b) -> b -> (f :.: g) a -> b # ifoldl :: ((i, j) -> b -> a -> b) -> b -> (f :.: g) a -> b # ifoldr' :: ((i, j) -> a -> b -> b) -> b -> (f :.: g) a -> b # ifoldl' :: ((i, j) -> b -> a -> b) -> b -> (f :.: g) a -> b # | |
class (FunctorWithIndex i t, FoldableWithIndex i t, Traversable t) => TraversableWithIndex i (t :: Type -> Type) | t -> i where #
Minimal complete definition
Nothing
Methods
itraverse :: Applicative f => (i -> a -> f b) -> t a -> f (t b) #
Instances
| TraversableWithIndex () Identity | |
| TraversableWithIndex () Par1 | |
| TraversableWithIndex () Maybe | |
| TraversableWithIndex () Solo | |
Defined in Data.Functor.WithIndex.Instances Methods itraverse :: Applicative f => (() -> a -> f b) -> Solo a -> f (Solo b) # | |
| TraversableWithIndex Int IntMap | |
| TraversableWithIndex Int Seq | |
| TraversableWithIndex Int NonEmpty | |
| TraversableWithIndex Int ZipList | |
| TraversableWithIndex Int Deque | |
Defined in Control.Lens.Internal.Deque | |
| TraversableWithIndex Int Vector | |
Defined in Data.Functor.WithIndex.Instances Methods itraverse :: Applicative f => (Int -> a -> f b) -> Vector a -> f (Vector b) # | |
| TraversableWithIndex Int [] | |
Defined in WithIndex Methods itraverse :: Applicative f => (Int -> a -> f b) -> [a] -> f [b] # | |
| TraversableWithIndex Void (Proxy :: Type -> Type) | |
| TraversableWithIndex Void (U1 :: Type -> Type) | |
| TraversableWithIndex Void (V1 :: Type -> Type) | |
| Ix i => TraversableWithIndex i (Array i) | |
| TraversableWithIndex i (Level i) | |
Defined in Control.Lens.Internal.Level Methods itraverse :: Applicative f => (i -> a -> f b) -> Level i a -> f (Level i b) # | |
| TraversableWithIndex k (Map k) | |
| TraversableWithIndex k (HashMap k) | |
Defined in Data.Functor.WithIndex.Instances Methods itraverse :: Applicative f => (k -> a -> f b) -> HashMap k a -> f (HashMap k b) # | |
| TraversableWithIndex k ((,) k) | |
Defined in WithIndex Methods itraverse :: Applicative f => (k -> a -> f b) -> (k, a) -> f (k, b) # | |
| TraversableWithIndex Void (Const e :: Type -> Type) | |
| TraversableWithIndex Void (Constant e :: Type -> Type) | |
| TraversableWithIndex () (Tagged a) | |
Defined in Data.Functor.WithIndex.Instances Methods itraverse :: Applicative f => (() -> a0 -> f b) -> Tagged a a0 -> f (Tagged a b) # | |
| TraversableWithIndex Int (V n) | |
| TraversableWithIndex i f => TraversableWithIndex i (Rec1 f) | |
| TraversableWithIndex i f => TraversableWithIndex i (Backwards f) | |
| TraversableWithIndex i m => TraversableWithIndex i (IdentityT m) | |
| TraversableWithIndex i f => TraversableWithIndex i (Reverse f) | |
| TraversableWithIndex Void (K1 i c :: Type -> Type) | |
| TraversableWithIndex i (Magma i t b) | |
Defined in Control.Lens.Internal.Magma Methods itraverse :: Applicative f => (i -> a -> f b0) -> Magma i t b a -> f (Magma i t b b0) # | |
| TraversableWithIndex (E Plucker) Plucker | |
Defined in Linear.Plucker | |
| TraversableWithIndex (E Quaternion) Quaternion | |
Defined in Linear.Quaternion Methods itraverse :: Applicative f => (E Quaternion -> a -> f b) -> Quaternion a -> f (Quaternion b) # | |
| TraversableWithIndex (E V0) V0 | |
| TraversableWithIndex (E V1) V1 | |
| TraversableWithIndex (E V2) V2 | |
| TraversableWithIndex (E V3) V3 | |
| TraversableWithIndex (E V4) V4 | |
| TraversableWithIndex [Int] Tree | |
| TraversableWithIndex i f => TraversableWithIndex [i] (Cofree f) | |
Defined in Control.Comonad.Cofree Methods itraverse :: Applicative f0 => ([i] -> a -> f0 b) -> Cofree f a -> f0 (Cofree f b) # | |
| TraversableWithIndex i f => TraversableWithIndex [i] (Free f) | |
Defined in Control.Monad.Free Methods itraverse :: Applicative f0 => ([i] -> a -> f0 b) -> Free f a -> f0 (Free f b) # | |
| (TraversableWithIndex i f, TraversableWithIndex j g) => TraversableWithIndex (Either i j) (Product f g) | |
| (TraversableWithIndex i f, TraversableWithIndex j g) => TraversableWithIndex (Either i j) (Sum f g) | |
| (TraversableWithIndex i f, TraversableWithIndex j g) => TraversableWithIndex (Either i j) (f :*: g) | |
| (TraversableWithIndex i f, TraversableWithIndex j g) => TraversableWithIndex (Either i j) (f :+: g) | |
| (TraversableWithIndex i f, TraversableWithIndex j g) => TraversableWithIndex (i, j) (Compose f g) | |
| (TraversableWithIndex i f, TraversableWithIndex j g) => TraversableWithIndex (i, j) (f :.: g) | |
iall :: FoldableWithIndex i f => (i -> a -> Bool) -> f a -> Bool #
iany :: FoldableWithIndex i f => (i -> a -> Bool) -> f a -> Bool #
iconcatMap :: FoldableWithIndex i f => (i -> a -> [b]) -> f a -> [b] #
ifind :: FoldableWithIndex i f => (i -> a -> Bool) -> f a -> Maybe (i, a) #
ifoldlM :: (FoldableWithIndex i f, Monad m) => (i -> b -> a -> m b) -> b -> f a -> m b #
ifoldrM :: (FoldableWithIndex i f, Monad m) => (i -> a -> b -> m b) -> b -> f a -> m b #
iforM_ :: (FoldableWithIndex i t, Monad m) => t a -> (i -> a -> m b) -> m () #
ifor_ :: (FoldableWithIndex i t, Applicative f) => t a -> (i -> a -> f b) -> f () #
imapM_ :: (FoldableWithIndex i t, Monad m) => (i -> a -> m b) -> t a -> m () #
inone :: FoldableWithIndex i f => (i -> a -> Bool) -> f a -> Bool #
itoList :: FoldableWithIndex i f => f a -> [(i, a)] #
itraverse_ :: (FoldableWithIndex i t, Applicative f) => (i -> a -> f b) -> t a -> f () #
iforM :: (TraversableWithIndex i t, Monad m) => t a -> (i -> a -> m b) -> m (t b) #
imapAccumL :: TraversableWithIndex i t => (i -> s -> a -> (s, b)) -> s -> t a -> (s, t b) #
imapAccumR :: TraversableWithIndex i t => (i -> s -> a -> (s, b)) -> s -> t a -> (s, t b) #
imapM :: (TraversableWithIndex i t, Monad m) => (i -> a -> m b) -> t a -> m (t b) #
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.
Instances
| FoldableWithIndex i (Level i) | |
Defined in Control.Lens.Internal.Level | |
| FunctorWithIndex i (Level i) | |
Defined in Control.Lens.Internal.Level | |
| TraversableWithIndex i (Level i) | |
Defined in Control.Lens.Internal.Level Methods itraverse :: Applicative f => (i -> a -> f b) -> Level i a -> f (Level i b) # | |
| Functor (Level i) | |
| Foldable (Level i) | |
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 # | |
| Traversable (Level i) | |
Defined in Control.Lens.Internal.Level | |
| (Read i, Read a) => Read (Level i a) | |
| (Show i, Show a) => Show (Level i a) | |
| (Eq i, Eq a) => Eq (Level i a) | |
| (Ord i, Ord a) => Ord (Level i a) | |
Defined in Control.Lens.Internal.Level | |
class Conjoined p => Indexable i (p :: Type -> Type -> Type) Source #
This class permits overloading of function application for things that also admit a notion of a key or index.
Minimal complete definition
class (Choice p, Corepresentable p, Comonad (Corep p), Traversable (Corep p), Strong p, Representable p, Monad (Rep p), MonadFix (Rep p), Distributive (Rep p), Costrong p, ArrowLoop p, ArrowApply p, ArrowChoice p, Closed p) => Conjoined (p :: Type -> Type -> Type) where Source #
This is a Profunctor that is both Corepresentable by f and Representable by g such
that f is left adjoint to g. From this you can derive a lot of structure due
to the preservation of limits and colimits.
Minimal complete definition
Nothing
Methods
distrib :: Functor f => p a b -> p (f a) (f b) Source #
Conjoined is strong enough to let us distribute every Conjoined
Profunctor over every Haskell Functor. This is effectively a
generalization of fmap.
conjoined :: (p ~ (->) => q (a -> b) r) -> q (p a b) r -> q (p a b) r Source #
This permits us to make a decision at an outermost point about whether or not we use an index.
Ideally any use of this function should be done in such a way so that you compute the same answer, but this cannot be enforced at the type level.
Instances
| Conjoined ReifiedGetter | |
Defined in Control.Lens.Reified Methods distrib :: Functor f => ReifiedGetter a b -> ReifiedGetter (f a) (f b) Source # conjoined :: (ReifiedGetter ~ (->) => q (a -> b) r) -> q (ReifiedGetter a b) r -> q (ReifiedGetter a b) r Source # | |
| Conjoined (Indexed i) | |
| Conjoined (->) | |
indexing :: Indexable Int p => ((a -> Indexing f b) -> s -> Indexing f t) -> p a (f b) -> s -> f t Source #
Transform a Traversal into an IndexedTraversal or
a Fold into an IndexedFold, etc.
indexing::Traversals t a b ->IndexedTraversalInts t a bindexing::Prisms t a b ->IndexedTraversalInts t a bindexing::Lenss t a b ->IndexedLensInts t a bindexing::Isos t a b ->IndexedLensInts t a bindexing::Folds a ->IndexedFoldInts aindexing::Getters a ->IndexedGetterInts a
indexing::IndexableIntp =>LensLike(Indexingf) s t a b ->Overp f s t a b
indexing64 :: Indexable Int64 p => ((a -> Indexing64 f b) -> s -> Indexing64 f t) -> p a (f b) -> s -> f t Source #
Transform a Traversal into an IndexedTraversal or
a Fold into an IndexedFold, etc.
This combinator is like indexing except that it handles large traversals and folds gracefully.
indexing64::Traversals t a b ->IndexedTraversalInt64s t a bindexing64::Prisms t a b ->IndexedTraversalInt64s t a bindexing64::Lenss t a b ->IndexedLensInt64s t a bindexing64::Isos t a b ->IndexedLensInt64s t a bindexing64::Folds a ->IndexedFoldInt64s aindexing64::Getters a ->IndexedGetterInt64s a
indexing64::IndexableInt64p =>LensLike(Indexing64f) s t a b ->Overp f s t a b
asIndex :: (Indexable i p, Contravariant f, Functor f) => p i (f i) -> Indexed i s (f s) Source #
When composed with an IndexedFold or IndexedTraversal this yields an
(Indexed) Fold of the indices.
class (Foldable1 t, Traversable t) => Traversable1 (t :: Type -> Type) where #
Minimal complete definition
traverse1 | sequence1
Instances
| Traversable1 Complex | |
| Traversable1 First | |
| Traversable1 Last | |
| Traversable1 Max | |
| Traversable1 Min | |
| Traversable1 Tree | |
| Traversable1 NonEmpty | |
| Traversable1 Identity | |
| Traversable1 Dual | |
| Traversable1 Product | |
| Traversable1 Sum | |
| Traversable1 Par1 | |
| Traversable1 Plucker | |
| Traversable1 V1 | |
| Traversable1 V2 | |
| Traversable1 V3 | |
| Traversable1 V4 | |
| Traversable1 f => Traversable1 (Cofree f) | |
Defined in Control.Comonad.Cofree | |
| Traversable1 f => Traversable1 (Free f) | |
Defined in Control.Monad.Free | |
| Traversable1 (V1 :: Type -> Type) | |
| Traversable1 f => Traversable1 (Yoneda f) | |
Defined in Data.Functor.Yoneda | |
| Traversable1 f => Traversable1 (Lift f) | |
| Traversable1 ((,) a) | |
Defined in Data.Semigroup.Traversable.Class | |
| (Traversable1 f, Traversable1 m) => Traversable1 (ReaderT f m) | |
Defined in Control.Monad.Representable.Reader | |
| Bitraversable1 p => Traversable1 (Join p) | |
Defined in Data.Semigroup.Traversable.Class | |
| Traversable1 f => Traversable1 (Alt f) | |
| Traversable1 f => Traversable1 (Rec1 f) | |
| Traversable1 f => Traversable1 (AlongsideLeft f b) | |
Defined in Control.Lens.Internal.Getter Methods traverse1 :: Apply f0 => (a -> f0 b0) -> AlongsideLeft f b a -> f0 (AlongsideLeft f b b0) # sequence1 :: Apply f0 => AlongsideLeft f b (f0 b0) -> f0 (AlongsideLeft f b b0) | |
| Traversable1 f => Traversable1 (AlongsideRight f a) | |
Defined in Control.Lens.Internal.Getter Methods traverse1 :: Apply f0 => (a0 -> f0 b) -> AlongsideRight f a a0 -> f0 (AlongsideRight f a b) # sequence1 :: Apply f0 => AlongsideRight f a (f0 b) -> f0 (AlongsideRight f a b) | |
| Traversable1 (Tagged a) | |
Defined in Data.Semigroup.Traversable.Class | |
| Traversable1 f => Traversable1 (Backwards f) | |
| Traversable1 f => Traversable1 (IdentityT f) | |
| Traversable1 f => Traversable1 (Reverse f) | |
| (Traversable1 f, Traversable1 g) => Traversable1 (Product f g) | |
| (Traversable1 f, Traversable1 g) => Traversable1 (Sum f g) | |
| (Traversable1 f, Traversable1 g) => Traversable1 (f :*: g) | |
| (Traversable1 f, Traversable1 g) => Traversable1 (f :+: g) | |
| (Traversable1 f, Traversable1 g) => Traversable1 (Compose f g) | |
| Traversable1 g => Traversable1 (Joker g a) | |
Defined in Data.Semigroup.Traversable.Class | |
| (Traversable1 f, Traversable1 g) => Traversable1 (f :.: g) | |
| Traversable1 f => Traversable1 (M1 i c f) | |
sequenceBy :: Traversable t => (forall x. x -> f x) -> (forall x y. f (x -> y) -> f x -> f y) -> t (f a) -> f (t a) #
traverseBy :: Traversable t => (forall x. x -> f x) -> (forall x y. f (x -> y) -> f x -> f y) -> (a -> f b) -> t a -> f (t b) #
data Sequenced a (m :: Type -> Type) Source #
Used internally by mapM_ and the like.
The argument a of the result should not be used!
See 4.16 Changelog entry for the explanation of "why not Apply f =>"?
data Traversed a (f :: Type -> Type) Source #
Used internally by traverseOf_ and the like.
The argument a of the result should not be used!
Instances
| Applicative f => Monoid (Traversed a f) | |
| Applicative f => Semigroup (Traversed a f) | |
The indexed store can be used to characterize a Lens
and is used by cloneLens.
is isomorphic to
Context a b tnewtype ,
and to Context a b t = Context { runContext :: forall f. Functor f => (a -> f b) -> f t }exists s. (s, .Lens s t a b)
A Context is like a Lens that has already been applied to a some structure.
Constructors
| Context (b -> t) a |
Instances
| IndexedComonad Context | |
| IndexedComonadStore Context | |
Defined in Control.Lens.Internal.Context Methods ipos :: Context a c t -> a Source # ipeek :: c -> Context a c t -> t Source # ipeeks :: (a -> c) -> Context a c t -> t Source # iseek :: b -> Context a c t -> Context b c t Source # iseeks :: (a -> b) -> Context a c t -> Context b c t Source # iexperiment :: Functor f => (b -> f c) -> Context b c t -> f t Source # | |
| IndexedFunctor Context | |
| a ~ b => ComonadStore a (Context a b) | |
Defined in Control.Lens.Internal.Context | |
| a ~ b => Comonad (Context a b) | |
| Functor (Context a b) | |
| Sellable (->) Context | |
Defined in Control.Lens.Internal.Context | |
newtype Bazaar1 (p :: Type -> Type -> Type) a b t Source #
This is used to characterize a Traversal.
a.k.a. indexed Cartesian store comonad, indexed Kleene store comonad, or an indexed FunList.
http://twanvl.nl/blog/haskell/non-regular1
A Bazaar1 is like a Traversal that has already been applied to some structure.
Where a holds an Context a b ta and a function from b to
t, a holds Bazaar1 a b tN as and a function from N
bs to t, (where N might be infinite).
Mnemonically, a Bazaar1 holds many stores and you can easily add more.
This is a final encoding of Bazaar1.
Constructors
| Bazaar1 | |
Fields
| |
Instances
| Profunctor p => Bizarre1 p (Bazaar1 p) | |
Defined in Control.Lens.Internal.Bazaar | |
| Corepresentable p => Sellable p (Bazaar1 p) | |
Defined in Control.Lens.Internal.Bazaar | |
| Conjoined p => IndexedComonad (Bazaar1 p) | |
| IndexedFunctor (Bazaar1 p) | |
| (a ~ b, Conjoined p) => Comonad (Bazaar1 p a b) | |
| (a ~ b, Conjoined p) => ComonadApply (Bazaar1 p a b) | |
| Functor (Bazaar1 p a b) | |
| Apply (Bazaar1 p a b) | |
Defined in Control.Lens.Internal.Bazaar | |
This provides a way to peek at the internal structure of a
Traversal or IndexedTraversal
Instances
| FoldableWithIndex i (Magma i t b) | |
Defined in Control.Lens.Internal.Magma Methods ifoldMap :: Monoid m => (i -> a -> m) -> Magma i t b a -> m # ifoldMap' :: Monoid m => (i -> a -> m) -> Magma i t b a -> m # 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) | |
Defined in Control.Lens.Internal.Magma | |
| TraversableWithIndex i (Magma i t b) | |
Defined in Control.Lens.Internal.Magma Methods itraverse :: Applicative f => (i -> a -> f b0) -> Magma i t b a -> f (Magma i t b b0) # | |
| Functor (Magma i t b) | |
| Foldable (Magma i t b) | |
Defined in Control.Lens.Internal.Magma Methods fold :: Monoid m => Magma i t b m -> m Source # foldMap :: Monoid m => (a -> m) -> Magma i t b a -> m Source # foldMap' :: Monoid m => (a -> m) -> Magma i t b a -> m Source # foldr :: (a -> b0 -> b0) -> b0 -> Magma i t b a -> b0 Source # foldr' :: (a -> b0 -> b0) -> b0 -> Magma i t b a -> b0 Source # foldl :: (b0 -> a -> b0) -> b0 -> Magma i t b a -> b0 Source # foldl' :: (b0 -> a -> b0) -> b0 -> Magma i t b a -> b0 Source # foldr1 :: (a -> a -> a) -> Magma i t b a -> a Source # foldl1 :: (a -> a -> a) -> Magma i t b a -> a Source # toList :: Magma i t b a -> [a] Source # null :: Magma i t b a -> Bool Source # length :: Magma i t b a -> Int Source # elem :: Eq a => a -> Magma i t b a -> Bool Source # maximum :: Ord a => Magma i t b a -> a Source # minimum :: Ord a => Magma i t b a -> a Source # | |
| Traversable (Magma i t b) | |
Defined in Control.Lens.Internal.Magma Methods traverse :: Applicative f => (a -> f b0) -> Magma i t b a -> f (Magma i t b b0) Source # sequenceA :: Applicative f => Magma i t b (f a) -> f (Magma i t b a) Source # mapM :: Monad m => (a -> m b0) -> Magma i t b a -> m (Magma i t b b0) Source # sequence :: Monad m => Magma i t b (m a) -> m (Magma i t b a) Source # | |
| (Show i, Show a) => Show (Magma i t b a) | |
class (Profunctor p, Bifunctor p) => Reviewable (p :: Type -> Type -> Type) Source #
This class is provided mostly for backwards compatibility with lens 3.8, but it can also shorten type signatures.
Instances
| (Profunctor p, Bifunctor p) => Reviewable p | |
Defined in Control.Lens.Internal.Review | |
retagged :: (Profunctor p, Bifunctor p) => p a b -> p s b Source #
This is a profunctor used internally to implement Review
It plays a role similar to that of Accessor
or Const do for Control.Lens.Getter
class (Applicative f, Distributive f, Traversable f) => Settable (f :: Type -> Type) Source #
Minimal complete definition
Instances
| Settable Identity | So you can pass our |
Defined in Control.Lens.Internal.Setter Methods untainted :: Identity a -> a Source # untaintedDot :: Profunctor p => p a (Identity b) -> p a b Source # taintedDot :: Profunctor p => p a b -> p a (Identity b) Source # | |
| Settable f => Settable (Backwards f) | |
Defined in Control.Lens.Internal.Setter Methods untainted :: Backwards f a -> a Source # untaintedDot :: Profunctor p => p a (Backwards f b) -> p a b Source # taintedDot :: Profunctor p => p a b -> p a (Backwards f b) Source # | |
| (Settable f, Settable g) => Settable (Compose f g) | |
Defined in Control.Lens.Internal.Setter Methods untainted :: Compose f g a -> a Source # untaintedDot :: Profunctor p => p a (Compose f g b) -> p a b Source # taintedDot :: Profunctor p => p a b -> p a (Compose f g b) Source # | |
type IndexedLensLike' i (f :: Type -> Type) s a = IndexedLensLike i f s s a a Source #
Convenient alias for constructing simple indexed lenses and their ilk.
type IndexedLensLike i (f :: k -> Type) s (t :: k) a (b :: k) = forall (p :: Type -> Type -> Type). Indexable i p => p a (f b) -> s -> f t Source #
Convenient alias for constructing indexed lenses and their ilk.
type Optical' (p :: k -> k1 -> Type) (q :: k -> k1 -> Type) (f :: k -> k1) (s :: k) (a :: k) = Optical p q f s s a a Source #
type Optical (p :: k -> k1 -> Type) (q :: k2 -> k1 -> Type) (f :: k3 -> k1) (s :: k2) (t :: k3) (a :: k) (b :: k3) = p a (f b) -> q s (f t) Source #
type Optic (p :: k -> k1 -> Type) (f :: k2 -> k1) (s :: k) (t :: k2) (a :: k) (b :: k2) = p a (f b) -> p s (f t) Source #
A valid Optic l should satisfy the laws:
lpure≡purel (Procomposef g) =Procompose(l f) (l g)
This gives rise to the laws for Equality, Iso, Prism, Lens,
Traversal, Traversal1, Setter, Fold, Fold1, and Getter as well
along with their index-preserving variants.
typeLensLikef s t a b =Optic(->) f s t a b
type IndexPreservingFold1 s a = forall (p :: Type -> Type -> Type) (f :: Type -> Type). (Conjoined p, Contravariant f, Apply f) => p a (f a) -> p s (f s) Source #
type IndexedFold1 i s a = forall (p :: Type -> Type -> Type) (f :: Type -> Type). (Indexable i p, Contravariant f, Apply f) => p a (f a) -> s -> f s Source #
type Fold1 s a = forall (f :: Type -> Type). (Contravariant f, Apply f) => (a -> f a) -> s -> f s Source #
A relevant Fold (aka Fold1) has one or more targets.
type IndexPreservingFold s a = forall (p :: Type -> Type -> Type) (f :: Type -> Type). (Conjoined p, Contravariant f, Applicative f) => p a (f a) -> p s (f s) Source #
An IndexPreservingFold can be used as a Fold, but when composed with an IndexedTraversal,
IndexedFold, or IndexedLens yields an IndexedFold respectively.
type IndexPreservingGetter s a = forall (p :: Type -> Type -> Type) (f :: Type -> Type). (Conjoined p, Contravariant f, Functor f) => p a (f a) -> p s (f s) Source #
An IndexPreservingGetter can be used as a Getter, but when composed with an IndexedTraversal,
IndexedFold, or IndexedLens yields an IndexedFold, IndexedFold or IndexedGetter respectively.
type As (a :: k2) = Equality' a a Source #
Composable asTypeOf. Useful for constraining excess
polymorphism, foo . (id :: As Int) . bar.
type Equality (s :: k1) (t :: k2) (a :: k1) (b :: k2) = forall k3 (p :: k1 -> k3 -> Type) (f :: k2 -> k3). p a (f b) -> p s (f t) Source #
A witness that (a ~ s, b ~ t).
Note: Composition with an Equality is index-preserving.
type Review t b = forall (p :: Type -> Type -> Type) (f :: Type -> Type). (Choice p, Bifunctor p, Settable f) => Optic' p f t b Source #
type IndexPreservingSetter' s a = IndexPreservingSetter s s a a Source #
typeIndexedPreservingSetter'i =SimpleIndexedPreservingSetter
type IndexPreservingSetter s t a b = forall (p :: Type -> Type -> Type) (f :: Type -> Type). (Conjoined p, Settable f) => p a (f b) -> p s (f t) Source #
An IndexPreservingSetter can be composed with a IndexedSetter, IndexedTraversal or IndexedLens
and leaves the index intact, yielding an IndexedSetter.
type IndexedSetter' i s a = IndexedSetter i s s a a Source #
typeIndexedSetter'i =Simple(IndexedSetteri)
type IndexedSetter i s t a b = forall (f :: Type -> Type) (p :: Type -> Type -> Type). (Indexable i p, Settable f) => p a (f b) -> s -> f t Source #
Every IndexedSetter is a valid Setter.
The Setter laws are still required to hold.
newtype ReifiedIndexedSetter i s t a b Source #
Reify an IndexedSetter so it can be stored safely in a container.
Constructors
| IndexedSetter | |
Fields
| |
type IndexPreservingTraversal1' s a = IndexPreservingTraversal1 s s a a Source #
type IndexPreservingTraversal1 s t a b = forall (p :: Type -> Type -> Type) (f :: Type -> Type). (Conjoined p, Apply f) => p a (f b) -> p s (f t) Source #
type IndexPreservingTraversal' s a = IndexPreservingTraversal s s a a Source #
type IndexPreservingTraversal s t a b = forall (p :: Type -> Type -> Type) (f :: Type -> Type). (Conjoined p, Applicative f) => p a (f b) -> p s (f t) Source #
An IndexPreservingTraversal leaves any index it is composed with alone.
type IndexedTraversal1' i s a = IndexedTraversal1 i s s a a Source #
type IndexedTraversal1 i s t a b = forall (p :: Type -> Type -> Type) (f :: Type -> Type). (Indexable i p, Apply f) => p a (f b) -> s -> f t Source #
type IndexedTraversal' i s a = IndexedTraversal i s s a a Source #
typeIndexedTraversal'i =Simple(IndexedTraversali)
type Traversal1' s a = Traversal1 s s a a Source #
type Traversal1 s t a b = forall (f :: Type -> Type). Apply f => (a -> f b) -> s -> f t Source #
A Traversal which targets at least one element.
Note that since Apply is not a superclass of Applicative, a Traversal1
cannot always be used in place of a Traversal. In such circumstances
cloneTraversal will convert a Traversal1 into a Traversal.
type IndexPreservingLens' s a = IndexPreservingLens s s a a Source #
type IndexPreservingLens s t a b = forall (p :: Type -> Type -> Type) (f :: Type -> Type). (Conjoined p, Functor f) => p a (f b) -> p s (f t) Source #
An IndexPreservingLens leaves any index it is composed with alone.
type IndexedLens' i s a = IndexedLens i s s a a Source #
typeIndexedLens'i =Simple(IndexedLensi)
type Setting' (p :: Type -> Type -> Type) s a = Setting p s s a a Source #
This is a convenient alias when defining highly polymorphic code that takes both
ASetter' and AnIndexedSetter' as appropriate. If a function takes this it is
expecting one of those two things based on context.
type Setting (p :: Type -> Type -> Type) s t a b = p a (Identity b) -> s -> Identity t Source #
This is a convenient alias when defining highly polymorphic code that takes both
ASetter and AnIndexedSetter as appropriate. If a function takes this it is
expecting one of those two things based on context.
type AnIndexedSetter' i s a = AnIndexedSetter i s s a a Source #
typeAnIndexedSetter'i =Simple(AnIndexedSetteri)
type AnIndexedSetter i s t a b = Indexed i a (Identity b) -> s -> Identity t Source #
Running an IndexedSetter instantiates it to a concrete type.
When consuming a setter directly to perform a mapping, you can use this type, but most user code will not need to use this type.
type ASetter s t a b = (a -> Identity b) -> s -> Identity t Source #
Running a Setter instantiates it to a concrete type.
When consuming a setter directly to perform a mapping, you can use this type, but most user code will not need to use this type.
mapped :: forall (f :: Type -> Type) a b. Functor f => Setter (f a) (f b) a b Source #
This Setter can be used to map over all of the values in a Functor.
fmap≡overmappedfmapDefault≡overtraverse(<$) ≡setmapped
>>>over mapped f [a,b,c][f a,f b,f c]
>>>over mapped (+1) [1,2,3][2,3,4]
>>>set mapped x [a,b,c][x,x,x]
>>>[[a,b],[c]] & mapped.mapped +~ x[[a + x,b + x],[c + x]]
>>>over (mapped._2) length [("hello","world"),("leaders","!!!")][("hello",5),("leaders",3)]
mapped::Functorf =>Setter(f a) (f b) a b
If you want an IndexPreservingSetter use .setting fmap
lifted :: forall (m :: Type -> Type) a b. Monad m => Setter (m a) (m b) a b Source #
This setter can be used to modify all of the values in a Monad.
You sometimes have to use this rather than mapped -- due to
temporary insanity Functor was not a superclass of Monad until
GHC 7.10.
liftM≡overlifted
>>>over lifted f [a,b,c][f a,f b,f c]
>>>set lifted b (Just a)Just b
If you want an IndexPreservingSetter use .setting liftM
contramapped :: forall (f :: Type -> Type) b a. Contravariant f => Setter (f b) (f a) a b Source #
This Setter can be used to map over all of the inputs to a Contravariant.
contramap≡overcontramapped
>>>getPredicate (over contramapped (*2) (Predicate even)) 5True
>>>getOp (over contramapped (*5) (Op show)) 100"500"
>>>Prelude.map ($ 1) $ over (mapped . _Unwrapping' Op . contramapped) (*12) [(*2),(+1),(^3)][24,13,1728]
setting :: ((a -> b) -> s -> t) -> IndexPreservingSetter s t a b Source #
Build an index-preserving Setter from a map-like function.
Your supplied function f is required to satisfy:
fid≡idf g.f h ≡ f (g.h)
Equational reasoning:
setting.over≡idover.setting≡id
Another way to view sets is that it takes a "semantic editor combinator"
and transforms it into a Setter.
setting:: ((a -> b) -> s -> t) ->Setters t a b
sets :: (Profunctor p, Profunctor q, Settable f) => (p a b -> q s t) -> Optical p q f s t a b Source #
Build a Setter, IndexedSetter or IndexPreservingSetter depending on your choice of Profunctor.
sets:: ((a -> b) -> s -> t) ->Setters t a b
cloneIndexPreservingSetter :: ASetter s t a b -> IndexPreservingSetter s t a b Source #
Build an IndexPreservingSetter from any Setter.
cloneIndexedSetter :: AnIndexedSetter i s t a b -> IndexedSetter i s t a b Source #
Clone an IndexedSetter.
set' :: ASetter' s a -> a -> s -> s Source #
Replace the target of a Lens or all of the targets of a Setter'
or Traversal with a constant value, without changing its type.
This is a type restricted version of set, which retains the type of the original.
>>>set' mapped x [a,b,c,d][x,x,x,x]
>>>set' _2 "hello" (1,"world")(1,"hello")
>>>set' mapped 0 [1,2,3,4][0,0,0,0]
Note: Attempting to adjust set' a Fold or Getter will fail at compile time with an
relatively nice error message.
set'::Setter's a -> a -> s -> sset'::Iso's a -> a -> s -> sset'::Lens's a -> a -> s -> sset'::Traversal's a -> a -> s -> s
(<?~) :: ASetter s t a (Maybe b) -> b -> s -> (b, t) infixr 4 Source #
Set to Just a value with pass-through.
This is mostly present for consistency, but may be useful for for chaining assignments.
If you do not need a copy of the intermediate result, then using l directly is a good idea.?~ d
>>>import qualified Data.Map as Map>>>_2.at "hello" <?~ "world" $ (42,Map.fromList [("goodnight","gracie")])("world",(42,fromList [("goodnight","gracie"),("hello","world")]))
(<?~) ::Setters t a (Maybeb) -> b -> s -> (b, t) (<?~) ::Isos t a (Maybeb) -> b -> s -> (b, t) (<?~) ::Lenss t a (Maybeb) -> b -> s -> (b, t) (<?~) ::Traversals t a (Maybeb) -> b -> s -> (b, t)
assign :: MonadState s m => ASetter s s a b -> b -> m () Source #
Replace the target of a Lens or all of the targets of a Setter or Traversal in our monadic
state with a new value, irrespective of the old.
This is an alias for (.=).
>>>execState (do assign _1 c; assign _2 d) (a,b)(c,d)
>>>execState (both .= c) (a,b)(c,c)
assign::MonadStates m =>Iso's a -> a -> m ()assign::MonadStates m =>Lens's a -> a -> m ()assign::MonadStates m =>Traversal's a -> a -> m ()assign::MonadStates m =>Setter's a -> a -> m ()
modifying :: MonadState s m => ASetter s s a b -> (a -> b) -> m () Source #
This is an alias for (%=).
(<~) :: MonadState s m => ASetter s s a b -> m b -> m () infixr 2 Source #
Run a monadic action, and set all of the targets of a Lens, Setter or Traversal to its result.
(<~) ::MonadStates m =>Isos s a b -> m b -> m () (<~) ::MonadStates m =>Lenss s a b -> m b -> m () (<~) ::MonadStates m =>Traversals s a b -> m b -> m () (<~) ::MonadStates m =>Setters s a b -> m b -> m ()
As a reasonable mnemonic, this lets you store the result of a monadic action in a Lens rather than
in a local variable.
do foo <- bar ...
will store the result in a variable, while
do foo <~ bar
...
(<?=) :: MonadState s m => ASetter s s a (Maybe b) -> b -> m b infix 4 Source #
Set Just a value with pass-through
This is useful for chaining assignment without round-tripping through your Monad stack.
do x <-at"foo"<?=ninety_nine_bottles_of_beer_on_the_wall
If you do not need a copy of the intermediate result, then using l will avoid unused binding warnings.?= d
(<?=) ::MonadStates m =>Setters s a (Maybeb) -> b -> m b (<?=) ::MonadStates m =>Isos s a (Maybeb) -> b -> m b (<?=) ::MonadStates m =>Lenss s a (Maybeb) -> b -> m b (<?=) ::MonadStates m =>Traversals s a (Maybeb) -> b -> m b
scribe :: (MonadWriter t m, Monoid s) => ASetter s t a b -> b -> m () Source #
Write to a fragment of a larger Writer format.
passing :: MonadWriter w m => Setter w w u v -> m (a, u -> v) -> m a Source #
This is a generalization of pass that allows you to modify just a
portion of the resulting MonadWriter.
ipassing :: MonadWriter w m => IndexedSetter i w w u v -> m (a, i -> u -> v) -> m a Source #
This is a generalization of pass that allows you to modify just a
portion of the resulting MonadWriter with access to the index of an
IndexedSetter.
censoring :: MonadWriter w m => Setter w w u v -> (u -> v) -> m a -> m a Source #
This is a generalization of censor that allows you to censor just a
portion of the resulting MonadWriter.
icensoring :: MonadWriter w m => IndexedSetter i w w u v -> (i -> u -> v) -> m a -> m a Source #
This is a generalization of censor that allows you to censor just a
portion of the resulting MonadWriter, with access to the index of an
IndexedSetter.
locally :: MonadReader s m => ASetter s s a b -> (a -> b) -> m r -> m r Source #
Modify the value of the Reader environment associated with the target of a
Setter, Lens, or Traversal.
locallylida ≡ alocallyl f.locally l g ≡locallyl (f.g)
>>>(1,1) & locally _1 (+1) (uncurry (+))3
>>>"," & locally ($) ("Hello" <>) (<> " world!")"Hello, world!"
locally :: MonadReader s m =>Isos s a b -> (a -> b) -> m r -> m r locally :: MonadReader s m =>Lenss s a b -> (a -> b) -> m r -> m r locally :: MonadReader s m =>Traversals s a b -> (a -> b) -> m r -> m r locally :: MonadReader s m =>Setters s a b -> (a -> b) -> m r -> m r
ilocally :: MonadReader s m => AnIndexedSetter i s s a b -> (i -> a -> b) -> m r -> m r Source #
This is a generalization of locally that allows one to make indexed
local changes to a Reader environment associated with the target of a
Setter, Lens, or Traversal.
locallyl f ≡ilocallyl f . constilocallyl f ≡locallyl f .Indexed
ilocally :: MonadReader s m =>IndexedLenss s a b -> (i -> a -> b) -> m r -> m r ilocally :: MonadReader s m =>IndexedTraversals s a b -> (i -> a -> b) -> m r -> m r ilocally :: MonadReader s m =>IndexedSetters s a b -> (i -> a -> b) -> m r -> m r
iover :: AnIndexedSetter i s t a b -> (i -> a -> b) -> s -> t Source #
Map with index. This is an alias for imapOf.
When you do not need access to the index, then over is more liberal in what it can accept.
overl ≡ioverl.constioverl ≡overl.Indexed
iover::IndexedSetteri s t a b -> (i -> a -> b) -> s -> tiover::IndexedLensi s t a b -> (i -> a -> b) -> s -> tiover::IndexedTraversali s t a b -> (i -> a -> b) -> s -> t
iset :: AnIndexedSetter i s t a b -> (i -> b) -> s -> t Source #
Set with index. Equivalent to iover with the current value ignored.
When you do not need access to the index, then set is more liberal in what it can accept.
setl ≡isetl.const
iset::IndexedSetteri s t a b -> (i -> b) -> s -> tiset::IndexedLensi s t a b -> (i -> b) -> s -> tiset::IndexedTraversali s t a b -> (i -> b) -> s -> t
isets :: ((i -> a -> b) -> s -> t) -> IndexedSetter i s t a b Source #
Build an IndexedSetter from an imap-like function.
Your supplied function f is required to satisfy:
fid≡idf g.f h ≡ f (g.h)
Equational reasoning:
isets.iover≡idiover.isets≡id
Another way to view isets is that it takes a "semantic editor combinator"
which has been modified to carry an index and transforms it into a IndexedSetter.
(.@~) :: AnIndexedSetter i s t a b -> (i -> b) -> s -> t infixr 4 Source #
Replace every target of an IndexedSetter, IndexedLens or IndexedTraversal
with access to the index.
(.@~) ≡iset
When you do not need access to the index then (.~) is more liberal in what it can accept.
l.~b ≡ l.@~constb
(.@~) ::IndexedSetteri s t a b -> (i -> b) -> s -> t (.@~) ::IndexedLensi s t a b -> (i -> b) -> s -> t (.@~) ::IndexedTraversali s t a b -> (i -> b) -> s -> t
(%@=) :: MonadState s m => AnIndexedSetter i s s a b -> (i -> a -> b) -> m () infix 4 Source #
Adjust every target in the current state of an IndexedSetter, IndexedLens or IndexedTraversal
with access to the index.
When you do not need access to the index then (%=) is more liberal in what it can accept.
l%=f ≡ l%@=constf
(%@=) ::MonadStates m =>IndexedSetteri s s a b -> (i -> a -> b) -> m () (%@=) ::MonadStates m =>IndexedLensi s s a b -> (i -> a -> b) -> m () (%@=) ::MonadStates m =>IndexedTraversali s t a b -> (i -> a -> b) -> m ()
imodifying :: MonadState s m => AnIndexedSetter i s s a b -> (i -> a -> b) -> m () Source #
This is an alias for (%@=).
(.@=) :: MonadState s m => AnIndexedSetter i s s a b -> (i -> b) -> m () infix 4 Source #
Replace every target in the current state of an IndexedSetter, IndexedLens or IndexedTraversal
with access to the index.
When you do not need access to the index then (.=) is more liberal in what it can accept.
l.=b ≡ l.@=constb
(.@=) ::MonadStates m =>IndexedSetteri s s a b -> (i -> b) -> m () (.@=) ::MonadStates m =>IndexedLensi s s a b -> (i -> b) -> m () (.@=) ::MonadStates m =>IndexedTraversali s t a b -> (i -> b) -> m ()
assignA :: Arrow p => ASetter s t a b -> p s b -> p s t Source #
Run an arrow command and use the output to set all the targets of
a Lens, Setter or Traversal to the result.
assignA can be used very similarly to (<~), except that the type of
the object being modified can change; for example:
runKleisli action ((), (), ()) where
action = assignA _1 (Kleisli (const getVal1))
>>> assignA _2 (Kleisli (const getVal2))
>>> assignA _3 (Kleisli (const getVal3))
getVal1 :: Either String Int
getVal1 = ...
getVal2 :: Either String Bool
getVal2 = ...
getVal3 :: Either String Char
getVal3 = ...
has the type Either String (Int, Bool, Char)
assignA::Arrowp =>Isos t a b -> p s b -> p s tassignA::Arrowp =>Lenss t a b -> p s b -> p s tassignA::Arrowp =>Traversals t a b -> p s b -> p s tassignA::Arrowp =>Setters t a b -> p s b -> p s t
imapOf :: AnIndexedSetter i s t a b -> (i -> a -> b) -> s -> t Source #
Map with index. (Deprecated alias for iover).
When you do not need access to the index, then mapOf is more liberal in what it can accept.
mapOfl ≡imapOfl.const
imapOf::IndexedSetteri s t a b -> (i -> a -> b) -> s -> timapOf::IndexedLensi s t a b -> (i -> a -> b) -> s -> timapOf::IndexedTraversali s t a b -> (i -> a -> b) -> s -> t
type AnIndexedLens' i s a = AnIndexedLens i s s a a Source #
typeAnIndexedLens'=Simple(AnIndexedLensi)
type AnIndexedLens i s t a b = Optical (Indexed i) (->) (Pretext (Indexed i) a b) s t a b Source #
When you see this as an argument to a function, it expects an IndexedLens
withLens :: ALens s t a b -> ((s -> a) -> (s -> b -> t) -> r) -> r Source #
Obtain a getter and a setter from a lens, reversing lens.
iplens :: (s -> a) -> (s -> b -> t) -> IndexPreservingLens s t a b Source #
ilens :: (s -> (i, a)) -> (s -> b -> t) -> IndexedLens i s t a b Source #
Build an IndexedLens from a Getter and
a Setter.
(&~) :: s -> State s a -> s infixl 1 Source #
This can be used to chain lens operations using op= syntax
rather than op~ syntax for simple non-type-changing cases.
>>>(10,20) & _1 .~ 30 & _2 .~ 40(30,40)
>>>(10,20) &~ do _1 .= 30; _2 .= 40(30,40)
This does not support type-changing assignment, e.g.
>>>(10,20) & _1 .~ "hello"("hello",20)
(%%~) :: forall {k} f s (t :: k) a (b :: k). LensLike f s t a b -> (a -> f b) -> s -> f t infixr 4 Source #
(%%~) can be used in one of two scenarios:
When applied to a Lens, it can edit the target of the Lens in a
structure, extracting a functorial result.
When applied to a Traversal, it can edit the
targets of the traversals, extracting an applicative summary of its
actions.
>>>[66,97,116,109,97,110] & each %%~ \a -> ("na", chr a)("nananananana","Batman")
For all that the definition of this combinator is just:
(%%~) ≡id
It may be beneficial to think about it as if it had these even more restricted types, however:
(%%~) ::Functorf =>Isos t a b -> (a -> f b) -> s -> f t (%%~) ::Functorf =>Lenss t a b -> (a -> f b) -> s -> f t (%%~) ::Applicativef =>Traversals t a b -> (a -> f b) -> s -> f t
When applied to a Traversal, it can edit the
targets of the traversals, extracting a supplemental monoidal summary
of its actions, by choosing f = ((,) m)
(%%~) ::Isos t a b -> (a -> (r, b)) -> s -> (r, t) (%%~) ::Lenss t a b -> (a -> (r, b)) -> s -> (r, t) (%%~) ::Monoidm =>Traversals t a b -> (a -> (m, b)) -> s -> (m, t)
(%%=) :: forall {k} s m p r (a :: k) b. MonadState s m => Over p ((,) r) s s a b -> p a (r, b) -> m r infix 4 Source #
Modify the target of a Lens in the current state returning some extra
information of type r or modify all targets of a
Traversal in the current state, extracting extra
information of type r and return a monoidal summary of the changes.
>>>runState (_1 %%= \x -> (f x, g x)) (a,b)(f a,(g a,b))
(%%=) ≡ (state.)
It may be useful to think of (%%=), instead, as having either of the
following more restricted type signatures:
(%%=) ::MonadStates m =>Isos s a b -> (a -> (r, b)) -> m r (%%=) ::MonadStates m =>Lenss s a b -> (a -> (r, b)) -> m r (%%=) :: (MonadStates m,Monoidr) =>Traversals s a b -> (a -> (r, b)) -> m r
(??) :: Functor f => f (a -> b) -> a -> f b infixl 1 Source #
This is convenient to flip argument order of composite functions defined as:
fab ?? a = fmap ($ a) fab
For the Functor instance f = ((->) r) you can reason about this function as if the definition was (:??) ≡ flip
>>>(h ?? x) ah a x
>>>execState ?? [] $ modify (1:)[1]
>>>over _2 ?? ("hello","world") $ length("hello",5)
>>>over ?? length ?? ("hello","world") $ _2("hello",5)
choosing :: Functor f => LensLike f s t a b -> LensLike f s' t' a b -> LensLike f (Either s s') (Either t t') a b Source #
Merge two lenses, getters, setters, folds or traversals.
chosen≡choosingidid
choosing::Getters a ->Getters' a ->Getter(Eithers s') achoosing::Folds a ->Folds' a ->Fold(Eithers s') achoosing::Lens's a ->Lens's' a ->Lens'(Eithers s') achoosing::Traversal's a ->Traversal's' a ->Traversal'(Eithers s') achoosing::Setter's a ->Setter's' a ->Setter'(Eithers s') a
chosen :: forall a b p f. (Conjoined p, Functor f) => p a (f b) -> p (Either a a) (f (Either b b)) Source #
This is a Lens that updates either side of an Either, where both sides have the same type.
chosen≡choosingidid
>>>Left a^.chosena
>>>Right a^.chosena
>>>Right "hello"^.chosen"hello"
>>>Right a & chosen *~ bRight (a * b)
chosen::Lens(Eithera a) (Eitherb b) a bchosenf (Lefta) =Left<$>f achosenf (Righta) =Right<$>f a
locus :: forall (p :: Type -> Type -> Type -> Type) a c s b. IndexedComonadStore p => Lens (p a c s) (p b c s) a b Source #
This Lens lets you view the current pos of any indexed
store comonad and seek to a new position. This reduces the API
for working these instances to a single Lens.
iposw ≡ w^.locusiseeks w ≡ w&locus.~siseeksf w ≡ w&locus%~f
locus::Lens'(Context'a s) alocus::Conjoinedp =>Lens'(Pretext'p a s) alocus::Conjoinedp =>Lens'(PretextT'p g a s) a
cloneIndexPreservingLens :: ALens s t a b -> IndexPreservingLens s t a b Source #
Clone a Lens as an IndexedPreservingLens that just passes through whatever
index is on any IndexedLens, IndexedFold, IndexedGetter or IndexedTraversal it is composed with.
cloneIndexedLens :: AnIndexedLens i s t a b -> IndexedLens i s t a b Source #
Clone an IndexedLens as an IndexedLens with the same index.
(<//~) :: Fractional a => LensLike ((,) a) s t a a -> a -> s -> (a, t) infixr 4 Source #
Divide the target of a fractionally valued Lens and return the result.
When you do not need the result of the division, (//~) is more flexible.
(<//~) ::Fractionala =>Lens's a -> a -> s -> (a, s) (<//~) ::Fractionala =>Iso's a -> a -> s -> (a, s)
(<^^~) :: (Fractional a, Integral e) => LensLike ((,) a) s t a a -> e -> s -> (a, t) infixr 4 Source #
Raise the target of a fractionally valued Lens to an Integral power
and return the result.
When you do not need the result of the operation, (^^~) is more flexible.
(<^^~) :: (Fractionala,Integrale) =>Lens's a -> e -> s -> (a, s) (<^^~) :: (Fractionala,Integrale) =>Iso's a -> e -> s -> (a, s)
(<<?~) :: LensLike ((,) a) s t a (Maybe b) -> b -> s -> (a, t) infixr 4 Source #
Replace the target of a Lens with a Just value, but return the old value.
If you do not need the old value (?~) is more flexible.
>>>import qualified Data.Map as Map>>>_2.at "hello" <<?~ "world" $ (42,Map.fromList [("goodnight","gracie")])(Nothing,(42,fromList [("goodnight","gracie"),("hello","world")]))
(<<?~) ::Isos t a (Maybeb) -> b -> s -> (a, t) (<<?~) ::Lenss t a (Maybeb) -> b -> s -> (a, t) (<<?~) ::Traversals t a (Maybeb) -> b -> s -> (a, t)
(<<+~) :: Num a => LensLike' ((,) a) s a -> a -> s -> (a, s) infixr 4 Source #
Increment the target of a numerically valued Lens and return the old value.
When you do not need the old value, (+~) is more flexible.
>>>(a,b) & _1 <<+~ c(a,(a + c,b))
>>>(a,b) & _2 <<+~ c(b,(a,b + c))
(<<+~) ::Numa =>Lens's a -> a -> s -> (a, s) (<<+~) ::Numa =>Iso's a -> a -> s -> (a, s)
(<<-~) :: Num a => LensLike' ((,) a) s a -> a -> s -> (a, s) infixr 4 Source #
Decrement the target of a numerically valued Lens and return the old value.
When you do not need the old value, (-~) is more flexible.
>>>(a,b) & _1 <<-~ c(a,(a - c,b))
>>>(a,b) & _2 <<-~ c(b,(a,b - c))
(<<-~) ::Numa =>Lens's a -> a -> s -> (a, s) (<<-~) ::Numa =>Iso's a -> a -> s -> (a, s)
(<<*~) :: Num a => LensLike' ((,) a) s a -> a -> s -> (a, s) infixr 4 Source #
Multiply the target of a numerically valued Lens and return the old value.
When you do not need the old value, (-~) is more flexible.
>>>(a,b) & _1 <<*~ c(a,(a * c,b))
>>>(a,b) & _2 <<*~ c(b,(a,b * c))
(<<*~) ::Numa =>Lens's a -> a -> s -> (a, s) (<<*~) ::Numa =>Iso's a -> a -> s -> (a, s)
(<<//~) :: Fractional a => LensLike' ((,) a) s a -> a -> s -> (a, s) infixr 4 Source #
Divide the target of a numerically valued Lens and return the old value.
When you do not need the old value, (//~) is more flexible.
>>>(a,b) & _1 <<//~ c(a,(a / c,b))
>>>("Hawaii",10) & _2 <<//~ 2(10.0,("Hawaii",5.0))
(<<//~) :: Fractional a =>Lens's a -> a -> s -> (a, s) (<<//~) :: Fractional a =>Iso's a -> a -> s -> (a, s)
(<<^^~) :: (Fractional a, Integral e) => LensLike' ((,) a) s a -> e -> s -> (a, s) infixr 4 Source #
Raise the target of a fractionally valued Lens to an integral power and return the old value.
When you do not need the old value, (^^~) is more flexible.
(<<^^~) :: (Fractionala,Integrale) =>Lens's a -> e -> s -> (a, s) (<<^^~) :: (Fractionala,Integrale) =>Iso's a -> e -> S -> (a, s)
(<<**~) :: Floating a => LensLike' ((,) a) s a -> a -> s -> (a, s) infixr 4 Source #
Raise the target of a floating-point valued Lens to an arbitrary power and return the old value.
When you do not need the old value, (**~) is more flexible.
>>>(a,b) & _1 <<**~ c(a,(a**c,b))
>>>(a,b) & _2 <<**~ c(b,(a,b**c))
(<<**~) ::Floatinga =>Lens's a -> a -> s -> (a, s) (<<**~) ::Floatinga =>Iso's a -> a -> s -> (a, s)
(<<||~) :: LensLike' ((,) Bool) s Bool -> Bool -> s -> (Bool, s) infixr 4 Source #
Logically || the target of a Bool-valued Lens and return the old value.
When you do not need the old value, (||~) is more flexible.
>>>(False,6) & _1 <<||~ True(False,(True,6))
>>>("hello",True) & _2 <<||~ False(True,("hello",True))
(<<||~) ::Lens'sBool->Bool-> s -> (Bool, s) (<<||~) ::Iso'sBool->Bool-> s -> (Bool, s)
(<<&&~) :: LensLike' ((,) Bool) s Bool -> Bool -> s -> (Bool, s) infixr 4 Source #
Logically && the target of a Bool-valued Lens and return the old value.
When you do not need the old value, (&&~) is more flexible.
>>>(False,6) & _1 <<&&~ True(False,(False,6))
>>>("hello",True) & _2 <<&&~ False(True,("hello",False))
(<<&&~) ::Lens's Bool -> Bool -> s -> (Bool, s) (<<&&~) ::Iso's Bool -> Bool -> s -> (Bool, s)
(<<<>~) :: Semigroup r => LensLike' ((,) r) s r -> r -> s -> (r, s) infixr 4 Source #
Modify the target of a monoidally valued Lens by using (<>) a new value and return the old value.
When you do not need the old value, (<>~) is more flexible.
>>>(Sum a,b) & _1 <<<>~ Sum c(Sum {getSum = a},(Sum {getSum = a + c},b))
>>>_2 <<<>~ ", 007" $ ("James", "Bond")("Bond",("James","Bond, 007"))
(<<<>~) ::Semigroupr =>Lens's r -> r -> s -> (r, s) (<<<>~) ::Semigroupr =>Iso's r -> r -> s -> (r, s)
(<%=) :: MonadState s m => LensLike ((,) b) s s a b -> (a -> b) -> m b infix 4 Source #
Modify the target of a Lens into your Monad's state by a user supplied
function and return the result.
When applied to a Traversal, it this will return a monoidal summary of all of the intermediate
results.
When you do not need the result of the operation, (%=) is more flexible.
(<%=) ::MonadStates m =>Lens's a -> (a -> a) -> m a (<%=) ::MonadStates m =>Iso's a -> (a -> a) -> m a (<%=) :: (MonadStates m,Monoida) =>Traversal's a -> (a -> a) -> m a
(<+=) :: (MonadState s m, Num a) => LensLike' ((,) a) s a -> a -> m a infix 4 Source #
Add to the target of a numerically valued Lens into your Monad's state
and return the result.
When you do not need the result of the addition, (+=) is more
flexible.
(<+=) :: (MonadStates m,Numa) =>Lens's a -> a -> m a (<+=) :: (MonadStates m,Numa) =>Iso's a -> a -> m a
(<-=) :: (MonadState s m, Num a) => LensLike' ((,) a) s a -> a -> m a infix 4 Source #
Subtract from the target of a numerically valued Lens into your Monad's
state and return the result.
When you do not need the result of the subtraction, (-=) is more
flexible.
(<-=) :: (MonadStates m,Numa) =>Lens's a -> a -> m a (<-=) :: (MonadStates m,Numa) =>Iso's a -> a -> m a
(<*=) :: (MonadState s m, Num a) => LensLike' ((,) a) s a -> a -> m a infix 4 Source #
Multiply the target of a numerically valued Lens into your Monad's
state and return the result.
When you do not need the result of the multiplication, (*=) is more
flexible.
(<*=) :: (MonadStates m,Numa) =>Lens's a -> a -> m a (<*=) :: (MonadStates m,Numa) =>Iso's a -> a -> m a
(<//=) :: (MonadState s m, Fractional a) => LensLike' ((,) a) s a -> a -> m a infix 4 Source #
Divide the target of a fractionally valued Lens into your Monad's state
and return the result.
When you do not need the result of the division, (//=) is more flexible.
(<//=) :: (MonadStates m,Fractionala) =>Lens's a -> a -> m a (<//=) :: (MonadStates m,Fractionala) =>Iso's a -> a -> m a
(<^=) :: (MonadState s m, Num a, Integral e) => LensLike' ((,) a) s a -> e -> m a infix 4 Source #
Raise the target of a numerically valued Lens into your Monad's state
to a non-negative Integral power and return the result.
When you do not need the result of the operation, (^=) is more flexible.
(<^=) :: (MonadStates m,Numa,Integrale) =>Lens's a -> e -> m a (<^=) :: (MonadStates m,Numa,Integrale) =>Iso's a -> e -> m a
(<^^=) :: (MonadState s m, Fractional a, Integral e) => LensLike' ((,) a) s a -> e -> m a infix 4 Source #
Raise the target of a fractionally valued Lens into your Monad's state
to an Integral power and return the result.
When you do not need the result of the operation, (^^=) is more flexible.
(<^^=) :: (MonadStates m,Fractionalb,Integrale) =>Lens's a -> e -> m a (<^^=) :: (MonadStates m,Fractionalb,Integrale) =>Iso's a -> e -> m a
(<**=) :: (MonadState s m, Floating a) => LensLike' ((,) a) s a -> a -> m a infix 4 Source #
Raise the target of a floating-point valued Lens into your Monad's
state to an arbitrary power and return the result.
When you do not need the result of the operation, (**=) is more flexible.
(<**=) :: (MonadStates m,Floatinga) =>Lens's a -> a -> m a (<**=) :: (MonadStates m,Floatinga) =>Iso's a -> a -> m a
(<<%=) :: (Strong p, MonadState s m) => Over p ((,) a) s s a b -> p a b -> m a infix 4 Source #
Modify the target of a Lens into your Monad's state by a user supplied
function and return the old value that was replaced.
When applied to a Traversal, this will return a monoidal summary of all of the old values
present.
When you do not need the result of the operation, (%=) is more flexible.
(<<%=) ::MonadStates m =>Lens's a -> (a -> a) -> m a (<<%=) ::MonadStates m =>Iso's a -> (a -> a) -> m a (<<%=) :: (MonadStates m,Monoida) =>Traversal's a -> (a -> a) -> m a
(<<%=) ::MonadStates m =>LensLike((,)a) s s a b -> (a -> b) -> m a
(<<.=) :: MonadState s m => LensLike ((,) a) s s a b -> b -> m a infix 4 Source #
Replace the target of a Lens into your Monad's state with a user supplied
value and return the old value that was replaced.
When applied to a Traversal, this will return a monoidal summary of all of the old values
present.
When you do not need the result of the operation, (.=) is more flexible.
(<<.=) ::MonadStates m =>Lens's a -> a -> m a (<<.=) ::MonadStates m =>Iso's a -> a -> m a (<<.=) :: (MonadStates m,Monoida) =>Traversal's a -> a -> m a
(<<?=) :: MonadState s m => LensLike ((,) a) s s a (Maybe b) -> b -> m a infix 4 Source #
Replace the target of a Lens into your Monad's state with Just a user supplied
value and return the old value that was replaced.
When applied to a Traversal, this will return a monoidal summary of all of the old values
present.
When you do not need the result of the operation, (?=) is more flexible.
(<<?=) ::MonadStates m =>Lenss t a (Maybe b) -> b -> m a (<<?=) ::MonadStates m =>Isos t a (Maybe b) -> b -> m a (<<?=) :: (MonadStates m,Monoida) =>Traversals t a (Maybe b) -> b -> m a
(<<+=) :: (MonadState s m, Num a) => LensLike' ((,) a) s a -> a -> m a infix 4 Source #
Modify the target of a Lens into your Monad's state by adding a value
and return the old value that was replaced.
When you do not need the result of the operation, (+=) is more flexible.
(<<+=) :: (MonadStates m,Numa) =>Lens's a -> a -> m a (<<+=) :: (MonadStates m,Numa) =>Iso's a -> a -> m a
(<<-=) :: (MonadState s m, Num a) => LensLike' ((,) a) s a -> a -> m a infix 4 Source #
Modify the target of a Lens into your Monad's state by subtracting a value
and return the old value that was replaced.
When you do not need the result of the operation, (-=) is more flexible.
(<<-=) :: (MonadStates m,Numa) =>Lens's a -> a -> m a (<<-=) :: (MonadStates m,Numa) =>Iso's a -> a -> m a
(<<*=) :: (MonadState s m, Num a) => LensLike' ((,) a) s a -> a -> m a infix 4 Source #
Modify the target of a Lens into your Monad's state by multipling a value
and return the old value that was replaced.
When you do not need the result of the operation, (*=) is more flexible.
(<<*=) :: (MonadStates m,Numa) =>Lens's a -> a -> m a (<<*=) :: (MonadStates m,Numa) =>Iso's a -> a -> m a
(<<//=) :: (MonadState s m, Fractional a) => LensLike' ((,) a) s a -> a -> m a infix 4 Source #
Modify the target of a Lens into your Monads state by dividing by a value
and return the old value that was replaced.
When you do not need the result of the operation, (//=) is more flexible.
(<<//=) :: (MonadStates m,Fractionala) =>Lens's a -> a -> m a (<<//=) :: (MonadStates m,Fractionala) =>Iso's a -> a -> m a
(<<^=) :: (MonadState s m, Num a, Integral e) => LensLike' ((,) a) s a -> e -> m a infix 4 Source #
Modify the target of a Lens into your Monad's state by raising it by a non-negative power
and return the old value that was replaced.
When you do not need the result of the operation, (^=) is more flexible.
(<<^=) :: (MonadStates m,Numa,Integrale) =>Lens's a -> e -> m a (<<^=) :: (MonadStates m,Numa,Integrale) =>Iso's a -> a -> m a
(<<^^=) :: (MonadState s m, Fractional a, Integral e) => LensLike' ((,) a) s a -> e -> m a infix 4 Source #
Modify the target of a Lens into your Monad's state by raising it by an integral power
and return the old value that was replaced.
When you do not need the result of the operation, (^^=) is more flexible.
(<<^^=) :: (MonadStates m,Fractionala,Integrale) =>Lens's a -> e -> m a (<<^^=) :: (MonadStates m,Fractionala,Integrale) =>Iso's a -> e -> m a
(<<**=) :: (MonadState s m, Floating a) => LensLike' ((,) a) s a -> a -> m a infix 4 Source #
Modify the target of a Lens into your Monad's state by raising it by an arbitrary power
and return the old value that was replaced.
When you do not need the result of the operation, (**=) is more flexible.
(<<**=) :: (MonadStates m,Floatinga) =>Lens's a -> a -> m a (<<**=) :: (MonadStates m,Floatinga) =>Iso's a -> a -> m a
(<<||=) :: MonadState s m => LensLike' ((,) Bool) s Bool -> Bool -> m Bool infix 4 Source #
Modify the target of a Lens into your Monad's state by taking its logical || with a value
and return the old value that was replaced.
When you do not need the result of the operation, (||=) is more flexible.
(<<||=) ::MonadStates m =>Lens'sBool->Bool-> mBool(<<||=) ::MonadStates m =>Iso'sBool->Bool-> mBool
(<<&&=) :: MonadState s m => LensLike' ((,) Bool) s Bool -> Bool -> m Bool infix 4 Source #
Modify the target of a Lens into your Monad's state by taking its logical && with a value
and return the old value that was replaced.
When you do not need the result of the operation, (&&=) is more flexible.
(<<&&=) ::MonadStates m =>Lens'sBool->Bool-> mBool(<<&&=) ::MonadStates m =>Iso'sBool->Bool-> mBool
(<<<>=) :: (MonadState s m, Semigroup r) => LensLike' ((,) r) s r -> r -> m r infix 4 Source #
Modify the target of a Lens into your Monad's state by using (<>)
and return the old value that was replaced.
When you do not need the result of the operation, (<>=) is more flexible.
(<<<>=) :: (MonadStates m,Semigroupr) =>Lens's r -> r -> m r (<<<>=) :: (MonadStates m,Semigroupr) =>Iso's r -> r -> m r
(<<~) :: MonadState s m => ALens s s a b -> m b -> m b infixr 2 Source #
Run a monadic action, and set the target of Lens to its result.
(<<~) ::MonadStates m =>Isos s a b -> m b -> m b (<<~) ::MonadStates m =>Lenss s a b -> m b -> m b
NB: This is limited to taking an actual Lens than admitting a Traversal because
there are potential loss of state issues otherwise.
(<%@~) :: Over (Indexed i) ((,) b) s t a b -> (i -> a -> b) -> s -> (b, t) infixr 4 Source #
Adjust the target of an IndexedLens returning the intermediate result, or
adjust all of the targets of an IndexedTraversal and return a monoidal summary
along with the answer.
l<%~f ≡ l<%@~constf
When you do not need access to the index then (<%~) is more liberal in what it can accept.
If you do not need the intermediate result, you can use (%@~) or even (%~).
(<%@~) ::IndexedLensi s t a b -> (i -> a -> b) -> s -> (b, t) (<%@~) ::Monoidb =>IndexedTraversali s t a b -> (i -> a -> b) -> s -> (b, t)
(<<%@~) :: Over (Indexed i) ((,) a) s t a b -> (i -> a -> b) -> s -> (a, t) infixr 4 Source #
Adjust the target of an IndexedLens returning the old value, or
adjust all of the targets of an IndexedTraversal and return a monoidal summary
of the old values along with the answer.
(<<%@~) ::IndexedLensi s t a b -> (i -> a -> b) -> s -> (a, t) (<<%@~) ::Monoida =>IndexedTraversali s t a b -> (i -> a -> b) -> s -> (a, t)
(%%@~) :: forall {k1} i f s (t :: k1) a (b :: k1). Over (Indexed i) f s t a b -> (i -> a -> f b) -> s -> f t infixr 4 Source #
Adjust the target of an IndexedLens returning a supplementary result, or
adjust all of the targets of an IndexedTraversal and return a monoidal summary
of the supplementary results and the answer.
(%%@~) ≡withIndex
(%%@~) ::Functorf =>IndexedLensi s t a b -> (i -> a -> f b) -> s -> f t (%%@~) ::Applicativef =>IndexedTraversali s t a b -> (i -> a -> f b) -> s -> f t
In particular, it is often useful to think of this function as having one of these even more restricted type signatures:
(%%@~) ::IndexedLensi s t a b -> (i -> a -> (r, b)) -> s -> (r, t) (%%@~) ::Monoidr =>IndexedTraversali s t a b -> (i -> a -> (r, b)) -> s -> (r, t)
(%%@=) :: MonadState s m => Over (Indexed i) ((,) r) s s a b -> (i -> a -> (r, b)) -> m r infix 4 Source #
Adjust the target of an IndexedLens returning a supplementary result, or
adjust all of the targets of an IndexedTraversal within the current state, and
return a monoidal summary of the supplementary results.
l%%@=f ≡state(l%%@~f)
(%%@=) ::MonadStates m =>IndexedLensi s s a b -> (i -> a -> (r, b)) -> s -> m r (%%@=) :: (MonadStates m,Monoidr) =>IndexedTraversali s s a b -> (i -> a -> (r, b)) -> s -> m r
(<%@=) :: MonadState s m => Over (Indexed i) ((,) b) s s a b -> (i -> a -> b) -> m b infix 4 Source #
Adjust the target of an IndexedLens returning the intermediate result, or
adjust all of the targets of an IndexedTraversal within the current state, and
return a monoidal summary of the intermediate results.
(<%@=) ::MonadStates m =>IndexedLensi s s a b -> (i -> a -> b) -> m b (<%@=) :: (MonadStates m,Monoidb) =>IndexedTraversali s s a b -> (i -> a -> b) -> m b
(<<%@=) :: MonadState s m => Over (Indexed i) ((,) a) s s a b -> (i -> a -> b) -> m a infix 4 Source #
Adjust the target of an IndexedLens returning the old value, or
adjust all of the targets of an IndexedTraversal within the current state, and
return a monoidal summary of the old values.
(<<%@=) ::MonadStates m =>IndexedLensi s s a b -> (i -> a -> b) -> m a (<<%@=) :: (MonadStates m,Monoidb) =>IndexedTraversali s s a b -> (i -> a -> b) -> m a
(#=) :: MonadState s m => ALens s s a b -> b -> m () infix 4 Source #
(#%=) :: MonadState s m => ALens s s a b -> (a -> b) -> m () infix 4 Source #
(<#%=) :: MonadState s m => ALens s s a b -> (a -> b) -> m b infix 4 Source #
(#%%=) :: MonadState s m => ALens s s a b -> (a -> (r, b)) -> m r infix 4 Source #
(<#=) :: MonadState s m => ALens s s a b -> b -> m b infix 4 Source #
united :: forall a f. Functor f => (() -> f ()) -> a -> f a Source #
We can always retrieve a () from any type.
>>>"hello"^.united()
>>>"hello" & united .~ ()"hello"
head1 :: forall (t :: Type -> Type) a. Traversable1 t => Lens' (t a) a Source #
A Lens focusing on the first element of a Traversable1 container.
>>>2 :| [3, 4] & head1 +~ 1012 :| [3,4]
>>>Identity True ^. head1True
last1 :: forall (t :: Type -> Type) a. Traversable1 t => Lens' (t a) a Source #
A Lens focusing on the last element of a Traversable1 container.
>>>2 :| [3, 4] & last1 +~ 102 :| [3,14]
>>>Node 'a' [Node 'b' [], Node 'c' []] ^. last1'c'
class Field19 s t a b | s -> a, t -> b, s b -> t, t a -> s where Source #
Provides access to the 19th field of a tuple.
Minimal complete definition
Nothing
Methods
Access the 19th field of a tuple.
class Field18 s t a b | s -> a, t -> b, s b -> t, t a -> s where Source #
Provides access to the 18th field of a tuple.
Minimal complete definition
Nothing
Methods
Access the 18th field of a tuple.
Instances
| 18 <= n => Field18 (V n a) (V n a) a a | |
| Field18 (a, b, c, d, e, f, g, h, i, j, kk, l, m, n, o, p, q, r) (a, b, c, d, e, f, g, h, i, j, kk, l, m, n, o, p, q, r') r r' | |
Defined in Control.Lens.Tuple | |
| Field18 (a, b, c, d, e, f, g, h, i, j, kk, l, m, n, o, p, q, r, s) (a, b, c, d, e, f, g, h, i, j, kk, l, m, n, o, p, q, r', s) r r' | |
Defined in Control.Lens.Tuple | |
class Field17 s t a b | s -> a, t -> b, s b -> t, t a -> s where Source #
Provides access to the 17th field of a tuple.
Minimal complete definition
Nothing
Methods
Access the 17th field of a tuple.
Instances
| 17 <= n => Field17 (V n a) (V n a) a a | |
| Field17 (a, b, c, d, e, f, g, h, i, j, kk, l, m, n, o, p, q) (a, b, c, d, e, f, g, h, i, j, kk, l, m, n, o, p, q') q q' | |
Defined in Control.Lens.Tuple | |
| Field17 (a, b, c, d, e, f, g, h, i, j, kk, l, m, n, o, p, q, r) (a, b, c, d, e, f, g, h, i, j, kk, l, m, n, o, p, q', r) q q' | |
Defined in Control.Lens.Tuple | |
| Field17 (a, b, c, d, e, f, g, h, i, j, kk, l, m, n, o, p, q, r, s) (a, b, c, d, e, f, g, h, i, j, kk, l, m, n, o, p, q', r, s) q q' | |
Defined in Control.Lens.Tuple | |
class Field16 s t a b | s -> a, t -> b, s b -> t, t a -> s where Source #
Provides access to the 16th field of a tuple.
Minimal complete definition
Nothing
Methods
Access the 16th field of a tuple.
Instances
| 16 <= n => Field16 (V n a) (V n a) a a | |
| Field16 (a, b, c, d, e, f, g, h, i, j, kk, l, m, n, o, p) (a, b, c, d, e, f, g, h, i, j, kk, l, m, n, o, p') p p' | |
Defined in Control.Lens.Tuple | |
| Field16 (a, b, c, d, e, f, g, h, i, j, kk, l, m, n, o, p, q) (a, b, c, d, e, f, g, h, i, j, kk, l, m, n, o, p', q) p p' | |
Defined in Control.Lens.Tuple | |
| Field16 (a, b, c, d, e, f, g, h, i, j, kk, l, m, n, o, p, q, r) (a, b, c, d, e, f, g, h, i, j, kk, l, m, n, o, p', q, r) p p' | |
Defined in Control.Lens.Tuple | |
| Field16 (a, b, c, d, e, f, g, h, i, j, kk, l, m, n, o, p, q, r, s) (a, b, c, d, e, f, g, h, i, j, kk, l, m, n, o, p', q, r, s) p p' | |
Defined in Control.Lens.Tuple | |
class Field15 s t a b | s -> a, t -> b, s b -> t, t a -> s where Source #
Provides access to the 15th field of a tuple.
Minimal complete definition
Nothing
Methods
Access the 15th field of a tuple.
Instances
| 15 <= n => Field15 (V n a) (V n a) a a | |
| Field15 (a, b, c, d, e, f, g, h, i, j, kk, l, m, n, o) (a, b, c, d, e, f, g, h, i, j, kk, l, m, n, o') o o' | |
Defined in Control.Lens.Tuple | |
| Field15 (a, b, c, d, e, f, g, h, i, j, kk, l, m, n, o, p) (a, b, c, d, e, f, g, h, i, j, kk, l, m, n, o', p) o o' | |
Defined in Control.Lens.Tuple | |
| Field15 (a, b, c, d, e, f, g, h, i, j, kk, l, m, n, o, p, q) (a, b, c, d, e, f, g, h, i, j, kk, l, m, n, o', p, q) o o' | |
Defined in Control.Lens.Tuple | |
| Field15 (a, b, c, d, e, f, g, h, i, j, kk, l, m, n, o, p, q, r) (a, b, c, d, e, f, g, h, i, j, kk, l, m, n, o', p, q, r) o o' | |
Defined in Control.Lens.Tuple | |
| Field15 (a, b, c, d, e, f, g, h, i, j, kk, l, m, n, o, p, q, r, s) (a, b, c, d, e, f, g, h, i, j, kk, l, m, n, o', p, q, r, s) o o' | |
Defined in Control.Lens.Tuple | |
class Field14 s t a b | s -> a, t -> b, s b -> t, t a -> s where Source #
Provides access to the 14th field of a tuple.
Minimal complete definition
Nothing
Methods
Access the 14th field of a tuple.
Instances
| 14 <= n => Field14 (V n a) (V n a) a a | |
| Field14 (a, b, c, d, e, f, g, h, i, j, kk, l, m, n) (a, b, c, d, e, f, g, h, i, j, kk, l, m, n') n n' | |
Defined in Control.Lens.Tuple | |
| Field14 (a, b, c, d, e, f, g, h, i, j, kk, l, m, n, o) (a, b, c, d, e, f, g, h, i, j, kk, l, m, n', o) n n' | |
Defined in Control.Lens.Tuple | |
| Field14 (a, b, c, d, e, f, g, h, i, j, kk, l, m, n, o, p) (a, b, c, d, e, f, g, h, i, j, kk, l, m, n', o, p) n n' | |
Defined in Control.Lens.Tuple | |
| Field14 (a, b, c, d, e, f, g, h, i, j, kk, l, m, n, o, p, q) (a, b, c, d, e, f, g, h, i, j, kk, l, m, n', o, p, q) n n' | |
Defined in Control.Lens.Tuple | |
| Field14 (a, b, c, d, e, f, g, h, i, j, kk, l, m, n, o, p, q, r) (a, b, c, d, e, f, g, h, i, j, kk, l, m, n', o, p, q, r) n n' | |
Defined in Control.Lens.Tuple | |
| Field14 (a, b, c, d, e, f, g, h, i, j, kk, l, m, n, o, p, q, r, s) (a, b, c, d, e, f, g, h, i, j, kk, l, m, n', o, p, q, r, s) n n' | |
Defined in Control.Lens.Tuple | |
class Field13 s t a b | s -> a, t -> b, s b -> t, t a -> s where Source #
Provides access to the 13th field of a tuple.
Minimal complete definition
Nothing
Methods
Access the 13th field of a tuple.
Instances
| 13 <= n => Field13 (V n a) (V n a) a a | |
| Field13 (a, b, c, d, e, f, g, h, i, j, kk, l, m) (a, b, c, d, e, f, g, h, i, j, kk, l, m') m m' | |
Defined in Control.Lens.Tuple | |
| Field13 (a, b, c, d, e, f, g, h, i, j, kk, l, m, n) (a, b, c, d, e, f, g, h, i, j, kk, l, m', n) m m' | |
Defined in Control.Lens.Tuple | |
| Field13 (a, b, c, d, e, f, g, h, i, j, kk, l, m, n, o) (a, b, c, d, e, f, g, h, i, j, kk, l, m', n, o) m m' | |
Defined in Control.Lens.Tuple | |
| Field13 (a, b, c, d, e, f, g, h, i, j, kk, l, m, n, o, p) (a, b, c, d, e, f, g, h, i, j, kk, l, m', n, o, p) m m' | |
Defined in Control.Lens.Tuple | |
| Field13 (a, b, c, d, e, f, g, h, i, j, kk, l, m, n, o, p, q) (a, b, c, d, e, f, g, h, i, j, kk, l, m', n, o, p, q) m m' | |
Defined in Control.Lens.Tuple | |
| Field13 (a, b, c, d, e, f, g, h, i, j, kk, l, m, n, o, p, q, r) (a, b, c, d, e, f, g, h, i, j, kk, l, m', n, o, p, q, r) m m' | |
Defined in Control.Lens.Tuple | |
| Field13 (a, b, c, d, e, f, g, h, i, j, kk, l, m, n, o, p, q, r, s) (a, b, c, d, e, f, g, h, i, j, kk, l, m', n, o, p, q, r, s) m m' | |
Defined in Control.Lens.Tuple | |
class Field12 s t a b | s -> a, t -> b, s b -> t, t a -> s where Source #
Provides access to the 12th field of a tuple.
Minimal complete definition
Nothing
Methods
Access the 12th field of a tuple.
Instances
| 12 <= n => Field12 (V n a) (V n a) a a | |
| Field12 (a, b, c, d, e, f, g, h, i, j, kk, l) (a, b, c, d, e, f, g, h, i, j, kk, l') l l' | |
Defined in Control.Lens.Tuple | |
| Field12 (a, b, c, d, e, f, g, h, i, j, kk, l, m) (a, b, c, d, e, f, g, h, i, j, kk, l', m) l l' | |
Defined in Control.Lens.Tuple | |
| Field12 (a, b, c, d, e, f, g, h, i, j, kk, l, m, n) (a, b, c, d, e, f, g, h, i, j, kk, l', m, n) l l' | |
Defined in Control.Lens.Tuple | |
| Field12 (a, b, c, d, e, f, g, h, i, j, kk, l, m, n, o) (a, b, c, d, e, f, g, h, i, j, kk, l', m, n, o) l l' | |
Defined in Control.Lens.Tuple | |
| Field12 (a, b, c, d, e, f, g, h, i, j, kk, l, m, n, o, p) (a, b, c, d, e, f, g, h, i, j, kk, l', m, n, o, p) l l' | |
Defined in Control.Lens.Tuple | |
| Field12 (a, b, c, d, e, f, g, h, i, j, kk, l, m, n, o, p, q) (a, b, c, d, e, f, g, h, i, j, kk, l', m, n, o, p, q) l l' | |
Defined in Control.Lens.Tuple | |
| Field12 (a, b, c, d, e, f, g, h, i, j, kk, l, m, n, o, p, q, r) (a, b, c, d, e, f, g, h, i, j, kk, l', m, n, o, p, q, r) l l' | |
Defined in Control.Lens.Tuple | |
| Field12 (a, b, c, d, e, f, g, h, i, j, kk, l, m, n, o, p, q, r, s) (a, b, c, d, e, f, g, h, i, j, kk, l', m, n, o, p, q, r, s) l l' | |
Defined in Control.Lens.Tuple | |
class Field11 s t a b | s -> a, t -> b, s b -> t, t a -> s where Source #
Provides access to the 11th field of a tuple.
Minimal complete definition
Nothing
Methods
Access the 11th field of a tuple.
Instances
| 11 <= n => Field11 (V n a) (V n a) a a | |
| Field11 (a, b, c, d, e, f, g, h, i, j, kk) (a, b, c, d, e, f, g, h, i, j, kk') kk kk' | |
Defined in Control.Lens.Tuple | |
| Field11 (a, b, c, d, e, f, g, h, i, j, kk, l) (a, b, c, d, e, f, g, h, i, j, kk', l) kk kk' | |
Defined in Control.Lens.Tuple | |
| Field11 (a, b, c, d, e, f, g, h, i, j, kk, l, m) (a, b, c, d, e, f, g, h, i, j, kk', l, m) kk kk' | |
Defined in Control.Lens.Tuple | |
| Field11 (a, b, c, d, e, f, g, h, i, j, kk, l, m, n) (a, b, c, d, e, f, g, h, i, j, kk', l, m, n) kk kk' | |
Defined in Control.Lens.Tuple | |
| Field11 (a, b, c, d, e, f, g, h, i, j, kk, l, m, n, o) (a, b, c, d, e, f, g, h, i, j, kk', l, m, n, o) kk kk' | |
Defined in Control.Lens.Tuple | |
| Field11 (a, b, c, d, e, f, g, h, i, j, kk, l, m, n, o, p) (a, b, c, d, e, f, g, h, i, j, kk', l, m, n, o, p) kk kk' | |
Defined in Control.Lens.Tuple | |
| Field11 (a, b, c, d, e, f, g, h, i, j, kk, l, m, n, o, p, q) (a, b, c, d, e, f, g, h, i, j, kk', l, m, n, o, p, q) kk kk' | |
Defined in Control.Lens.Tuple | |
| Field11 (a, b, c, d, e, f, g, h, i, j, kk, l, m, n, o, p, q, r) (a, b, c, d, e, f, g, h, i, j, kk', l, m, n, o, p, q, r) kk kk' | |
Defined in Control.Lens.Tuple | |
| Field11 (a, b, c, d, e, f, g, h, i, j, kk, l, m, n, o, p, q, r, s) (a, b, c, d, e, f, g, h, i, j, kk', l, m, n, o, p, q, r, s) kk kk' | |
Defined in Control.Lens.Tuple | |
class Field10 s t a b | s -> a, t -> b, s b -> t, t a -> s where Source #
Provides access to the 10th field of a tuple.
Minimal complete definition
Nothing
Methods
Access the 10th field of a tuple.
Instances
| 10 <= n => Field10 (V n a) (V n a) a a | |
| Field10 (a, b, c, d, e, f, g, h, i, j) (a, b, c, d, e, f, g, h, i, j') j j' | |
Defined in Control.Lens.Tuple | |
| Field10 (a, b, c, d, e, f, g, h, i, j, kk) (a, b, c, d, e, f, g, h, i, j', kk) j j' | |
Defined in Control.Lens.Tuple | |
| Field10 (a, b, c, d, e, f, g, h, i, j, kk, l) (a, b, c, d, e, f, g, h, i, j', kk, l) j j' | |
Defined in Control.Lens.Tuple | |
| Field10 (a, b, c, d, e, f, g, h, i, j, kk, l, m) (a, b, c, d, e, f, g, h, i, j', kk, l, m) j j' | |
Defined in Control.Lens.Tuple | |
| Field10 (a, b, c, d, e, f, g, h, i, j, kk, l, m, n) (a, b, c, d, e, f, g, h, i, j', kk, l, m, n) j j' | |
Defined in Control.Lens.Tuple | |
| Field10 (a, b, c, d, e, f, g, h, i, j, kk, l, m, n, o) (a, b, c, d, e, f, g, h, i, j', kk, l, m, n, o) j j' | |
Defined in Control.Lens.Tuple | |
| Field10 (a, b, c, d, e, f, g, h, i, j, kk, l, m, n, o, p) (a, b, c, d, e, f, g, h, i, j', kk, l, m, n, o, p) j j' | |
Defined in Control.Lens.Tuple | |
| Field10 (a, b, c, d, e, f, g, h, i, j, kk, l, m, n, o, p, q) (a, b, c, d, e, f, g, h, i, j', kk, l, m, n, o, p, q) j j' | |
Defined in Control.Lens.Tuple | |
| Field10 (a, b, c, d, e, f, g, h, i, j, kk, l, m, n, o, p, q, r) (a, b, c, d, e, f, g, h, i, j', kk, l, m, n, o, p, q, r) j j' | |
Defined in Control.Lens.Tuple | |
| Field10 (a, b, c, d, e, f, g, h, i, j, kk, l, m, n, o, p, q, r, s) (a, b, c, d, e, f, g, h, i, j', kk, l, m, n, o, p, q, r, s) j j' | |
Defined in Control.Lens.Tuple | |
class Field9 s t a b | s -> a, t -> b, s b -> t, t a -> s where Source #
Provides access to the 9th field of a tuple.
Minimal complete definition
Nothing
Methods
Access the 9th field of a tuple.
Instances
| 9 <= n => Field9 (V n a) (V n a) a a | |
| Field9 (a, b, c, d, e, f, g, h, i) (a, b, c, d, e, f, g, h, i') i i' | |
Defined in Control.Lens.Tuple | |
| Field9 (a, b, c, d, e, f, g, h, i, j) (a, b, c, d, e, f, g, h, i', j) i i' | |
Defined in Control.Lens.Tuple | |
| Field9 (a, b, c, d, e, f, g, h, i, j, kk) (a, b, c, d, e, f, g, h, i', j, kk) i i' | |
Defined in Control.Lens.Tuple | |
| Field9 (a, b, c, d, e, f, g, h, i, j, kk, l) (a, b, c, d, e, f, g, h, i', j, kk, l) i i' | |
Defined in Control.Lens.Tuple | |
| Field9 (a, b, c, d, e, f, g, h, i, j, kk, l, m) (a, b, c, d, e, f, g, h, i', j, kk, l, m) i i' | |
Defined in Control.Lens.Tuple | |
| Field9 (a, b, c, d, e, f, g, h, i, j, kk, l, m, n) (a, b, c, d, e, f, g, h, i', j, kk, l, m, n) i i' | |
Defined in Control.Lens.Tuple | |
| Field9 (a, b, c, d, e, f, g, h, i, j, kk, l, m, n, o) (a, b, c, d, e, f, g, h, i', j, kk, l, m, n, o) i i' | |
Defined in Control.Lens.Tuple | |
| Field9 (a, b, c, d, e, f, g, h, i, j, kk, l, m, n, o, p) (a, b, c, d, e, f, g, h, i', j, kk, l, m, n, o, p) i i' | |
Defined in Control.Lens.Tuple | |
| Field9 (a, b, c, d, e, f, g, h, i, j, kk, l, m, n, o, p, q) (a, b, c, d, e, f, g, h, i', j, kk, l, m, n, o, p, q) i i' | |
Defined in Control.Lens.Tuple | |
| Field9 (a, b, c, d, e, f, g, h, i, j, kk, l, m, n, o, p, q, r) (a, b, c, d, e, f, g, h, i', j, kk, l, m, n, o, p, q, r) i i' | |
Defined in Control.Lens.Tuple | |
| Field9 (a, b, c, d, e, f, g, h, i, j, kk, l, m, n, o, p, q, r, s) (a, b, c, d, e, f, g, h, i', j, kk, l, m, n, o, p, q, r, s) i i' | |
Defined in Control.Lens.Tuple | |
class Field8 s t a b | s -> a, t -> b, s b -> t, t a -> s where Source #
Provide access to the 8th field of a tuple.
Minimal complete definition
Nothing
Methods
Access the 8th field of a tuple.
Instances
| 8 <= n => Field8 (V n a) (V n a) a a | |
| Field8 (a, b, c, d, e, f, g, h) (a, b, c, d, e, f, g, h') h h' | |
Defined in Control.Lens.Tuple | |
| Field8 (a, b, c, d, e, f, g, h, i) (a, b, c, d, e, f, g, h', i) h h' | |
Defined in Control.Lens.Tuple | |
| Field8 (a, b, c, d, e, f, g, h, i, j) (a, b, c, d, e, f, g, h', i, j) h h' | |
Defined in Control.Lens.Tuple | |
| Field8 (a, b, c, d, e, f, g, h, i, j, kk) (a, b, c, d, e, f, g, h', i, j, kk) h h' | |
Defined in Control.Lens.Tuple | |
| Field8 (a, b, c, d, e, f, g, h, i, j, kk, l) (a, b, c, d, e, f, g, h', i, j, kk, l) h h' | |
Defined in Control.Lens.Tuple | |
| Field8 (a, b, c, d, e, f, g, h, i, j, kk, l, m) (a, b, c, d, e, f, g, h', i, j, kk, l, m) h h' | |
Defined in Control.Lens.Tuple | |
| Field8 (a, b, c, d, e, f, g, h, i, j, kk, l, m, n) (a, b, c, d, e, f, g, h', i, j, kk, l, m, n) h h' | |
Defined in Control.Lens.Tuple | |
| Field8 (a, b, c, d, e, f, g, h, i, j, kk, l, m, n, o) (a, b, c, d, e, f, g, h', i, j, kk, l, m, n, o) h h' | |
Defined in Control.Lens.Tuple | |
| Field8 (a, b, c, d, e, f, g, h, i, j, kk, l, m, n, o, p) (a, b, c, d, e, f, g, h', i, j, kk, l, m, n, o, p) h h' | |
Defined in Control.Lens.Tuple | |
| Field8 (a, b, c, d, e, f, g, h, i, j, kk, l, m, n, o, p, q) (a, b, c, d, e, f, g, h', i, j, kk, l, m, n, o, p, q) h h' | |
Defined in Control.Lens.Tuple | |
| Field8 (a, b, c, d, e, f, g, h, i, j, kk, l, m, n, o, p, q, r) (a, b, c, d, e, f, g, h', i, j, kk, l, m, n, o, p, q, r) h h' | |
Defined in Control.Lens.Tuple | |
| Field8 (a, b, c, d, e, f, g, h, i, j, kk, l, m, n, o, p, q, r, s) (a, b, c, d, e, f, g, h', i, j, kk, l, m, n, o, p, q, r, s) h h' | |
Defined in Control.Lens.Tuple | |
class Field7 s t a b | s -> a, t -> b, s b -> t, t a -> s where Source #
Provide access to the 7th field of a tuple.
Minimal complete definition
Nothing
Methods
Access the 7th field of a tuple.
Instances
| 7 <= n => Field7 (V n a) (V n a) a a | |
| Field7 (a, b, c, d, e, f, g) (a, b, c, d, e, f, g') g g' | |
Defined in Control.Lens.Tuple | |
| Field7 (a, b, c, d, e, f, g, h) (a, b, c, d, e, f, g', h) g g' | |
Defined in Control.Lens.Tuple | |
| Field7 (a, b, c, d, e, f, g, h, i) (a, b, c, d, e, f, g', h, i) g g' | |
Defined in Control.Lens.Tuple | |
| Field7 (a, b, c, d, e, f, g, h, i, j) (a, b, c, d, e, f, g', h, i, j) g g' | |
Defined in Control.Lens.Tuple | |
| Field7 (a, b, c, d, e, f, g, h, i, j, kk) (a, b, c, d, e, f, g', h, i, j, kk) g g' | |
Defined in Control.Lens.Tuple | |
| Field7 (a, b, c, d, e, f, g, h, i, j, kk, l) (a, b, c, d, e, f, g', h, i, j, kk, l) g g' | |
Defined in Control.Lens.Tuple | |
| Field7 (a, b, c, d, e, f, g, h, i, j, kk, l, m) (a, b, c, d, e, f, g', h, i, j, kk, l, m) g g' | |
Defined in Control.Lens.Tuple | |
| Field7 (a, b, c, d, e, f, g, h, i, j, kk, l, m, n) (a, b, c, d, e, f, g', h, i, j, kk, l, m, n) g g' | |
Defined in Control.Lens.Tuple | |
| Field7 (a, b, c, d, e, f, g, h, i, j, kk, l, m, n, o) (a, b, c, d, e, f, g', h, i, j, kk, l, m, n, o) g g' | |
Defined in Control.Lens.Tuple | |
| Field7 (a, b, c, d, e, f, g, h, i, j, kk, l, m, n, o, p) (a, b, c, d, e, f, g', h, i, j, kk, l, m, n, o, p) g g' | |
Defined in Control.Lens.Tuple | |
| Field7 (a, b, c, d, e, f, g, h, i, j, kk, l, m, n, o, p, q) (a, b, c, d, e, f, g', h, i, j, kk, l, m, n, o, p, q) g g' | |
Defined in Control.Lens.Tuple | |
| Field7 (a, b, c, d, e, f, g, h, i, j, kk, l, m, n, o, p, q, r) (a, b, c, d, e, f, g', h, i, j, kk, l, m, n, o, p, q, r) g g' | |
Defined in Control.Lens.Tuple | |
| Field7 (a, b, c, d, e, f, g, h, i, j, kk, l, m, n, o, p, q, r, s) (a, b, c, d, e, f, g', h, i, j, kk, l, m, n, o, p, q, r, s) g g' | |
Defined in Control.Lens.Tuple | |
class Field6 s t a b | s -> a, t -> b, s b -> t, t a -> s where Source #
Provides access to the 6th element of a tuple.
Minimal complete definition
Nothing
Methods
Access the 6th field of a tuple.
Instances
| Field6 (Plucker a) (Plucker a) a a | |
| 6 <= n => Field6 (V n a) (V n a) a a | |
| Field6 (a, b, c, d, e, f) (a, b, c, d, e, f') f f' | |
Defined in Control.Lens.Tuple | |
| Field6 (a, b, c, d, e, f, g) (a, b, c, d, e, f', g) f f' | |
Defined in Control.Lens.Tuple | |
| Field6 (a, b, c, d, e, f, g, h) (a, b, c, d, e, f', g, h) f f' | |
Defined in Control.Lens.Tuple | |
| Field6 (a, b, c, d, e, f, g, h, i) (a, b, c, d, e, f', g, h, i) f f' | |
Defined in Control.Lens.Tuple | |
| Field6 (a, b, c, d, e, f, g, h, i, j) (a, b, c, d, e, f', g, h, i, j) f f' | |
Defined in Control.Lens.Tuple | |
| Field6 (a, b, c, d, e, f, g, h, i, j, kk) (a, b, c, d, e, f', g, h, i, j, kk) f f' | |
Defined in Control.Lens.Tuple | |
| Field6 (a, b, c, d, e, f, g, h, i, j, kk, l) (a, b, c, d, e, f', g, h, i, j, kk, l) f f' | |
Defined in Control.Lens.Tuple | |
| Field6 (a, b, c, d, e, f, g, h, i, j, kk, l, m) (a, b, c, d, e, f', g, h, i, j, kk, l, m) f f' | |
Defined in Control.Lens.Tuple | |
| Field6 (a, b, c, d, e, f, g, h, i, j, kk, l, m, n) (a, b, c, d, e, f', g, h, i, j, kk, l, m, n) f f' | |
Defined in Control.Lens.Tuple | |
| Field6 (a, b, c, d, e, f, g, h, i, j, kk, l, m, n, o) (a, b, c, d, e, f', g, h, i, j, kk, l, m, n, o) f f' | |
Defined in Control.Lens.Tuple | |
| Field6 (a, b, c, d, e, f, g, h, i, j, kk, l, m, n, o, p) (a, b, c, d, e, f', g, h, i, j, kk, l, m, n, o, p) f f' | |
Defined in Control.Lens.Tuple | |
| Field6 (a, b, c, d, e, f, g, h, i, j, kk, l, m, n, o, p, q) (a, b, c, d, e, f', g, h, i, j, kk, l, m, n, o, p, q) f f' | |
Defined in Control.Lens.Tuple | |
| Field6 (a, b, c, d, e, f, g, h, i, j, kk, l, m, n, o, p, q, r) (a, b, c, d, e, f', g, h, i, j, kk, l, m, n, o, p, q, r) f f' | |
Defined in Control.Lens.Tuple | |
| Field6 (a, b, c, d, e, f, g, h, i, j, kk, l, m, n, o, p, q, r, s) (a, b, c, d, e, f', g, h, i, j, kk, l, m, n, o, p, q, r, s) f f' | |
Defined in Control.Lens.Tuple | |
class Field5 s t a b | s -> a, t -> b, s b -> t, t a -> s where Source #
Provides access to the 5th field of a tuple.
Minimal complete definition
Nothing
Methods
Access the 5th field of a tuple.
Instances
| Field5 (Plucker a) (Plucker a) a a | |
| 5 <= n => Field5 (V n a) (V n a) a a | |
| Field5 (a, b, c, d, e) (a, b, c, d, e') e e' | |
Defined in Control.Lens.Tuple | |
| Field5 (a, b, c, d, e, f) (a, b, c, d, e', f) e e' | |
Defined in Control.Lens.Tuple | |
| Field5 (a, b, c, d, e, f, g) (a, b, c, d, e', f, g) e e' | |
Defined in Control.Lens.Tuple | |
| Field5 (a, b, c, d, e, f, g, h) (a, b, c, d, e', f, g, h) e e' | |
Defined in Control.Lens.Tuple | |
| Field5 (a, b, c, d, e, f, g, h, i) (a, b, c, d, e', f, g, h, i) e e' | |
Defined in Control.Lens.Tuple | |
| Field5 (a, b, c, d, e, f, g, h, i, j) (a, b, c, d, e', f, g, h, i, j) e e' | |
Defined in Control.Lens.Tuple | |
| Field5 (a, b, c, d, e, f, g, h, i, j, kk) (a, b, c, d, e', f, g, h, i, j, kk) e e' | |
Defined in Control.Lens.Tuple | |
| Field5 (a, b, c, d, e, f, g, h, i, j, kk, l) (a, b, c, d, e', f, g, h, i, j, kk, l) e e' | |
Defined in Control.Lens.Tuple | |
| Field5 (a, b, c, d, e, f, g, h, i, j, kk, l, m) (a, b, c, d, e', f, g, h, i, j, kk, l, m) e e' | |
Defined in Control.Lens.Tuple | |
| Field5 (a, b, c, d, e, f, g, h, i, j, kk, l, m, n) (a, b, c, d, e', f, g, h, i, j, kk, l, m, n) e e' | |
Defined in Control.Lens.Tuple | |
| Field5 (a, b, c, d, e, f, g, h, i, j, kk, l, m, n, o) (a, b, c, d, e', f, g, h, i, j, kk, l, m, n, o) e e' | |
Defined in Control.Lens.Tuple | |
| Field5 (a, b, c, d, e, f, g, h, i, j, kk, l, m, n, o, p) (a, b, c, d, e', f, g, h, i, j, kk, l, m, n, o, p) e e' | |
Defined in Control.Lens.Tuple | |
| Field5 (a, b, c, d, e, f, g, h, i, j, kk, l, m, n, o, p, q) (a, b, c, d, e', f, g, h, i, j, kk, l, m, n, o, p, q) e e' | |
Defined in Control.Lens.Tuple | |
| Field5 (a, b, c, d, e, f, g, h, i, j, kk, l, m, n, o, p, q, r) (a, b, c, d, e', f, g, h, i, j, kk, l, m, n, o, p, q, r) e e' | |
Defined in Control.Lens.Tuple | |
| Field5 (a, b, c, d, e, f, g, h, i, j, kk, l, m, n, o, p, q, r, s) (a, b, c, d, e', f, g, h, i, j, kk, l, m, n, o, p, q, r, s) e e' | |
Defined in Control.Lens.Tuple | |
class Field4 s t a b | s -> a, t -> b, s b -> t, t a -> s where Source #
Provide access to the 4th field of a tuple.
Minimal complete definition
Nothing
Methods
Access the 4th field of a tuple.
Instances
| Field4 (Plucker a) (Plucker a) a a | |
| Field4 (Quaternion a) (Quaternion a) a a | |
Defined in Linear.Quaternion Methods _4 :: Lens (Quaternion a) (Quaternion a) a a Source # | |
| Field4 (V4 a) (V4 a) a a | |
| 4 <= n => Field4 (V n a) (V n a) a a | |
| Field4 (a, b, c, d) (a, b, c, d') d d' | |
Defined in Control.Lens.Tuple | |
| Field4 (a, b, c, d, e) (a, b, c, d', e) d d' | |
Defined in Control.Lens.Tuple | |
| Field4 (a, b, c, d, e, f) (a, b, c, d', e, f) d d' | |
Defined in Control.Lens.Tuple | |
| Field4 (a, b, c, d, e, f, g) (a, b, c, d', e, f, g) d d' | |
Defined in Control.Lens.Tuple | |
| Field4 (a, b, c, d, e, f, g, h) (a, b, c, d', e, f, g, h) d d' | |
Defined in Control.Lens.Tuple | |
| Field4 (a, b, c, d, e, f, g, h, i) (a, b, c, d', e, f, g, h, i) d d' | |
Defined in Control.Lens.Tuple | |
| Field4 (a, b, c, d, e, f, g, h, i, j) (a, b, c, d', e, f, g, h, i, j) d d' | |
Defined in Control.Lens.Tuple | |
| Field4 (a, b, c, d, e, f, g, h, i, j, kk) (a, b, c, d', e, f, g, h, i, j, kk) d d' | |
Defined in Control.Lens.Tuple | |
| Field4 (a, b, c, d, e, f, g, h, i, j, kk, l) (a, b, c, d', e, f, g, h, i, j, kk, l) d d' | |
Defined in Control.Lens.Tuple | |
| Field4 (a, b, c, d, e, f, g, h, i, j, kk, l, m) (a, b, c, d', e, f, g, h, i, j, kk, l, m) d d' | |
Defined in Control.Lens.Tuple | |
| Field4 (a, b, c, d, e, f, g, h, i, j, kk, l, m, n) (a, b, c, d', e, f, g, h, i, j, kk, l, m, n) d d' | |
Defined in Control.Lens.Tuple | |
| Field4 (a, b, c, d, e, f, g, h, i, j, kk, l, m, n, o) (a, b, c, d', e, f, g, h, i, j, kk, l, m, n, o) d d' | |
Defined in Control.Lens.Tuple | |
| Field4 (a, b, c, d, e, f, g, h, i, j, kk, l, m, n, o, p) (a, b, c, d', e, f, g, h, i, j, kk, l, m, n, o, p) d d' | |
Defined in Control.Lens.Tuple | |
| Field4 (a, b, c, d, e, f, g, h, i, j, kk, l, m, n, o, p, q) (a, b, c, d', e, f, g, h, i, j, kk, l, m, n, o, p, q) d d' | |
Defined in Control.Lens.Tuple | |
| Field4 (a, b, c, d, e, f, g, h, i, j, kk, l, m, n, o, p, q, r) (a, b, c, d', e, f, g, h, i, j, kk, l, m, n, o, p, q, r) d d' | |
Defined in Control.Lens.Tuple | |
| Field4 (a, b, c, d, e, f, g, h, i, j, kk, l, m, n, o, p, q, r, s) (a, b, c, d', e, f, g, h, i, j, kk, l, m, n, o, p, q, r, s) d d' | |
Defined in Control.Lens.Tuple | |
class Field3 s t a b | s -> a, t -> b, s b -> t, t a -> s where Source #
Provides access to the 3rd field of a tuple.
Minimal complete definition
Nothing
Methods
Access the 3rd field of a tuple.
Instances
| Field3 (Plucker a) (Plucker a) a a | |
| Field3 (Quaternion a) (Quaternion a) a a | |
Defined in Linear.Quaternion Methods _3 :: Lens (Quaternion a) (Quaternion a) a a Source # | |
| Field3 (V3 a) (V3 a) a a | |
| Field3 (V4 a) (V4 a) a a | |
| 3 <= n => Field3 (V n a) (V n a) a a | |
| Field3 (a, b, c) (a, b, c') c c' | |
Defined in Control.Lens.Tuple | |
| Field3 (a, b, c, d) (a, b, c', d) c c' | |
Defined in Control.Lens.Tuple | |
| Field3 (a, b, c, d, e) (a, b, c', d, e) c c' | |
Defined in Control.Lens.Tuple | |
| Field3 (a, b, c, d, e, f) (a, b, c', d, e, f) c c' | |
Defined in Control.Lens.Tuple | |
| Field3 (a, b, c, d, e, f, g) (a, b, c', d, e, f, g) c c' | |
Defined in Control.Lens.Tuple | |
| Field3 (a, b, c, d, e, f, g, h) (a, b, c', d, e, f, g, h) c c' | |
Defined in Control.Lens.Tuple | |
| Field3 (a, b, c, d, e, f, g, h, i) (a, b, c', d, e, f, g, h, i) c c' | |
Defined in Control.Lens.Tuple | |
| Field3 (a, b, c, d, e, f, g, h, i, j) (a, b, c', d, e, f, g, h, i, j) c c' | |
Defined in Control.Lens.Tuple | |
| Field3 (a, b, c, d, e, f, g, h, i, j, kk) (a, b, c', d, e, f, g, h, i, j, kk) c c' | |
Defined in Control.Lens.Tuple | |
| Field3 (a, b, c, d, e, f, g, h, i, j, kk, l) (a, b, c', d, e, f, g, h, i, j, kk, l) c c' | |
Defined in Control.Lens.Tuple | |
| Field3 (a, b, c, d, e, f, g, h, i, j, kk, l, m) (a, b, c', d, e, f, g, h, i, j, kk, l, m) c c' | |
Defined in Control.Lens.Tuple | |
| Field3 (a, b, c, d, e, f, g, h, i, j, kk, l, m, n) (a, b, c', d, e, f, g, h, i, j, kk, l, m, n) c c' | |
Defined in Control.Lens.Tuple | |
| Field3 (a, b, c, d, e, f, g, h, i, j, kk, l, m, n, o) (a, b, c', d, e, f, g, h, i, j, kk, l, m, n, o) c c' | |
Defined in Control.Lens.Tuple | |
| Field3 (a, b, c, d, e, f, g, h, i, j, kk, l, m, n, o, p) (a, b, c', d, e, f, g, h, i, j, kk, l, m, n, o, p) c c' | |
Defined in Control.Lens.Tuple | |
| Field3 (a, b, c, d, e, f, g, h, i, j, kk, l, m, n, o, p, q) (a, b, c', d, e, f, g, h, i, j, kk, l, m, n, o, p, q) c c' | |
Defined in Control.Lens.Tuple | |
| Field3 (a, b, c, d, e, f, g, h, i, j, kk, l, m, n, o, p, q, r) (a, b, c', d, e, f, g, h, i, j, kk, l, m, n, o, p, q, r) c c' | |
Defined in Control.Lens.Tuple | |
| Field3 (a, b, c, d, e, f, g, h, i, j, kk, l, m, n, o, p, q, r, s) (a, b, c', d, e, f, g, h, i, j, kk, l, m, n, o, p, q, r, s) c c' | |
Defined in Control.Lens.Tuple | |
type Accessing (p :: Type -> Type -> Type) m s a = p a (Const m a) -> s -> Const m s Source #
This is a convenient alias used when consuming (indexed) getters and (indexed) folds in a highly general fashion.
type IndexedGetting i m s a = Indexed i a (Const m a) -> s -> Const m s Source #
Used to consume an IndexedFold.
ito :: (Indexable i p, Contravariant f) => (s -> (i, a)) -> Over' p f s a Source #
ito:: (s -> (i, a)) ->IndexedGetteri s a
like :: (Profunctor p, Contravariant f, Functor f) => a -> Optic' p f s a Source #
ilike :: (Indexable i p, Contravariant f, Functor f) => i -> a -> Over' p f s a Source #
ilike:: i -> a ->IndexedGetteri s a
views :: MonadReader s m => LensLike' (Const r :: Type -> Type) s a -> (a -> r) -> m r Source #
View a function of the value pointed to by a Getter or Lens or the result of
folding over the result of mapping the targets of a Fold or
Traversal.
viewsl f ≡view(l.tof)
>>>views (to f) g ag (f a)
>>>views _2 length (1,"hello")5
As views is commonly used to access the target of a Getter or obtain a monoidal summary of the targets of a Fold,
It may be useful to think of it as having one of these more restricted signatures:
views::Getters a -> (a -> r) -> s -> rviews::Monoidm =>Folds a -> (a -> m) -> s -> mviews::Iso's a -> (a -> r) -> s -> rviews::Lens's a -> (a -> r) -> s -> rviews::Monoidm =>Traversal's a -> (a -> m) -> s -> m
In a more general setting, such as when working with a Monad transformer stack you can use:
views::MonadReaders m =>Getters a -> (a -> r) -> m rviews:: (MonadReaders m,Monoidr) =>Folds a -> (a -> r) -> m rviews::MonadReaders m =>Iso's a -> (a -> r) -> m rviews::MonadReaders m =>Lens's a -> (a -> r) -> m rviews:: (MonadReaders m,Monoidr) =>Traversal's a -> (a -> r) -> m r
views::MonadReaders m =>Gettingr s a -> (a -> r) -> m r
uses :: MonadState s m => LensLike' (Const r :: Type -> Type) s a -> (a -> r) -> m r Source #
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 (uses _1 length) ("hello","world")5
uses::MonadStates m =>Getters a -> (a -> r) -> m ruses:: (MonadStates m,Monoidr) =>Folds a -> (a -> r) -> m ruses::MonadStates m =>Lens's a -> (a -> r) -> m ruses::MonadStates m =>Iso's a -> (a -> r) -> m ruses:: (MonadStates m,Monoidr) =>Traversal's a -> (a -> r) -> m r
uses::MonadStates m =>Gettingr s t a b -> (a -> r) -> m r
listening :: MonadWriter w m => Getting u w u -> m a -> m (a, u) Source #
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.
listening::MonadWriterw m =>Getterw u -> m a -> m (a, u)listening::MonadWriterw m =>Lens'w u -> m a -> m (a, u)listening::MonadWriterw m =>Iso'w u -> m a -> m (a, u)listening:: (MonadWriterw m,Monoidu) =>Foldw u -> m a -> m (a, u)listening:: (MonadWriterw m,Monoidu) =>Traversal'w u -> m a -> m (a, u)listening:: (MonadWriterw m,Monoidu) =>Prism'w u -> m a -> m (a, u)
ilistening :: MonadWriter w m => IndexedGetting i (i, u) w u -> m a -> m (a, (i, u)) Source #
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.
ilistening::MonadWriterw m =>IndexedGetteri w u -> m a -> m (a, (i, u))ilistening::MonadWriterw m =>IndexedLens'i w u -> m a -> m (a, (i, u))ilistening:: (MonadWriterw m,Monoidu) =>IndexedFoldi w u -> m a -> m (a, (i, u))ilistening:: (MonadWriterw m,Monoidu) =>IndexedTraversal'i w u -> m a -> m (a, (i, u))
listenings :: MonadWriter w m => Getting v w u -> (u -> v) -> m a -> m (a, v) Source #
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.
listenings::MonadWriterw m =>Getterw u -> (u -> v) -> m a -> m (a, v)listenings::MonadWriterw m =>Lens'w u -> (u -> v) -> m a -> m (a, v)listenings::MonadWriterw m =>Iso'w u -> (u -> v) -> m a -> m (a, v)listenings:: (MonadWriterw m,Monoidv) =>Foldw u -> (u -> v) -> m a -> m (a, v)listenings:: (MonadWriterw m,Monoidv) =>Traversal'w u -> (u -> v) -> m a -> m (a, v)listenings:: (MonadWriterw m,Monoidv) =>Prism'w u -> (u -> v) -> m a -> m (a, v)
ilistenings :: MonadWriter w m => IndexedGetting i v w u -> (i -> u -> v) -> m a -> m (a, v) Source #
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.
ilistenings::MonadWriterw m =>IndexedGetterw u -> (i -> u -> v) -> m a -> m (a, v)ilistenings::MonadWriterw m =>IndexedLens'w u -> (i -> u -> v) -> m a -> m (a, v)ilistenings:: (MonadWriterw m,Monoidv) =>IndexedFoldw u -> (i -> u -> v) -> m a -> m (a, v)ilistenings:: (MonadWriterw m,Monoidv) =>IndexedTraversal'w u -> (i -> u -> v) -> m a -> m (a, v)
iview :: MonadReader s m => IndexedGetting i (i, a) s a -> m (i, a) Source #
View the index and value of an IndexedGetter into the current environment as a pair.
When applied to an IndexedFold the result will most likely be a nonsensical monoidal summary of
the indices tupled with a monoidal summary of the values and probably not whatever it is you wanted.
iviews :: MonadReader s m => IndexedGetting i r s a -> (i -> a -> r) -> m r Source #
View a function of the index and value of an IndexedGetter into the current environment.
When applied to an IndexedFold the result will be a monoidal summary instead of a single answer.
iviews≡ifoldMapOf
iuse :: MonadState s m => IndexedGetting i (i, a) s a -> m (i, a) Source #
Use the index and value of an IndexedGetter into the current state as a pair.
When applied to an IndexedFold the result will most likely be a nonsensical monoidal summary of
the indices tupled with a monoidal summary of the values and probably not whatever it is you wanted.
iuses :: MonadState s m => IndexedGetting i r s a -> (i -> a -> r) -> m r Source #
Use a function of the index and value of an IndexedGetter into the current state.
When applied to an IndexedFold the result will be a monoidal summary instead of a single answer.
(^@.) :: s -> IndexedGetting i (i, a) s a -> (i, a) infixl 8 Source #
View the index and value of an IndexedGetter or IndexedLens.
This is the same operation as iview with the arguments flipped.
The fixity and semantics are such that subsequent field accesses can be
performed with (.).
(^@.) :: s ->IndexedGetteri s a -> (i, a) (^@.) :: s ->IndexedLens'i s a -> (i, a)
The result probably doesn't have much meaning when applied to an IndexedFold.
getting :: (Profunctor p, Profunctor q, Functor f, Contravariant f) => Optical p q f s t a b -> Optical' p q f s a Source #
Coerce a Getter-compatible Optical to an Optical'. This
is useful when using a Traversal that is not simple as a Getter or a
Fold.
getting::Traversals t a b ->Folds agetting::Lenss t a b ->Getters agetting::IndexedTraversali s t a b ->IndexedFoldi s agetting::IndexedLensi s t a b ->IndexedGetteri s a
reviews :: MonadReader b m => AReview t b -> (t -> r) -> m r Source #
This can be used to turn an Iso or Prism around and view a value (or the current environment) through it the other way,
applying a function.
reviews≡views.rereviews(untof) g ≡ g.f
>>>reviews _Left isRight "mustard"False
>>>reviews (unto succ) (*2) 38
Usually this function is used in the (->) Monad with a Prism or Iso, in which case it may be useful to think of
it as having one of these more restricted type signatures:
reviews::Iso's a -> (s -> r) -> a -> rreviews::Prism's a -> (s -> r) -> a -> r
However, when working with a Monad transformer stack, it is sometimes useful to be able to review the current environment, in which case
it may be beneficial to think of it as having one of these slightly more liberal type signatures:
reviews::MonadReadera m =>Iso's a -> (s -> r) -> m rreviews::MonadReadera m =>Prism's a -> (s -> r) -> m r
reuse :: MonadState b m => AReview t b -> m t Source #
This can be used to turn an Iso or Prism around and use a value (or the current environment) through it the other way.
reuse≡use.rereuse.unto≡gets
>>>evalState (reuse _Left) 5Left 5
>>>evalState (reuse (unto succ)) 56
reuse::MonadStatea m =>Prism's a -> m sreuse::MonadStatea m =>Iso's a -> m s
reuses :: MonadState b m => AReview t b -> (t -> r) -> m r Source #
This can be used to turn an Iso or Prism around and use the current state through it the other way,
applying a function.
reuses≡uses.rereuses(untof) g ≡gets(g.f)
>>>evalState (reuses _Left isLeft) (5 :: Int)True
reuses::MonadStatea m =>Prism's a -> (s -> r) -> m rreuses::MonadStatea m =>Iso's a -> (s -> r) -> m r
reviewing :: (Bifunctor p, Functor f) => Optic (Tagged :: Type -> Type -> Type) Identity s t a b -> Optic' p f t b Source #
class Suffixed t where Source #
Methods
Instances
| Suffixed ByteString | |
Defined in Control.Lens.Prism Methods suffixed :: ByteString -> Prism' ByteString ByteString Source # | |
| Suffixed ByteString | |
Defined in Control.Lens.Prism Methods suffixed :: ByteString -> Prism' ByteString ByteString Source # | |
| Suffixed Text | |
| Suffixed Text | |
| Eq a => Suffixed [a] | |
Defined in Control.Lens.Prism | |
class Prefixed t where Source #
Methods
Instances
| Prefixed ByteString | |
Defined in Control.Lens.Prism Methods prefixed :: ByteString -> Prism' ByteString ByteString Source # | |
| Prefixed ByteString | |
Defined in Control.Lens.Prism Methods prefixed :: ByteString -> Prism' ByteString ByteString Source # | |
| Prefixed Text | |
| Prefixed Text | |
| Eq a => Prefixed [a] | |
Defined in Control.Lens.Prism | |
type APrism s t a b = Market a b a (Identity b) -> Market a b s (Identity t) Source #
If you see this in a signature for a function, the function is expecting a Prism.
withPrism :: APrism s t a b -> ((b -> t) -> (s -> Either t a) -> r) -> r Source #
Convert APrism to the pair of functions that characterize it.
clonePrism :: APrism s t a b -> Prism s t a b Source #
Clone a Prism so that you can reuse the same monomorphically typed Prism for different purposes.
See cloneLens and cloneTraversal for examples of why you might want to do this.
aside :: APrism s t a b -> Prism (e, s) (e, t) (e, a) (e, b) Source #
Use a Prism to work over part of a structure.
below :: forall (f :: Type -> Type) s a. Traversable f => APrism' s a -> Prism' (f s) (f a) Source #
lift a Prism through a Traversable functor, giving a Prism that matches only if all the elements of the container match the Prism.
>>>[Left 1, Right "foo", Left 4, Right "woot"]^..below _Right[]
>>>[Right "hail hydra!", Right "foo", Right "blah", Right "woot"]^..below _Right[["hail hydra!","foo","blah","woot"]]
matching' :: LensLike (Either a) s t a b -> s -> Either t a Source #
Like matching, but also works for combinations of Lens and Prisms,
and also Traversals.
>>>matching' (_2 . _Just) ('x', Just True)Right True
>>>matching' (_2 . _Just) ('x', Nothing :: Maybe Int) :: Either (Char, Maybe Bool) IntLeft ('x',Nothing)
>>>matching' traverse "" :: Either [Int] CharLeft []
>>>matching' traverse "xyz" :: Either [Int] CharRight 'x'
_Right :: forall c a b p f. (Choice p, Applicative f) => p a (f b) -> p (Either c a) (f (Either c b)) Source #
This Prism provides a Traversal for tweaking the Right half of an Either:
>>>over _Right (+1) (Left 2)Left 2
>>>over _Right (+1) (Right 2)Right 3
>>>Right "hello" ^._Right"hello"
>>>Left "hello" ^._Right :: [Double][]
It also can be turned around to obtain the embedding into the Right half of an Either:
>>>_Right # 5Right 5
>>>5^.re _RightRight 5
_Just :: forall a b p f. (Choice p, Applicative f) => p a (f b) -> p (Maybe a) (f (Maybe b)) Source #
This Prism provides a Traversal for tweaking the target of the value of Just in a Maybe.
>>>over _Just (+1) (Just 2)Just 3
Unlike traverse this is a Prism, and so you can use it to inject as well:
>>>_Just # 5Just 5
>>>5^.re _JustJust 5
Interestingly,
m^?_Just≡ m
>>>Just x ^? _JustJust x
>>>Nothing ^? _JustNothing
_Nothing :: forall a p f. (Choice p, Applicative f) => p () (f ()) -> p (Maybe a) (f (Maybe a)) Source #
nearly :: a -> (a -> Bool) -> Prism' a () Source #
This Prism compares for approximate equality with a given value and a predicate for testing,
an example where the value is the empty list and the predicate checks that a list is empty (same
as _Empty with the AsEmpty list instance):
>>>nearly [] null # ()[]>>>[1,2,3,4] ^? nearly [] nullNothing
nearly[]null::Prism'[a] ()
To comply with the Prism laws the arguments you supply to nearly a p are somewhat constrained.
We assume p x holds iff x ≡ a. Under that assumption then this is a valid Prism.
This is useful when working with a type where you can test equality for only a subset of its values, and the prism selects such a value.
_Show :: (Read a, Show a) => Prism' String a Source #
This is an improper prism for text formatting based on Read and Show.
This Prism is "improper" in the sense that it normalizes the text formatting, but round tripping
is idempotent given sane Read/Show instances.
>>>_Show # 2"2"
>>>"EQ" ^? _Show :: Maybe OrderingJust EQ
_Show≡prism'showreadMaybe
ifolding :: (Foldable f, Indexable i p, Contravariant g, Applicative g) => (s -> f (i, a)) -> Over p g s t a b Source #
foldring :: (Contravariant f, Applicative f) => ((a -> f a -> f a) -> f a -> s -> f a) -> LensLike f s t a b Source #
ifoldring :: (Indexable i p, Contravariant f, Applicative f) => ((i -> a -> f a -> f a) -> f a -> s -> f a) -> Over p f s t a b Source #
Obtain FoldWithIndex by lifting ifoldr like function.
replicated :: Int -> Fold a a Source #
A Fold that replicates its input n times.
replicaten ≡toListOf(replicatedn)
>>>5^..replicated 20[5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5]
filtered :: (Choice p, Applicative f) => (a -> Bool) -> Optic' p f a a Source #
Obtain a Fold that can be composed with to filter another Lens, Iso, Getter, Fold (or Traversal).
Note: This is not a legal Traversal, unless you are very careful not to invalidate the predicate on the target.
Note: This is also not a legal Prism, unless you are very careful not to inject a value that fails the predicate.
As a counter example, consider that given evens = the second filtered evenTraversal law is violated:
overevenssucc.overevenssucc/=overevens (succ.succ)
So, in order for this to qualify as a legal Traversal you can only use it for actions that preserve the result of the predicate!
>>>[1..10]^..folded.filtered even[2,4,6,8,10]
This will preserve an index if it is present.
filteredBy :: (Indexable i p, Applicative f) => Getting (First i) a i -> p a (f a) -> a -> f a Source #
Obtain a potentially empty IndexedTraversal by taking the first element from another,
potentially empty Fold and using it as an index.
The resulting optic can be composed with to filter another Lens, Iso, Getter, Fold (or Traversal).
>>>[(Just 2, 3), (Nothing, 4)] & mapped . filteredBy (_1 . _Just) <. _2 %@~ (*) :: [(Maybe Int, Int)][(Just 2,6),(Nothing,4)]
filteredBy::Folda i ->IndexedTraversal'i a a
Note: As with filtered, this is not a legal IndexedTraversal, unless you are very careful not to invalidate the predicate on the target!
takingWhile :: (Conjoined p, Applicative f) => (a -> Bool) -> Over p (TakingWhile p f a a) s t a a -> Over p f s t a a Source #
Obtain a Fold by taking elements from another Fold, Lens, Iso, Getter or Traversal while a predicate holds.
takeWhilep ≡toListOf(takingWhilepfolded)
>>>timingOut $ toListOf (takingWhile (<=3) folded) [1..][1,2,3]
takingWhile:: (a ->Bool) ->Folds a ->Folds atakingWhile:: (a ->Bool) ->Getters a ->Folds atakingWhile:: (a ->Bool) ->Traversal's a ->Folds a -- * See note belowtakingWhile:: (a ->Bool) ->Lens's a ->Folds a -- * See note belowtakingWhile:: (a ->Bool) ->Prism's a ->Folds a -- * See note belowtakingWhile:: (a ->Bool) ->Iso's a ->Folds a -- * See note belowtakingWhile:: (a ->Bool) ->IndexedTraversal'i s a ->IndexedFoldi s a -- * See note belowtakingWhile:: (a ->Bool) ->IndexedLens'i s a ->IndexedFoldi s a -- * See note belowtakingWhile:: (a ->Bool) ->IndexedFoldi s a ->IndexedFoldi s atakingWhile:: (a ->Bool) ->IndexedGetteri s a ->IndexedFoldi s a
Note: When applied to a Traversal, takingWhile yields something that can be used as if it were a Traversal, but
which is not a Traversal per the laws, unless you are careful to ensure that you do not invalidate the predicate when
writing back through it.
droppingWhile :: (Conjoined p, Profunctor q, Applicative f) => (a -> Bool) -> Optical p q (Compose (State Bool) f) s t a a -> Optical p q f s t a a Source #
Obtain a Fold by dropping elements from another Fold, Lens, Iso, Getter or Traversal while a predicate holds.
dropWhilep ≡toListOf(droppingWhilepfolded)
>>>toListOf (droppingWhile (<=3) folded) [1..6][4,5,6]
>>>toListOf (droppingWhile (<=3) folded) [1,6,1][6,1]
droppingWhile:: (a ->Bool) ->Folds a ->Folds adroppingWhile:: (a ->Bool) ->Getters a ->Folds adroppingWhile:: (a ->Bool) ->Traversal's a ->Folds a -- see notesdroppingWhile:: (a ->Bool) ->Lens's a ->Folds a -- see notesdroppingWhile:: (a ->Bool) ->Prism's a ->Folds a -- see notesdroppingWhile:: (a ->Bool) ->Iso's a ->Folds a -- see notes
droppingWhile:: (a ->Bool) ->IndexPreservingTraversal's a ->IndexPreservingFolds a -- see notesdroppingWhile:: (a ->Bool) ->IndexPreservingLens's a ->IndexPreservingFolds a -- see notesdroppingWhile:: (a ->Bool) ->IndexPreservingGetters a ->IndexPreservingFolds adroppingWhile:: (a ->Bool) ->IndexPreservingFolds a ->IndexPreservingFolds a
droppingWhile:: (a ->Bool) ->IndexedTraversal'i s a ->IndexedFoldi s a -- see notesdroppingWhile:: (a ->Bool) ->IndexedLens'i s a ->IndexedFoldi s a -- see notesdroppingWhile:: (a ->Bool) ->IndexedGetteri s a ->IndexedFoldi s adroppingWhile:: (a ->Bool) ->IndexedFoldi s a ->IndexedFoldi s a
Note: Many uses of this combinator will yield something that meets the types, but not the laws of a valid
Traversal or IndexedTraversal. The Traversal and IndexedTraversal laws are only satisfied if the
new values you assign to the first target also does not pass the predicate! Otherwise subsequent traversals
will visit fewer elements and Traversal fusion is not sound.
So for any traversal t and predicate p, may not be lawful, but
droppingWhile p t( is. For example:dropping 1 . droppingWhile p) t
>>>let l :: Traversal' [Int] Int; l = droppingWhile (<= 1) traverse>>>let l' :: Traversal' [Int] Int; l' = dropping 1 l
l is not a lawful setter because :over l f .
over l g ≢ over l (f . g)
>>>[1,2,3] & l .~ 0 & l .~ 4[1,0,0]>>>[1,2,3] & l .~ 4[1,4,4]
l' on the other hand behaves lawfully:
>>>[1,2,3] & l' .~ 0 & l' .~ 4[1,2,4]>>>[1,2,3] & l' .~ 4[1,2,4]
worded :: forall (f :: Type -> Type). Applicative f => IndexedLensLike' Int f String String Source #
A Fold over the individual words of a String.
worded::FoldStringStringworded::Traversal'StringString
worded::IndexedFoldIntStringStringworded::IndexedTraversal'IntStringString
Note: This function type-checks as a Traversal but it doesn't satisfy the laws. It's only valid to use it
when you don't insert any whitespace characters while traversing, and if your original String contains only
isolated space characters (and no other characters that count as space, such as non-breaking spaces).
lined :: forall (f :: Type -> Type). Applicative f => IndexedLensLike' Int f String String Source #
A Fold over the individual lines of a String.
lined::FoldStringStringlined::Traversal'StringString
lined::IndexedFoldIntStringStringlined::IndexedTraversal'IntStringString
Note: This function type-checks as a Traversal but it doesn't satisfy the laws. It's only valid to use it
when you don't insert any newline characters while traversing, and if your original String contains only
isolated newline characters.
foldOf :: Getting a s a -> s -> a Source #
Combine the elements of a structure viewed through a Lens, Getter,
Fold or Traversal using a monoid.
>>>foldOf (folded.folded) [[Sum 1,Sum 4],[Sum 8, Sum 8],[Sum 21]]Sum {getSum = 42}
fold=foldOffolded
foldOf≡view
foldOf::Getters m -> s -> mfoldOf::Monoidm =>Folds m -> s -> mfoldOf::Lens's m -> s -> mfoldOf::Iso's m -> s -> mfoldOf::Monoidm =>Traversal's m -> s -> mfoldOf::Monoidm =>Prism's m -> s -> m
foldrOf :: Getting (Endo r) s a -> (a -> r -> r) -> r -> s -> r Source #
Right-associative fold of parts of a structure that are viewed through a Lens, Getter, Fold or Traversal.
foldr≡foldrOffolded
foldrOf::Getters a -> (a -> r -> r) -> r -> s -> rfoldrOf::Folds a -> (a -> r -> r) -> r -> s -> rfoldrOf::Lens's a -> (a -> r -> r) -> r -> s -> rfoldrOf::Iso's a -> (a -> r -> r) -> r -> s -> rfoldrOf::Traversal's a -> (a -> r -> r) -> r -> s -> rfoldrOf::Prism's a -> (a -> r -> r) -> r -> s -> r
ifoldrOfl ≡foldrOfl.Indexed
foldrOf::Getting(Endor) s a -> (a -> r -> r) -> r -> s -> r
foldlOf :: Getting (Dual (Endo r)) s a -> (r -> a -> r) -> r -> s -> r Source #
Left-associative fold of the parts of a structure that are viewed through a Lens, Getter, Fold or Traversal.
foldl≡foldlOffolded
foldlOf::Getters a -> (r -> a -> r) -> r -> s -> rfoldlOf::Folds a -> (r -> a -> r) -> r -> s -> rfoldlOf::Lens's a -> (r -> a -> r) -> r -> s -> rfoldlOf::Iso's a -> (r -> a -> r) -> r -> s -> rfoldlOf::Traversal's a -> (r -> a -> r) -> r -> s -> rfoldlOf::Prism's a -> (r -> a -> r) -> r -> s -> r
toNonEmptyOf :: Getting (NonEmptyDList a) s a -> s -> NonEmpty a Source #
Extract a NonEmpty of the targets of Fold1.
>>>toNonEmptyOf both1 ("hello", "world")"hello" :| ["world"]
toNonEmptyOf::Getters a -> s -> NonEmpty atoNonEmptyOf::Fold1s a -> s -> NonEmpty atoNonEmptyOf::Lens's a -> s -> NonEmpty atoNonEmptyOf::Iso's a -> s -> NonEmpty atoNonEmptyOf::Traversal1's a -> s -> NonEmpty a
altOf :: Applicative f => Getting (Alt f a) s a -> s -> f a Source #
Calls pure on the target of a Lens, Getter, or Iso.
Calls pure on the targets of a Traversal, Fold, or Prism, and
combines them with <|> (or empty if none). Intuitively, it collects
targets into an Alternative until the container fills up or it runs out of
targets, whichever comes first.
Generalizes toListOf and (^?).
>>>altOf both ("hello", "world") :: [String]["hello","world"]>>>altOf both ("hello", "world") :: Maybe StringJust "hello"
altOf:: Applicative f =>Lens's a -> s -> f aaltOf:: Applicative f =>Getters a -> s -> f aaltOf:: Applicative f =>Iso's a -> s -> f aaltOf:: Alternative f =>Traversal's a -> s -> f aaltOf:: Alternative f =>Folds a -> s -> f aaltOf:: Alternative f =>Prism's a -> s -> f a
(^..) :: s -> Getting (Endo [a]) s a -> [a] infixl 8 Source #
A convenient infix (flipped) version of toListOf.
>>>[[1,2],[3]]^..id[[[1,2],[3]]]>>>[[1,2],[3]]^..traverse[[1,2],[3]]>>>[[1,2],[3]]^..traverse.traverse[1,2,3]
>>>(1,2)^..both[1,2]
toListxs ≡ xs^..folded(^..) ≡fliptoListOf
(^..) :: s ->Getters a -> a :: s ->Folds a -> a :: s ->Lens's a -> a :: s ->Iso's a -> a :: s ->Traversal's a -> a :: s ->Prism's a -> [a]
andOf :: Getting All s Bool -> s -> Bool Source #
Returns True if every target of a Fold is True.
>>>andOf both (True,False)False>>>andOf both (True,True)True
and≡andOffolded
andOf::GettersBool-> s ->BoolandOf::FoldsBool-> s ->BoolandOf::Lens'sBool-> s ->BoolandOf::Iso'sBool-> s ->BoolandOf::Traversal'sBool-> s ->BoolandOf::Prism'sBool-> s ->Bool
orOf :: Getting Any s Bool -> s -> Bool Source #
Returns True if any target of a Fold is True.
>>>orOf both (True,False)True>>>orOf both (False,False)False
or≡orOffolded
orOf::GettersBool-> s ->BoolorOf::FoldsBool-> s ->BoolorOf::Lens'sBool-> s ->BoolorOf::Iso'sBool-> s ->BoolorOf::Traversal'sBool-> s ->BoolorOf::Prism'sBool-> s ->Bool
allOf :: Getting All s a -> (a -> Bool) -> s -> Bool Source #
Returns True if every target of a Fold satisfies a predicate.
>>>allOf both (>=3) (4,5)True>>>allOf folded (>=2) [1..10]False
all≡allOffolded
iallOfl =allOfl.Indexed
allOf::Getters a -> (a ->Bool) -> s ->BoolallOf::Folds a -> (a ->Bool) -> s ->BoolallOf::Lens's a -> (a ->Bool) -> s ->BoolallOf::Iso's a -> (a ->Bool) -> s ->BoolallOf::Traversal's a -> (a ->Bool) -> s ->BoolallOf::Prism's a -> (a ->Bool) -> s ->Bool
noneOf :: Getting Any s a -> (a -> Bool) -> s -> Bool Source #
Returns True only if no targets of a Fold satisfy a predicate.
>>>noneOf each (is _Nothing) (Just 3, Just 4, Just 5)True>>>noneOf (folded.folded) (<10) [[13,99,20],[3,71,42]]False
inoneOfl =noneOfl.Indexed
noneOf::Getters a -> (a ->Bool) -> s ->BoolnoneOf::Folds a -> (a ->Bool) -> s ->BoolnoneOf::Lens's a -> (a ->Bool) -> s ->BoolnoneOf::Iso's a -> (a ->Bool) -> s ->BoolnoneOf::Traversal's a -> (a ->Bool) -> s ->BoolnoneOf::Prism's a -> (a ->Bool) -> s ->Bool
productOf :: Num a => Getting (Endo (Endo a)) s a -> s -> a Source #
Calculate the Product of every number targeted by a Fold.
>>>productOf both (4,5)20>>>productOf folded [1,2,3,4,5]120
product≡productOffolded
This operation may be more strict than you would expect. If you
want a lazier version use ala Product . foldMapOf
productOf::Numa =>Getters a -> s -> aproductOf::Numa =>Folds a -> s -> aproductOf::Numa =>Lens's a -> s -> aproductOf::Numa =>Iso's a -> s -> aproductOf::Numa =>Traversal's a -> s -> aproductOf::Numa =>Prism's a -> s -> a
sumOf :: Num a => Getting (Endo (Endo a)) s a -> s -> a Source #
Calculate the Sum of every number targeted by a Fold.
>>>sumOf both (5,6)11>>>sumOf folded [1,2,3,4]10>>>sumOf (folded.both) [(1,2),(3,4)]10>>>import Data.Data.Lens>>>sumOf biplate [(1::Int,[]),(2,[(3::Int,4::Int)])] :: Int10
sum≡sumOffolded
This operation may be more strict than you would expect. If you
want a lazier version use ala Sum . foldMapOf
sumOf_1::Numa => (a, b) -> asumOf(folded._1) :: (Foldablef,Numa) => f (a, b) -> a
sumOf::Numa =>Getters a -> s -> asumOf::Numa =>Folds a -> s -> asumOf::Numa =>Lens's a -> s -> asumOf::Numa =>Iso's a -> s -> asumOf::Numa =>Traversal's a -> s -> asumOf::Numa =>Prism's a -> s -> a
forOf_ :: Functor f => Getting (Traversed r f) s a -> s -> (a -> f r) -> f () Source #
Traverse over all of the targets of a Fold (or Getter), computing an Applicative (or Functor)-based answer,
but unlike forOf do not construct a new structure. forOf_ generalizes
for_ to work over any Fold.
When passed a Getter, forOf_ can work over any Functor, but when passed a Fold, forOf_ requires
an Applicative.
for_≡forOf_folded
>>>forOf_ both ("hello","world") putStrLnhello world
The rather specific signature of forOf_ allows it to be used as if the signature was any of:
iforOf_l s ≡forOf_l s.Indexed
forOf_::Functorf =>Getters a -> s -> (a -> f r) -> f ()forOf_::Applicativef =>Folds a -> s -> (a -> f r) -> f ()forOf_::Functorf =>Lens's a -> s -> (a -> f r) -> f ()forOf_::Functorf =>Iso's a -> s -> (a -> f r) -> f ()forOf_::Applicativef =>Traversal's a -> s -> (a -> f r) -> f ()forOf_::Applicativef =>Prism's a -> s -> (a -> f r) -> f ()
sequenceAOf_ :: Functor f => Getting (Traversed a f) s (f a) -> s -> f () Source #
Evaluate each action in observed by a Fold on a structure from left to right, ignoring the results.
sequenceA_≡sequenceAOf_folded
>>>sequenceAOf_ both (putStrLn "hello",putStrLn "world")hello world
sequenceAOf_::Functorf =>Getters (f a) -> s -> f ()sequenceAOf_::Applicativef =>Folds (f a) -> s -> f ()sequenceAOf_::Functorf =>Lens's (f a) -> s -> f ()sequenceAOf_::Functorf =>Iso's (f a) -> s -> f ()sequenceAOf_::Applicativef =>Traversal's (f a) -> s -> f ()sequenceAOf_::Applicativef =>Prism's (f a) -> s -> f ()
for1Of_ :: Functor f => Getting (TraversedF r f) s a -> s -> (a -> f r) -> f () Source #
See forOf_ and traverse1Of_.
>>>for1Of_ both1 ("abc", "bcd") (\ks -> Map.fromList [ (k, ()) | k <- ks ])fromList [('b',()),('c',())]
for1Of_::Applyf =>Fold1s a -> s -> (a -> f r) -> f ()
Since: lens-4.16
sequence1Of_ :: Functor f => Getting (TraversedF a f) s (f a) -> s -> f () Source #
See sequenceAOf_ and traverse1Of_.
sequence1Of_::Applyf =>Fold1s (f a) -> s -> f ()
Since: lens-4.16
mapMOf_ :: Monad m => Getting (Sequenced r m) s a -> (a -> m r) -> s -> m () Source #
Map each target of a Fold on a structure to a monadic action, evaluate these actions from left to right, and ignore the results.
>>>mapMOf_ both putStrLn ("hello","world")hello world
mapM_≡mapMOf_folded
mapMOf_::Monadm =>Getters a -> (a -> m r) -> s -> m ()mapMOf_::Monadm =>Folds a -> (a -> m r) -> s -> m ()mapMOf_::Monadm =>Lens's a -> (a -> m r) -> s -> m ()mapMOf_::Monadm =>Iso's a -> (a -> m r) -> s -> m ()mapMOf_::Monadm =>Traversal's a -> (a -> m r) -> s -> m ()mapMOf_::Monadm =>Prism's a -> (a -> m r) -> s -> m ()
forMOf_ :: Monad m => Getting (Sequenced r m) s a -> s -> (a -> m r) -> m () Source #
forMOf_ is mapMOf_ with two of its arguments flipped.
>>>forMOf_ both ("hello","world") putStrLnhello world
forM_≡forMOf_folded
forMOf_::Monadm =>Getters a -> s -> (a -> m r) -> m ()forMOf_::Monadm =>Folds a -> s -> (a -> m r) -> m ()forMOf_::Monadm =>Lens's a -> s -> (a -> m r) -> m ()forMOf_::Monadm =>Iso's a -> s -> (a -> m r) -> m ()forMOf_::Monadm =>Traversal's a -> s -> (a -> m r) -> m ()forMOf_::Monadm =>Prism's a -> s -> (a -> m r) -> m ()
sequenceOf_ :: Monad m => Getting (Sequenced a m) s (m a) -> s -> m () Source #
Evaluate each monadic action referenced by a Fold on the structure from left to right, and ignore the results.
>>>sequenceOf_ both (putStrLn "hello",putStrLn "world")hello world
sequence_≡sequenceOf_folded
sequenceOf_::Monadm =>Getters (m a) -> s -> m ()sequenceOf_::Monadm =>Folds (m a) -> s -> m ()sequenceOf_::Monadm =>Lens's (m a) -> s -> m ()sequenceOf_::Monadm =>Iso's (m a) -> s -> m ()sequenceOf_::Monadm =>Traversal's (m a) -> s -> m ()sequenceOf_::Monadm =>Prism's (m a) -> s -> m ()
asumOf :: Alternative f => Getting (Endo (f a)) s (f a) -> s -> f a Source #
The sum of a collection of actions, generalizing concatOf.
>>>asumOf both ("hello","world")"helloworld"
>>>asumOf each (Nothing, Just "hello", Nothing)Just "hello"
asum≡asumOffolded
asumOf::Alternativef =>Getters (f a) -> s -> f aasumOf::Alternativef =>Folds (f a) -> s -> f aasumOf::Alternativef =>Lens's (f a) -> s -> f aasumOf::Alternativef =>Iso's (f a) -> s -> f aasumOf::Alternativef =>Traversal's (f a) -> s -> f aasumOf::Alternativef =>Prism's (f a) -> s -> f a
msumOf :: MonadPlus m => Getting (Endo (m a)) s (m a) -> s -> m a Source #
The sum of a collection of actions, generalizing concatOf.
>>>msumOf both ("hello","world")"helloworld"
>>>msumOf each (Nothing, Just "hello", Nothing)Just "hello"
msum≡msumOffolded
msumOf::MonadPlusm =>Getters (m a) -> s -> m amsumOf::MonadPlusm =>Folds (m a) -> s -> m amsumOf::MonadPlusm =>Lens's (m a) -> s -> m amsumOf::MonadPlusm =>Iso's (m a) -> s -> m amsumOf::MonadPlusm =>Traversal's (m a) -> s -> m amsumOf::MonadPlusm =>Prism's (m a) -> s -> m a
elemOf :: Eq a => Getting Any s a -> a -> s -> Bool Source #
Does the element occur anywhere within a given Fold of the structure?
>>>elemOf both "hello" ("hello","world")True
elem≡elemOffolded
elemOf::Eqa =>Getters a -> a -> s ->BoolelemOf::Eqa =>Folds a -> a -> s ->BoolelemOf::Eqa =>Lens's a -> a -> s ->BoolelemOf::Eqa =>Iso's a -> a -> s ->BoolelemOf::Eqa =>Traversal's a -> a -> s ->BoolelemOf::Eqa =>Prism's a -> a -> s ->Bool
notElemOf :: Eq a => Getting All s a -> a -> s -> Bool Source #
Does the element not occur anywhere within a given Fold of the structure?
>>>notElemOf each 'd' ('a','b','c')True
>>>notElemOf each 'a' ('a','b','c')False
notElem≡notElemOffolded
notElemOf::Eqa =>Getters a -> a -> s ->BoolnotElemOf::Eqa =>Folds a -> a -> s ->BoolnotElemOf::Eqa =>Iso's a -> a -> s ->BoolnotElemOf::Eqa =>Lens's a -> a -> s ->BoolnotElemOf::Eqa =>Traversal's a -> a -> s ->BoolnotElemOf::Eqa =>Prism's a -> a -> s ->Bool
concatMapOf :: Getting [r] s a -> (a -> [r]) -> s -> [r] Source #
Map a function over all the targets of a Fold of a container and concatenate the resulting lists.
>>>concatMapOf both (\x -> [x, x + 1]) (1,3)[1,2,3,4]
concatMap≡concatMapOffolded
concatMapOf::Getters a -> (a -> [r]) -> s -> [r]concatMapOf::Folds a -> (a -> [r]) -> s -> [r]concatMapOf::Lens's a -> (a -> [r]) -> s -> [r]concatMapOf::Iso's a -> (a -> [r]) -> s -> [r]concatMapOf::Traversal's a -> (a -> [r]) -> s -> [r]
concatOf :: Getting [r] s [r] -> s -> [r] Source #
Concatenate all of the lists targeted by a Fold into a longer list.
>>>concatOf both ("pan","ama")"panama"
concat≡concatOffoldedconcatOf≡view
concatOf::Getters [r] -> s -> [r]concatOf::Folds [r] -> s -> [r]concatOf::Iso's [r] -> s -> [r]concatOf::Lens's [r] -> s -> [r]concatOf::Traversal's [r] -> s -> [r]
first1Of :: Getting (First a) s a -> s -> a Source #
Retrieve the First entry of a Fold1 or Traversal1 or the result from a Getter or Lens.
>>>first1Of traverse1 (1 :| [2..10])1
>>>first1Of both1 (1,2)1
Note: this is different from ^..
>>>first1Of traverse1 ([1,2] :| [[3,4],[5,6]])[1,2]
>>>([1,2] :| [[3,4],[5,6]]) ^. traverse1[1,2,3,4,5,6]
first1Of::Getters a -> s -> afirst1Of::Fold1s a -> s -> afirst1Of::Lens's a -> s -> afirst1Of::Iso's a -> s -> afirst1Of::Traversal1's a -> s -> a
last1Of :: Getting (Last a) s a -> s -> a Source #
Retrieve the Last entry of a Fold1 or Traversal1 or retrieve the result
from a Getter or Lens.o
>>>last1Of traverse1 (1 :| [2..10])10
>>>last1Of both1 (1,2)2
last1Of::Getters a -> s ->Maybealast1Of::Fold1s a -> s ->Maybealast1Of::Lens's a -> s ->Maybealast1Of::Iso's a -> s ->Maybealast1Of::Traversal1's a -> s ->Maybea
nullOf :: Getting All s a -> s -> Bool Source #
Returns True if this Fold or Traversal has no targets in the given container.
Note: nullOf on a valid Iso, Lens or Getter should always return False.
null≡nullOffolded
This may be rather inefficient compared to the null check of many containers.
>>>nullOf _1 (1,2)False
>>>nullOf ignored ()True
>>>nullOf traverse []True
>>>nullOf (element 20) [1..10]True
nullOf(folded._1.folded) :: (Foldablef,Foldableg) => f (g a, b) ->Bool
nullOf::Getters a -> s ->BoolnullOf::Folds a -> s ->BoolnullOf::Iso's a -> s ->BoolnullOf::Lens's a -> s ->BoolnullOf::Traversal's a -> s ->Bool
notNullOf :: Getting Any s a -> s -> Bool Source #
Returns True if this Fold or Traversal has any targets in the given container.
A more "conversational" alias for this combinator is has.
Note: notNullOf on a valid Iso, Lens or Getter should always return True.
not.null≡notNullOffolded
This may be rather inefficient compared to the check of many containers.not . null
>>>notNullOf _1 (1,2)True
>>>notNullOf traverse [1..10]True
>>>notNullOf folded []False
>>>notNullOf (element 20) [1..10]False
notNullOf(folded._1.folded) :: (Foldablef,Foldableg) => f (g a, b) ->Bool
notNullOf::Getters a -> s ->BoolnotNullOf::Folds a -> s ->BoolnotNullOf::Iso's a -> s ->BoolnotNullOf::Lens's a -> s ->BoolnotNullOf::Traversal's a -> s ->Bool
maximumOf :: Ord a => Getting (Endo (Endo (Maybe a))) s a -> s -> Maybe a Source #
Obtain the maximum element (if any) targeted by a Fold or Traversal safely.
Note: maximumOf on a valid Iso, Lens or Getter will always return Just a value.
>>>maximumOf traverse [1..10]Just 10
>>>maximumOf traverse []Nothing
>>>maximumOf (folded.filtered even) [1,4,3,6,7,9,2]Just 6
maximum≡fromMaybe(error"empty").maximumOffolded
In the interest of efficiency, This operation has semantics more strict than strictly necessary.
has lazier semantics but could leak memory.rmap getMax (foldMapOf l Max)
maximumOf::Orda =>Getters a -> s ->MaybeamaximumOf::Orda =>Folds a -> s ->MaybeamaximumOf::Orda =>Iso's a -> s ->MaybeamaximumOf::Orda =>Lens's a -> s ->MaybeamaximumOf::Orda =>Traversal's a -> s ->Maybea
maximum1Of :: Ord a => Getting (Max a) s a -> s -> a Source #
Obtain the maximum element targeted by a Fold1 or Traversal1.
>>>maximum1Of traverse1 (1 :| [2..10])10
maximum1Of::Orda =>Getters a -> s -> amaximum1Of::Orda =>Fold1s a -> s -> amaximum1Of::Orda =>Iso's a -> s -> amaximum1Of::Orda =>Lens's a -> s -> amaximum1Of::Orda =>Traversal1's a -> s -> a
minimumOf :: Ord a => Getting (Endo (Endo (Maybe a))) s a -> s -> Maybe a Source #
Obtain the minimum element (if any) targeted by a Fold or Traversal safely.
Note: minimumOf on a valid Iso, Lens or Getter will always return Just a value.
>>>minimumOf traverse [1..10]Just 1
>>>minimumOf traverse []Nothing
>>>minimumOf (folded.filtered even) [1,4,3,6,7,9,2]Just 2
minimum≡fromMaybe(error"empty").minimumOffolded
In the interest of efficiency, This operation has semantics more strict than strictly necessary.
has lazier semantics but could leak memory.rmap getMin (foldMapOf l Min)
minimumOf::Orda =>Getters a -> s ->MaybeaminimumOf::Orda =>Folds a -> s ->MaybeaminimumOf::Orda =>Iso's a -> s ->MaybeaminimumOf::Orda =>Lens's a -> s ->MaybeaminimumOf::Orda =>Traversal's a -> s ->Maybea
minimum1Of :: Ord a => Getting (Min a) s a -> s -> a Source #
Obtain the minimum element targeted by a Fold1 or Traversal1.
>>>minimum1Of traverse1 (1 :| [2..10])1
minimum1Of::Orda =>Getters a -> s -> aminimum1Of::Orda =>Fold1s a -> s -> aminimum1Of::Orda =>Iso's a -> s -> aminimum1Of::Orda =>Lens's a -> s -> aminimum1Of::Orda =>Traversal1's a -> s -> a
maximumByOf :: Getting (Endo (Endo (Maybe a))) s a -> (a -> a -> Ordering) -> s -> Maybe a Source #
Obtain the maximum element (if any) targeted by a Fold, Traversal, Lens, Iso,
or Getter according to a user supplied Ordering.
>>>maximumByOf traverse (compare `on` length) ["mustard","relish","ham"]Just "mustard"
In the interest of efficiency, This operation has semantics more strict than strictly necessary.
maximumBycmp ≡fromMaybe(error"empty").maximumByOffoldedcmp
maximumByOf::Getters a -> (a -> a ->Ordering) -> s ->MaybeamaximumByOf::Folds a -> (a -> a ->Ordering) -> s ->MaybeamaximumByOf::Iso's a -> (a -> a ->Ordering) -> s ->MaybeamaximumByOf::Lens's a -> (a -> a ->Ordering) -> s ->MaybeamaximumByOf::Traversal's a -> (a -> a ->Ordering) -> s ->Maybea
minimumByOf :: Getting (Endo (Endo (Maybe a))) s a -> (a -> a -> Ordering) -> s -> Maybe a Source #
Obtain the minimum element (if any) targeted by a Fold, Traversal, Lens, Iso
or Getter according to a user supplied Ordering.
In the interest of efficiency, This operation has semantics more strict than strictly necessary.
>>>minimumByOf traverse (compare `on` length) ["mustard","relish","ham"]Just "ham"
minimumBycmp ≡fromMaybe(error"empty").minimumByOffoldedcmp
minimumByOf::Getters a -> (a -> a ->Ordering) -> s ->MaybeaminimumByOf::Folds a -> (a -> a ->Ordering) -> s ->MaybeaminimumByOf::Iso's a -> (a -> a ->Ordering) -> s ->MaybeaminimumByOf::Lens's a -> (a -> a ->Ordering) -> s ->MaybeaminimumByOf::Traversal's a -> (a -> a ->Ordering) -> s ->Maybea
findOf :: Getting (Endo (Maybe a)) s a -> (a -> Bool) -> s -> Maybe a Source #
The findOf function takes a Lens (or Getter, Iso, Fold, or Traversal),
a predicate and a structure and returns the leftmost element of the structure
matching the predicate, or Nothing if there is no such element.
>>>findOf each even (1,3,4,6)Just 4
>>>findOf folded even [1,3,5,7]Nothing
findOf::Getters a -> (a ->Bool) -> s ->MaybeafindOf::Folds a -> (a ->Bool) -> s ->MaybeafindOf::Iso's a -> (a ->Bool) -> s ->MaybeafindOf::Lens's a -> (a ->Bool) -> s ->MaybeafindOf::Traversal's a -> (a ->Bool) -> s ->Maybea
find≡findOffoldedifindOfl ≡findOfl.Indexed
A simpler version that didn't permit indexing, would be:
findOf::Getting(Endo(Maybea)) s a -> (a ->Bool) -> s ->MaybeafindOfl p =foldrOfl (a y -> if p a thenJusta else y)Nothing
findMOf :: Monad m => Getting (Endo (m (Maybe a))) s a -> (a -> m Bool) -> s -> m (Maybe a) Source #
The findMOf function takes a Lens (or Getter, Iso, Fold, or Traversal),
a monadic predicate and a structure and returns in the monad the leftmost element of the structure
matching the predicate, or Nothing if there is no such element.
>>>findMOf each ( \x -> print ("Checking " ++ show x) >> return (even x)) (1,3,4,6)"Checking 1" "Checking 3" "Checking 4" Just 4
>>>findMOf each ( \x -> print ("Checking " ++ show x) >> return (even x)) (1,3,5,7)"Checking 1" "Checking 3" "Checking 5" "Checking 7" Nothing
findMOf:: (Monadm,Getters a) -> (a -> mBool) -> s -> m (Maybea)findMOf:: (Monadm,Folds a) -> (a -> mBool) -> s -> m (Maybea)findMOf:: (Monadm,Iso's a) -> (a -> mBool) -> s -> m (Maybea)findMOf:: (Monadm,Lens's a) -> (a -> mBool) -> s -> m (Maybea)findMOf:: (Monadm,Traversal's a) -> (a -> mBool) -> s -> m (Maybea)
findMOffolded:: (Monad m, Foldable f) => (a -> m Bool) -> f a -> m (Maybe a)ifindMOfl ≡findMOfl.Indexed
A simpler version that didn't permit indexing, would be:
findMOf:: Monad m =>Getting(Endo(m (Maybea))) s a -> (a -> mBool) -> s -> m (Maybea)findMOfl p =foldrOfl (a y -> p a >>= x -> if x then return (Justa) else y) $ returnNothing
lookupOf :: Eq k => Getting (Endo (Maybe v)) s (k, v) -> k -> s -> Maybe v Source #
The lookupOf function takes a Fold (or Getter, Traversal,
Lens, Iso, etc.), a key, and a structure containing key/value pairs.
It returns the first value corresponding to the given key. This function
generalizes lookup to work on an arbitrary Fold instead of lists.
>>>lookupOf folded 4 [(2, 'a'), (4, 'b'), (4, 'c')]Just 'b'
>>>lookupOf each 2 [(2, 'a'), (4, 'b'), (4, 'c')]Just 'a'
lookupOf::Eqk =>Folds (k,v) -> k -> s ->Maybev
foldr1Of :: HasCallStack => Getting (Endo (Maybe a)) s a -> (a -> a -> a) -> s -> a Source #
A variant of foldrOf that has no base case and thus may only be applied
to lenses and structures such that the Lens views at least one element of
the structure.
>>>foldr1Of each (+) (1,2,3,4)10
foldr1Ofl f ≡foldr1f.toListOflfoldr1≡foldr1Offolded
foldr1Of::Getters a -> (a -> a -> a) -> s -> afoldr1Of::Folds a -> (a -> a -> a) -> s -> afoldr1Of::Iso's a -> (a -> a -> a) -> s -> afoldr1Of::Lens's a -> (a -> a -> a) -> s -> afoldr1Of::Traversal's a -> (a -> a -> a) -> s -> a
foldl1Of :: HasCallStack => Getting (Dual (Endo (Maybe a))) s a -> (a -> a -> a) -> s -> a Source #
A variant of foldlOf that has no base case and thus may only be applied to lenses and structures such
that the Lens views at least one element of the structure.
>>>foldl1Of each (+) (1,2,3,4)10
foldl1Ofl f ≡foldl1f.toListOflfoldl1≡foldl1Offolded
foldl1Of::Getters a -> (a -> a -> a) -> s -> afoldl1Of::Folds a -> (a -> a -> a) -> s -> afoldl1Of::Iso's a -> (a -> a -> a) -> s -> afoldl1Of::Lens's a -> (a -> a -> a) -> s -> afoldl1Of::Traversal's a -> (a -> a -> a) -> s -> a
foldrOf' :: Getting (Dual (Endo (Endo r))) s a -> (a -> r -> r) -> r -> s -> r Source #
Strictly fold right over the elements of a structure.
foldr'≡foldrOf'folded
foldrOf'::Getters a -> (a -> r -> r) -> r -> s -> rfoldrOf'::Folds a -> (a -> r -> r) -> r -> s -> rfoldrOf'::Iso's a -> (a -> r -> r) -> r -> s -> rfoldrOf'::Lens's a -> (a -> r -> r) -> r -> s -> rfoldrOf'::Traversal's a -> (a -> r -> r) -> r -> s -> r
foldlOf' :: Getting (Endo (Endo r)) s a -> (r -> a -> r) -> r -> s -> r Source #
Fold over the elements of a structure, associating to the left, but strictly.
foldl'≡foldlOf'folded
foldlOf'::Getters a -> (r -> a -> r) -> r -> s -> rfoldlOf'::Folds a -> (r -> a -> r) -> r -> s -> rfoldlOf'::Iso's a -> (r -> a -> r) -> r -> s -> rfoldlOf'::Lens's a -> (r -> a -> r) -> r -> s -> rfoldlOf'::Traversal's a -> (r -> a -> r) -> r -> s -> r
foldr1Of' :: HasCallStack => Getting (Dual (Endo (Endo (Maybe a)))) s a -> (a -> a -> a) -> s -> a Source #
A variant of foldrOf' that has no base case and thus may only be applied
to folds and structures such that the fold views at least one element of the
structure.
foldr1Ofl f ≡foldr1f.toListOfl
foldr1Of'::Getters a -> (a -> a -> a) -> s -> afoldr1Of'::Folds a -> (a -> a -> a) -> s -> afoldr1Of'::Iso's a -> (a -> a -> a) -> s -> afoldr1Of'::Lens's a -> (a -> a -> a) -> s -> afoldr1Of'::Traversal's a -> (a -> a -> a) -> s -> a
foldl1Of' :: HasCallStack => Getting (Endo (Endo (Maybe a))) s a -> (a -> a -> a) -> s -> a Source #
A variant of foldlOf' that has no base case and thus may only be applied
to folds and structures such that the fold views at least one element of
the structure.
foldl1Of'l f ≡foldl1'f.toListOfl
foldl1Of'::Getters a -> (a -> a -> a) -> s -> afoldl1Of'::Folds a -> (a -> a -> a) -> s -> afoldl1Of'::Iso's a -> (a -> a -> a) -> s -> afoldl1Of'::Lens's a -> (a -> a -> a) -> s -> afoldl1Of'::Traversal's a -> (a -> a -> a) -> s -> a
foldrMOf :: Monad m => Getting (Dual (Endo (r -> m r))) s a -> (a -> r -> m r) -> r -> s -> m r Source #
Monadic fold over the elements of a structure, associating to the right, i.e. from right to left.
foldrM≡foldrMOffolded
foldrMOf::Monadm =>Getters a -> (a -> r -> m r) -> r -> s -> m rfoldrMOf::Monadm =>Folds a -> (a -> r -> m r) -> r -> s -> m rfoldrMOf::Monadm =>Iso's a -> (a -> r -> m r) -> r -> s -> m rfoldrMOf::Monadm =>Lens's a -> (a -> r -> m r) -> r -> s -> m rfoldrMOf::Monadm =>Traversal's a -> (a -> r -> m r) -> r -> s -> m r
foldlMOf :: Monad m => Getting (Endo (r -> m r)) s a -> (r -> a -> m r) -> r -> s -> m r Source #
Monadic fold over the elements of a structure, associating to the left, i.e. from left to right.
foldlM≡foldlMOffolded
foldlMOf::Monadm =>Getters a -> (r -> a -> m r) -> r -> s -> m rfoldlMOf::Monadm =>Folds a -> (r -> a -> m r) -> r -> s -> m rfoldlMOf::Monadm =>Iso's a -> (r -> a -> m r) -> r -> s -> m rfoldlMOf::Monadm =>Lens's a -> (r -> a -> m r) -> r -> s -> m rfoldlMOf::Monadm =>Traversal's a -> (r -> a -> m r) -> r -> s -> m r
has :: Getting Any s a -> s -> Bool Source #
Check to see if this Fold or Traversal matches 1 or more entries.
>>>has (element 0) []False
>>>has _Left (Left 12)True
>>>has _Right (Left 12)False
This will always return True for a Lens or Getter.
>>>has _1 ("hello","world")True
has::Getters a -> s ->Boolhas::Folds a -> s ->Boolhas::Iso's a -> s ->Boolhas::Lens's a -> s ->Boolhas::Traversal's a -> s ->Bool
pre :: Getting (First a) s a -> IndexPreservingGetter s (Maybe a) Source #
This converts a Fold to a IndexPreservingGetter that returns the first element, if it
exists, as a Maybe.
pre::Getters a ->IndexPreservingGetters (Maybea)pre::Folds a ->IndexPreservingGetters (Maybea)pre::Traversal's a ->IndexPreservingGetters (Maybea)pre::Lens's a ->IndexPreservingGetters (Maybea)pre::Iso's a ->IndexPreservingGetters (Maybea)pre::Prism's a ->IndexPreservingGetters (Maybea)
ipre :: IndexedGetting i (First (i, a)) s a -> IndexPreservingGetter s (Maybe (i, a)) Source #
This converts an IndexedFold to an IndexPreservingGetter that returns the first index
and element, if they exist, as a Maybe.
ipre::IndexedGetteri s a ->IndexPreservingGetters (Maybe(i, a))ipre::IndexedFoldi s a ->IndexPreservingGetters (Maybe(i, a))ipre::IndexedTraversal'i s a ->IndexPreservingGetters (Maybe(i, a))ipre::IndexedLens'i s a ->IndexPreservingGetters (Maybe(i, a))
ipreview :: MonadReader s m => IndexedGetting i (First (i, a)) s a -> m (Maybe (i, a)) Source #
Retrieve the first index and value targeted by a Fold or Traversal (or Just the result
from a Getter or Lens). See also (^@?).
ipreview=view.ipre
This is usually applied in the Reader
Monad (->) s.
ipreview::IndexedGetteri s a -> s ->Maybe(i, a)ipreview::IndexedFoldi s a -> s ->Maybe(i, a)ipreview::IndexedLens'i s a -> s ->Maybe(i, a)ipreview::IndexedTraversal'i s a -> s ->Maybe(i, a)
However, it may be useful to think of its full generality when working with
a Monad transformer stack:
ipreview::MonadReaders m =>IndexedGetters a -> m (Maybe(i, a))ipreview::MonadReaders m =>IndexedFolds a -> m (Maybe(i, a))ipreview::MonadReaders m =>IndexedLens's a -> m (Maybe(i, a))ipreview::MonadReaders m =>IndexedTraversal's a -> m (Maybe(i, a))
ipreviews :: MonadReader s m => IndexedGetting i (First r) s a -> (i -> a -> r) -> m (Maybe r) Source #
Retrieve a function of the first index and value targeted by an IndexedFold or
IndexedTraversal (or Just the result from an IndexedGetter or IndexedLens).
See also (^@?).
ipreviews=views.ipre
This is usually applied in the Reader
Monad (->) s.
ipreviews::IndexedGetteri s a -> (i -> a -> r) -> s ->Mayberipreviews::IndexedFoldi s a -> (i -> a -> r) -> s ->Mayberipreviews::IndexedLens'i s a -> (i -> a -> r) -> s ->Mayberipreviews::IndexedTraversal'i s a -> (i -> a -> r) -> s ->Mayber
However, it may be useful to think of its full generality when working with
a Monad transformer stack:
ipreviews::MonadReaders m =>IndexedGetteri s a -> (i -> a -> r) -> m (Mayber)ipreviews::MonadReaders m =>IndexedFoldi s a -> (i -> a -> r) -> m (Mayber)ipreviews::MonadReaders m =>IndexedLens'i s a -> (i -> a -> r) -> m (Mayber)ipreviews::MonadReaders m =>IndexedTraversal'i s a -> (i -> a -> r) -> m (Mayber)
preuse :: MonadState s m => Getting (First a) s a -> m (Maybe a) Source #
Retrieve the first value targeted by a Fold or Traversal (or Just the result
from a Getter or Lens) into the current state.
preuse=use.pre
preuse::MonadStates m =>Getters a -> m (Maybea)preuse::MonadStates m =>Folds a -> m (Maybea)preuse::MonadStates m =>Lens's a -> m (Maybea)preuse::MonadStates m =>Iso's a -> m (Maybea)preuse::MonadStates m =>Traversal's a -> m (Maybea)
ipreuse :: MonadState s m => IndexedGetting i (First (i, a)) s a -> m (Maybe (i, a)) Source #
Retrieve the first index and value targeted by an IndexedFold or IndexedTraversal (or Just the index
and result from an IndexedGetter or IndexedLens) into the current state.
ipreuse=use.ipre
ipreuse::MonadStates m =>IndexedGetteri s a -> m (Maybe(i, a))ipreuse::MonadStates m =>IndexedFoldi s a -> m (Maybe(i, a))ipreuse::MonadStates m =>IndexedLens'i s a -> m (Maybe(i, a))ipreuse::MonadStates m =>IndexedTraversal'i s a -> m (Maybe(i, a))
preuses :: MonadState s m => Getting (First r) s a -> (a -> r) -> m (Maybe r) Source #
Retrieve a function of the first value targeted by a Fold or
Traversal (or Just the result from a Getter or Lens) into the current state.
preuses=uses.pre
preuses::MonadStates m =>Getters a -> (a -> r) -> m (Mayber)preuses::MonadStates m =>Folds a -> (a -> r) -> m (Mayber)preuses::MonadStates m =>Lens's a -> (a -> r) -> m (Mayber)preuses::MonadStates m =>Iso's a -> (a -> r) -> m (Mayber)preuses::MonadStates m =>Traversal's a -> (a -> r) -> m (Mayber)
ipreuses :: MonadState s m => IndexedGetting i (First r) s a -> (i -> a -> r) -> m (Maybe r) Source #
Retrieve a function of the first index and value targeted by an IndexedFold or
IndexedTraversal (or a function of Just the index and result from an IndexedGetter
or IndexedLens) into the current state.
ipreuses=uses.ipre
ipreuses::MonadStates m =>IndexedGetteri s a -> (i -> a -> r) -> m (Mayber)ipreuses::MonadStates m =>IndexedFoldi s a -> (i -> a -> r) -> m (Mayber)ipreuses::MonadStates m =>IndexedLens'i s a -> (i -> a -> r) -> m (Mayber)ipreuses::MonadStates m =>IndexedTraversal'i s a -> (i -> a -> r) -> m (Mayber)
ifoldrOf :: IndexedGetting i (Endo r) s a -> (i -> a -> r -> r) -> r -> s -> r Source #
Right-associative fold of parts of a structure that are viewed through an IndexedFold or IndexedTraversal with
access to the i.
When you don't need access to the index then foldrOf is more flexible in what it accepts.
foldrOfl ≡ifoldrOfl.const
ifoldrOf::IndexedGetteri s a -> (i -> a -> r -> r) -> r -> s -> rifoldrOf::IndexedFoldi s a -> (i -> a -> r -> r) -> r -> s -> rifoldrOf::IndexedLens'i s a -> (i -> a -> r -> r) -> r -> s -> rifoldrOf::IndexedTraversal'i s a -> (i -> a -> r -> r) -> r -> s -> r
ifoldlOf :: IndexedGetting i (Dual (Endo r)) s a -> (i -> r -> a -> r) -> r -> s -> r Source #
Left-associative fold of the parts of a structure that are viewed through an IndexedFold or IndexedTraversal with
access to the i.
When you don't need access to the index then foldlOf is more flexible in what it accepts.
foldlOfl ≡ifoldlOfl.const
ifoldlOf::IndexedGetteri s a -> (i -> r -> a -> r) -> r -> s -> rifoldlOf::IndexedFoldi s a -> (i -> r -> a -> r) -> r -> s -> rifoldlOf::IndexedLens'i s a -> (i -> r -> a -> r) -> r -> s -> rifoldlOf::IndexedTraversal'i s a -> (i -> r -> a -> r) -> r -> s -> r
ianyOf :: IndexedGetting i Any s a -> (i -> a -> Bool) -> s -> Bool Source #
Return whether or not any element viewed through an IndexedFold or IndexedTraversal
satisfy a predicate, with access to the i.
When you don't need access to the index then anyOf is more flexible in what it accepts.
anyOfl ≡ianyOfl.const
ianyOf::IndexedGetteri s a -> (i -> a ->Bool) -> s ->BoolianyOf::IndexedFoldi s a -> (i -> a ->Bool) -> s ->BoolianyOf::IndexedLens'i s a -> (i -> a ->Bool) -> s ->BoolianyOf::IndexedTraversal'i s a -> (i -> a ->Bool) -> s ->Bool
iallOf :: IndexedGetting i All s a -> (i -> a -> Bool) -> s -> Bool Source #
Return whether or not all elements viewed through an IndexedFold or IndexedTraversal
satisfy a predicate, with access to the i.
When you don't need access to the index then allOf is more flexible in what it accepts.
allOfl ≡iallOfl.const
iallOf::IndexedGetteri s a -> (i -> a ->Bool) -> s ->BooliallOf::IndexedFoldi s a -> (i -> a ->Bool) -> s ->BooliallOf::IndexedLens'i s a -> (i -> a ->Bool) -> s ->BooliallOf::IndexedTraversal'i s a -> (i -> a ->Bool) -> s ->Bool
inoneOf :: IndexedGetting i Any s a -> (i -> a -> Bool) -> s -> Bool Source #
Return whether or not none of the elements viewed through an IndexedFold or IndexedTraversal
satisfy a predicate, with access to the i.
When you don't need access to the index then noneOf is more flexible in what it accepts.
noneOfl ≡inoneOfl.const
inoneOf::IndexedGetteri s a -> (i -> a ->Bool) -> s ->BoolinoneOf::IndexedFoldi s a -> (i -> a ->Bool) -> s ->BoolinoneOf::IndexedLens'i s a -> (i -> a ->Bool) -> s ->BoolinoneOf::IndexedTraversal'i s a -> (i -> a ->Bool) -> s ->Bool
itraverseOf_ :: Functor f => IndexedGetting i (Traversed r f) s a -> (i -> a -> f r) -> s -> f () Source #
Traverse the targets of an IndexedFold or IndexedTraversal with access to the i, discarding the results.
When you don't need access to the index then traverseOf_ is more flexible in what it accepts.
traverseOf_l ≡itraverseOfl.const
itraverseOf_::Functorf =>IndexedGetteri s a -> (i -> a -> f r) -> s -> f ()itraverseOf_::Applicativef =>IndexedFoldi s a -> (i -> a -> f r) -> s -> f ()itraverseOf_::Functorf =>IndexedLens'i s a -> (i -> a -> f r) -> s -> f ()itraverseOf_::Applicativef =>IndexedTraversal'i s a -> (i -> a -> f r) -> s -> f ()
iforOf_ :: Functor f => IndexedGetting i (Traversed r f) s a -> s -> (i -> a -> f r) -> f () Source #
Traverse the targets of an IndexedFold or IndexedTraversal with access to the index, discarding the results
(with the arguments flipped).
iforOf_≡flip.itraverseOf_
When you don't need access to the index then forOf_ is more flexible in what it accepts.
forOf_l a ≡iforOf_l a.const
iforOf_::Functorf =>IndexedGetteri s a -> s -> (i -> a -> f r) -> f ()iforOf_::Applicativef =>IndexedFoldi s a -> s -> (i -> a -> f r) -> f ()iforOf_::Functorf =>IndexedLens'i s a -> s -> (i -> a -> f r) -> f ()iforOf_::Applicativef =>IndexedTraversal'i s a -> s -> (i -> a -> f r) -> f ()
imapMOf_ :: Monad m => IndexedGetting i (Sequenced r m) s a -> (i -> a -> m r) -> s -> m () Source #
Run monadic actions for each target of an IndexedFold or IndexedTraversal with access to the index,
discarding the results.
When you don't need access to the index then mapMOf_ is more flexible in what it accepts.
mapMOf_l ≡imapMOfl.const
imapMOf_::Monadm =>IndexedGetteri s a -> (i -> a -> m r) -> s -> m ()imapMOf_::Monadm =>IndexedFoldi s a -> (i -> a -> m r) -> s -> m ()imapMOf_::Monadm =>IndexedLens'i s a -> (i -> a -> m r) -> s -> m ()imapMOf_::Monadm =>IndexedTraversal'i s a -> (i -> a -> m r) -> s -> m ()
iforMOf_ :: Monad m => IndexedGetting i (Sequenced r m) s a -> s -> (i -> a -> m r) -> m () Source #
Run monadic actions for each target of an IndexedFold or IndexedTraversal with access to the index,
discarding the results (with the arguments flipped).
iforMOf_≡flip.imapMOf_
When you don't need access to the index then forMOf_ is more flexible in what it accepts.
forMOf_l a ≡iforMOfl a.const
iforMOf_::Monadm =>IndexedGetteri s a -> s -> (i -> a -> m r) -> m ()iforMOf_::Monadm =>IndexedFoldi s a -> s -> (i -> a -> m r) -> m ()iforMOf_::Monadm =>IndexedLens'i s a -> s -> (i -> a -> m r) -> m ()iforMOf_::Monadm =>IndexedTraversal'i s a -> s -> (i -> a -> m r) -> m ()
iconcatMapOf :: IndexedGetting i [r] s a -> (i -> a -> [r]) -> s -> [r] Source #
Concatenate the results of a function of the elements of an IndexedFold or IndexedTraversal
with access to the index.
When you don't need access to the index then concatMapOf is more flexible in what it accepts.
concatMapOfl ≡iconcatMapOfl.consticoncatMapOf≡ifoldMapOf
iconcatMapOf::IndexedGetteri s a -> (i -> a -> [r]) -> s -> [r]iconcatMapOf::IndexedFoldi s a -> (i -> a -> [r]) -> s -> [r]iconcatMapOf::IndexedLens'i s a -> (i -> a -> [r]) -> s -> [r]iconcatMapOf::IndexedTraversal'i s a -> (i -> a -> [r]) -> s -> [r]
ifindOf :: IndexedGetting i (Endo (Maybe a)) s a -> (i -> a -> Bool) -> s -> Maybe a Source #
The ifindOf function takes an IndexedFold or IndexedTraversal, a predicate that is also
supplied the index, a structure and returns the left-most element of the structure
matching the predicate, or Nothing if there is no such element.
When you don't need access to the index then findOf is more flexible in what it accepts.
findOfl ≡ifindOfl.const
ifindOf::IndexedGetteri s a -> (i -> a ->Bool) -> s ->MaybeaifindOf::IndexedFoldi s a -> (i -> a ->Bool) -> s ->MaybeaifindOf::IndexedLens'i s a -> (i -> a ->Bool) -> s ->MaybeaifindOf::IndexedTraversal'i s a -> (i -> a ->Bool) -> s ->Maybea
ifindMOf :: Monad m => IndexedGetting i (Endo (m (Maybe a))) s a -> (i -> a -> m Bool) -> s -> m (Maybe a) Source #
The ifindMOf function takes an IndexedFold or IndexedTraversal, a monadic predicate that is also
supplied the index, a structure and returns in the monad the left-most element of the structure
matching the predicate, or Nothing if there is no such element.
When you don't need access to the index then findMOf is more flexible in what it accepts.
findMOfl ≡ifindMOfl.const
ifindMOf::Monadm =>IndexedGetteri s a -> (i -> a -> mBool) -> s -> m (Maybea)ifindMOf::Monadm =>IndexedFoldi s a -> (i -> a -> mBool) -> s -> m (Maybea)ifindMOf::Monadm =>IndexedLens'i s a -> (i -> a -> mBool) -> s -> m (Maybea)ifindMOf::Monadm =>IndexedTraversal'i s a -> (i -> a -> mBool) -> s -> m (Maybea)
ifoldrOf' :: IndexedGetting i (Dual (Endo (r -> r))) s a -> (i -> a -> r -> r) -> r -> s -> r Source #
Strictly fold right over the elements of a structure with an index.
When you don't need access to the index then foldrOf' is more flexible in what it accepts.
foldrOf'l ≡ifoldrOf'l.const
ifoldrOf'::IndexedGetteri s a -> (i -> a -> r -> r) -> r -> s -> rifoldrOf'::IndexedFoldi s a -> (i -> a -> r -> r) -> r -> s -> rifoldrOf'::IndexedLens'i s a -> (i -> a -> r -> r) -> r -> s -> rifoldrOf'::IndexedTraversal'i s a -> (i -> a -> r -> r) -> r -> s -> r
ifoldlOf' :: IndexedGetting i (Endo (r -> r)) s a -> (i -> r -> a -> r) -> r -> s -> r Source #
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
ifoldlOf'::IndexedGetteri s a -> (i -> r -> a -> r) -> r -> s -> rifoldlOf'::IndexedFoldi s a -> (i -> r -> a -> r) -> r -> s -> rifoldlOf'::IndexedLens'i s a -> (i -> r -> a -> r) -> r -> s -> rifoldlOf'::IndexedTraversal'i s a -> (i -> r -> a -> r) -> r -> s -> r
ifoldrMOf :: Monad m => IndexedGetting i (Dual (Endo (r -> m r))) s a -> (i -> a -> r -> m r) -> r -> s -> m r Source #
Monadic fold right over the elements of a structure with an index.
When you don't need access to the index then foldrMOf is more flexible in what it accepts.
foldrMOfl ≡ifoldrMOfl.const
ifoldrMOf::Monadm =>IndexedGetteri s a -> (i -> a -> r -> m r) -> r -> s -> m rifoldrMOf::Monadm =>IndexedFoldi s a -> (i -> a -> r -> m r) -> r -> s -> m rifoldrMOf::Monadm =>IndexedLens'i s a -> (i -> a -> r -> m r) -> r -> s -> m rifoldrMOf::Monadm =>IndexedTraversal'i s a -> (i -> a -> r -> m r) -> r -> s -> m r
ifoldlMOf :: Monad m => IndexedGetting i (Endo (r -> m r)) s a -> (i -> r -> a -> m r) -> r -> s -> m r Source #
Monadic fold over the elements of a structure with an index, associating to the left.
When you don't need access to the index then foldlMOf is more flexible in what it accepts.
foldlMOfl ≡ifoldlMOfl.const
ifoldlMOf::Monadm =>IndexedGetteri s a -> (i -> r -> a -> m r) -> r -> s -> m rifoldlMOf::Monadm =>IndexedFoldi s a -> (i -> r -> a -> m r) -> r -> s -> m rifoldlMOf::Monadm =>IndexedLens'i s a -> (i -> r -> a -> m r) -> r -> s -> m rifoldlMOf::Monadm =>IndexedTraversal'i s a -> (i -> r -> a -> m r) -> r -> s -> m r
itoListOf :: IndexedGetting i (Endo [(i, a)]) s a -> s -> [(i, a)] Source #
Extract the key-value pairs from a structure.
When you don't need access to the indices in the result, then toListOf is more flexible in what it accepts.
toListOfl ≡mapsnd.itoListOfl
itoListOf::IndexedGetteri s a -> s -> [(i,a)]itoListOf::IndexedFoldi s a -> s -> [(i,a)]itoListOf::IndexedLens'i s a -> s -> [(i,a)]itoListOf::IndexedTraversal'i s a -> s -> [(i,a)]
(^@..) :: s -> IndexedGetting i (Endo [(i, a)]) s a -> [(i, a)] infixl 8 Source #
An infix version of itoListOf.
(^@?) :: s -> IndexedGetting i (Endo (Maybe (i, a))) s a -> Maybe (i, a) infixl 8 Source #
Perform a safe head (with index) of an IndexedFold or IndexedTraversal or retrieve Just the index and result
from an IndexedGetter or IndexedLens.
When using a IndexedTraversal as a partial IndexedLens, or an IndexedFold as a partial IndexedGetter this can be a convenient
way to extract the optional value.
(^@?) :: s ->IndexedGetteri s a ->Maybe(i, a) (^@?) :: s ->IndexedFoldi s a ->Maybe(i, a) (^@?) :: s ->IndexedLens'i s a ->Maybe(i, a) (^@?) :: s ->IndexedTraversal'i s a ->Maybe(i, a)
(^@?!) :: HasCallStack => s -> IndexedGetting i (Endo (i, a)) s a -> (i, a) infixl 8 Source #
Perform an *UNSAFE* head (with index) of an IndexedFold or IndexedTraversal assuming that it is there.
(^@?!) :: s ->IndexedGetteri s a -> (i, a) (^@?!) :: s ->IndexedFoldi s a -> (i, a) (^@?!) :: s ->IndexedLens'i s a -> (i, a) (^@?!) :: s ->IndexedTraversal'i s a -> (i, a)
elemIndexOf :: Eq a => IndexedGetting i (First i) s a -> a -> s -> Maybe i Source #
Retrieve the index of the first value targeted by a IndexedFold or IndexedTraversal which is equal to a given value.
elemIndex≡elemIndexOffolded
elemIndexOf::Eqa =>IndexedFoldi s a -> a -> s ->MaybeielemIndexOf::Eqa =>IndexedTraversal'i s a -> a -> s ->Maybei
elemIndicesOf :: Eq a => IndexedGetting i (Endo [i]) s a -> a -> s -> [i] Source #
Retrieve the indices of the values targeted by a IndexedFold or IndexedTraversal which are equal to a given value.
elemIndices≡elemIndicesOffolded
elemIndicesOf::Eqa =>IndexedFoldi s a -> a -> s -> [i]elemIndicesOf::Eqa =>IndexedTraversal'i s a -> a -> s -> [i]
findIndexOf :: IndexedGetting i (First i) s a -> (a -> Bool) -> s -> Maybe i Source #
Retrieve the index of the first value targeted by a IndexedFold or IndexedTraversal which satisfies a predicate.
findIndex≡findIndexOffolded
findIndexOf::IndexedFoldi s a -> (a ->Bool) -> s ->MaybeifindIndexOf::IndexedTraversal'i s a -> (a ->Bool) -> s ->Maybei
findIndicesOf :: IndexedGetting i (Endo [i]) s a -> (a -> Bool) -> s -> [i] Source #
Retrieve the indices of the values targeted by a IndexedFold or IndexedTraversal which satisfy a predicate.
findIndices≡findIndicesOffolded
findIndicesOf::IndexedFoldi s a -> (a ->Bool) -> s -> [i]findIndicesOf::IndexedTraversal'i s a -> (a ->Bool) -> s -> [i]
ifiltered :: (Indexable i p, Applicative f) => (i -> a -> Bool) -> Optical' p (Indexed i) f a a Source #
Filter an IndexedFold or IndexedGetter, obtaining an IndexedFold.
>>>[0,0,0,5,5,5]^..traversed.ifiltered (\i a -> i <= a)[0,5,5,5]
Compose with ifiltered to filter another IndexedLens, IndexedIso, IndexedGetter, IndexedFold (or IndexedTraversal) with
access to both the value and the index.
Note: As with filtered, this is not a legal IndexedTraversal, unless you are very careful not to invalidate the predicate on the target!
itakingWhile :: (Indexable i p, Profunctor q, Contravariant f, Applicative f) => (i -> a -> Bool) -> Optical' (Indexed i) q (Const (Endo (f s)) :: Type -> Type) s a -> Optical' p q f s a Source #
Obtain an IndexedFold by taking elements from another
IndexedFold, IndexedLens, IndexedGetter or IndexedTraversal while a predicate holds.
itakingWhile:: (i -> a ->Bool) ->IndexedFoldi s a ->IndexedFoldi s aitakingWhile:: (i -> a ->Bool) ->IndexedTraversal'i s a ->IndexedFoldi s aitakingWhile:: (i -> a ->Bool) ->IndexedLens'i s a ->IndexedFoldi s aitakingWhile:: (i -> a ->Bool) ->IndexedGetteri s a ->IndexedFoldi s a
Note: Applying itakingWhile to an IndexedLens or IndexedTraversal will still allow you to use it as a
pseudo-IndexedTraversal, but if you change the value of any target to one where the predicate returns
False, then you will break the Traversal laws and Traversal fusion will no longer be sound.
idroppingWhile :: (Indexable i p, Profunctor q, Applicative f) => (i -> a -> Bool) -> Optical (Indexed i) q (Compose (State Bool) f) s t a a -> Optical p q f s t a a Source #
Obtain an IndexedFold by dropping elements from another IndexedFold, IndexedLens, IndexedGetter or IndexedTraversal while a predicate holds.
idroppingWhile:: (i -> a ->Bool) ->IndexedFoldi s a ->IndexedFoldi s aidroppingWhile:: (i -> a ->Bool) ->IndexedTraversal'i s a ->IndexedFoldi s a -- see notesidroppingWhile:: (i -> a ->Bool) ->IndexedLens'i s a ->IndexedFoldi s a -- see notesidroppingWhile:: (i -> a ->Bool) ->IndexedGetteri s a ->IndexedFoldi s a
Note: As with droppingWhile applying idroppingWhile to an IndexedLens or IndexedTraversal will still
allow you to use it as a pseudo-IndexedTraversal, but if you change the value of the first target to one
where the predicate returns True, then you will break the Traversal laws and Traversal fusion will
no longer be sound.
foldByOf :: Fold s a -> (a -> a -> a) -> a -> s -> a Source #
Fold a value using a specified Fold and Monoid operations.
This is like foldBy where the Foldable instance can be
manually specified.
foldByOffolded≡foldBy
foldByOf::Getters a -> (a -> a -> a) -> a -> s -> afoldByOf::Folds a -> (a -> a -> a) -> a -> s -> afoldByOf::Lens's a -> (a -> a -> a) -> a -> s -> afoldByOf::Traversal's a -> (a -> a -> a) -> a -> s -> afoldByOf::Iso's a -> (a -> a -> a) -> a -> s -> a
>>>foldByOf both (++) [] ("hello","world")"helloworld"
foldMapByOf :: Fold s a -> (r -> r -> r) -> r -> (a -> r) -> s -> r Source #
Fold a value using a specified Fold and Monoid operations.
This is like foldMapBy where the Foldable instance can be
manually specified.
foldMapByOffolded≡foldMapBy
foldMapByOf::Getters a -> (r -> r -> r) -> r -> (a -> r) -> s -> rfoldMapByOf::Folds a -> (r -> r -> r) -> r -> (a -> r) -> s -> rfoldMapByOf::Traversal's a -> (r -> r -> r) -> r -> (a -> r) -> s -> rfoldMapByOf::Lens's a -> (r -> r -> r) -> r -> (a -> r) -> s -> rfoldMapByOf::Iso's a -> (r -> r -> r) -> r -> (a -> r) -> s -> r
>>>foldMapByOf both (+) 0 length ("hello","world")10
class Ord k => TraverseMax k (m :: Type -> Type) | m -> k where Source #
Allows IndexedTraversal of the value at the largest index.
Methods
traverseMax :: IndexedTraversal' k (m v) v Source #
IndexedTraversal of the element at the largest index.
Instances
| TraverseMax Int IntMap | |
Defined in Control.Lens.Traversal Methods traverseMax :: IndexedTraversal' Int (IntMap v) v Source # | |
| Ord k => TraverseMax k (Map k) | |
Defined in Control.Lens.Traversal Methods traverseMax :: IndexedTraversal' k (Map k v) v Source # | |
class Ord k => TraverseMin k (m :: Type -> Type) | m -> k where Source #
Allows IndexedTraversal the value at the smallest index.
Methods
traverseMin :: IndexedTraversal' k (m v) v Source #
IndexedTraversal of the element with the smallest index.
Instances
| TraverseMin Int IntMap | |
Defined in Control.Lens.Traversal Methods traverseMin :: IndexedTraversal' Int (IntMap v) v Source # | |
| Ord k => TraverseMin k (Map k) | |
Defined in Control.Lens.Traversal Methods traverseMin :: IndexedTraversal' k (Map k v) v Source # | |
type Traversing1' (p :: Type -> Type -> Type) (f :: Type -> Type) s a = Traversing1 p f s s a a Source #
type Traversing' (p :: Type -> Type -> Type) (f :: Type -> Type) s a = Traversing p f s s a a Source #
typeTraversing'f =Simple(Traversingf)
type Traversing1 (p :: Type -> Type -> Type) (f :: Type -> Type) s t a b = Over p (BazaarT1 p f a b) s t a b Source #
type Traversing (p :: Type -> Type -> Type) (f :: Type -> Type) s t a b = Over p (BazaarT p f a b) s t a b Source #
When you see this as an argument to a function, it expects
- to be indexed if
pis an instance ofIndexedi, - to be unindexed if
pis(->), - a
TraversaliffisApplicative, - a
Getteriffis only aFunctorandContravariant, - a
Lensiffis only aFunctor, - a
FoldiffisApplicativeandContravariant.
type AnIndexedTraversal1' i s a = AnIndexedTraversal1 i s s a a Source #
typeAnIndexedTraversal1'=Simple(AnIndexedTraversal1i)
type AnIndexedTraversal' i s a = AnIndexedTraversal i s s a a Source #
typeAnIndexedTraversal'=Simple(AnIndexedTraversali)
type AnIndexedTraversal1 i s t a b = Over (Indexed i) (Bazaar1 (Indexed i) a b) s t a b Source #
When you see this as an argument to a function, it expects an IndexedTraversal1.
type AnIndexedTraversal i s t a b = Over (Indexed i) (Bazaar (Indexed i) a b) s t a b Source #
When you see this as an argument to a function, it expects an IndexedTraversal.
type ATraversal1' s a = ATraversal1 s s a a Source #
typeATraversal1'=SimpleATraversal1
type ATraversal1 s t a b = LensLike (Bazaar1 (->) a b) s t a b Source #
When you see this as an argument to a function, it expects a Traversal1.
type ATraversal' s a = ATraversal s s a a Source #
typeATraversal'=SimpleATraversal
type ATraversal s t a b = LensLike (Bazaar (->) a b) s t a b Source #
When you see this as an argument to a function, it expects a Traversal.
traversal :: ((a -> f b) -> s -> f t) -> LensLike f s t a b Source #
Build a Traversal by providing a function which specifies the elements you wish to
focus.
The caller provides a function of type:
Applicative f => (a -> f b) -> s -> f t
Which is a higher order function which accepts a "focusing function" and applies
it to all desired focuses within s, then constructs a t using the Applicative
instance of f.
Only elements which are "focused" using the focusing function will be targeted by the resulting traversal.
For example, we can explicitly write a traversal which targets the first and third elements of a tuple like this:
firstAndThird :: Traversal (a, x, a) (b, x, b) a b
firstAndThird = traversal go
where
go :: Applicative f => (a -> f b) -> (a, x, a) -> f (b, x, b)
go focus (a, x, a') = liftA3 (,,) (focus a) (pure x) (focus a')
>>>(1,"two",3) & firstAndThird *~ 10(10,"two",30)
>>>over firstAndThird length ("one",2,"three")(3,2,5)
We can re-use existing Traversals when writing new ones by passing our focusing function
along to them. This example re-uses traverse to focus all elements in a list which is
embedded in a tuple. This traversal could also be written simply as _2 . traverse.
selectNested :: Traversal (x, [a]) (x, [b]) a b
selectNested = traversal go
where
go :: Applicative f => (a -> f b) -> (x, [a]) -> f (x, [b])
go focus (x, as) = liftA2 (,) (pure x) (traverse focus as)
>>>selectNested .~ "hello" $ (1,[2,3,4,5])(1,["hello","hello","hello","hello"])
>>>(1,[2,3,4,5]) & selectNested *~ 3(1,[6,9,12,15])
Note that the traversal function actually just returns the same function you pass to
it. The function it accepts is in fact a valid traversal all on its own! The use of
traversal does nothing except verify that the function it is passed matches the signature
of a valid traversal. One could remove the traversal combinator from either of the last
two examples and use the definition of go directly with no change in behaviour.
This function exists for consistency with the lens, prism and iso constructors
as well as to serve as a touchpoint for beginners who wish to construct their own
traversals but are uncertain how to do so.
sequenceAOf :: LensLike f s t (f b) b -> s -> f t Source #
Evaluate each action in the structure from left to right, and collect the results.
>>>sequenceAOf both ([1,2],[3,4])[(1,3),(1,4),(2,3),(2,4)]
sequenceA≡sequenceAOftraverse≡traverseidsequenceAOfl ≡traverseOflid≡ lid
sequenceAOf::Functorf =>Isos t (f b) b -> s -> f tsequenceAOf::Functorf =>Lenss t (f b) b -> s -> f tsequenceAOf::Applicativef =>Traversals t (f b) b -> s -> f t
sequenceOf :: LensLike (WrappedMonad m) s t (m b) b -> s -> m t Source #
Sequence the (monadic) effects targeted by a Lens in a container from left to right.
>>>sequenceOf each ([1,2],[3,4],[5,6])[(1,3,5),(1,3,6),(1,4,5),(1,4,6),(2,3,5),(2,3,6),(2,4,5),(2,4,6)]
sequence≡sequenceOftraversesequenceOfl ≡mapMOflidsequenceOfl ≡unwrapMonad.lWrapMonad
sequenceOf::Monadm =>Isos t (m b) b -> s -> m tsequenceOf::Monadm =>Lenss t (m b) b -> s -> m tsequenceOf::Monadm =>Traversals t (m b) b -> s -> m t
transposeOf :: LensLike ZipList s t [a] a -> s -> [t] Source #
This generalizes transpose to an arbitrary Traversal.
Note: transpose handles ragged inputs more intelligently, but for non-ragged inputs:
>>>transposeOf traverse [[1,2,3],[4,5,6]][[1,4],[2,5],[3,6]]
transpose≡transposeOftraverse
Since every Lens is a Traversal, we can use this as a form of
monadic strength as well:
transposeOf_2:: (b, [a]) -> [(b, a)]
loci :: forall a c s b f. Applicative f => (a -> f b) -> Bazaar (->) a c s -> f (Bazaar (->) b c s) Source #
iloci :: forall i a c s b p f. (Indexable i p, Applicative f) => p a (f b) -> Bazaar (Indexed i) a c s -> f (Bazaar (Indexed i) b c s) Source #
This IndexedTraversal allows you to traverse the individual stores in
a Bazaar with access to their indices.
partsOf :: Functor f => Traversing (->) f s t a a -> LensLike f s t [a] [a] Source #
partsOf turns a Traversal into a Lens that resembles an early version of the uniplate (or biplate) type.
Note: You should really try to maintain the invariant of the number of children in the list.
>>>(a,b,c) & partsOf each .~ [x,y,z](x,y,z)
Any extras will be lost. If you do not supply enough, then the remainder will come from the original structure.
>>>(a,b,c) & partsOf each .~ [w,x,y,z](w,x,y)
>>>(a,b,c) & partsOf each .~ [x,y](x,y,c)
>>>('b', 'a', 'd', 'c') & partsOf each %~ sort('a','b','c','d')
So technically, this is only a Lens if you do not change the number of results it returns.
When applied to a Fold the result is merely a Getter.
partsOf::Iso's a ->Lens's [a]partsOf::Lens's a ->Lens's [a]partsOf::Traversal's a ->Lens's [a]partsOf::Folds a ->Getters [a]partsOf::Getters a ->Getters [a]
ipartsOf :: (Indexable [i] p, Functor f) => Traversing (Indexed i) f s t a a -> Over p f s t [a] [a] Source #
An indexed version of partsOf that receives the entire list of indices as its index.
partsOf' :: ATraversal s t a a -> Lens s t [a] [a] Source #
ipartsOf' :: forall i p f s t a. (Indexable [i] p, Functor f) => Over (Indexed i) (Bazaar' (Indexed i) a) s t a a -> Over p f s t [a] [a] Source #
A type-restricted version of ipartsOf that can only be used with an IndexedTraversal.
unsafePartsOf :: Functor f => Traversing (->) f s t a b -> LensLike f s t [a] [b] Source #
unsafePartsOf turns a Traversal into a uniplate (or biplate) family.
If you do not need the types of s and t to be different, it is recommended that
you use partsOf.
It is generally safer to traverse with the Bazaar rather than use this
combinator. However, it is sometimes convenient.
This is unsafe because if you don't supply at least as many b's as you were
given a's, then the reconstruction of t will result in an error!
When applied to a Fold the result is merely a Getter (and becomes safe).
unsafePartsOf::Isos t a b ->Lenss t [a] [b]unsafePartsOf::Lenss t a b ->Lenss t [a] [b]unsafePartsOf::Traversals t a b ->Lenss t [a] [b]unsafePartsOf::Folds a ->Getters [a]unsafePartsOf::Getters a ->Getters [a]
iunsafePartsOf :: (Indexable [i] p, Functor f) => Traversing (Indexed i) f s t a b -> Over p f s t [a] [b] Source #
An indexed version of unsafePartsOf that receives the entire list of indices as its index.
unsafePartsOf' :: ATraversal s t a b -> Lens s t [a] [b] Source #
iunsafePartsOf' :: forall i s t a b. Over (Indexed i) (Bazaar (Indexed i) a b) s t a b -> IndexedLens [i] s t [a] [b] Source #
unsafeSingular :: (HasCallStack, Conjoined p, Functor f) => Traversing p f s t a b -> Over p f s t a b Source #
This converts a Traversal that you "know" will target only one element to a Lens. It can also be
used to transform a Fold into a Getter.
The resulting Lens or Getter will be partial if the Traversal targets nothing
or more than one element.
>>>Left (ErrorCall "unsafeSingular: empty traversal") <- try (evaluate ([] & unsafeSingular traverse .~ 0)) :: IO (Either ErrorCall [Integer])
unsafeSingular::Traversals t a b ->Lenss t a bunsafeSingular::Folds a ->Getters aunsafeSingular::IndexedTraversali s t a b ->IndexedLensi s t a bunsafeSingular::IndexedFoldi s a ->IndexedGetteri s a
holesOf :: Conjoined p => Over p (Bazaar p a a) s t a a -> s -> [Pretext p a a t] Source #
The one-level version of contextsOf. This extracts a
list of the immediate children according to a given Traversal as editable
contexts.
Given a context you can use pos to see the
values, peek at what the structure would be
like with an edited result, or simply extract the original structure.
propChildren l x =toListOfl x==mappos(holesOfl x) propId l x =all(==x) [extractw | w <-holesOfl x]
holesOf::Iso's a -> s -> [Pretext'(->) a s]holesOf::Lens's a -> s -> [Pretext'(->) a s]holesOf::Traversal's a -> s -> [Pretext'(->) a s]holesOf::IndexedLens'i s a -> s -> [Pretext'(Indexedi) a s]holesOf::IndexedTraversal'i s a -> s -> [Pretext'(Indexedi) a s]
holes1Of :: Conjoined p => Over p (Bazaar1 p a a) s t a a -> s -> NonEmpty (Pretext p a a t) Source #
The non-empty version of holesOf.
This extract a non-empty list of immediate children according to a given
Traversal1 as editable contexts.
>>>let head1 f s = runPretext (NonEmpty.head $ holes1Of traversed1 s) f>>>('a' :| "bc") ^. head1'a'
>>>('a' :| "bc") & head1 %~ toUpper'A' :| "bc"
holes1Of::Iso's a -> s ->NonEmpty(Pretext'(->) a s)holes1Of::Lens's a -> s ->NonEmpty(Pretext'(->) a s)holes1Of::Traversal1's a -> s ->NonEmpty(Pretext'(->) a s)holes1Of::IndexedLens'i s a -> s ->NonEmpty(Pretext'(Indexedi) a s)holes1Of::IndexedTraversal1'i s a -> s ->NonEmpty(Pretext'(Indexedi) a s)
both1 :: forall (r :: Type -> Type -> Type) a b. Bitraversable1 r => Traversal1 (r a a) (r b b) a b Source #
Traverse both parts of a Bitraversable1 container with matching types.
Usually that type will be a pair.
both1::Traversal1(a, a) (b, b) a bboth1::Traversal1(Eithera a) (Eitherb b) a b
cloneIndexPreservingTraversal :: ATraversal s t a b -> IndexPreservingTraversal s t a b Source #
Clone a Traversal yielding an IndexPreservingTraversal that passes through
whatever index it is composed with.
cloneIndexedTraversal :: AnIndexedTraversal i s t a b -> IndexedTraversal i s t a b Source #
Clone an IndexedTraversal yielding an IndexedTraversal with the same index.
cloneTraversal1 :: ATraversal1 s t a b -> Traversal1 s t a b Source #
A Traversal1 is completely characterized by its behavior on a Bazaar1.
cloneIndexPreservingTraversal1 :: ATraversal1 s t a b -> IndexPreservingTraversal1 s t a b Source #
Clone a Traversal1 yielding an IndexPreservingTraversal1 that passes through
whatever index it is composed with.
cloneIndexedTraversal1 :: AnIndexedTraversal1 i s t a b -> IndexedTraversal1 i s t a b Source #
Clone an IndexedTraversal1 yielding an IndexedTraversal1 with the same index.
iforOf :: (Indexed i a (f b) -> s -> f t) -> s -> (i -> a -> f b) -> f t Source #
Traverse with an index (and the arguments flipped).
forOfl a ≡iforOfl a.constiforOf≡flip.itraverseOf
iforOf::Functorf =>IndexedLensi s t a b -> s -> (i -> a -> f b) -> f tiforOf::Applicativef =>IndexedTraversali s t a b -> s -> (i -> a -> f b) -> f tiforOf::Applyf =>IndexedTraversal1i s t a b -> s -> (i -> a -> f b) -> f t
imapAccumROf :: Over (Indexed i) (Backwards (State acc)) s t a b -> (i -> acc -> a -> (acc, b)) -> acc -> s -> (acc, t) Source #
Generalizes mapAccumR to an arbitrary IndexedTraversal with access to the index.
imapAccumROf accumulates state from right to left.
mapAccumROfl ≡imapAccumROfl.const
imapAccumROf::IndexedLensi s t a b -> (i -> acc -> a -> (acc, b)) -> acc -> s -> (acc, t)imapAccumROf::IndexedTraversali s t a b -> (i -> acc -> a -> (acc, b)) -> acc -> s -> (acc, t)
imapAccumLOf :: Over (Indexed i) (State acc) s t a b -> (i -> acc -> a -> (acc, b)) -> acc -> s -> (acc, t) Source #
Generalizes mapAccumL to an arbitrary IndexedTraversal with access to the index.
imapAccumLOf accumulates state from left to right.
mapAccumLOfl ≡imapAccumLOfl.const
imapAccumLOf::IndexedLensi s t a b -> (i -> acc -> a -> (acc, b)) -> acc -> s -> (acc, t)imapAccumLOf::IndexedTraversali s t a b -> (i -> acc -> a -> (acc, b)) -> acc -> s -> (acc, t)
traversed1 :: forall (f :: Type -> Type) a b. Traversable1 f => IndexedTraversal1 Int (f a) (f b) a b Source #
Traverse any Traversable1 container. This is an IndexedTraversal1 that is indexed by ordinal position.
traversed64 :: forall (f :: Type -> Type) a b. Traversable f => IndexedTraversal Int64 (f a) (f b) a b Source #
Traverse any Traversable container. This is an IndexedTraversal that is indexed by ordinal position.
ignored :: Applicative f => pafb -> s -> f s Source #
elementOf :: forall (f :: Type -> Type) s t a. Applicative f => LensLike (Indexing f) s t a a -> Int -> IndexedLensLike Int f s t a a Source #
Traverse the nth elementOf a Traversal, Lens or
Iso if it exists.
>>>[[1],[3,4]] & elementOf (traverse.traverse) 1 .~ 5[[1],[5,4]]
>>>[[1],[3,4]] ^? elementOf (folded.folded) 1Just 3
>>>timingOut $ ['a'..] ^?! elementOf folded 5'f'
>>>timingOut $ take 10 $ elementOf traverse 3 .~ 16 $ [0..][0,1,2,16,4,5,6,7,8,9]
elementOf::Traversal's a ->Int->IndexedTraversal'Ints aelementOf::Folds a ->Int->IndexedFoldInts a
element :: forall (t :: Type -> Type) a. Traversable t => Int -> IndexedTraversal' Int (t a) a Source #
Traverse the nth element of a Traversable container.
element≡elementOftraverse
elementsOf :: forall (f :: Type -> Type) s t a. Applicative f => LensLike (Indexing f) s t a a -> (Int -> Bool) -> IndexedLensLike Int f s t a a Source #
Traverse (or fold) selected elements of a Traversal (or Fold) where their ordinal positions match a predicate.
elementsOf::Traversal's a -> (Int->Bool) ->IndexedTraversal'Ints aelementsOf::Folds a -> (Int->Bool) ->IndexedFoldInts a
elements :: forall (t :: Type -> Type) a. Traversable t => (Int -> Bool) -> IndexedTraversal' Int (t a) a Source #
Traverse elements of a Traversable container where their ordinal positions match a predicate.
elements≡elementsOftraverse
failover :: Alternative m => LensLike ((,) Any) s t a b -> (a -> b) -> s -> m t Source #
Try to map a function over this Traversal, failing if the Traversal has no targets.
>>>failover (element 3) (*2) [1,2] :: Maybe [Int]Nothing
>>>failover _Left (*2) (Right 4) :: Maybe (Either Int Int)Nothing
>>>failover _Right (*2) (Right 4) :: Maybe (Either Int Int)Just (Right 8)
failover :: Alternative m => Traversal s t a b -> (a -> b) -> s -> m t
ifailover :: Alternative m => Over (Indexed i) ((,) Any) s t a b -> (i -> a -> b) -> s -> m t Source #
Try to map a function which uses the index over this IndexedTraversal, failing if the IndexedTraversal has no targets.
ifailover :: Alternative m => IndexedTraversal i s t a b -> (i -> a -> b) -> s -> m t
deepOf :: (Conjoined p, Applicative f) => LensLike f s t s t -> Traversing p f s t a b -> Over p f s t a b Source #
Try the second traversal. If it returns no entries, try again with all entries from the first traversal, recursively.
deepOf::Folds s ->Folds a ->Folds adeepOf::Traversal's s ->Traversal's a ->Traversal's adeepOf::Traversals t s t ->Traversals t a b ->Traversals t a bdeepOf::Folds s ->IndexedFoldi s a ->IndexedFoldi s adeepOf::Traversals t s t ->IndexedTraversali s t a b ->IndexedTraversali s t a b
confusing :: Applicative f => LensLike (Curried (Yoneda f) (Yoneda f)) s t a b -> LensLike f s t a b Source #
Fuse a Traversal by reassociating all of the ( operations to the
left and fusing all of the <*>)fmap calls into one. This is particularly
useful when constructing a Traversal using operations from GHC.Generics.
Given a pair of Traversals foo and bar,
confusing (foo.bar) = foo.bar
However, foo and bar are each going to use the Applicative they are given.
confusing exploits the Yoneda lemma to merge their separate uses of fmap into a single fmap.
and it further exploits an interesting property of the right Kan lift (or Curried) to left associate
all of the uses of ( to make it possible to fuse together more fmaps.<*>)
This is particularly effective when the choice of functor f is unknown at compile
time or when the Traversal foo.bar in the above description is recursive or complex
enough to prevent inlining.
fusing is a version of this combinator suitable for fusing lenses.
confusing::Traversals t a b ->Traversals t a b
traverseByOf :: Traversal s t a b -> (forall x. x -> f x) -> (forall x y. f (x -> y) -> f x -> f y) -> (a -> f b) -> s -> f t Source #
Traverse a container using a specified Applicative.
This is like traverseBy where the Traversable instance can be specified by any Traversal
traverseByOftraverse≡traverseBy
sequenceByOf :: Traversal s t (f b) b -> (forall x. x -> f x) -> (forall x y. f (x -> y) -> f x -> f y) -> s -> f t Source #
Sequence a container using a specified Applicative.
This is like traverseBy where the Traversable instance can be specified by any Traversal
sequenceByOftraverse≡sequenceBy
ilevels :: forall (f :: Type -> Type) i s t a b j. Applicative f => Traversing (Indexed i) f s t a b -> IndexedLensLike Int f s t (Level i a) (Level j b) Source #
This provides a breadth-first Traversal or Fold of the individual
levels of any other Traversal or Fold via iterative deepening depth-first
search. The levels are returned to you in a compressed format.
This is similar to levels, but retains the index of the original IndexedTraversal, so you can
access it when traversing the levels later on.
>>>["dog","cat"]^@..ilevels (traversed<.>traversed).itraversed[((0,0),'d'),((0,1),'o'),((1,0),'c'),((0,2),'g'),((1,1),'a'),((1,2),'t')]
The resulting Traversal of the levels which is indexed by the depth of each Level.
>>>["dog","cat"]^@..ilevels (traversed<.>traversed)<.>itraversed[((2,(0,0)),'d'),((3,(0,1)),'o'),((3,(1,0)),'c'),((4,(0,2)),'g'),((4,(1,1)),'a'),((5,(1,2)),'t')]
ilevels::IndexedTraversali s t a b ->IndexedTraversalInts t (Leveli a) (Leveli b)ilevels::IndexedFoldi s a ->IndexedFoldInts (Leveli a)
Note: Internally this is implemented by using an illegal Applicative, as it extracts information
in an order that violates the Applicative laws.
type ReifiedPrism' s a = ReifiedPrism s s a a Source #
typeReifiedPrism'=SimpleReifiedPrism
type ReifiedIso' s a = ReifiedIso s s a a Source #
typeReifiedIso'=SimpleReifiedIso
type ReifiedIndexedSetter' i s a = ReifiedIndexedSetter i s s a a Source #
typeReifiedIndexedSetter'i =Simple(ReifiedIndexedSetteri)
type ReifiedSetter' s a = ReifiedSetter s s a a Source #
typeReifiedSetter'=SimpleReifiedSetter
type ReifiedTraversal' s a = ReifiedTraversal s s a a Source #
type ReifiedIndexedTraversal' i s a = ReifiedIndexedTraversal i s s a a Source #
typeReifiedIndexedTraversal'i =Simple(ReifiedIndexedTraversali)
type ReifiedIndexedLens' i s a = ReifiedIndexedLens i s s a a Source #
typeReifiedIndexedLens'i =Simple(ReifiedIndexedLensi)
type ReifiedLens' s a = ReifiedLens s s a a Source #
typeReifiedLens'=SimpleReifiedLens
(<.) :: Indexable i p => (Indexed i s t -> r) -> ((a -> b) -> s -> t) -> p a b -> r infixr 9 Source #
Compose an Indexed function with a non-indexed function.
Mnemonically, the < points to the indexing we want to preserve.
>>>let nestedMap = (fmap Map.fromList . Map.fromList) [(1, [(10, "one,ten"), (20, "one,twenty")]), (2, [(30, "two,thirty"), (40,"two,forty")])]>>>nestedMap^..(itraversed<.itraversed).withIndex[(1,"one,ten"),(1,"one,twenty"),(2,"two,thirty"),(2,"two,forty")]
selfIndex :: Indexable a p => p a fb -> a -> fb Source #
Use a value itself as its own index. This is essentially an indexed version of id.
Note: When used to modify the value, this can break the index requirements assumed by indices and similar,
so this is only properly an IndexedGetter, but it can be used as more.
selfIndex::IndexedGettera a b
reindexed :: Indexable j p => (i -> j) -> (Indexed i a b -> r) -> p a b -> r Source #
Remap the index.
icompose :: Indexable p c => (i -> j -> p) -> (Indexed i s t -> r) -> (Indexed j a b -> s -> t) -> c a b -> r Source #
Composition of Indexed functions with a user supplied function for combining indices.
imapped :: forall i (f :: Type -> Type) a b. FunctorWithIndex i f => IndexedSetter i (f a) (f b) a b Source #
The IndexedSetter for a FunctorWithIndex.
If you don't need access to the index, then mapped is more flexible in what it accepts.
ifolded :: forall i (f :: Type -> Type) a. FoldableWithIndex i f => IndexedFold i (f a) a Source #
The IndexedFold of a FoldableWithIndex container.
is a fold over the keys of a ifolded . asIndexFoldableWithIndex.
>>>Data.Map.fromList [(2, "hello"), (1, "world")]^..ifolded.asIndex[1,2]
itraversed :: forall i (t :: Type -> Type) a b. TraversableWithIndex i t => IndexedTraversal i (t a) (t b) a b Source #
The IndexedTraversal of a TraversableWithIndex container.
ifoldMapBy :: FoldableWithIndex i t => (r -> r -> r) -> r -> (i -> a -> r) -> t a -> r Source #
ifoldMapByOf :: IndexedFold i t a -> (r -> r -> r) -> r -> (i -> a -> r) -> t -> r Source #
itraverseBy :: TraversableWithIndex i t => (forall x. x -> f x) -> (forall x y. f (x -> y) -> f x -> f y) -> (i -> a -> f b) -> t a -> f (t b) Source #
itraverseByOf :: IndexedTraversal i s t a b -> (forall x. x -> f x) -> (forall x y. f (x -> y) -> f x -> f y) -> (i -> a -> f b) -> s -> f t Source #
type AnEquality' (s :: k) (a :: k) = AnEquality s s a a Source #
A Simple AnEquality.
type AnEquality (s :: k) (t :: k1) (a :: k) (b :: k2) = Identical a (Proxy b) a (Proxy b) -> Identical a (Proxy b) s (Proxy t) Source #
When you see this as an argument to a function, it expects an Equality.
data Identical (a :: k) (b :: k1) (s :: k) (t :: k1) where Source #
Provides witness that (s ~ a, b ~ t) holds.
runEq :: forall {k1} {k2} (s :: k1) (t :: k2) (a :: k1) (b :: k2). AnEquality s t a b -> Identical s t a b Source #
Extract a witness of type Equality.
substEq :: forall {k1} {k2} (s :: k1) (t :: k2) (a :: k1) (b :: k2) r. AnEquality s t a b -> ((s ~ a, t ~ b) => r) -> r Source #
Substituting types with Equality.
mapEq :: forall k1 k2 (s :: k1) (t :: k2) (a :: k1) (b :: k2) f. AnEquality s t a b -> f s -> f a Source #
We can use Equality to do substitution into anything.
fromEq :: forall {k2} {k1} (s :: k2) (t :: k1) (a :: k2) (b :: k1). AnEquality s t a b -> Equality b a t s Source #
Equality is symmetric.
simply :: forall {k} {k1} p (f :: k -> k1) (s :: k) (a :: k) r. (Optic' p f s a -> r) -> Optic' p f s a -> r Source #
This is an adverb that can be used to modify many other Lens combinators to make them require
simple lenses, simple traversals, simple prisms or simple isos as input.
cloneEquality :: forall {k1} {k2} (s :: k1) (t :: k2) (a :: k1) (b :: k2). AnEquality s t a b -> Equality s t a b Source #
equality :: forall {k1} {k2} (s :: k1) (a :: k1) (b :: k2) (t :: k2). (s :~: a) -> (b :~: t) -> Equality s t a b Source #
Construct an Equality from explicit equality evidence.
overEquality :: forall {k1} {k2} (s :: k1) (t :: k2) (a :: k1) (b :: k2) p. AnEquality s t a b -> p a b -> p s t Source #
Recover a "profunctor lens" form of equality. Reverses fromLeibniz.
underEquality :: forall {k1} {k2} (s :: k1) (t :: k2) (a :: k1) (b :: k2) p. AnEquality s t a b -> p t s -> p b a Source #
The opposite of working overEquality is working underEquality.
fromLeibniz :: forall {k1} {k2} (a :: k1) (b :: k2) (s :: k1) (t :: k2). (Identical a b a b -> Identical a b s t) -> Equality s t a b Source #
Convert a "profunctor lens" form of equality to an equality. Reverses
overEquality.
The type should be understood as
fromLeibniz :: (forall p. p a b -> p s t) -> Equality s t a b
withEquality :: forall {k1} {k2} (s :: k1) (t :: k2) (a :: k1) (b :: k2) r. AnEquality s t a b -> ((s :~: a) -> (b :~: t) -> r) -> r Source #
A version of substEq that provides explicit, rather than implicit,
equality evidence.
type AnIso s t a b = Exchange a b a (Identity b) -> Exchange a b s (Identity t) Source #
When you see this as an argument to a function, it expects an Iso.
withIso :: AnIso s t a b -> ((s -> a) -> (b -> t) -> r) -> r Source #
Extract the two functions, one from s -> a and
one from b -> t that characterize an Iso.
cloneIso :: AnIso s t a b -> Iso s t a b Source #
Convert from AnIso back to any Iso.
This is useful when you need to store an isomorphism as a data type inside a container and later reconstitute it as an overloaded function.
See cloneLens or cloneTraversal for more information on why you might want to do this.
au :: Functor f => AnIso s t a b -> ((b -> t) -> f s) -> f a Source #
Based on ala from Conor McBride's work on Epigram.
This version is generalized to accept any Iso, not just a newtype.
>>>au (_Wrapping Sum) foldMap [1,2,3,4]10
You may want to think of this combinator as having the following, simpler type:
au :: AnIso s t a b -> ((b -> t) -> e -> s) -> e -> a
au = xplat . from
auf :: (Functor f, Functor g) => AnIso s t a b -> (f t -> g s) -> f b -> g a Source #
Based on ala' from Conor McBride's work on Epigram.
This version is generalized to accept any Iso, not just a newtype.
For a version you pass the name of the newtype constructor to, see alaf.
>>>auf (_Wrapping Sum) (foldMapOf both) Prelude.length ("hello","world")10
Mnemonically, the German auf plays a similar role to à la, and the combinator
is au with an extra function argument:
auf::Isos t a b -> ((r -> t) -> e -> s) -> (r -> b) -> e -> a
but the signature is general.
Note: The direction of the Iso required for this function changed in lens 4.18 to match up
with the behavior of au. For the old behavior use xplatf or for a version that is compatible
across both old and new versions of lens you can just use coerce!
xplat :: forall {k2} s g (t :: k2) a (b :: k2). Optic (Costar ((->) s)) g s t a b -> ((s -> a) -> g b) -> g t Source #
xplatf :: forall {k} {k2} f g (s :: k) (t :: k2) (a :: k) (b :: k2). Optic (Costar f) g s t a b -> (f a -> g b) -> f s -> g t Source #
enum :: Enum a => Iso' Int a Source #
This isomorphism can be used to convert to or from an instance of Enum.
>>>LT^.from enum0
>>>97^.enum :: Char'a'
Note: this is only an isomorphism from the numeric range actually used
and it is a bit of a pleasant fiction, since there are questionable
Enum instances for Double, and Float that exist solely for
[1.0 .. 4.0] sugar and the instances for those and Integer don't
cover all values in their range.
mapping :: forall (f :: Type -> Type) (g :: Type -> Type) s t a b. (Functor f, Functor g) => AnIso s t a b -> Iso (f s) (g t) (f a) (g b) Source #
non :: Eq a => a -> Iso' (Maybe a) a Source #
If v is an element of a type a, and a' is a sans the element v, then is an isomorphism from
non v to Maybe a'a.
non≡non'.only
Keep in mind this is only a real isomorphism if you treat the domain as being .Maybe (a sans v)
This is practically quite useful when you want to have a Map where all the entries should have non-zero values.
>>>Map.fromList [("hello",1)] & at "hello" . non 0 +~ 2fromList [("hello",3)]
>>>Map.fromList [("hello",1)] & at "hello" . non 0 -~ 1fromList []
>>>Map.fromList [("hello",1)] ^. at "hello" . non 01
>>>Map.fromList [] ^. at "hello" . non 00
This combinator is also particularly useful when working with nested maps.
e.g. When you want to create the nested Map when it is missing:
>>>Map.empty & at "hello" . non Map.empty . at "world" ?~ "!!!"fromList [("hello",fromList [("world","!!!")])]
and when have deleting the last entry from the nested Map mean that we
should delete its entry from the surrounding one:
>>>Map.fromList [("hello",Map.fromList [("world","!!!")])] & at "hello" . non Map.empty . at "world" .~ NothingfromList []
It can also be used in reverse to exclude a given value:
>>>non 0 # rem 10 4Just 2
>>>non 0 # rem 10 5Nothing
non' :: APrism' a () -> Iso' (Maybe a) a Source #
generalizes non' p to take any unit non (p # ())Prism
This function generates an isomorphism between and Maybe (a | isn't p a)a.
>>>Map.singleton "hello" Map.empty & at "hello" . non' _Empty . at "world" ?~ "!!!"fromList [("hello",fromList [("world","!!!")])]
>>>Map.fromList [("hello",Map.fromList [("world","!!!")])] & at "hello" . non' _Empty . at "world" .~ NothingfromList []
anon :: a -> (a -> Bool) -> Iso' (Maybe a) a Source #
generalizes anon a p to take any value and a predicate.non a
This function assumes that p a holds and generates an isomorphism between True and Maybe (a | not (p a))a.
>>>Map.empty & at "hello" . anon Map.empty Map.null . at "world" ?~ "!!!"fromList [("hello",fromList [("world","!!!")])]
>>>Map.fromList [("hello",Map.fromList [("world","!!!")])] & at "hello" . anon Map.empty Map.null . at "world" .~ NothingfromList []
curried :: forall a b c d e f1 p f2. (Profunctor p, Functor f2) => p (a -> b -> c) (f2 (d -> e -> f1)) -> p ((a, b) -> c) (f2 ((d, e) -> f1)) Source #
uncurried :: forall a b c d e f1 p f2. (Profunctor p, Functor f2) => p ((a, b) -> c) (f2 ((d, e) -> f1)) -> p (a -> b -> c) (f2 (d -> e -> f1)) Source #
flipped :: forall a b c a' b' c' p f. (Profunctor p, Functor f) => p (b -> a -> c) (f (b' -> a' -> c')) -> p (a -> b -> c) (f (a' -> b' -> c')) Source #
The isomorphism for flipping a function.
>>>((,)^.flipped) 1 2(2,1)
swapped :: forall (p :: Type -> Type -> Type) a b c d. Swap p => Iso (p a b) (p c d) (p b a) (p d c) Source #
reversed :: Reversing a => Iso' a a Source #
An Iso between a list, ByteString, Text fragment, etc. and its reversal.
>>>"live" ^. reversed"evil"
>>>"live" & reversed %~ ('d':)"lived"
imagma :: Over (Indexed i) (Molten i a b) s t a b -> Iso s t' (Magma i t b a) (Magma j t' c c) Source #
This isomorphism can be used to inspect an IndexedTraversal to see how it associates
the structure and it can also be used to bake the IndexedTraversal into a Magma so
that you can traverse over it multiple times with access to the original indices.
contramapping :: forall (f :: Type -> Type) s t a b. Contravariant f => AnIso s t a b -> Iso (f a) (f b) (f s) (f t) Source #
Lift an Iso into a Contravariant functor.
contramapping ::Contravariantf =>Isos t a b ->Iso(f a) (f b) (f s) (f t) contramapping ::Contravariantf =>Iso's a ->Iso'(f a) (f s)
dimapping :: forall (p :: Type -> Type -> Type) (q :: Type -> Type -> Type) s t a b s' t' a' b'. (Profunctor p, Profunctor q) => AnIso s t a b -> AnIso s' t' a' b' -> Iso (p a s') (q b t') (p s a') (q t b') Source #
Lift two Isos into both arguments of a Profunctor simultaneously.
dimapping ::Profunctorp =>Isos t a b ->Isos' t' a' b' ->Iso(p a s') (p b t') (p s a') (p t b') dimapping ::Profunctorp =>Iso's a ->Iso's' a' ->Iso'(p a s') (p s a')
lmapping :: forall (p :: Type -> Type -> Type) (q :: Type -> Type -> Type) s t a b x y. (Profunctor p, Profunctor q) => AnIso s t a b -> Iso (p a x) (q b y) (p s x) (q t y) Source #
Lift an Iso contravariantly into the left argument of a Profunctor.
lmapping ::Profunctorp =>Isos t a b ->Iso(p a x) (p b y) (p s x) (p t y) lmapping ::Profunctorp =>Iso's a ->Iso'(p a x) (p s x)
rmapping :: forall (p :: Type -> Type -> Type) (q :: Type -> Type -> Type) s t a b x y. (Profunctor p, Profunctor q) => AnIso s t a b -> Iso (p x s) (q y t) (p x a) (q y b) Source #
Lift an Iso covariantly into the right argument of a Profunctor.
rmapping ::Profunctorp =>Isos t a b ->Iso(p x s) (p y t) (p x a) (p y b) rmapping ::Profunctorp =>Iso's a ->Iso'(p x s) (p x a)
bimapping :: forall (f :: Type -> Type -> Type) (g :: Type -> Type -> Type) s t a b s' t' a' b'. (Bifunctor f, Bifunctor g) => AnIso s t a b -> AnIso s' t' a' b' -> Iso (f s s') (g t t') (f a a') (g b b') Source #
firsting :: forall (f :: Type -> Type -> Type) (g :: Type -> Type -> Type) s t a b x y. (Bifunctor f, Bifunctor g) => AnIso s t a b -> Iso (f s x) (g t y) (f a x) (g b y) Source #
seconding :: forall (f :: Type -> Type -> Type) (g :: Type -> Type -> Type) s t a b x y. (Bifunctor f, Bifunctor g) => AnIso s t a b -> Iso (f x s) (g y t) (f x a) (g y b) Source #
Lift an Iso into the second argument of a Bifunctor. This is
essentially the same as mapping, but it takes a 'Bifunctor p'
constraint instead of a 'Functor (p a)' one.
seconding ::Bifunctorp =>Isos t a b ->Iso(p x s) (p y t) (p x a) (p y b) seconding ::Bifunctorp =>Iso's a ->Iso'(p x s) (p x a)
coerced :: forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b Source #
Data types that are representationally equal are isomorphic.
This is only available on GHC 7.8+
Since: lens-4.13
class Snoc s t a b | s -> a, t -> b, s b -> t, t a -> s where Source #
This class provides a way to attach or detach elements on the right side of a structure in a flexible manner.
Methods
Instances
| Snoc ByteString ByteString Word8 Word8 | |
Defined in Control.Lens.Cons Methods _Snoc :: Prism ByteString ByteString (ByteString, Word8) (ByteString, Word8) Source # | |
| Snoc ByteString ByteString Word8 Word8 | |
Defined in Control.Lens.Cons Methods _Snoc :: Prism ByteString ByteString (ByteString, Word8) (ByteString, Word8) Source # | |
| Snoc Text Text Char Char | |
| Snoc Text Text Char Char | |
| Snoc (Seq a) (Seq b) a b | |
| Snoc (ZipList a) (ZipList b) a b | |
| Snoc (Deque a) (Deque b) a b | |
| Snoc (Vector a) (Vector b) a b | |
Defined in Control.Lens.Cons | |
| (Prim a, Prim b) => Snoc (Vector a) (Vector b) a b | |
Defined in Control.Lens.Cons | |
| (Storable a, Storable b) => Snoc (Vector a) (Vector b) a b | |
Defined in Control.Lens.Cons | |
| (Unbox a, Unbox b) => Snoc (Vector a) (Vector b) a b | |
Defined in Control.Lens.Cons | |
| Snoc [a] [b] a b | |
Defined in Control.Lens.Cons | |
| (Measured m a, Measured n b) => Snoc (FingerTree m a) (FingerTree n b) a b Source # | |
Defined in Diagrams.Trail | |
| Snoc (Path v n) (Path v' n') (Located (Trail v n)) (Located (Trail v' n')) Source # | |
| (Metric v, OrderedField n, Metric u, OrderedField n') => Snoc (SegTree v n) (SegTree u n') (Segment Closed v n) (Segment Closed u n') Source # | |
| (Metric v, OrderedField n, Metric u, OrderedField n') => Snoc (Trail' Line v n) (Trail' Line u n') (Segment Closed v n) (Segment Closed u n') Source # | |
class Cons s t a b | s -> a, t -> b, s b -> t, t a -> s where Source #
This class provides a way to attach or detach elements on the left side of a structure in a flexible manner.
Methods
Instances
| Cons ByteString ByteString Word8 Word8 | |
Defined in Control.Lens.Cons Methods _Cons :: Prism ByteString ByteString (Word8, ByteString) (Word8, ByteString) Source # | |
| Cons ByteString ByteString Word8 Word8 | |
Defined in Control.Lens.Cons Methods _Cons :: Prism ByteString ByteString (Word8, ByteString) (Word8, ByteString) Source # | |
| Cons Text Text Char Char | |
| Cons Text Text Char Char | |
| Cons (Seq a) (Seq b) a b | |
| Cons (ZipList a) (ZipList b) a b | |
| Cons (Deque a) (Deque b) a b | |
| Cons (Vector a) (Vector b) a b | |
Defined in Control.Lens.Cons | |
| (Prim a, Prim b) => Cons (Vector a) (Vector b) a b | |
Defined in Control.Lens.Cons | |
| (Storable a, Storable b) => Cons (Vector a) (Vector b) a b | |
Defined in Control.Lens.Cons | |
| Cons (Vector a) (Vector b) a b | |
Defined in Control.Lens.Cons | |
| (Unbox a, Unbox b) => Cons (Vector a) (Vector b) a b | |
Defined in Control.Lens.Cons | |
| Cons [a] [b] a b | |
Defined in Control.Lens.Cons | |
| (Measured m a, Measured n b) => Cons (FingerTree m a) (FingerTree n b) a b Source # | |
Defined in Diagrams.Trail | |
| Cons (Path v n) (Path v' n') (Located (Trail v n)) (Located (Trail v' n')) Source # | |
| (Metric v, OrderedField n, Metric u, OrderedField n') => Cons (SegTree v n) (SegTree u n') (Segment Closed v n) (Segment Closed u n') Source # | |
| (Metric v, OrderedField n, Metric u, OrderedField n') => Cons (Trail' Line v n) (Trail' Line u n') (Segment Closed v n) (Segment Closed u n') Source # | |
_head :: Cons s s a a => Traversal' s a Source #
A Traversal reading and writing to the head of a non-empty container.
>>>[a,b,c]^? _headJust a
>>>[a,b,c] & _head .~ d[d,b,c]
>>>[a,b,c] & _head %~ f[f a,b,c]
>>>[] & _head %~ f[]
>>>[1,2,3]^?!_head1
>>>[]^?_headNothing
>>>[1,2]^?_headJust 1
>>>[] & _head .~ 1[]
>>>[0] & _head .~ 2[2]
>>>[0,1] & _head .~ 2[2,1]
This isn't limited to lists.
For instance you can also traverse the head of a Seq:
>>>Seq.fromList [a,b,c,d] & _head %~ ffromList [f a,b,c,d]
>>>Seq.fromList [] ^? _headNothing
>>>Seq.fromList [a,b,c,d] ^? _headJust a
_head::Traversal'[a] a_head::Traversal'(Seqa) a_head::Traversal'(Vectora) a
_tail :: Cons s s a a => Traversal' s s Source #
A Traversal reading and writing to the tail of a non-empty container.
>>>[a,b] & _tail .~ [c,d,e][a,c,d,e]
>>>[] & _tail .~ [a,b][]
>>>[a,b,c,d,e] & _tail.traverse %~ f[a,f b,f c,f d,f e]
>>>[1,2] & _tail .~ [3,4,5][1,3,4,5]
>>>[] & _tail .~ [1,2][]
>>>[a,b,c]^?_tailJust [b,c]
>>>[1,2]^?!_tail[2]
>>>"hello"^._tail"ello"
>>>""^._tail""
This isn't limited to lists. For instance you can also traverse the tail of a Seq.
>>>Seq.fromList [a,b] & _tail .~ Seq.fromList [c,d,e]fromList [a,c,d,e]
>>>Seq.fromList [a,b,c] ^? _tailJust (fromList [b,c])
>>>Seq.fromList [] ^? _tailNothing
_tail::Traversal'[a] [a]_tail::Traversal'(Seqa) (Seqa)_tail::Traversal'(Vectora) (Vectora)
_init :: Snoc s s a a => Traversal' s s Source #
A Traversal reading and replacing all but the a last element of a non-empty container.
>>>[a,b,c,d]^?_initJust [a,b,c]
>>>[]^?_initNothing
>>>[a,b] & _init .~ [c,d,e][c,d,e,b]
>>>[] & _init .~ [a,b][]
>>>[a,b,c,d] & _init.traverse %~ f[f a,f b,f c,d]
>>>[1,2,3]^?_initJust [1,2]
>>>[1,2,3,4]^?!_init[1,2,3]
>>>"hello"^._init"hell"
>>>""^._init""
_init::Traversal'[a] [a]_init::Traversal'(Seqa) (Seqa)_init::Traversal'(Vectora) (Vectora)
_last :: Snoc s s a a => Traversal' s a Source #
A Traversal reading and writing to the last element of a non-empty container.
>>>[a,b,c]^?!_lastc
>>>[]^?_lastNothing
>>>[a,b,c] & _last %~ f[a,b,f c]
>>>[1,2]^?_lastJust 2
>>>[] & _last .~ 1[]
>>>[0] & _last .~ 2[2]
>>>[0,1] & _last .~ 2[0,2]
This Traversal is not limited to lists, however. We can also work with other containers, such as a Vector.
>>>Vector.fromList "abcde" ^? _lastJust 'e'
>>>Vector.empty ^? _lastNothing
>>>(Vector.fromList "abcde" & _last .~ 'Q') == Vector.fromList "abcdQ"True
_last::Traversal'[a] a_last::Traversal'(Seqa) a_last::Traversal'(Vectora) a
class (Rewrapped s t, Rewrapped t s) => Rewrapping s t Source #
Instances
| (Rewrapped s t, Rewrapped t s) => Rewrapping s t | |
Defined in Control.Lens.Wrapped | |
class Wrapped s => Rewrapped s t Source #
Instances
| t ~ IntSet => Rewrapped IntSet t | |
Defined in Control.Lens.Wrapped | |
| Rewrapped Name Name | |
Defined in Diagrams.Core.Names | |
| Rewrapped SegCount SegCount Source # | |
Defined in Diagrams.Segment | |
| t ~ NoMethodError => Rewrapped NoMethodError t | |
Defined in Control.Lens.Wrapped | |
| t ~ PatternMatchFail => Rewrapped PatternMatchFail t | |
Defined in Control.Lens.Wrapped | |
| t ~ RecConError => Rewrapped RecConError t | |
Defined in Control.Lens.Wrapped | |
| t ~ RecSelError => Rewrapped RecSelError t | |
Defined in Control.Lens.Wrapped | |
| t ~ RecUpdError => Rewrapped RecUpdError t | |
Defined in Control.Lens.Wrapped | |
| t ~ TypeError => Rewrapped TypeError t | |
Defined in Control.Lens.Wrapped | |
| t ~ All => Rewrapped All t | |
Defined in Control.Lens.Wrapped | |
| t ~ Any => Rewrapped Any t | |
Defined in Control.Lens.Wrapped | |
| t ~ ErrorCall => Rewrapped ErrorCall t | |
Defined in Control.Lens.Wrapped | |
| Rewrapped Errno t | |
Defined in Control.Lens.Wrapped | |
| Rewrapped CBool t | |
Defined in Control.Lens.Wrapped | |
| Rewrapped CChar t | |
Defined in Control.Lens.Wrapped | |
| Rewrapped CClock t | |
Defined in Control.Lens.Wrapped | |
| Rewrapped CDouble t | |
Defined in Control.Lens.Wrapped | |
| Rewrapped CFloat t | |
Defined in Control.Lens.Wrapped | |
| Rewrapped CInt t | |
Defined in Control.Lens.Wrapped | |
| Rewrapped CIntMax t | |
Defined in Control.Lens.Wrapped | |
| Rewrapped CIntPtr t | |
Defined in Control.Lens.Wrapped | |
| Rewrapped CLLong t | |
Defined in Control.Lens.Wrapped | |
| Rewrapped CLong t | |
Defined in Control.Lens.Wrapped | |
| Rewrapped CPtrdiff t | |
Defined in Control.Lens.Wrapped | |
| Rewrapped CSChar t | |
Defined in Control.Lens.Wrapped | |
| Rewrapped CSUSeconds t | |
Defined in Control.Lens.Wrapped | |
| Rewrapped CShort t | |
Defined in Control.Lens.Wrapped | |
| Rewrapped CSigAtomic t | |
Defined in Control.Lens.Wrapped | |
| Rewrapped CSize t | |
Defined in Control.Lens.Wrapped | |
| Rewrapped CTime t | |
Defined in Control.Lens.Wrapped | |
| Rewrapped CUChar t | |
Defined in Control.Lens.Wrapped | |
| Rewrapped CUInt t | |
Defined in Control.Lens.Wrapped | |
| Rewrapped CUIntMax t | |
Defined in Control.Lens.Wrapped | |
| Rewrapped CUIntPtr t | |
Defined in Control.Lens.Wrapped | |
| Rewrapped CULLong t | |
Defined in Control.Lens.Wrapped | |
| Rewrapped CULong t | |
Defined in Control.Lens.Wrapped | |
| Rewrapped CUSeconds t | |
Defined in Control.Lens.Wrapped | |
| Rewrapped CUShort t | |
Defined in Control.Lens.Wrapped | |
| Rewrapped CWchar t | |
Defined in Control.Lens.Wrapped | |
| t ~ AssertionFailed => Rewrapped AssertionFailed t | |
Defined in Control.Lens.Wrapped | |
| t ~ CompactionFailed => Rewrapped CompactionFailed t | |
Defined in Control.Lens.Wrapped | |
| Rewrapped CBlkCnt t | |
Defined in Control.Lens.Wrapped | |
| Rewrapped CBlkSize t | |
Defined in Control.Lens.Wrapped | |
| Rewrapped CCc t | |
Defined in Control.Lens.Wrapped | |
| Rewrapped CClockId t | |
Defined in Control.Lens.Wrapped | |
| Rewrapped CDev t | |
Defined in Control.Lens.Wrapped | |
| Rewrapped CFsBlkCnt t | |
Defined in Control.Lens.Wrapped | |
| Rewrapped CFsFilCnt t | |
Defined in Control.Lens.Wrapped | |
| Rewrapped CGid t | |
Defined in Control.Lens.Wrapped | |
| Rewrapped CId t | |
Defined in Control.Lens.Wrapped | |
| Rewrapped CIno t | |
Defined in Control.Lens.Wrapped | |
| Rewrapped CKey t | |
Defined in Control.Lens.Wrapped | |
| Rewrapped CMode t | |
Defined in Control.Lens.Wrapped | |
| Rewrapped CNlink t | |
Defined in Control.Lens.Wrapped | |
| Rewrapped COff t | |
Defined in Control.Lens.Wrapped | |
| Rewrapped CPid t | |
Defined in Control.Lens.Wrapped | |
| Rewrapped CRLim t | |
Defined in Control.Lens.Wrapped | |
| Rewrapped CSpeed t | |
Defined in Control.Lens.Wrapped | |
| Rewrapped CSsize t | |
Defined in Control.Lens.Wrapped | |
| Rewrapped CTcflag t | |
Defined in Control.Lens.Wrapped | |
| Rewrapped CTimer t | |
Defined in Control.Lens.Wrapped | |
| Rewrapped CUid t | |
Defined in Control.Lens.Wrapped | |
| Rewrapped Fd t | |
Defined in Control.Lens.Wrapped | |
| t ~ Comparison b => Rewrapped (Comparison a) t | |
Defined in Control.Lens.Wrapped | |
| t ~ Equivalence b => Rewrapped (Equivalence a) t | |
Defined in Control.Lens.Wrapped | |
| t ~ Predicate b => Rewrapped (Predicate a) t | |
Defined in Control.Lens.Wrapped | |
| t ~ First b => Rewrapped (First a) t | |
Defined in Control.Lens.Wrapped | |
| t ~ Last b => Rewrapped (Last a) t | |
Defined in Control.Lens.Wrapped | |
| t ~ Max b => Rewrapped (Max a) t | |
Defined in Control.Lens.Wrapped | |
| t ~ Min b => Rewrapped (Min a) t | |
Defined in Control.Lens.Wrapped | |
| t ~ WrappedMonoid b => Rewrapped (WrappedMonoid a) t | |
Defined in Control.Lens.Wrapped | |
| t ~ IntMap a' => Rewrapped (IntMap a) t | |
Defined in Control.Lens.Wrapped | |
| t ~ Seq a' => Rewrapped (Seq a) t | |
Defined in Control.Lens.Wrapped | |
| (t ~ Set a', Ord a) => Rewrapped (Set a) t | |
Defined in Control.Lens.Wrapped | |
| Clip n1 ~ t => Rewrapped (Clip n2) t Source # | |
Defined in Diagrams.TwoD.Path | |
| t ~ NonEmpty b => Rewrapped (NonEmpty a) t | |
Defined in Control.Lens.Wrapped | |
| t ~ Identity b => Rewrapped (Identity a) t | |
Defined in Control.Lens.Wrapped | |
| t ~ First b => Rewrapped (First a) t | |
Defined in Control.Lens.Wrapped | |
| t ~ Last b => Rewrapped (Last a) t | |
Defined in Control.Lens.Wrapped | |
| t ~ Down b => Rewrapped (Down a) t | |
Defined in Control.Lens.Wrapped | |
| t ~ Dual b => Rewrapped (Dual a) t | |
Defined in Control.Lens.Wrapped | |
| t ~ Endo b => Rewrapped (Endo a) t | |
Defined in Control.Lens.Wrapped | |
| t ~ Product b => Rewrapped (Product a) t | |
Defined in Control.Lens.Wrapped | |
| t ~ Sum b => Rewrapped (Sum a) t | |
Defined in Control.Lens.Wrapped | |
| t ~ ZipList b => Rewrapped (ZipList a) t | |
Defined in Control.Lens.Wrapped | |
| t ~ Par1 p' => Rewrapped (Par1 p) t | |
Defined in Control.Lens.Wrapped | |
| (t ~ HashSet a', Hashable a, Eq a) => Rewrapped (HashSet a) t | Use |
Defined in Control.Lens.Wrapped | |
| t ~ Vector a' => Rewrapped (Vector a) t | |
Defined in Control.Lens.Wrapped | |
| (Prim a, t ~ Vector a') => Rewrapped (Vector a) t | |
Defined in Control.Lens.Wrapped | |
| (Storable a, t ~ Vector a') => Rewrapped (Vector a) t | |
Defined in Control.Lens.Wrapped | |
| t ~ Vector a' => Rewrapped (Vector a) t | |
Defined in Control.Lens.Wrapped | |
| (Unbox a, t ~ Vector a') => Rewrapped (Vector a) t | |
Defined in Control.Lens.Wrapped | |
| Rewrapped (Active a) (Active b) | |
Defined in Data.Active | |
| Rewrapped (Duration a) (Duration b) | |
Defined in Data.Active | |
| Rewrapped (Time a) (Time b) | |
Defined in Data.Active | |
| Rewrapped (TransInv t) (TransInv t') | |
Defined in Diagrams.Core.Transform | |
| Rewrapped (ArcLength n) (ArcLength n') Source # | |
Defined in Diagrams.Segment | |
| t ~ WrappedMonad m' a' => Rewrapped (WrappedMonad m a) t | |
Defined in Control.Lens.Wrapped | |
| t ~ Op a' b' => Rewrapped (Op a b) t | |
Defined in Control.Lens.Wrapped | |
| (t ~ Map k' a', Ord k) => Rewrapped (Map k a) t | |
Defined in Control.Lens.Wrapped | |
| t ~ CatchT m' a' => Rewrapped (CatchT m a) t | |
Defined in Control.Lens.Wrapped | |
| t ~ Alt f' a' => Rewrapped (Alt f a) t | |
Defined in Control.Lens.Wrapped | |
| t ~ CoiterT w' a' => Rewrapped (CoiterT w a) t | |
Defined in Control.Lens.Wrapped | |
| t ~ IterT m' a' => Rewrapped (IterT m a) t | |
Defined in Control.Lens.Wrapped | |
| t ~ ArrowMonad m' a' => Rewrapped (ArrowMonad m a) t | |
Defined in Control.Lens.Wrapped | |
| t ~ Point g b => Rewrapped (Point f a) t | |
Defined in Linear.Affine | |
| t ~ MaybeApply f' a' => Rewrapped (MaybeApply f a) t | |
Defined in Control.Lens.Wrapped | |
| t ~ WrappedApplicative f' a' => Rewrapped (WrappedApplicative f a) t | |
Defined in Control.Lens.Wrapped | |
| t ~ MaybeT n b => Rewrapped (MaybeT m a) t | |
Defined in Control.Lens.Wrapped | |
| (t ~ HashMap k' a', Hashable k, Eq k) => Rewrapped (HashMap k a) t | Use |
Defined in Control.Lens.Wrapped | |
| Rewrapped (Envelope v n) (Envelope v' n') | |
Defined in Diagrams.Core.Envelope | |
| Rewrapped (Style v n) (Style v' n') | |
Defined in Diagrams.Core.Style | |
| Rewrapped (Trace v n) (Trace v' n') | |
Defined in Diagrams.Core.Trace | |
| Rewrapped (Path v n) (Path v' n') Source # | |
Defined in Diagrams.Path | |
| Rewrapped (TotalOffset v n) (TotalOffset v' n') Source # | |
Defined in Diagrams.Segment | |
| Rewrapped (SegTree v n) (SegTree v' n') Source # | |
Defined in Diagrams.Trail | |
| Rewrapped (Trail v n) (Trail v' n') Source # | |
Defined in Diagrams.Trail | |
| t ~ WrappedArrow a' b' c' => Rewrapped (WrappedArrow a b c) t | |
Defined in Control.Lens.Wrapped | |
| t ~ Fix p' a' => Rewrapped (Fix p a) t | |
Defined in Control.Lens.Wrapped | |
| t ~ Join p' a' => Rewrapped (Join p a) t | |
Defined in Control.Lens.Wrapped | |
| t ~ TracedT m' w' a' => Rewrapped (TracedT m w a) t | |
Defined in Control.Lens.Wrapped | |
| t ~ Compose f' g' a' => Rewrapped (Compose f g a) t | |
Defined in Control.Lens.Wrapped | |
| t ~ ComposeCF f' g' a' => Rewrapped (ComposeCF f g a) t | |
Defined in Control.Lens.Wrapped | |
| t ~ ComposeFC f' g' a' => Rewrapped (ComposeFC f g a) t | |
Defined in Control.Lens.Wrapped | |
| t ~ ApT f' g' a' => Rewrapped (ApT f g a) t | |
Defined in Control.Lens.Wrapped | |
| t ~ CofreeT f' w' a' => Rewrapped (CofreeT f w a) t | |
Defined in Control.Lens.Wrapped | |
| t ~ FreeT f' m' a' => Rewrapped (FreeT f m a) t | |
Defined in Control.Lens.Wrapped | |
| t ~ Kleisli m' a' b' => Rewrapped (Kleisli m a b) t | |
Defined in Control.Lens.Wrapped | |
| t ~ Const a' x' => Rewrapped (Const a x) t | |
Defined in Control.Lens.Wrapped | |
| t ~ Ap g b => Rewrapped (Ap f a) t | |
Defined in Control.Lens.Wrapped | |
| t ~ Alt g b => Rewrapped (Alt f a) t | |
Defined in Control.Lens.Wrapped | |
| t ~ Rec1 f' p' => Rewrapped (Rec1 f p) t | |
Defined in Control.Lens.Wrapped | |
| t ~ Static f' a' b' => Rewrapped (Static f a b) t | |
Defined in Control.Lens.Wrapped | |
| t ~ Tagged s' a' => Rewrapped (Tagged s a) t | |
Defined in Control.Lens.Wrapped | |
| t ~ Backwards g b => Rewrapped (Backwards f a) t | |
Defined in Control.Lens.Wrapped | |
| t ~ ExceptT e' m' a' => Rewrapped (ExceptT e m a) t | |
Defined in Control.Lens.Wrapped | |
| t ~ IdentityT n b => Rewrapped (IdentityT m a) t | |
Defined in Control.Lens.Wrapped | |
| t ~ ReaderT s n b => Rewrapped (ReaderT r m a) t | |
Defined in Control.Lens.Wrapped | |
| t ~ StateT s' m' a' => Rewrapped (StateT s m a) t | |
Defined in Control.Lens.Wrapped | |
| t ~ StateT s' m' a' => Rewrapped (StateT s m a) t | |
Defined in Control.Lens.Wrapped | |
| t ~ WriterT w' m' a' => Rewrapped (WriterT w m a) t | |
Defined in Control.Lens.Wrapped | |
| t ~ WriterT w' m' a' => Rewrapped (WriterT w m a) t | |
Defined in Control.Lens.Wrapped | |
| t ~ Constant a' b' => Rewrapped (Constant a b) t | |
Defined in Control.Lens.Wrapped | |
| t ~ Reverse g b => Rewrapped (Reverse f a) t | |
Defined in Control.Lens.Wrapped | |
| Rewrapped (Query v a m) (Query v' a' m') | |
Defined in Diagrams.Core.Query | |
| Rewrapped (Trail' Line v n) (Trail' Line v' n') Source # | |
Defined in Diagrams.Trail | |
| t ~ K1 i' c' p' => Rewrapped (K1 i c p) t | |
Defined in Control.Lens.Wrapped | |
| t ~ Costar f' d' c' => Rewrapped (Costar f d c) t | |
Defined in Control.Lens.Wrapped | |
| t ~ Forget r' a' b' => Rewrapped (Forget r a b) t | |
Defined in Control.Lens.Wrapped | |
| t ~ Star f' d' c' => Rewrapped (Star f d c) t | |
Defined in Control.Lens.Wrapped | |
| t ~ ContT r' m' a' => Rewrapped (ContT r m a) t | |
Defined in Control.Lens.Wrapped | |
| Rewrapped (QDiagram b v n m) (QDiagram b' v' n' m') | |
Defined in Diagrams.Core.Types | |
| Rewrapped (SubMap b v n m) (SubMap b' v' n' m') | |
Defined in Diagrams.Core.Types | |
| t ~ Compose f' g' a' => Rewrapped (Compose f g a) t | |
Defined in Control.Lens.Wrapped | |
| t ~ Clown f' a' b' => Rewrapped (Clown f a b) t | |
Defined in Control.Lens.Wrapped | |
| t ~ Flip p' a' b' => Rewrapped (Flip p a b) t | |
Defined in Control.Lens.Wrapped | |
| t ~ Joker g' a' b' => Rewrapped (Joker g a b) t | |
Defined in Control.Lens.Wrapped | |
| t ~ WrappedBifunctor p' a' b' => Rewrapped (WrappedBifunctor p a b) t | |
Defined in Control.Lens.Wrapped | |
| t ~ (f' :.: g') p' => Rewrapped ((f :.: g) p) t | |
Defined in Control.Lens.Wrapped | |
| t ~ M1 i' c' f' p' => Rewrapped (M1 i c f p) t | |
Defined in Control.Lens.Wrapped | |
| t ~ WrappedArrow p' a' b' => Rewrapped (WrappedArrow p a b) t | |
Defined in Control.Lens.Wrapped | |
| t ~ Semi m' a' b' => Rewrapped (Semi m a b) t | |
Defined in Control.Lens.Wrapped | |
| t ~ WrappedCategory k' a' b' => Rewrapped (WrappedCategory k6 a b) t | |
Defined in Control.Lens.Wrapped | |
| t ~ Dual k' a' b' => Rewrapped (Dual k6 a b) t | |
Defined in Control.Lens.Wrapped | |
| t ~ RWST r' w' s' m' a' => Rewrapped (RWST r w s m a) t | |
Defined in Control.Lens.Wrapped | |
| t ~ RWST r' w' s' m' a' => Rewrapped (RWST r w s m a) t | |
Defined in Control.Lens.Wrapped | |
| t ~ Tannen f' p' a' b' => Rewrapped (Tannen f p a b) t | |
Defined in Control.Lens.Wrapped | |
| t ~ Cayley f' p' a' b' => Rewrapped (Cayley f p a b) t | |
Defined in Control.Lens.Wrapped | |
| t ~ Biff p' f' g' a' b' => Rewrapped (Biff p f g a b) t | |
Defined in Control.Lens.Wrapped | |
type family Unwrapped s Source #
Instances
| type Unwrapped IntSet | |
Defined in Control.Lens.Wrapped | |
| type Unwrapped Name | |
Defined in Diagrams.Core.Names | |
| type Unwrapped SegCount Source # | |
Defined in Diagrams.Segment | |
| type Unwrapped NoMethodError | |
Defined in Control.Lens.Wrapped | |
| type Unwrapped PatternMatchFail | |
Defined in Control.Lens.Wrapped | |
| type Unwrapped RecConError | |
Defined in Control.Lens.Wrapped | |
| type Unwrapped RecSelError | |
Defined in Control.Lens.Wrapped | |
| type Unwrapped RecUpdError | |
Defined in Control.Lens.Wrapped | |
| type Unwrapped TypeError | |
Defined in Control.Lens.Wrapped | |
| type Unwrapped All | |
Defined in Control.Lens.Wrapped | |
| type Unwrapped Any | |
Defined in Control.Lens.Wrapped | |
| type Unwrapped ErrorCall | |
Defined in Control.Lens.Wrapped | |
| type Unwrapped Errno | |
Defined in Control.Lens.Wrapped | |
| type Unwrapped CBool | |
Defined in Control.Lens.Wrapped | |
| type Unwrapped CChar | |
Defined in Control.Lens.Wrapped | |
| type Unwrapped CClock | |
Defined in Control.Lens.Wrapped | |
| type Unwrapped CDouble | |
Defined in Control.Lens.Wrapped | |
| type Unwrapped CFloat | |
Defined in Control.Lens.Wrapped | |
| type Unwrapped CInt | |
Defined in Control.Lens.Wrapped | |
| type Unwrapped CIntMax | |
Defined in Control.Lens.Wrapped | |
| type Unwrapped CIntPtr | |
Defined in Control.Lens.Wrapped | |
| type Unwrapped CLLong | |
Defined in Control.Lens.Wrapped | |
| type Unwrapped CLong | |
Defined in Control.Lens.Wrapped | |
| type Unwrapped CPtrdiff | |
Defined in Control.Lens.Wrapped | |
| type Unwrapped CSChar | |
Defined in Control.Lens.Wrapped | |
| type Unwrapped CSUSeconds | |
Defined in Control.Lens.Wrapped | |
| type Unwrapped CShort | |
Defined in Control.Lens.Wrapped | |
| type Unwrapped CSigAtomic | |
Defined in Control.Lens.Wrapped | |
| type Unwrapped CSize | |
Defined in Control.Lens.Wrapped | |
| type Unwrapped CTime | |
Defined in Control.Lens.Wrapped | |
| type Unwrapped CUChar | |
Defined in Control.Lens.Wrapped | |
| type Unwrapped CUInt | |
Defined in Control.Lens.Wrapped | |
| type Unwrapped CUIntMax | |
Defined in Control.Lens.Wrapped | |
| type Unwrapped CUIntPtr | |
Defined in Control.Lens.Wrapped | |
| type Unwrapped CULLong | |
Defined in Control.Lens.Wrapped | |
| type Unwrapped CULong | |
Defined in Control.Lens.Wrapped | |
| type Unwrapped CUSeconds | |
Defined in Control.Lens.Wrapped | |
| type Unwrapped CUShort | |
Defined in Control.Lens.Wrapped | |
| type Unwrapped CWchar | |
Defined in Control.Lens.Wrapped | |
| type Unwrapped AssertionFailed | |
Defined in Control.Lens.Wrapped | |
| type Unwrapped CompactionFailed | |
Defined in Control.Lens.Wrapped | |
| type Unwrapped CBlkCnt | |
Defined in Control.Lens.Wrapped | |
| type Unwrapped CBlkSize | |
Defined in Control.Lens.Wrapped | |
| type Unwrapped CCc | |
Defined in Control.Lens.Wrapped | |
| type Unwrapped CClockId | |
Defined in Control.Lens.Wrapped | |
| type Unwrapped CDev | |
Defined in Control.Lens.Wrapped | |
| type Unwrapped CFsBlkCnt | |
Defined in Control.Lens.Wrapped | |
| type Unwrapped CFsFilCnt | |
Defined in Control.Lens.Wrapped | |
| type Unwrapped CGid | |
Defined in Control.Lens.Wrapped | |
| type Unwrapped CId | |
Defined in Control.Lens.Wrapped | |
| type Unwrapped CIno | |
Defined in Control.Lens.Wrapped | |
| type Unwrapped CKey | |
Defined in Control.Lens.Wrapped | |
| type Unwrapped CMode | |
Defined in Control.Lens.Wrapped | |
| type Unwrapped CNlink | |
Defined in Control.Lens.Wrapped | |
| type Unwrapped COff | |
Defined in Control.Lens.Wrapped | |
| type Unwrapped CPid | |
Defined in Control.Lens.Wrapped | |
| type Unwrapped CRLim | |
Defined in Control.Lens.Wrapped | |
| type Unwrapped CSpeed | |
Defined in Control.Lens.Wrapped | |
| type Unwrapped CSsize | |
Defined in Control.Lens.Wrapped | |
| type Unwrapped CTcflag | |
Defined in Control.Lens.Wrapped | |
| type Unwrapped CTimer | |
Defined in Control.Lens.Wrapped | |
| type Unwrapped CUid | |
Defined in Control.Lens.Wrapped | |
| type Unwrapped Fd | |
Defined in Control.Lens.Wrapped | |
| type Unwrapped (Active a) | |
Defined in Data.Active | |
| type Unwrapped (Duration a) | |
Defined in Data.Active | |
| type Unwrapped (Time a) | |
Defined in Data.Active | |
| type Unwrapped (Comparison a) | |
Defined in Control.Lens.Wrapped | |
| type Unwrapped (Equivalence a) | |
Defined in Control.Lens.Wrapped | |
| type Unwrapped (Predicate a) | |
Defined in Control.Lens.Wrapped | |
| type Unwrapped (First a) | |
Defined in Control.Lens.Wrapped | |
| type Unwrapped (Last a) | |
Defined in Control.Lens.Wrapped | |
| type Unwrapped (Max a) | |
Defined in Control.Lens.Wrapped | |
| type Unwrapped (Min a) | |
Defined in Control.Lens.Wrapped | |
| type Unwrapped (WrappedMonoid a) | |
Defined in Control.Lens.Wrapped | |
| type Unwrapped (IntMap a) | |
Defined in Control.Lens.Wrapped | |
| type Unwrapped (Seq a) | |
Defined in Control.Lens.Wrapped | |
| type Unwrapped (Set a) | |
Defined in Control.Lens.Wrapped | |
| type Unwrapped (TransInv t) | |
Defined in Diagrams.Core.Transform | |
| type Unwrapped (ArcLength n) Source # | |
Defined in Diagrams.Segment | |
| type Unwrapped (Clip n) Source # | |
Defined in Diagrams.TwoD.Path | |
| type Unwrapped (NonEmpty a) | |
Defined in Control.Lens.Wrapped | |
| type Unwrapped (Identity a) | |
Defined in Control.Lens.Wrapped | |
| type Unwrapped (First a) | |
Defined in Control.Lens.Wrapped | |
| type Unwrapped (Last a) | |
Defined in Control.Lens.Wrapped | |
| type Unwrapped (Down a) | |
Defined in Control.Lens.Wrapped | |
| type Unwrapped (Dual a) | |
Defined in Control.Lens.Wrapped | |
| type Unwrapped (Endo a) | |
Defined in Control.Lens.Wrapped | |
| type Unwrapped (Product a) | |
Defined in Control.Lens.Wrapped | |
| type Unwrapped (Sum a) | |
Defined in Control.Lens.Wrapped | |
| type Unwrapped (ZipList a) | |
Defined in Control.Lens.Wrapped | |
| type Unwrapped (Par1 p) | |
Defined in Control.Lens.Wrapped | |
| type Unwrapped (HashSet a) | |
Defined in Control.Lens.Wrapped type Unwrapped (HashSet a) = [a] | |
| type Unwrapped (Vector a) | |
Defined in Control.Lens.Wrapped type Unwrapped (Vector a) = [a] | |
| type Unwrapped (Vector a) | |
Defined in Control.Lens.Wrapped type Unwrapped (Vector a) = [a] | |
| type Unwrapped (Vector a) | |
Defined in Control.Lens.Wrapped type Unwrapped (Vector a) = [a] | |
| type Unwrapped (Vector a) | |
Defined in Control.Lens.Wrapped type Unwrapped (Vector a) = [a] | |
| type Unwrapped (Vector a) | |
Defined in Control.Lens.Wrapped type Unwrapped (Vector a) = [a] | |
| type Unwrapped (WrappedMonad m a) | |
Defined in Control.Lens.Wrapped | |
| type Unwrapped (Op a b) | |
Defined in Control.Lens.Wrapped | |
| type Unwrapped (Map k a) | |
Defined in Control.Lens.Wrapped | |
| type Unwrapped (Envelope v n) | |
Defined in Diagrams.Core.Envelope | |
| type Unwrapped (Style v n) | |
Defined in Diagrams.Core.Style | |
| type Unwrapped (Trace v n) | |
Defined in Diagrams.Core.Trace | |
| type Unwrapped (Path v n) Source # | |
Defined in Diagrams.Path | |
| type Unwrapped (TotalOffset v n) Source # | |
Defined in Diagrams.Segment | |
| type Unwrapped (SegTree v n) Source # | |
Defined in Diagrams.Trail | |
| type Unwrapped (Trail v n) Source # | |
| type Unwrapped (CatchT m a) | |
Defined in Control.Lens.Wrapped | |
| type Unwrapped (Alt f a) | |
Defined in Control.Lens.Wrapped type Unwrapped (Alt f a) = [AltF f a] | |
| type Unwrapped (CoiterT w a) | |
Defined in Control.Lens.Wrapped type Unwrapped (CoiterT w a) = w (a, CoiterT w a) | |
| type Unwrapped (IterT m a) | |
Defined in Control.Lens.Wrapped | |
| type Unwrapped (ArrowMonad m a) | |
Defined in Control.Lens.Wrapped | |
| type Unwrapped (Point f a) | |
Defined in Linear.Affine | |
| type Unwrapped (MaybeApply f a) | |
Defined in Control.Lens.Wrapped | |
| type Unwrapped (WrappedApplicative f a) | |
Defined in Control.Lens.Wrapped type Unwrapped (WrappedApplicative f a) = f a | |
| type Unwrapped (MaybeT m a) | |
Defined in Control.Lens.Wrapped | |
| type Unwrapped (HashMap k a) | |
Defined in Control.Lens.Wrapped type Unwrapped (HashMap k a) = [(k, a)] | |
| type Unwrapped (WrappedArrow a b c) | |
Defined in Control.Lens.Wrapped | |
| type Unwrapped (Fix p a) | |
Defined in Control.Lens.Wrapped type Unwrapped (Fix p a) = p (Fix p a) a | |
| type Unwrapped (Join p a) | |
Defined in Control.Lens.Wrapped type Unwrapped (Join p a) = p a a | |
| type Unwrapped (TracedT m w a) | |
Defined in Control.Lens.Wrapped type Unwrapped (TracedT m w a) = w (m -> a) | |
| type Unwrapped (Compose f g a) | |
Defined in Control.Lens.Wrapped type Unwrapped (Compose f g a) = f (g a) | |
| type Unwrapped (ComposeCF f g a) | |
Defined in Control.Lens.Wrapped type Unwrapped (ComposeCF f g a) = f (g a) | |
| type Unwrapped (ComposeFC f g a) | |
Defined in Control.Lens.Wrapped type Unwrapped (ComposeFC f g a) = f (g a) | |
| type Unwrapped (Query v n m) | |
Defined in Diagrams.Core.Query | |
| type Unwrapped (Trail' Line v n) Source # | |
Defined in Diagrams.Trail | |
| type Unwrapped (ApT f g a) | |
Defined in Control.Lens.Wrapped type Unwrapped (ApT f g a) = g (ApF f g a) | |
| type Unwrapped (CofreeT f w a) | |
Defined in Control.Lens.Wrapped type Unwrapped (CofreeT f w a) = w (CofreeF f a (CofreeT f w a)) | |
| type Unwrapped (FreeT f m a) | |
Defined in Control.Lens.Wrapped type Unwrapped (FreeT f m a) = m (FreeF f a (FreeT f m a)) | |
| type Unwrapped (Kleisli m a b) | |
Defined in Control.Lens.Wrapped | |
| type Unwrapped (Const a x) | |
Defined in Control.Lens.Wrapped | |
| type Unwrapped (Ap f a) | |
Defined in Control.Lens.Wrapped | |
| type Unwrapped (Alt f a) | |
Defined in Control.Lens.Wrapped | |
| type Unwrapped (Rec1 f p) | |
Defined in Control.Lens.Wrapped | |
| type Unwrapped (Static f a b) | |
Defined in Control.Lens.Wrapped type Unwrapped (Static f a b) = f (a -> b) | |
| type Unwrapped (Tagged s a) | |
Defined in Control.Lens.Wrapped type Unwrapped (Tagged s a) = a | |
| type Unwrapped (Backwards f a) | |
Defined in Control.Lens.Wrapped | |
| type Unwrapped (ExceptT e m a) | |
Defined in Control.Lens.Wrapped | |
| type Unwrapped (IdentityT m a) | |
Defined in Control.Lens.Wrapped | |
| type Unwrapped (ReaderT r m a) | |
Defined in Control.Lens.Wrapped | |
| type Unwrapped (StateT s m a) | |
Defined in Control.Lens.Wrapped | |
| type Unwrapped (StateT s m a) | |
Defined in Control.Lens.Wrapped | |
| type Unwrapped (WriterT w m a) | |
Defined in Control.Lens.Wrapped | |
| type Unwrapped (WriterT w m a) | |
Defined in Control.Lens.Wrapped | |
| type Unwrapped (Constant a b) | |
Defined in Control.Lens.Wrapped | |
| type Unwrapped (Reverse f a) | |
Defined in Control.Lens.Wrapped | |
| type Unwrapped (QDiagram b v n m) | |
Defined in Diagrams.Core.Types type Unwrapped (QDiagram b v n m) = DUALTree (DownAnnots v n) (UpAnnots b v n m) Annotation (QDiaLeaf b v n m) | |
| type Unwrapped (SubMap b v n m) | |
Defined in Diagrams.Core.Types | |
| type Unwrapped (K1 i c p) | |
Defined in Control.Lens.Wrapped | |
| type Unwrapped (Costar f d c) | |
Defined in Control.Lens.Wrapped type Unwrapped (Costar f d c) = f d -> c | |
| type Unwrapped (Forget r a b) | |
Defined in Control.Lens.Wrapped type Unwrapped (Forget r a b) = a -> r | |
| type Unwrapped (Star f d c) | |
Defined in Control.Lens.Wrapped type Unwrapped (Star f d c) = d -> f c | |
| type Unwrapped (ContT r m a) | |
Defined in Control.Lens.Wrapped | |
| type Unwrapped (Compose f g a) | |
Defined in Control.Lens.Wrapped | |
| type Unwrapped (Clown f a b) | |
Defined in Control.Lens.Wrapped type Unwrapped (Clown f a b) = f a | |
| type Unwrapped (Flip p a b) | |
Defined in Control.Lens.Wrapped type Unwrapped (Flip p a b) = p b a | |
| type Unwrapped (Joker g a b) | |
Defined in Control.Lens.Wrapped type Unwrapped (Joker g a b) = g b | |
| type Unwrapped (WrappedBifunctor p a b) | |
Defined in Control.Lens.Wrapped type Unwrapped (WrappedBifunctor p a b) = p a b | |
| type Unwrapped ((f :.: g) p) | |
Defined in Control.Lens.Wrapped | |
| type Unwrapped (M1 i c f p) | |
Defined in Control.Lens.Wrapped | |
| type Unwrapped (WrappedArrow p a b) | |
Defined in Control.Lens.Wrapped type Unwrapped (WrappedArrow p a b) = p a b | |
| type Unwrapped (Semi m a b) | |
Defined in Control.Lens.Wrapped type Unwrapped (Semi m a b) = m | |
| type Unwrapped (WrappedCategory k3 a b) | |
Defined in Control.Lens.Wrapped type Unwrapped (WrappedCategory k3 a b) = k3 a b | |
| type Unwrapped (Dual k3 a b) | |
Defined in Control.Lens.Wrapped type Unwrapped (Dual k3 a b) = k3 b a | |
| type Unwrapped (RWST r w s m a) | |
Defined in Control.Lens.Wrapped | |
| type Unwrapped (RWST r w s m a) | |
Defined in Control.Lens.Wrapped | |
| type Unwrapped (Tannen f p a b) | |
Defined in Control.Lens.Wrapped type Unwrapped (Tannen f p a b) = f (p a b) | |
| type Unwrapped (Cayley f p a b) | |
Defined in Control.Lens.Wrapped type Unwrapped (Cayley f p a b) = f (p a b) | |
| type Unwrapped (Biff p f g a b) | |
Defined in Control.Lens.Wrapped type Unwrapped (Biff p f g a b) = p (f a) (g b) | |
_GWrapped' :: forall s (d :: Meta) (c :: Meta) (s' :: Meta) a. (Generic s, D1 d (C1 c (S1 s' (Rec0 a))) ~ Rep s, Unwrapped s ~ GUnwrapped (Rep s)) => Iso' s (Unwrapped s) Source #
_Wrapped :: Rewrapping s t => Iso s t (Unwrapped s) (Unwrapped t) Source #
Work under a newtype wrapper.
>>>Const "hello" & _Wrapped %~ Prelude.length & getConst5
_Wrapped≡from_Unwrapped_Unwrapped≡from_Wrapped
_Unwrapped :: Rewrapping s t => Iso (Unwrapped t) (Unwrapped s) t s Source #
_Wrapping' :: Wrapped s => (Unwrapped s -> s) -> Iso' s (Unwrapped s) Source #
This is a convenient version of _Wrapped with an argument that's ignored.
The user supplied function is ignored, merely its type is used.
_Unwrapping' :: Wrapped s => (Unwrapped s -> s) -> Iso' (Unwrapped s) s Source #
This is a convenient version of _Wrapped with an argument that's ignored.
The user supplied function is ignored, merely its type is used.
_Wrapping :: Rewrapping s t => (Unwrapped s -> s) -> Iso s t (Unwrapped s) (Unwrapped t) Source #
This is a convenient version of _Wrapped with an argument that's ignored.
The user supplied function is ignored, merely its types are used.
_Unwrapping :: Rewrapping s t => (Unwrapped s -> s) -> Iso (Unwrapped t) (Unwrapped s) t s Source #
This is a convenient version of _Unwrapped with an argument that's ignored.
The user supplied function is ignored, merely its types are used.
type family Magnified (m :: Type -> Type) :: Type -> Type -> Type Source #
This type family is used by Magnify to describe the common effect type.
Instances
| type Magnified (IdentityT m) | |
Defined in Control.Lens.Zoom | |
| type Magnified (ReaderT b m) | |
Defined in Control.Lens.Zoom | |
| type Magnified ((->) b) | |
| type Magnified (RWST a w s m) | |
Defined in Control.Lens.Zoom | |
| type Magnified (RWST a w s m) | |
Defined in Control.Lens.Zoom | |
| type Magnified (RWST a w s m) | |
Defined in Control.Lens.Zoom | |
type family Zoomed (m :: Type -> Type) :: Type -> Type -> Type Source #
This type family is used by Zoom to describe the common effect type.
Instances
| type Zoomed (MaybeT m) | |
Defined in Control.Lens.Zoom | |
| type Zoomed (FreeT f m) | |
Defined in Control.Lens.Zoom | |
| type Zoomed (ExceptT e m) | |
Defined in Control.Lens.Zoom | |
| type Zoomed (IdentityT m) | |
Defined in Control.Lens.Zoom | |
| type Zoomed (ReaderT e m) | |
Defined in Control.Lens.Zoom | |
| type Zoomed (StateT s z) | |
Defined in Control.Lens.Zoom | |
| type Zoomed (StateT s z) | |
Defined in Control.Lens.Zoom | |
| type Zoomed (WriterT w m) | |
Defined in Control.Lens.Zoom | |
| type Zoomed (WriterT w m) | |
Defined in Control.Lens.Zoom | |
| type Zoomed (RWST r w s z) | |
Defined in Control.Lens.Zoom | |
| type Zoomed (RWST r w s z) | |
Defined in Control.Lens.Zoom | |
class GPlated1 (f :: k -> Type) (g :: k -> Type) Source #
Minimal complete definition
gplate1'
Instances
| GPlated1 (f :: Type -> Type) Par1 | ignored |
Defined in Control.Lens.Plated Methods gplate1' :: Traversal' (Par1 a) (f a) | |
| GPlated1 (f :: k -> Type) (U1 :: k -> Type) | ignored |
Defined in Control.Lens.Plated Methods gplate1' :: forall (a :: k). Traversal' (U1 a) (f a) | |
| GPlated1 (f :: k -> Type) (V1 :: k -> Type) | ignored |
Defined in Control.Lens.Plated Methods gplate1' :: forall (a :: k). Traversal' (V1 a) (f a) | |
| GPlated1 (f :: k -> Type) (Rec1 f :: k -> Type) | match |
Defined in Control.Lens.Plated Methods gplate1' :: forall (a :: k). Traversal' (Rec1 f a) (f a) | |
| GPlated1 (f :: k -> Type) (Rec1 g :: k -> Type) | ignored |
Defined in Control.Lens.Plated Methods gplate1' :: forall (a :: k). Traversal' (Rec1 g a) (f a) | |
| GPlated1 (f :: k -> Type) (URec a :: k -> Type) | ignored |
Defined in Control.Lens.Plated Methods gplate1' :: forall (a0 :: k). Traversal' (URec a a0) (f a0) | |
| (GPlated1 f g, GPlated1 f h) => GPlated1 (f :: k -> Type) (g :*: h :: k -> Type) | recursive match |
Defined in Control.Lens.Plated Methods gplate1' :: forall (a :: k). Traversal' ((g :*: h) a) (f a) | |
| (GPlated1 f g, GPlated1 f h) => GPlated1 (f :: k -> Type) (g :+: h :: k -> Type) | recursive match |
Defined in Control.Lens.Plated Methods gplate1' :: forall (a :: k). Traversal' ((g :+: h) a) (f a) | |
| GPlated1 (f :: k -> Type) (K1 i a :: k -> Type) | ignored |
Defined in Control.Lens.Plated Methods gplate1' :: forall (a0 :: k). Traversal' (K1 i a a0) (f a0) | |
| GPlated1 f g => GPlated1 (f :: k -> Type) (M1 i c g :: k -> Type) | recursive match |
Defined in Control.Lens.Plated Methods gplate1' :: forall (a :: k). Traversal' (M1 i c g a) (f a) | |
| (Traversable t, GPlated1 f g) => GPlated1 (f :: k1 -> Type) (t :.: g :: k1 -> Type) | recursive match under outer |
Defined in Control.Lens.Plated Methods gplate1' :: forall (a :: k1). Traversal' ((t :.: g) a) (f a) | |
class GPlated a (g :: k -> Type) Source #
Minimal complete definition
gplate'
Instances
| GPlated a (U1 :: k -> Type) | |
Defined in Control.Lens.Plated Methods gplate' :: forall (p :: k). Traversal' (U1 p) a | |
| GPlated a (V1 :: k -> Type) | |
Defined in Control.Lens.Plated Methods gplate' :: forall (p :: k). Traversal' (V1 p) a | |
| GPlated a (URec b :: k -> Type) | |
Defined in Control.Lens.Plated Methods gplate' :: forall (p :: k). Traversal' (URec b p) a | |
| (GPlated a f, GPlated a g) => GPlated a (f :*: g :: k -> Type) | |
Defined in Control.Lens.Plated Methods gplate' :: forall (p :: k). Traversal' ((f :*: g) p) a | |
| (GPlated a f, GPlated a g) => GPlated a (f :+: g :: k -> Type) | |
Defined in Control.Lens.Plated Methods gplate' :: forall (p :: k). Traversal' ((f :+: g) p) a | |
| GPlated a (K1 i a :: k -> Type) | |
Defined in Control.Lens.Plated Methods gplate' :: forall (p :: k). Traversal' (K1 i a p) a | |
| GPlated a (K1 i b :: k -> Type) | |
Defined in Control.Lens.Plated Methods gplate' :: forall (p :: k). Traversal' (K1 i b p) a | |
| GPlated a f => GPlated a (M1 i c f :: k -> Type) | |
Defined in Control.Lens.Plated Methods gplate' :: forall (p :: k). Traversal' (M1 i c f p) a | |
deep :: (Conjoined p, Applicative f, Plated s) => Traversing p f s s a b -> Over p f s s a b Source #
Try to apply a traversal to all transitive descendants of a Plated container, but
do not recurse through matching descendants.
deep::Plateds =>Folds a ->Folds adeep::Plateds =>IndexedFolds a ->IndexedFolds adeep::Plateds =>Traversals s a b ->Traversals s a bdeep::Plateds =>IndexedTraversals s a b ->IndexedTraversals s a b
rewrite :: Plated a => (a -> Maybe a) -> a -> a Source #
Rewrite by applying a rule everywhere you can. Ensures that the rule cannot be applied anywhere in the result:
propRewrite r x =all(isNothing.r) (universe(rewriter x))
Usually transform is more appropriate, but rewrite can give better
compositionality. Given two single transformations f and g, you can
construct \a -> f a which performs both rewrites until a fixed point.<|> g a
rewriteOf :: ASetter a b a b -> (b -> Maybe a) -> a -> b Source #
Rewrite by applying a rule everywhere you can. Ensures that the rule cannot be applied anywhere in the result:
propRewriteOf l r x =all(isNothing.r) (universeOfl (rewriteOfl r x))
Usually transformOf is more appropriate, but rewriteOf can give better
compositionality. Given two single transformations f and g, you can
construct \a -> f a which performs both rewrites until a fixed point.<|> g a
rewriteOf::Iso'a a -> (a ->Maybea) -> a -> arewriteOf::Lens'a a -> (a ->Maybea) -> a -> arewriteOf::Traversal'a a -> (a ->Maybea) -> a -> arewriteOf::Setter'a a -> (a ->Maybea) -> a -> a
rewriteOn :: Plated a => ASetter s t a a -> (a -> Maybe a) -> s -> t Source #
Rewrite recursively over part of a larger structure.
rewriteOn::Plateda =>Iso's a -> (a ->Maybea) -> s -> srewriteOn::Plateda =>Lens's a -> (a ->Maybea) -> s -> srewriteOn::Plateda =>Traversal's a -> (a ->Maybea) -> s -> srewriteOn::Plateda =>ASetter's a -> (a ->Maybea) -> s -> s
rewriteOnOf :: ASetter s t a b -> ASetter a b a b -> (b -> Maybe a) -> s -> t Source #
Rewrite recursively over part of a larger structure using a specified Setter.
rewriteOnOf::Iso's a ->Iso'a a -> (a ->Maybea) -> s -> srewriteOnOf::Lens's a ->Lens'a a -> (a ->Maybea) -> s -> srewriteOnOf::Traversal's a ->Traversal'a a -> (a ->Maybea) -> s -> srewriteOnOf::Setter's a ->Setter'a a -> (a ->Maybea) -> s -> s
rewriteM :: (Monad m, Plated a) => (a -> m (Maybe a)) -> a -> m a Source #
Rewrite by applying a monadic rule everywhere you can. Ensures that the rule cannot be applied anywhere in the result.
rewriteMOf :: Monad m => LensLike (WrappedMonad m) a b a b -> (b -> m (Maybe a)) -> a -> m b Source #
Rewrite by applying a monadic rule everywhere you recursing with a user-specified Traversal.
Ensures that the rule cannot be applied anywhere in the result.
rewriteMOn :: (Monad m, Plated a) => LensLike (WrappedMonad m) s t a a -> (a -> m (Maybe a)) -> s -> m t Source #
Rewrite by applying a monadic rule everywhere inside of a structure located by a user-specified Traversal.
Ensures that the rule cannot be applied anywhere in the result.
rewriteMOnOf :: Monad m => LensLike (WrappedMonad m) s t a b -> LensLike (WrappedMonad m) a b a b -> (b -> m (Maybe a)) -> s -> m t Source #
universe :: Plated a => a -> [a] Source #
Retrieve all of the transitive descendants of a Plated container, including itself.
universeOf :: Getting (Endo [a]) a a -> a -> [a] Source #
Given a Fold that knows how to locate immediate children, retrieve all of the transitive descendants of a node, including itself.
universeOf::Folda a -> a -> [a]
universeOnOf :: Getting (Endo [a]) s a -> Getting (Endo [a]) a a -> s -> [a] Source #
Given a Fold that knows how to locate immediate children, retrieve all of the transitive descendants of a node, including itself that lie
in a region indicated by another Fold.
toListOfl ≡universeOnOflignored
cosmos :: Plated a => Fold a a Source #
Fold over all transitive descendants of a Plated container, including itself.
cosmosOf :: (Applicative f, Contravariant f) => LensLike' f a a -> LensLike' f a a Source #
cosmosOn :: (Applicative f, Contravariant f, Plated a) => LensLike' f s a -> LensLike' f s a Source #
cosmosOnOf :: (Applicative f, Contravariant f) => LensLike' f s a -> LensLike' f a a -> LensLike' f s a Source #
transformOn :: Plated a => ASetter s t a a -> (a -> a) -> s -> t Source #
Transform every element in the tree in a bottom-up manner over a region indicated by a Setter.
transformOn::Plateda =>Traversal's a -> (a -> a) -> s -> stransformOn::Plateda =>Setter's a -> (a -> a) -> s -> s
transformOf :: ASetter a b a b -> (b -> b) -> a -> b Source #
Transform every element by recursively applying a given Setter in a bottom-up manner.
transformOf::Traversal'a a -> (a -> a) -> a -> atransformOf::Setter'a a -> (a -> a) -> a -> a
transformOnOf :: ASetter s t a b -> ASetter a b a b -> (b -> b) -> s -> t Source #
Transform every element in a region indicated by a Setter by recursively applying another Setter
in a bottom-up manner.
transformOnOf::Setter's a ->Traversal'a a -> (a -> a) -> s -> stransformOnOf::Setter's a ->Setter'a a -> (a -> a) -> s -> s
transformM :: (Monad m, Plated a) => (a -> m a) -> a -> m a Source #
Transform every element in the tree, in a bottom-up manner, monadically.
transformMOn :: (Monad m, Plated a) => LensLike (WrappedMonad m) s t a a -> (a -> m a) -> s -> m t Source #
Transform every element in the tree in a region indicated by a supplied Traversal, in a bottom-up manner, monadically.
transformMOn:: (Monadm,Plateda) =>Traversal's a -> (a -> m a) -> s -> m s
transformMOf :: Monad m => LensLike (WrappedMonad m) a b a b -> (b -> m b) -> a -> m b Source #
Transform every element in a tree using a user supplied Traversal in a bottom-up manner with a monadic effect.
transformMOf::Monadm =>Traversal'a a -> (a -> m a) -> a -> m a
transformMOnOf :: Monad m => LensLike (WrappedMonad m) s t a b -> LensLike (WrappedMonad m) a b a b -> (b -> m b) -> s -> m t Source #
Transform every element in a tree that lies in a region indicated by a supplied Traversal, walking with a user supplied Traversal in
a bottom-up manner with a monadic effect.
transformMOnOf::Monadm =>Traversal's a ->Traversal'a a -> (a -> m a) -> s -> m s
contextsOn :: Plated a => ATraversal s t a a -> s -> [Context a a t] Source #
Return a list of all of the editable contexts for every location in the structure in an areas indicated by a user supplied Traversal, recursively using plate.
contextsOnb ≡contextsOnOfbplate
contextsOn::Plateda =>Traversal's a -> s -> [Contexta a s]
contextsOnOf :: ATraversal s t a a -> ATraversal' a a -> s -> [Context a a t] Source #
Return a list of all of the editable contexts for every location in the structure in an areas indicated by a user supplied Traversal, recursively using
another user-supplied Traversal to walk each layer.
contextsOnOf::Traversal's a ->Traversal'a a -> s -> [Contexta a s]
holes :: Plated a => a -> [Pretext (->) a a a] Source #
The one-level version of context. This extracts a list of the immediate children as editable contexts.
Given a context you can use pos to see the values, peek at what the structure would be like with an edited result, or simply extract the original structure.
propChildren x =childrenl x==mappos(holesl x) propId x =all(==x) [extractw | w <-holesl x]
holes=holesOfplate
holesOn :: Conjoined p => Over p (Bazaar p a a) s t a a -> s -> [Pretext p a a t] Source #
An alias for holesOf, provided for consistency with the other combinators.
holesOn≡holesOf
holesOn::Iso's a -> s -> [Pretext(->) a a s]holesOn::Lens's a -> s -> [Pretext(->) a a s]holesOn::Traversal's a -> s -> [Pretext(->) a a s]holesOn::IndexedLens'i s a -> s -> [Pretext(Indexedi) a a s]holesOn::IndexedTraversal'i s a -> s -> [Pretext(Indexedi) a a s]
holesOnOf :: Conjoined p => LensLike (Bazaar p r r) s t a b -> Over p (Bazaar p r r) a b r r -> s -> [Pretext p r r t] Source #
Extract one level of holes from a container in a region specified by one Traversal, using another.
holesOnOfb l ≡holesOf(b.l)
holesOnOf::Iso's a ->Iso'a a -> s -> [Pretext(->) a a s]holesOnOf::Lens's a ->Lens'a a -> s -> [Pretext(->) a a s]holesOnOf::Traversal's a ->Traversal'a a -> s -> [Pretext(->) a a s]holesOnOf::Lens's a ->IndexedLens'i a a -> s -> [Pretext(Indexedi) a a s]holesOnOf::Traversal's a ->IndexedTraversal'i a a -> s -> [Pretext(Indexedi) a a s]
composOpFold :: Plated a => b -> (b -> b -> b) -> (a -> b) -> a -> b Source #
Fold the immediate children of a Plated container.
composOpFoldz c f =foldrOfplate(c.f) z
gplate :: (Generic a, GPlated a (Rep a)) => Traversal' a a Source #
Implement plate operation for a type using its Generic instance.
Note: the behavior may be different than with uniplate in some special cases.
gplate doesn't look through other types in a group of mutually
recursive types.
For example consider mutually recursive even and odd natural numbers:
>>>data Even = Z | E Odd deriving (Show, Generic, Data); data Odd = O Even deriving (Show, Generic, Data)
Then uniplate, which is based on Data, finds
all even numbers less or equal than four:
>>>import Data.Data.Lens (uniplate)>>>universeOf uniplate (E (O (E (O Z))))[E (O (E (O Z))),E (O Z),Z]
but gplate doesn't see through Odd.
>>>universeOf gplate (E (O (E (O Z))))[E (O (E (O Z)))]
If using Data is not an option, you can still write the traversal manually.
It is sometimes useful to use helper traversals
>>>:{let oddeven :: Traversal' Odd Even oddeven f (O n) = O <$> f n evenplate :: Traversal' Even Even evenplate f Z = pure Z evenplate f (E n) = E <$> oddeven f n :}
>>>universeOf evenplate (E (O (E (O Z))))[E (O (E (O Z))),E (O Z),Z]
gplate1 :: forall {k} (f :: k -> Type) (a :: k). (Generic1 f, GPlated1 f (Rep1 f)) => Traversal' (f a) (f a) Source #
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:
ixk ≡atk.traverse
Minimal complete definition
Provides a simple Traversal lets you traverse the value at a given
key in a Map or element at an ordinal position in a list or Seq.
Minimal complete definition
Nothing
Methods
ix :: Index m -> Traversal' m (IxValue m) Source #
NB: Setting the value of this Traversal 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.
>>>Seq.fromList [a,b,c,d] & ix 2 %~ ffromList [a,b,f c,d]
>>>Seq.fromList [a,b,c,d] & ix 2 .~ efromList [a,b,e,d]
>>>Seq.fromList [a,b,c,d] ^? ix 2Just c
>>>Seq.fromList [] ^? ix 2Nothing
Instances
| Ixed ByteString | |
Defined in Control.Lens.At Methods ix :: Index ByteString -> Traversal' ByteString (IxValue ByteString) Source # | |
| Ixed ByteString | |
Defined in Control.Lens.At Methods ix :: Index ByteString -> Traversal' ByteString (IxValue ByteString) Source # | |
| Ixed IntSet | |
Defined in Control.Lens.At | |
| Ixed Text | |
Defined in Control.Lens.At | |
| Ixed Text | |
Defined in Control.Lens.At | |
| Ixed (IntMap a) | |
Defined in Control.Lens.At | |
| Ixed (Seq a) | |
Defined in Control.Lens.At | |
| Ord k => Ixed (Set k) | |
Defined in Control.Lens.At | |
| Ixed (Tree a) | |
Defined in Control.Lens.At | |
| Ixed (NonEmpty a) | |
Defined in Control.Lens.At | |
| Ixed (Identity a) | |
Defined in Control.Lens.At | |
| Ixed (Plucker a) | |
Defined in Linear.Plucker | |
| Ixed (Quaternion a) | |
Defined in Linear.Quaternion Methods ix :: Index (Quaternion a) -> Traversal' (Quaternion a) (IxValue (Quaternion a)) Source # | |
| Ixed (V0 a) | |
| Ixed (V1 a) | |
| Ixed (V2 a) | |
| Ixed (V3 a) | |
| Ixed (V4 a) | |
| (Eq k, Hashable k) => Ixed (HashSet k) | |
Defined in Control.Lens.At | |
| Ixed (Vector a) | |
Defined in Control.Lens.At | |
| Prim a => Ixed (Vector a) | |
Defined in Control.Lens.At | |
| Storable a => Ixed (Vector a) | |
Defined in Control.Lens.At | |
| Ixed (Vector a) | |
Defined in Control.Lens.At | |
| Unbox a => Ixed (Vector a) | |
Defined in Control.Lens.At | |
| Ixed (Maybe a) | |
Defined in Control.Lens.At | |
| Ixed [a] | |
Defined in Control.Lens.At | |
| (IArray UArray e, Ix i) => Ixed (UArray i e) | arr |
Defined in Control.Lens.At | |
| Ord k => Ixed (Map k a) | |
Defined in Control.Lens.At | |
| Ixed (Style v n) | |
Defined in Diagrams.Core.Style | |
| Ix i => Ixed (Array i e) | arr |
Defined in Control.Lens.At | |
| Ixed (f a) => Ixed (Point f a) | |
Defined in Linear.Affine | |
| (Eq k, Hashable k) => Ixed (HashMap k a) | |
Defined in Control.Lens.At | |
| a ~ a2 => Ixed (a, a2) | |
Defined in Control.Lens.At | |
| Eq e => Ixed (e -> a) | |
Defined in Control.Lens.At | |
| Ixed (V n a) | |
| (a ~ a2, a ~ a3) => Ixed (a, a2, a3) | |
Defined in Control.Lens.At | |
| (a ~ a2, a ~ a3, a ~ a4) => Ixed (a, a2, a3, a4) | |
Defined in Control.Lens.At | |
| (a ~ a2, a ~ a3, a ~ a4, a ~ a5) => Ixed (a, a2, a3, a4, a5) | |
Defined in Control.Lens.At | |
| (a ~ a2, a ~ a3, a ~ a4, a ~ a5, a ~ a6) => Ixed (a, a2, a3, a4, a5, a6) | |
Defined in Control.Lens.At | |
| (a ~ a2, a ~ a3, a ~ a4, a ~ a5, a ~ a6, a ~ a7) => Ixed (a, a2, a3, a4, a5, a6, a7) | |
Defined in Control.Lens.At | |
| (a ~ a2, a ~ a3, a ~ a4, a ~ a5, a ~ a6, a ~ a7, a ~ a8) => Ixed (a, a2, a3, a4, a5, a6, a7, a8) | |
Defined in Control.Lens.At | |
| (a ~ a2, a ~ a3, a ~ a4, a ~ a5, a ~ a6, a ~ a7, a ~ a8, a ~ a9) => Ixed (a, a2, a3, a4, a5, a6, a7, a8, a9) | |
Defined in Control.Lens.At | |
type family IxValue m Source #
Instances
| type IxValue ByteString | |
Defined in Control.Lens.At | |
| type IxValue ByteString | |
Defined in Control.Lens.At | |
| type IxValue IntSet | |
Defined in Control.Lens.At | |
| type IxValue Text | |
Defined in Control.Lens.At | |
| type IxValue Text | |
Defined in Control.Lens.At | |
| type IxValue (IntMap a) | |
Defined in Control.Lens.At | |
| type IxValue (Seq a) | |
Defined in Control.Lens.At | |
| type IxValue (Set k) | |
Defined in Control.Lens.At | |
| type IxValue (Tree a) | |
Defined in Control.Lens.At | |
| type IxValue (NonEmpty a) | |
Defined in Control.Lens.At | |
| type IxValue (Identity a) | |
Defined in Control.Lens.At | |
| type IxValue (Plucker a) | |
Defined in Linear.Plucker | |
| type IxValue (Quaternion a) | |
Defined in Linear.Quaternion | |
| type IxValue (V0 a) | |
| type IxValue (V1 a) | |
| type IxValue (V2 a) | |
| type IxValue (V3 a) | |
| type IxValue (V4 a) | |
| type IxValue (HashSet k) | |
Defined in Control.Lens.At type IxValue (HashSet k) = () | |
| type IxValue (Vector a) | |
Defined in Control.Lens.At type IxValue (Vector a) = a | |
| type IxValue (Vector a) | |
Defined in Control.Lens.At type IxValue (Vector a) = a | |
| type IxValue (Vector a) | |
Defined in Control.Lens.At type IxValue (Vector a) = a | |
| type IxValue (Vector a) | |
Defined in Control.Lens.At type IxValue (Vector a) = a | |
| type IxValue (Vector a) | |
Defined in Control.Lens.At type IxValue (Vector a) = a | |
| type IxValue (Maybe a) | |
Defined in Control.Lens.At | |
| type IxValue [a] | |
Defined in Control.Lens.At type IxValue [a] = a | |
| type IxValue (UArray i e) | |
Defined in Control.Lens.At | |
| type IxValue (Map k a) | |
Defined in Control.Lens.At | |
| type IxValue (Style v n) | |
Defined in Diagrams.Core.Style | |
| type IxValue (Array i e) | |
Defined in Control.Lens.At | |
| type IxValue (Point f a) | |
Defined in Linear.Affine | |
| type IxValue (HashMap k a) | |
Defined in Control.Lens.At type IxValue (HashMap k a) = a | |
| type IxValue (a, a2) |
|
Defined in Control.Lens.At type IxValue (a, a2) = a | |
| type IxValue (e -> a) | |
Defined in Control.Lens.At type IxValue (e -> a) = a | |
| type IxValue (V n a) | |
| type IxValue (a, a2, a3) |
|
Defined in Control.Lens.At type IxValue (a, a2, a3) = a | |
| type IxValue (a, a2, a3, a4) |
|
Defined in Control.Lens.At type IxValue (a, a2, a3, a4) = a | |
| type IxValue (a, a2, a3, a4, a5) |
|
Defined in Control.Lens.At type IxValue (a, a2, a3, a4, a5) = a | |
| type IxValue (a, a2, a3, a4, a5, a6) |
|
Defined in Control.Lens.At type IxValue (a, a2, a3, a4, a5, a6) = a | |
| type IxValue (a, a2, a3, a4, a5, a6, a7) |
|
Defined in Control.Lens.At type IxValue (a, a2, a3, a4, a5, a6, a7) = a | |
| type IxValue (a, a2, a3, a4, a5, a6, a7, a8) |
|
Defined in Control.Lens.At type IxValue (a, a2, a3, a4, a5, a6, a7, a8) = a | |
| type IxValue (a, a2, a3, a4, a5, a6, a7, a8, a9) |
|
Defined in Control.Lens.At type IxValue (a, a2, a3, a4, a5, a6, a7, a8, a9) = a | |
This class provides a simple Lens that lets you view (and modify)
information about whether or not a container contains a given Index.
Minimal complete definition
Instances
| type Index ByteString | |
Defined in Control.Lens.At | |
| type Index ByteString | |
Defined in Control.Lens.At | |
| type Index IntSet | |
Defined in Control.Lens.At | |
| type Index Text | |
Defined in Control.Lens.At | |
| type Index Text | |
Defined in Control.Lens.At | |
| type Index (Complex a) | |
Defined in Control.Lens.At | |
| type Index (IntMap a) | |
Defined in Control.Lens.At | |
| type Index (Seq a) | |
Defined in Control.Lens.At | |
| type Index (Set a) | |
Defined in Control.Lens.At | |
| type Index (Tree a) | |
Defined in Control.Lens.At | |
| type Index (NonEmpty a) | |
Defined in Control.Lens.At | |
| type Index (Identity a) | |
Defined in Control.Lens.At | |
| type Index (Plucker a) | |
Defined in Linear.Plucker | |
| type Index (Quaternion a) | |
Defined in Linear.Quaternion | |
| type Index (V0 a) | |
| type Index (V1 a) | |
| type Index (V2 a) | |
| type Index (V3 a) | |
| type Index (V4 a) | |
| type Index (HashSet a) | |
Defined in Control.Lens.At type Index (HashSet a) = a | |
| type Index (Vector a) | |
Defined in Control.Lens.At | |
| type Index (Vector a) | |
Defined in Control.Lens.At | |
| type Index (Vector a) | |
Defined in Control.Lens.At | |
| type Index (Vector a) | |
Defined in Control.Lens.At | |
| type Index (Vector a) | |
Defined in Control.Lens.At | |
| type Index (Maybe a) | |
Defined in Control.Lens.At | |
| type Index [a] | |
Defined in Control.Lens.At | |
| type Index (UArray i e) | |
Defined in Control.Lens.At | |
| type Index (Map k a) | |
Defined in Control.Lens.At | |
| type Index (Style v n) | |
Defined in Diagrams.Core.Style | |
| type Index (Array i e) | |
Defined in Control.Lens.At | |
| type Index (Point f a) | |
Defined in Linear.Affine | |
| type Index (HashMap k a) | |
Defined in Control.Lens.At type Index (HashMap k a) = k | |
| type Index (a, b) | |
Defined in Control.Lens.At | |
| type Index (e -> a) | |
Defined in Control.Lens.At type Index (e -> a) = e | |
| type Index (V n a) | |
| type Index (a, b, c) | |
Defined in Control.Lens.At | |
| type Index (a, b, c, d) | |
Defined in Control.Lens.At | |
| type Index (a, b, c, d, e) | |
Defined in Control.Lens.At | |
| type Index (a, b, c, d, e, f) | |
Defined in Control.Lens.At | |
| type Index (a, b, c, d, e, f, g) | |
Defined in Control.Lens.At | |
| type Index (a, b, c, d, e, f, g, h) | |
Defined in Control.Lens.At | |
| type Index (a, b, c, d, e, f, g, h, i) | |
Defined in Control.Lens.At | |
icontains :: Contains m => Index m -> IndexedLens' (Index m) m Bool Source #
An indexed version of contains.
>>>IntSet.fromList [1,2,3,4] ^@. icontains 3(3,True)
>>>IntSet.fromList [1,2,3,4] ^@. icontains 5(5,False)
>>>IntSet.fromList [1,2,3,4] & icontains 3 %@~ \i x -> if odd i then not x else xfromList [1,2,4]
>>>IntSet.fromList [1,2,3,4] & icontains 3 %@~ \i x -> if even i then not x else xfromList [1,2,3,4]
iix :: Ixed m => Index m -> IndexedTraversal' (Index m) m (IxValue m) Source #
An indexed version of ix.
>>>Seq.fromList [a,b,c,d] & iix 2 %@~ f'fromList [a,b,f' 2 c,d]
>>>Seq.fromList [a,b,c,d] & iix 2 .@~ hfromList [a,b,h 2,d]
>>>Seq.fromList [a,b,c,d] ^@? iix 2Just (2,c)
>>>Seq.fromList [] ^@? iix 2Nothing
iat :: At m => Index m -> IndexedLens' (Index m) m (Maybe (IxValue m)) Source #
An indexed version of at.
>>>Map.fromList [(1,"world")] ^@. iat 1(1,Just "world")
>>>iat 1 %@~ (\i x -> if odd i then Just "hello" else Nothing) $ Map.emptyfromList [(1,"hello")]
>>>iat 2 %@~ (\i x -> if odd i then Just "hello" else Nothing) $ Map.emptyfromList []
Generate a Prism for each constructor of a data type.
Isos generated when possible.
Reviews are created for constructors with existentially
quantified constructors and GADTs.
e.g.
data FooBarBaz a = Foo Int | Bar a | Baz Int Char makePrisms ''FooBarBaz
will create
_Foo :: Prism' (FooBarBaz a) Int _Bar :: Prism (FooBarBaz a) (FooBarBaz b) a b _Baz :: Prism' (FooBarBaz a) (Int, Char)
Generate a Prism for each constructor of a data type
and combine them into a single class. No Isos are created.
Reviews are created for constructors with existentially
quantified constructors and GADTs.
e.g.
data FooBarBaz a = Foo Int | Bar a | Baz Int Char makeClassyPrisms ''FooBarBaz
will create
class AsFooBarBaz s a | s -> a where _FooBarBaz :: Prism' s (FooBarBaz a) _Foo :: Prism' s Int _Bar :: Prism' s a _Baz :: Prism' s (Int,Char) _Foo = _FooBarBaz . _Foo _Bar = _FooBarBaz . _Bar _Baz = _FooBarBaz . _Baz instance AsFooBarBaz (FooBarBaz a) a
Generate an As class of prisms. Names are selected by prefixing the constructor name with an underscore. Constructors with multiple fields will construct Prisms to tuples of those fields.
In the event that the name of a data type is also the name of one of its
constructors, the name of the Prism generated for the data type will be
prefixed with an extra _ (if the data type name is prefix) or . (if the
name is infix) to disambiguate it from the Prism for the corresponding
constructor. For example, this code:
data Quux = Quux Int | Fred Bool makeClassyPrisms ''Quux
will create:
class AsQuux s where __Quux :: Prism' s Quux -- Data type prism _Quux :: Prism' s Int -- Constructor prism _Fred :: Prism' s Bool _Quux = __Quux . _Quux _Fred = __Quux . _Fred instance AsQuux Quux
type ClassyNamer Source #
Arguments
| = Name | Name of the data type that lenses are being generated for. |
| -> Maybe (Name, Name) | Names of the class and the main method it generates, respectively. |
The optional rule to create a class and method around a monomorphic data type. If this naming convention is provided, it generates a "classy" lens.
Name to give to generated field optics.
Constructors
| TopName Name | Simple top-level definition name |
| MethodName Name Name | makeFields-style class name and method name |
Instances
| Show DefName | |
| Eq DefName | |
| Ord DefName | |
Defined in Control.Lens.Internal.FieldTH | |
type FieldNamer Source #
Arguments
| = Name | Name of the data type that lenses are being generated for. |
| -> [Name] | Names of all fields (including the field being named) in the data type. |
| -> Name | Name of the field being named. |
| -> [DefName] | Name(s) of the lens functions. If empty, no lens is created for that field. |
The rule to create function names of lenses for data fields.
Although it's sometimes useful, you won't need the first two arguments most of the time.
generateSignatures :: Lens' LensRules Bool Source #
Indicate whether or not to supply the signatures for the generated lenses.
Disabling this can be useful if you want to provide a more restricted type signature or if you want to supply hand-written haddocks.
generateLazyPatterns :: Lens' LensRules Bool Source #
Generate optics using lazy pattern matches. This can allow fields of an undefined value to be initialized with lenses:
data Foo = Foo {_x :: Int, _y :: Bool}
deriving Show
makeLensesWith (lensRules & generateLazyPatterns .~ True) ''Foo
> undefined & x .~ 8 & y .~ True
Foo {_x = 8, _y = True}
The downside of this flag is that it can lead to space-leaks and code-size/compile-time increases when generated for large records. By default this flag is turned off, and strict optics are generated.
When using lazy optics the strict optic can be recovered by composing
with $!:
strictOptic = ($!) . lazyOptic
lensClass :: Lens' LensRules ClassyNamer Source #
Lens' to access the option for naming "classy" lenses.
lensRules :: LensRules Source #
Rules for making fairly simple partial lenses, ignoring the special cases
for isomorphisms and traversals, and not making any classes.
It uses underscoreNoPrefixNamer.
underscoreNoPrefixNamer :: FieldNamer Source #
A FieldNamer that strips the _ off of the field name,
lowercases the name, and skips the field if it doesn't start with
an '_'.
Construct a LensRules value for generating top-level definitions
using the given map from field names to definition names.
lookingupNamer :: [(String, String)] -> FieldNamer Source #
Create a FieldNamer from explicit pairings of (fieldName, lensName).
Arguments
| :: (String -> [String]) | A function that maps a |
| -> FieldNamer |
Create a FieldNamer from a mapping function. If the function
returns [], it creates no lens for the field.
classyRules :: LensRules Source #
Rules for making lenses and traversals that precompose another Lens.
classyRules_ :: LensRules Source #
A LensRules used by makeClassy_.
makeLenses :: Name -> DecsQ Source #
Build lenses (and traversals) with a sensible default configuration.
e.g.
data FooBar
= Foo { _x, _y :: Int }
| Bar { _x :: Int }
makeLenses ''FooBar
will create
x ::Lens'FooBarIntx f (Foo a b) = (\a' -> Foo a' b) <$> f a x f (Bar a) = Bar <$> f a y ::Traversal'FooBarInty f (Foo a b) = (\b' -> Foo a b') <$> f b y _ c@(Bar _) = pure c
makeLenses=makeLensesWithlensRules
makeClassy :: Name -> DecsQ Source #
Make lenses and traversals for a type, and create a class when the type has no arguments.
e.g.
data Foo = Foo { _fooX, _fooY :: Int }
makeClassy ''Foo
will create
class HasFoo t where foo ::Lens't Foo fooX ::Lens'tIntfooX = foo . go where go f (Foo x y) = (\x' -> Foo x' y) <$> f x fooY ::Lens'tIntfooY = foo . go where go f (Foo x y) = (\y' -> Foo x y') <$> f y instance HasFoo Foo where foo = id
makeClassy=makeLensesWithclassyRules
makeClassy_ :: Name -> DecsQ Source #
Make lenses and traversals for a type, and create a class when the type
has no arguments. Works the same as makeClassy except that (a) it
expects that record field names do not begin with an underscore, (b) all
record fields are made into lenses, and (c) the resulting lens is prefixed
with an underscore.
makeLensesFor :: [(String, String)] -> Name -> DecsQ Source #
Derive lenses and traversals, specifying explicit pairings
of (fieldName, lensName).
If you map multiple names to the same label, and it is present in the same
constructor then this will generate a Traversal.
e.g.
makeLensesFor[("_foo", "fooLens"), ("baz", "lbaz")] ''FoomakeLensesFor[("_barX", "bar"), ("_barY", "bar")] ''Bar
makeClassyFor :: String -> String -> [(String, String)] -> Name -> DecsQ Source #
Derive lenses and traversals, using a named wrapper class, and
specifying explicit pairings of (fieldName, traversalName).
Example usage:
makeClassyFor "HasFoo" "foo" [("_foo", "fooLens"), ("bar", "lbar")] ''Foo
declareLenses :: DecsQ -> DecsQ Source #
declareLensesFor :: [(String, String)] -> DecsQ -> DecsQ Source #
Similar to makeLensesFor, but takes a declaration quote.
declareClassy :: DecsQ -> DecsQ Source #
For each record in the declaration quote, make lenses and traversals for it, and create a class when the type has no arguments. All record syntax in the input will be stripped off.
e.g.
declareClassy [d|
data Foo = Foo { fooX, fooY :: Int }
deriving Show
|]
will create
data Foo = FooIntIntderivingShowclass HasFoo t where foo ::Lens't Foo instance HasFoo Foo where foo =idfooX, fooY :: HasFoo t =>Lens'tInt
declareClassyFor :: [(String, (String, String))] -> [(String, String)] -> DecsQ -> DecsQ Source #
Similar to makeClassyFor, but takes a declaration quote.
declarePrisms :: DecsQ -> DecsQ Source #
Generate a Prism for each constructor of each data type.
e.g.
declarePrisms [d|
data Exp = Lit Int | Var String | Lambda{ bound::String, body::Exp }
|]
will create
data Exp = Lit Int | Var String | Lambda { bound::String, body::Exp }
_Lit :: Prism' Exp Int
_Var :: Prism' Exp String
_Lambda :: Prism' Exp (String, Exp)
declareFields :: DecsQ -> DecsQ Source #
declareFields =declareLensesWithdefaultFieldRules
declareLensesWith :: LensRules -> DecsQ -> DecsQ Source #
Declare lenses for each records in the given declarations, using the
specified LensRules. Any record syntax in the input will be stripped
off.
makeWrapped :: Name -> DecsQ Source #
Build Wrapped instance for a given newtype
underscoreFields :: LensRules Source #
Field rules for fields in the form _prefix_fieldname
camelCaseFields :: LensRules Source #
Field rules for fields in the form prefixFieldname or _prefixFieldname
If you want all fields to be lensed, then there is no reason to use an _ before the prefix.
If any of the record fields leads with an _ then it is assume a field without an _ should not have a lens created.
Note: The prefix must be the same as the typename (with the first
letter lowercased). This is a change from lens versions before lens 4.5.
If you want the old behaviour, use makeLensesWith abbreviatedFields
camelCaseNamer :: FieldNamer Source #
A FieldNamer for camelCaseFields.
classUnderscoreNoPrefixFields :: LensRules Source #
Field rules for fields in the form _fieldname (the leading
underscore is mandatory).
Note: The primary difference to camelCaseFields is that for
classUnderscoreNoPrefixFields the field names are not expected to
be prefixed with the type name. This might be the desired behaviour
when the DuplicateRecordFields extension is enabled.
classIdFields :: LensRules Source #
Field rules for fields whose names are to be used verbatim, with no prefixes, no underscores, no transformations of any kind.
classIdNamer :: FieldNamer Source #
A FieldNamer for classIdFields.
abbreviatedFields :: LensRules Source #
Field rules fields in the form prefixFieldname or _prefixFieldname
If you want all fields to be lensed, then there is no reason to use an _ before the prefix.
If any of the record fields leads with an _ then it is assume a field without an _ should not have a lens created.
Note that prefix may be any string of characters that are not uppercase
letters. (In particular, it may be arbitrary string of lowercase letters
and numbers) This is the behavior that defaultFieldRules had in lens
4.4 and earlier.
makeFields :: Name -> DecsQ Source #
Generate overloaded field accessors.
e.g
data Foo a = Foo { _fooX :: Int, _fooY :: a }
newtype Bar = Bar { _barX :: Char }
makeFields ''Foo
makeFields ''Bar
will create
_fooXLens :: Lens' (Foo a) Int _fooYLens :: Lens (Foo a) (Foo b) a b class HasX s a | s -> a where x :: Lens' s a instance HasX (Foo a) Int where x = _fooXLens class HasY s a | s -> a where y :: Lens' s a instance HasY (Foo a) a where y = _fooYLens _barXLens :: Iso' Bar Char instance HasX Bar Char where x = _barXLens
For details, see camelCaseFields.
makeFields =makeLensesWithdefaultFieldRules
makeFieldsNoPrefix :: Name -> DecsQ Source #
Generate overloaded field accessors based on field names which
are only prefixed with an underscore (e.g. _name), not
additionally with the type name (e.g. _fooName).
This might be the desired behaviour in case the
DuplicateRecordFields language extension is used in order to get
rid of the necessity to prefix each field name with the type name.
As an example:
data Foo a = Foo { _x :: Int, _y :: a }
newtype Bar = Bar { _x :: Char }
makeFieldsNoPrefix ''Foo
makeFieldsNoPrefix ''Bar
will create classes
class HasX s a | s -> a where x :: Lens' s a class HasY s a | s -> a where y :: Lens' s a
together with instances
instance HasX (Foo a) Int instance HasY (Foo a) a where instance HasX Bar Char where
For details, see classUnderscoreNoPrefixFields.
makeFieldsNoPrefix =makeLensesWithclassUnderscoreNoPrefixFields
makeFieldsId :: Name -> DecsQ Source #
Generate overloaded field accessors, using exactly the same names as the
underlying fields. Intended for use with the NoFieldSelectors and
DuplicateRecordFields language extensions.
As an example:
data Foo a = Foo { x :: Int, y :: a }
newtype Bar = Bar { x :: Char }
makeFieldsId ''Foo
makeFieldsId ''Bar
will create classes
class HasX s a | s -> a where x :: Lens' s a class HasY s a | s -> a where y :: Lens' s a
together with instances
instance HasX (Foo a) Int instance HasY (Foo a) a where instance HasX Bar Char where
makeFieldsId =makeLensesWithclassIdFields
class Functor f => Applicative (f :: Type -> Type) where Source #
A functor with application, providing operations to
A minimal complete definition must include implementations of pure
and of either <*> or liftA2. If it defines both, then they must behave
the same as their default definitions:
(<*>) =liftA2id
liftA2f x y = f<$>x<*>y
Further, any definition must satisfy the following:
- Identity
pureid<*>v = v- Composition
pure(.)<*>u<*>v<*>w = u<*>(v<*>w)- Homomorphism
puref<*>purex =pure(f x)- Interchange
u
<*>purey =pure($y)<*>u
The other methods have the following default definitions, which may be overridden with equivalent specialized implementations:
As a consequence of these laws, the Functor instance for f will satisfy
It may be useful to note that supposing
forall x y. p (q x y) = f x . g y
it follows from the above that
liftA2p (liftA2q u v) =liftA2f u .liftA2g v
If f is also a Monad, it should satisfy
(which implies that pure and <*> satisfy the applicative functor laws).
Methods
Lift a value into the Structure.
Examples
>>>pure 1 :: Maybe IntJust 1
>>>pure 'z' :: [Char]"z"
>>>pure (pure ":D") :: Maybe [String]Just [":D"]
(<*>) :: f (a -> b) -> f a -> f b infixl 4 Source #
Sequential application.
A few functors support an implementation of <*> that is more
efficient than the default one.
Example
Used in combination with , (<$>) can be used to build a record.(<*>)
>>>data MyState = MyState {arg1 :: Foo, arg2 :: Bar, arg3 :: Baz}
>>>produceFoo :: Applicative f => f Foo>>>produceBar :: Applicative f => f Bar>>>produceBaz :: Applicative f => f Baz
>>>mkState :: Applicative f => f MyState>>>mkState = MyState <$> produceFoo <*> produceBar <*> produceBaz
liftA2 :: (a -> b -> c) -> f a -> f b -> f c Source #
Lift a binary function to actions.
Some functors support an implementation of liftA2 that is more
efficient than the default one. In particular, if fmap is an
expensive operation, it is likely better to use liftA2 than to
fmap over the structure and then use <*>.
This became a typeclass method in 4.10.0.0. Prior to that, it was
a function defined in terms of <*> and fmap.
Example
>>>liftA2 (,) (Just 3) (Just 5)Just (3,5)
>>>liftA2 (+) [1, 2, 3] [4, 5, 6][5,6,7,6,7,8,7,8,9]
(*>) :: f a -> f b -> f b infixl 4 Source #
Sequence actions, discarding the value of the first argument.
Examples
If used in conjunction with the Applicative instance for Maybe,
you can chain Maybe computations, with a possible "early return"
in case of Nothing.
>>>Just 2 *> Just 3Just 3
>>>Nothing *> Just 3Nothing
Of course a more interesting use case would be to have effectful computations instead of just returning pure values.
>>>import Data.Char>>>import GHC.Internal.Text.ParserCombinators.ReadP>>>let p = string "my name is " *> munch1 isAlpha <* eof>>>readP_to_S p "my name is Simon"[("Simon","")]
(<*) :: f a -> f b -> f a infixl 4 Source #
Sequence actions, discarding the value of the second argument.
Instances
| Applicative Active | |
| Applicative Duration | |
Defined in Data.Active | |
| Applicative Complex | Since: base-4.9.0.0 |
| Applicative First | Since: base-4.9.0.0 |
| Applicative Last | Since: base-4.9.0.0 |
| Applicative Max | Since: base-4.9.0.0 |
| Applicative Min | Since: base-4.9.0.0 |
| Applicative Put | |
| Applicative Get | |
| Applicative PutM | |
| Applicative RGB | |
| Applicative Seq | Since: containers-0.5.4 |
| Applicative Tree | |
| Applicative Angle Source # | |
| Applicative NonEmpty | Since: base-4.9.0.0 |
Defined in GHC.Internal.Base | |
| Applicative Identity | Since: base-4.8.0.0 |
Defined in GHC.Internal.Data.Functor.Identity | |
| Applicative First | Since: base-4.8.0.0 |
| Applicative Last | Since: base-4.8.0.0 |
| Applicative Down | Since: base-4.11.0.0 |
| Applicative Dual | Since: base-4.8.0.0 |
| Applicative Product | Since: base-4.8.0.0 |
Defined in GHC.Internal.Data.Semigroup.Internal | |
| Applicative Sum | Since: base-4.8.0.0 |
| Applicative ZipList | f <$> ZipList xs1 <*> ... <*> ZipList xsN
= ZipList (zipWithN f xs1 ... xsN)where (\a b c -> stimes c [a, b]) <$> ZipList "abcd" <*> ZipList "567" <*> ZipList [1..]
= ZipList (zipWith3 (\a b c -> stimes c [a, b]) "abcd" "567" [1..])
= ZipList {getZipList = ["a5","b6b6","c7c7c7"]}Since: base-2.1 |
Defined in GHC.Internal.Functor.ZipList | |
| Applicative Par1 | Since: base-4.9.0.0 |
| Applicative P | Since: base-4.5.0.0 |
| Applicative ReadP | Since: base-4.6.0.0 |
Defined in GHC.Internal.Text.ParserCombinators.ReadP | |
| Applicative ReadPrec | Since: base-4.6.0.0 |
Defined in GHC.Internal.Text.ParserCombinators.ReadPrec | |
| Applicative IO | Since: base-2.1 |
| Applicative Interval | |
Defined in Numeric.Interval.Kaucher | |
| Applicative Deque | |
| Applicative Plucker | |
| Applicative Quaternion | |
Defined in Linear.Quaternion Methods pure :: a -> Quaternion a Source # (<*>) :: Quaternion (a -> b) -> Quaternion a -> Quaternion b Source # liftA2 :: (a -> b -> c) -> Quaternion a -> Quaternion b -> Quaternion c Source # (*>) :: Quaternion a -> Quaternion b -> Quaternion b Source # (<*) :: Quaternion a -> Quaternion b -> Quaternion a Source # | |
| Applicative V0 | |
| Applicative V1 | |
| Applicative V2 | |
| Applicative V3 | |
| Applicative V4 | |
| Applicative Chunk | |
| Applicative ComplResult | |
Defined in Options.Applicative.Internal Methods pure :: a -> ComplResult a Source # (<*>) :: ComplResult (a -> b) -> ComplResult a -> ComplResult b Source # liftA2 :: (a -> b -> c) -> ComplResult a -> ComplResult b -> ComplResult c Source # (*>) :: ComplResult a -> ComplResult b -> ComplResult b Source # (<*) :: ComplResult a -> ComplResult b -> ComplResult a Source # | |
| Applicative Completion | |
Defined in Options.Applicative.Internal Methods pure :: a -> Completion a Source # (<*>) :: Completion (a -> b) -> Completion a -> Completion b Source # liftA2 :: (a -> b -> c) -> Completion a -> Completion b -> Completion c Source # (*>) :: Completion a -> Completion b -> Completion b Source # (<*) :: Completion a -> Completion b -> Completion a Source # | |
| Applicative P | |
| Applicative Parser | |
| Applicative ParserM | |
Defined in Options.Applicative.Types | |
| Applicative ParserResult | |
Defined in Options.Applicative.Types Methods pure :: a -> ParserResult a Source # (<*>) :: ParserResult (a -> b) -> ParserResult a -> ParserResult b Source # liftA2 :: (a -> b -> c) -> ParserResult a -> ParserResult b -> ParserResult c Source # (*>) :: ParserResult a -> ParserResult b -> ParserResult b Source # (<*) :: ParserResult a -> ParserResult b -> ParserResult a Source # | |
| Applicative ReadM | |
| Applicative Array | |
| Applicative SmallArray | |
Defined in Data.Primitive.SmallArray Methods pure :: a -> SmallArray a Source # (<*>) :: SmallArray (a -> b) -> SmallArray a -> SmallArray b Source # liftA2 :: (a -> b -> c) -> SmallArray a -> SmallArray b -> SmallArray c Source # (*>) :: SmallArray a -> SmallArray b -> SmallArray b Source # (<*) :: SmallArray a -> SmallArray b -> SmallArray a Source # | |
| Applicative Q | |
| Applicative Vector | |
| Applicative Vector | |
| Applicative Stream | |
Defined in Codec.Compression.Zlib.Stream | |
| Applicative Maybe | Since: base-2.1 |
| Applicative Solo | Since: base-4.15 |
| Applicative [] | Since: base-2.1 |
| Applicative (Fold a) | |
Defined in Codec.Picture.ColorQuant | |
| Representable f => Applicative (Co f) | |
| Monad m => Applicative (WrappedMonad m) | Since: base-2.1 |
Defined in Control.Applicative Methods pure :: a -> WrappedMonad m a Source # (<*>) :: WrappedMonad m (a -> b) -> WrappedMonad m a -> WrappedMonad m b Source # liftA2 :: (a -> b -> c) -> WrappedMonad m a -> WrappedMonad m b -> WrappedMonad m c Source # (*>) :: WrappedMonad m a -> WrappedMonad m b -> WrappedMonad m b Source # (<*) :: WrappedMonad m a -> WrappedMonad m b -> WrappedMonad m a Source # | |
| Applicative (SetM s) | |
| Applicative (Measured n) | |
Defined in Diagrams.Core.Measure Methods pure :: a -> Measured n a Source # (<*>) :: Measured n (a -> b) -> Measured n a -> Measured n b Source # liftA2 :: (a -> b -> c) -> Measured n a -> Measured n b -> Measured n c Source # (*>) :: Measured n a -> Measured n b -> Measured n b Source # (<*) :: Measured n a -> Measured n b -> Measured n a Source # | |
| Monad m => Applicative (CatchT m) | |
Defined in Control.Monad.Catch.Pure | |
| Alternative f => Applicative (Cofree f) | |
Defined in Control.Comonad.Cofree | |
| Functor f => Applicative (Free f) | |
| Arrow a => Applicative (ArrowMonad a) | Since: base-4.6.0.0 |
Defined in GHC.Internal.Control.Arrow Methods pure :: a0 -> ArrowMonad a a0 Source # (<*>) :: ArrowMonad a (a0 -> b) -> ArrowMonad a a0 -> ArrowMonad a b Source # liftA2 :: (a0 -> b -> c) -> ArrowMonad a a0 -> ArrowMonad a b -> ArrowMonad a c Source # (*>) :: ArrowMonad a a0 -> ArrowMonad a b -> ArrowMonad a b Source # (<*) :: ArrowMonad a a0 -> ArrowMonad a b -> ArrowMonad a a0 Source # | |
| Applicative (Either e) | Since: base-3.0 |
Defined in GHC.Internal.Data.Either | |
| Applicative (Proxy :: Type -> Type) | Since: base-4.7.0.0 |
| Applicative (U1 :: Type -> Type) | Since: base-4.9.0.0 |
| Applicative (ST s) | Since: base-4.4.0.0 |
| Applicative f => Applicative (Yoneda f) | |
Defined in Data.Functor.Yoneda | |
| Applicative f => Applicative (Indexing f) | |
Defined in Control.Lens.Internal.Indexed Methods pure :: a -> Indexing f a Source # (<*>) :: Indexing f (a -> b) -> Indexing f a -> Indexing f b Source # liftA2 :: (a -> b -> c) -> Indexing f a -> Indexing f b -> Indexing f c Source # (*>) :: Indexing f a -> Indexing f b -> Indexing f b Source # (<*) :: Indexing f a -> Indexing f b -> Indexing f a Source # | |
| Applicative f => Applicative (Indexing64 f) | |
Defined in Control.Lens.Internal.Indexed Methods pure :: a -> Indexing64 f a Source # (<*>) :: Indexing64 f (a -> b) -> Indexing64 f a -> Indexing64 f b Source # liftA2 :: (a -> b -> c) -> Indexing64 f a -> Indexing64 f b -> Indexing64 f c Source # (*>) :: Indexing64 f a -> Indexing64 f b -> Indexing64 f b Source # (<*) :: Indexing64 f a -> Indexing64 f b -> Indexing64 f a Source # | |
| Applicative (ReifiedFold s) | |
Defined in Control.Lens.Reified Methods pure :: a -> ReifiedFold s a Source # (<*>) :: ReifiedFold s (a -> b) -> ReifiedFold s a -> ReifiedFold s b Source # liftA2 :: (a -> b -> c) -> ReifiedFold s a -> ReifiedFold s b -> ReifiedFold s c Source # (*>) :: ReifiedFold s a -> ReifiedFold s b -> ReifiedFold s b Source # (<*) :: ReifiedFold s a -> ReifiedFold s b -> ReifiedFold s a Source # | |
| Applicative (ReifiedGetter s) | |
Defined in Control.Lens.Reified Methods pure :: a -> ReifiedGetter s a Source # (<*>) :: ReifiedGetter s (a -> b) -> ReifiedGetter s a -> ReifiedGetter s b Source # liftA2 :: (a -> b -> c) -> ReifiedGetter s a -> ReifiedGetter s b -> ReifiedGetter s c Source # (*>) :: ReifiedGetter s a -> ReifiedGetter s b -> ReifiedGetter s b Source # (<*) :: ReifiedGetter s a -> ReifiedGetter s b -> ReifiedGetter s a Source # | |
| Applicative f => Applicative (Point f) | |
| Applicative (Covector r) | |
Defined in Linear.Covector Methods pure :: a -> Covector r a Source # (<*>) :: Covector r (a -> b) -> Covector r a -> Covector r b Source # liftA2 :: (a -> b -> c) -> Covector r a -> Covector r b -> Covector r c Source # (*>) :: Covector r a -> Covector r b -> Covector r b Source # (<*) :: Covector r a -> Covector r b -> Covector r a Source # | |
| Applicative (Inf p) | |
| Monad m => Applicative (ListT m) | |
Defined in Options.Applicative.Internal | |
| Monad m => Applicative (NondetT m) | |
Defined in Options.Applicative.Internal | |
| Apply f => Applicative (MaybeApply f) | |
Defined in Data.Functor.Bind.Class Methods pure :: a -> MaybeApply f a Source # (<*>) :: MaybeApply f (a -> b) -> MaybeApply f a -> MaybeApply f b Source # liftA2 :: (a -> b -> c) -> MaybeApply f a -> MaybeApply f b -> MaybeApply f c Source # (*>) :: MaybeApply f a -> MaybeApply f b -> MaybeApply f b Source # (<*) :: MaybeApply f a -> MaybeApply f b -> MaybeApply f a Source # | |
| Applicative f => Applicative (WrappedApplicative f) | |
Defined in Data.Functor.Bind.Class Methods pure :: a -> WrappedApplicative f a Source # (<*>) :: WrappedApplicative f (a -> b) -> WrappedApplicative f a -> WrappedApplicative f b Source # liftA2 :: (a -> b -> c) -> WrappedApplicative f a -> WrappedApplicative f b -> WrappedApplicative f c Source # (*>) :: WrappedApplicative f a -> WrappedApplicative f b -> WrappedApplicative f b Source # (<*) :: WrappedApplicative f a -> WrappedApplicative f b -> WrappedApplicative f a Source # | |
| Semigroup a => Applicative (These a) | |
Defined in Data.Strict.These | |
| Applicative (IParser t) | |
Defined in Data.Text.Internal.Read | |
| Semigroup a => Applicative (These a) | |
Defined in Data.These | |
| Applicative f => Applicative (Lift f) | A combination is |
| (Functor m, Monad m) => Applicative (MaybeT m) | |
Defined in Control.Monad.Trans.Maybe | |
| Monoid a => Applicative ((,) a) | For tuples, the ("hello ", (+15)) <*> ("world!", 2002)
("hello world!",2017)Since: base-2.1 |
| (Applicative w, Monoid (Rep g), Representable g) => Applicative (StoreT g w) | |
Defined in Control.Comonad.Representable.Store Methods pure :: a -> StoreT g w a Source # (<*>) :: StoreT g w (a -> b) -> StoreT g w a -> StoreT g w b Source # liftA2 :: (a -> b -> c) -> StoreT g w a -> StoreT g w b -> StoreT g w c Source # (*>) :: StoreT g w a -> StoreT g w b -> StoreT g w b Source # (<*) :: StoreT g w a -> StoreT g w b -> StoreT g w a Source # | |
| (Representable f, Applicative m) => Applicative (ReaderT f m) | |
Defined in Control.Monad.Representable.Reader Methods pure :: a -> ReaderT f m a Source # (<*>) :: ReaderT f m (a -> b) -> ReaderT f m a -> ReaderT f m b Source # liftA2 :: (a -> b -> c) -> ReaderT f m a -> ReaderT f m b -> ReaderT f m c Source # (*>) :: ReaderT f m a -> ReaderT f m b -> ReaderT f m b Source # (<*) :: ReaderT f m a -> ReaderT f m b -> ReaderT f m a Source # | |
| (Representable g, Functor m, Monad m) => Applicative (StateT g m) | |
Defined in Control.Monad.Representable.State Methods pure :: a -> StateT g m a Source # (<*>) :: StateT g m (a -> b) -> StateT g m a -> StateT g m b Source # liftA2 :: (a -> b -> c) -> StateT g m a -> StateT g m b -> StateT g m c Source # (*>) :: StateT g m a -> StateT g m b -> StateT g m b Source # (<*) :: StateT g m a -> StateT g m b -> StateT g m a Source # | |
| Arrow a => Applicative (WrappedArrow a b) | Since: base-2.1 |
Defined in Control.Applicative Methods pure :: a0 -> WrappedArrow a b a0 Source # (<*>) :: WrappedArrow a b (a0 -> b0) -> WrappedArrow a b a0 -> WrappedArrow a b b0 Source # liftA2 :: (a0 -> b0 -> c) -> WrappedArrow a b a0 -> WrappedArrow a b b0 -> WrappedArrow a b c Source # (*>) :: WrappedArrow a b a0 -> WrappedArrow a b b0 -> WrappedArrow a b b0 Source # (<*) :: WrappedArrow a b a0 -> WrappedArrow a b b0 -> WrappedArrow a b a0 Source # | |
| Biapplicative p => Applicative (Fix p) | |
| Biapplicative p => Applicative (Join p) | |
| (Applicative f, Monad f) => Applicative (WhenMissing f x) | Equivalent to Since: containers-0.5.9 |
Defined in Data.IntMap.Internal Methods pure :: a -> WhenMissing f x a Source # (<*>) :: WhenMissing f x (a -> b) -> WhenMissing f x a -> WhenMissing f x b Source # liftA2 :: (a -> b -> c) -> WhenMissing f x a -> WhenMissing f x b -> WhenMissing f x c Source # (*>) :: WhenMissing f x a -> WhenMissing f x b -> WhenMissing f x b Source # (<*) :: WhenMissing f x a -> WhenMissing f x b -> WhenMissing f x a Source # | |
| Applicative (Query v n) | |
Defined in Diagrams.Core.Query | |
| (Alternative f, Applicative w) => Applicative (CofreeT f w) | |
Defined in Control.Comonad.Trans.Cofree Methods pure :: a -> CofreeT f w a Source # (<*>) :: CofreeT f w (a -> b) -> CofreeT f w a -> CofreeT f w b Source # liftA2 :: (a -> b -> c) -> CofreeT f w a -> CofreeT f w b -> CofreeT f w c Source # (*>) :: CofreeT f w a -> CofreeT f w b -> CofreeT f w b Source # (<*) :: CofreeT f w a -> CofreeT f w b -> CofreeT f w a Source # | |
| (Functor f, Monad m) => Applicative (FreeT f m) | |
Defined in Control.Monad.Trans.Free | |
| Applicative m => Applicative (Kleisli m a) | Since: base-4.14.0.0 |
Defined in GHC.Internal.Control.Arrow Methods pure :: a0 -> Kleisli m a a0 Source # (<*>) :: Kleisli m a (a0 -> b) -> Kleisli m a a0 -> Kleisli m a b Source # liftA2 :: (a0 -> b -> c) -> Kleisli m a a0 -> Kleisli m a b -> Kleisli m a c Source # (*>) :: Kleisli m a a0 -> Kleisli m a b -> Kleisli m a b Source # (<*) :: Kleisli m a a0 -> Kleisli m a b -> Kleisli m a a0 Source # | |
| Monoid m => Applicative (Const m :: Type -> Type) | Since: base-2.0.1 |
Defined in GHC.Internal.Data.Functor.Const | |
| Applicative f => Applicative (Ap f) | Since: base-4.12.0.0 |
| Applicative f => Applicative (Alt f) | Since: base-4.8.0.0 |
| (Generic1 f, Applicative (Rep1 f)) => Applicative (Generically1 f) | Since: base-4.17.0.0 |
Defined in GHC.Internal.Generics Methods pure :: a -> Generically1 f a Source # (<*>) :: Generically1 f (a -> b) -> Generically1 f a -> Generically1 f b Source # liftA2 :: (a -> b -> c) -> Generically1 f a -> Generically1 f b -> Generically1 f c Source # (*>) :: Generically1 f a -> Generically1 f b -> Generically1 f b Source # (<*) :: Generically1 f a -> Generically1 f b -> Generically1 f a Source # | |
| Applicative f => Applicative (Rec1 f) | Since: base-4.9.0.0 |
| Applicative f => Applicative (Indexing f) | |
Defined in WithIndex Methods pure :: a -> Indexing f a Source # (<*>) :: Indexing f (a -> b) -> Indexing f a -> Indexing f b Source # liftA2 :: (a -> b -> c) -> Indexing f a -> Indexing f b -> Indexing f c Source # (*>) :: Indexing f a -> Indexing f b -> Indexing f b Source # (<*) :: Indexing f a -> Indexing f b -> Indexing f a Source # | |
| (Applicative f, Applicative g) => Applicative (Day f g) | |
Defined in Data.Functor.Day | |
| (Functor g, g ~ h) => Applicative (Curried g h) | |
Defined in Data.Functor.Day.Curried Methods pure :: a -> Curried g h a Source # (<*>) :: Curried g h (a -> b) -> Curried g h a -> Curried g h b Source # liftA2 :: (a -> b -> c) -> Curried g h a -> Curried g h b -> Curried g h c Source # (*>) :: Curried g h a -> Curried g h b -> Curried g h b Source # (<*) :: Curried g h a -> Curried g h b -> Curried g h a Source # | |
| Applicative (Indexed i a) | |
Defined in Control.Lens.Internal.Indexed Methods pure :: a0 -> Indexed i a a0 Source # (<*>) :: Indexed i a (a0 -> b) -> Indexed i a a0 -> Indexed i a b Source # liftA2 :: (a0 -> b -> c) -> Indexed i a a0 -> Indexed i a b -> Indexed i a c Source # (*>) :: Indexed i a a0 -> Indexed i a b -> Indexed i a b Source # (<*) :: Indexed i a a0 -> Indexed i a b -> Indexed i a a0 Source # | |
| Applicative (Flows i b) | This is an illegal |
| Applicative (Mafic a b) | |
Defined in Control.Lens.Internal.Magma Methods pure :: a0 -> Mafic a b a0 Source # (<*>) :: Mafic a b (a0 -> b0) -> Mafic a b a0 -> Mafic a b b0 Source # liftA2 :: (a0 -> b0 -> c) -> Mafic a b a0 -> Mafic a b b0 -> Mafic a b c Source # (*>) :: Mafic a b a0 -> Mafic a b b0 -> Mafic a b b0 Source # (<*) :: Mafic a b a0 -> Mafic a b b0 -> Mafic a b a0 Source # | |
| (Monad m, Monoid r) => Applicative (Effect m r) | |
Defined in Control.Lens.Internal.Zoom Methods pure :: a -> Effect m r a Source # (<*>) :: Effect m r (a -> b) -> Effect m r a -> Effect m r b Source # liftA2 :: (a -> b -> c) -> Effect m r a -> Effect m r b -> Effect m r c Source # (*>) :: Effect m r a -> Effect m r b -> Effect m r b Source # (<*) :: Effect m r a -> Effect m r b -> Effect m r a Source # | |
| (Monad m, Monoid s) => Applicative (Focusing m s) | |
Defined in Control.Lens.Internal.Zoom Methods pure :: a -> Focusing m s a Source # (<*>) :: Focusing m s (a -> b) -> Focusing m s a -> Focusing m s b Source # liftA2 :: (a -> b -> c) -> Focusing m s a -> Focusing m s b -> Focusing m s c Source # (*>) :: Focusing m s a -> Focusing m s b -> Focusing m s b Source # (<*) :: Focusing m s a -> Focusing m s b -> Focusing m s a Source # | |
| Applicative (k (May s)) => Applicative (FocusingMay k s) | |
Defined in Control.Lens.Internal.Zoom Methods pure :: a -> FocusingMay k s a Source # (<*>) :: FocusingMay k s (a -> b) -> FocusingMay k s a -> FocusingMay k s b Source # liftA2 :: (a -> b -> c) -> FocusingMay k s a -> FocusingMay k s b -> FocusingMay k s c Source # (*>) :: FocusingMay k s a -> FocusingMay k s b -> FocusingMay k s b Source # (<*) :: FocusingMay k s a -> FocusingMay k s b -> FocusingMay k s a Source # | |
| Monoid m => Applicative (Holes t m) | |
Defined in Control.Lens.Traversal | |
| Dim n => Applicative (V n) | |
| Applicative (t m) => Applicative (LiftingAccum t m) | Since: mtl-2.3 |
Defined in Control.Monad.Accum Methods pure :: a -> LiftingAccum t m a Source # (<*>) :: LiftingAccum t m (a -> b) -> LiftingAccum t m a -> LiftingAccum t m b Source # liftA2 :: (a -> b -> c) -> LiftingAccum t m a -> LiftingAccum t m b -> LiftingAccum t m c Source # (*>) :: LiftingAccum t m a -> LiftingAccum t m b -> LiftingAccum t m b Source # (<*) :: LiftingAccum t m a -> LiftingAccum t m b -> LiftingAccum t m a Source # | |
| Applicative (t m) => Applicative (LiftingSelect t m) | Since: mtl-2.3 |
Defined in Control.Monad.Select Methods pure :: a -> LiftingSelect t m a Source # (<*>) :: LiftingSelect t m (a -> b) -> LiftingSelect t m a -> LiftingSelect t m b Source # liftA2 :: (a -> b -> c) -> LiftingSelect t m a -> LiftingSelect t m b -> LiftingSelect t m c Source # (*>) :: LiftingSelect t m a -> LiftingSelect t m b -> LiftingSelect t m b Source # (<*) :: LiftingSelect t m a -> LiftingSelect t m b -> LiftingSelect t m a Source # | |
| (Profunctor p, Arrow p) => Applicative (Closure p a) | |
Defined in Data.Profunctor.Closed Methods pure :: a0 -> Closure p a a0 Source # (<*>) :: Closure p a (a0 -> b) -> Closure p a a0 -> Closure p a b Source # liftA2 :: (a0 -> b -> c) -> Closure p a a0 -> Closure p a b -> Closure p a c Source # (*>) :: Closure p a a0 -> Closure p a b -> Closure p a b Source # (<*) :: Closure p a a0 -> Closure p a b -> Closure p a a0 Source # | |
| (Applicative (Rep p), Representable p) => Applicative (Prep p) | |
| (Profunctor p, Arrow p) => Applicative (Tambara p a) | |
Defined in Data.Profunctor.Strong Methods pure :: a0 -> Tambara p a a0 Source # (<*>) :: Tambara p a (a0 -> b) -> Tambara p a a0 -> Tambara p a b Source # liftA2 :: (a0 -> b -> c) -> Tambara p a a0 -> Tambara p a b -> Tambara p a c Source # (*>) :: Tambara p a a0 -> Tambara p a b -> Tambara p a b Source # (<*) :: Tambara p a a0 -> Tambara p a b -> Tambara p a a0 Source # | |
| Applicative (Bazaar a b) | |
Defined in Data.Profunctor.Traversing Methods pure :: a0 -> Bazaar a b a0 Source # (<*>) :: Bazaar a b (a0 -> b0) -> Bazaar a b a0 -> Bazaar a b b0 Source # liftA2 :: (a0 -> b0 -> c) -> Bazaar a b a0 -> Bazaar a b b0 -> Bazaar a b c Source # (*>) :: Bazaar a b a0 -> Bazaar a b b0 -> Bazaar a b b0 Source # (<*) :: Bazaar a b a0 -> Bazaar a b b0 -> Bazaar a b a0 Source # | |
| Applicative (Tagged s) | |
Defined in Data.Tagged | |
| Applicative f => Applicative (Backwards f) | Apply |
Defined in Control.Applicative.Backwards Methods pure :: a -> Backwards f a Source # (<*>) :: Backwards f (a -> b) -> Backwards f a -> Backwards f b Source # liftA2 :: (a -> b -> c) -> Backwards f a -> Backwards f b -> Backwards f c Source # (*>) :: Backwards f a -> Backwards f b -> Backwards f b Source # (<*) :: Backwards f a -> Backwards f b -> Backwards f a Source # | |
| (Monoid w, Functor m, Monad m) => Applicative (AccumT w m) | |
Defined in Control.Monad.Trans.Accum Methods pure :: a -> AccumT w m a Source # (<*>) :: AccumT w m (a -> b) -> AccumT w m a -> AccumT w m b Source # liftA2 :: (a -> b -> c) -> AccumT w m a -> AccumT w m b -> AccumT w m c Source # (*>) :: AccumT w m a -> AccumT w m b -> AccumT w m b Source # (<*) :: AccumT w m a -> AccumT w m b -> AccumT w m a Source # | |
| (Functor m, Monad m) => Applicative (ExceptT e m) | |
Defined in Control.Monad.Trans.Except Methods pure :: a -> ExceptT e m a Source # (<*>) :: ExceptT e m (a -> b) -> ExceptT e m a -> ExceptT e m b Source # liftA2 :: (a -> b -> c) -> ExceptT e m a -> ExceptT e m b -> ExceptT e m c Source # (*>) :: ExceptT e m a -> ExceptT e m b -> ExceptT e m b Source # (<*) :: ExceptT e m a -> ExceptT e m b -> ExceptT e m a Source # | |
| Applicative m => Applicative (IdentityT m) | |
Defined in Control.Monad.Trans.Identity Methods pure :: a -> IdentityT m a Source # (<*>) :: IdentityT m (a -> b) -> IdentityT m a -> IdentityT m b Source # liftA2 :: (a -> b -> c) -> IdentityT m a -> IdentityT m b -> IdentityT m c Source # (*>) :: IdentityT m a -> IdentityT m b -> IdentityT m b Source # (<*) :: IdentityT m a -> IdentityT m b -> IdentityT m a Source # | |
| Applicative m => Applicative (ReaderT r m) | |
Defined in Control.Monad.Trans.Reader Methods pure :: a -> ReaderT r m a Source # (<*>) :: ReaderT r m (a -> b) -> ReaderT r m a -> ReaderT r m b Source # liftA2 :: (a -> b -> c) -> ReaderT r m a -> ReaderT r m b -> ReaderT r m c Source # (*>) :: ReaderT r m a -> ReaderT r m b -> ReaderT r m b Source # (<*) :: ReaderT r m a -> ReaderT r m b -> ReaderT r m a Source # | |
| (Functor m, Monad m) => Applicative (SelectT r m) | |
Defined in Control.Monad.Trans.Select Methods pure :: a -> SelectT r m a Source # (<*>) :: SelectT r m (a -> b) -> SelectT r m a -> SelectT r m b Source # liftA2 :: (a -> b -> c) -> SelectT r m a -> SelectT r m b -> SelectT r m c Source # (*>) :: SelectT r m a -> SelectT r m b -> SelectT r m b Source # (<*) :: SelectT r m a -> SelectT r m b -> SelectT r m a Source # | |
| (Functor m, Monad m) => Applicative (StateT s m) | |
Defined in Control.Monad.Trans.State.Lazy Methods pure :: a -> StateT s m a Source # (<*>) :: StateT s m (a -> b) -> StateT s m a -> StateT s m b Source # liftA2 :: (a -> b -> c) -> StateT s m a -> StateT s m b -> StateT s m c Source # (*>) :: StateT s m a -> StateT s m b -> StateT s m b Source # (<*) :: StateT s m a -> StateT s m b -> StateT s m a Source # | |
| (Functor m, Monad m) => Applicative (StateT s m) | |
Defined in Control.Monad.Trans.State.Strict Methods pure :: a -> StateT s m a Source # (<*>) :: StateT s m (a -> b) -> StateT s m a -> StateT s m b Source # liftA2 :: (a -> b -> c) -> StateT s m a -> StateT s m b -> StateT s m c Source # (*>) :: StateT s m a -> StateT s m b -> StateT s m b Source # (<*) :: StateT s m a -> StateT s m b -> StateT s m a Source # | |
| (Functor m, Monad m) => Applicative (WriterT w m) | |
Defined in Control.Monad.Trans.Writer.CPS Methods pure :: a -> WriterT w m a Source # (<*>) :: WriterT w m (a -> b) -> WriterT w m a -> WriterT w m b Source # liftA2 :: (a -> b -> c) -> WriterT w m a -> WriterT w m b -> WriterT w m c Source # (*>) :: WriterT w m a -> WriterT w m b -> WriterT w m b Source # (<*) :: WriterT w m a -> WriterT w m b -> WriterT w m a Source # | |
| (Monoid w, Applicative m) => Applicative (WriterT w m) | |
Defined in Control.Monad.Trans.Writer.Lazy Methods pure :: a -> WriterT w m a Source # (<*>) :: WriterT w m (a -> b) -> WriterT w m a -> WriterT w m b Source # liftA2 :: (a -> b -> c) -> WriterT w m a -> WriterT w m b -> WriterT w m c Source # (*>) :: WriterT w m a -> WriterT w m b -> WriterT w m b Source # (<*) :: WriterT w m a -> WriterT w m b -> WriterT w m a Source # | |
| (Monoid w, Applicative m) => Applicative (WriterT w m) | |
Defined in Control.Monad.Trans.Writer.Strict Methods pure :: a -> WriterT w m a Source # (<*>) :: WriterT w m (a -> b) -> WriterT w m a -> WriterT w m b Source # liftA2 :: (a -> b -> c) -> WriterT w m a -> WriterT w m b -> WriterT w m c Source # (*>) :: WriterT w m a -> WriterT w m b -> WriterT w m b Source # (<*) :: WriterT w m a -> WriterT w m b -> WriterT w m a Source # | |
| Monoid a => Applicative (Constant a :: Type -> Type) | |
Defined in Data.Functor.Constant Methods pure :: a0 -> Constant a a0 Source # (<*>) :: Constant a (a0 -> b) -> Constant a a0 -> Constant a b Source # liftA2 :: (a0 -> b -> c) -> Constant a a0 -> Constant a b -> Constant a c Source # (*>) :: Constant a a0 -> Constant a b -> Constant a b Source # (<*) :: Constant a a0 -> Constant a b -> Constant a a0 Source # | |
| Applicative f => Applicative (Reverse f) | Derived instance. |
Defined in Data.Functor.Reverse | |
| (Monoid a, Monoid b) => Applicative ((,,) a b) | Since: base-4.14.0.0 |
Defined in GHC.Internal.Base | |
| (Adjunction f g, Monad m) => Applicative (AdjointT f g m) | |
Defined in Control.Monad.Trans.Adjoint Methods pure :: a -> AdjointT f g m a Source # (<*>) :: AdjointT f g m (a -> b) -> AdjointT f g m a -> AdjointT f g m b Source # liftA2 :: (a -> b -> c) -> AdjointT f g m a -> AdjointT f g m b -> AdjointT f g m c Source # (*>) :: AdjointT f g m a -> AdjointT f g m b -> AdjointT f g m b Source # (<*) :: AdjointT f g m a -> AdjointT f g m b -> AdjointT f g m a Source # | |
| (Adjunction f g, Comonad w) => Applicative (AdjointT f g w) | |
Defined in Control.Monad.Trans.Contravariant.Adjoint Methods pure :: a -> AdjointT f g w a Source # (<*>) :: AdjointT f g w (a -> b) -> AdjointT f g w a -> AdjointT f g w b Source # liftA2 :: (a -> b -> c) -> AdjointT f g w a -> AdjointT f g w b -> AdjointT f g w c Source # (*>) :: AdjointT f g w a -> AdjointT f g w b -> AdjointT f g w b Source # (<*) :: AdjointT f g w a -> AdjointT f g w b -> AdjointT f g w a Source # | |
| Comonad w => Applicative (ContsT r w m) | |
Defined in Control.Monad.Trans.Conts Methods pure :: a -> ContsT r w m a Source # (<*>) :: ContsT r w m (a -> b) -> ContsT r w m a -> ContsT r w m b Source # liftA2 :: (a -> b -> c) -> ContsT r w m a -> ContsT r w m b -> ContsT r w m c Source # (*>) :: ContsT r w m a -> ContsT r w m b -> ContsT r w m b Source # (<*) :: ContsT r w m a -> ContsT r w m b -> ContsT r w m a Source # | |
| (Applicative f, Applicative g) => Applicative (Product f g) | Since: base-4.9.0.0 |
Defined in Data.Functor.Product Methods pure :: a -> Product f g a Source # (<*>) :: Product f g (a -> b) -> Product f g a -> Product f g b Source # liftA2 :: (a -> b -> c) -> Product f g a -> Product f g b -> Product f g c Source # (*>) :: Product f g a -> Product f g b -> Product f g b Source # (<*) :: Product f g a -> Product f g b -> Product f g a Source # | |
| Applicative (Cokleisli w a) | |
Defined in Control.Comonad Methods pure :: a0 -> Cokleisli w a a0 Source # (<*>) :: Cokleisli w a (a0 -> b) -> Cokleisli w a a0 -> Cokleisli w a b Source # liftA2 :: (a0 -> b -> c) -> Cokleisli w a a0 -> Cokleisli w a b -> Cokleisli w a c Source # (*>) :: Cokleisli w a a0 -> Cokleisli w a b -> Cokleisli w a b Source # (<*) :: Cokleisli w a a0 -> Cokleisli w a b -> Cokleisli w a a0 Source # | |
| (Monad f, Applicative f) => Applicative (WhenMatched f x y) | Equivalent to Since: containers-0.5.9 |
Defined in Data.IntMap.Internal Methods pure :: a -> WhenMatched f x y a Source # (<*>) :: WhenMatched f x y (a -> b) -> WhenMatched f x y a -> WhenMatched f x y b Source # liftA2 :: (a -> b -> c) -> WhenMatched f x y a -> WhenMatched f x y b -> WhenMatched f x y c Source # (*>) :: WhenMatched f x y a -> WhenMatched f x y b -> WhenMatched f x y b Source # (<*) :: WhenMatched f x y a -> WhenMatched f x y b -> WhenMatched f x y a Source # | |
| (Applicative f, Monad f) => Applicative (WhenMissing f k x) | Equivalent to Since: containers-0.5.9 |
Defined in Data.Map.Internal Methods pure :: a -> WhenMissing f k x a Source # (<*>) :: WhenMissing f k x (a -> b) -> WhenMissing f k x a -> WhenMissing f k x b Source # liftA2 :: (a -> b -> c) -> WhenMissing f k x a -> WhenMissing f k x b -> WhenMissing f k x c Source # (*>) :: WhenMissing f k x a -> WhenMissing f k x b -> WhenMissing f k x b Source # (<*) :: WhenMissing f k x a -> WhenMissing f k x b -> WhenMissing f k x a Source # | |
| (Applicative f, Applicative g) => Applicative (f :*: g) | Since: base-4.9.0.0 |
Defined in GHC.Internal.Generics | |
| Monoid c => Applicative (K1 i c :: Type -> Type) | Since: base-4.12.0.0 |
| Applicative (Bazaar p a b) | |
Defined in Control.Lens.Internal.Bazaar Methods pure :: a0 -> Bazaar p a b a0 Source # (<*>) :: Bazaar p a b (a0 -> b0) -> Bazaar p a b a0 -> Bazaar p a b b0 Source # liftA2 :: (a0 -> b0 -> c) -> Bazaar p a b a0 -> Bazaar p a b b0 -> Bazaar p a b c Source # (*>) :: Bazaar p a b a0 -> Bazaar p a b b0 -> Bazaar p a b b0 Source # (<*) :: Bazaar p a b a0 -> Bazaar p a b b0 -> Bazaar p a b a0 Source # | |
| Applicative (Molten i a b) | |
Defined in Control.Lens.Internal.Magma Methods pure :: a0 -> Molten i a b a0 Source # (<*>) :: Molten i a b (a0 -> b0) -> Molten i a b a0 -> Molten i a b b0 Source # liftA2 :: (a0 -> b0 -> c) -> Molten i a b a0 -> Molten i a b b0 -> Molten i a b c Source # (*>) :: Molten i a b a0 -> Molten i a b b0 -> Molten i a b b0 Source # (<*) :: Molten i a b a0 -> Molten i a b b0 -> Molten i a b a0 Source # | |
| Applicative (k (Err e s)) => Applicative (FocusingErr e k s) | |
Defined in Control.Lens.Internal.Zoom Methods pure :: a -> FocusingErr e k s a Source # (<*>) :: FocusingErr e k s (a -> b) -> FocusingErr e k s a -> FocusingErr e k s b Source # liftA2 :: (a -> b -> c) -> FocusingErr e k s a -> FocusingErr e k s b -> FocusingErr e k s c Source # (*>) :: FocusingErr e k s a -> FocusingErr e k s b -> FocusingErr e k s b Source # (<*) :: FocusingErr e k s a -> FocusingErr e k s b -> FocusingErr e k s a Source # | |
| Applicative (k (f s)) => Applicative (FocusingOn f k s) | |
Defined in Control.Lens.Internal.Zoom Methods pure :: a -> FocusingOn f k s a Source # (<*>) :: FocusingOn f k s (a -> b) -> FocusingOn f k s a -> FocusingOn f k s b Source # liftA2 :: (a -> b -> c) -> FocusingOn f k s a -> FocusingOn f k s b -> FocusingOn f k s c Source # (*>) :: FocusingOn f k s a -> FocusingOn f k s b -> FocusingOn f k s b Source # (<*) :: FocusingOn f k s a -> FocusingOn f k s b -> FocusingOn f k s a Source # | |
| Applicative (k (s, w)) => Applicative (FocusingPlus w k s) | |
Defined in Control.Lens.Internal.Zoom Methods pure :: a -> FocusingPlus w k s a Source # (<*>) :: FocusingPlus w k s (a -> b) -> FocusingPlus w k s a -> FocusingPlus w k s b Source # liftA2 :: (a -> b -> c) -> FocusingPlus w k s a -> FocusingPlus w k s b -> FocusingPlus w k s c Source # (*>) :: FocusingPlus w k s a -> FocusingPlus w k s b -> FocusingPlus w k s b Source # (<*) :: FocusingPlus w k s a -> FocusingPlus w k s b -> FocusingPlus w k s a Source # | |
| (Monad m, Monoid s, Monoid w) => Applicative (FocusingWith w m s) | |
Defined in Control.Lens.Internal.Zoom Methods pure :: a -> FocusingWith w m s a Source # (<*>) :: FocusingWith w m s (a -> b) -> FocusingWith w m s a -> FocusingWith w m s b Source # liftA2 :: (a -> b -> c) -> FocusingWith w m s a -> FocusingWith w m s b -> FocusingWith w m s c Source # (*>) :: FocusingWith w m s a -> FocusingWith w m s b -> FocusingWith w m s b Source # (<*) :: FocusingWith w m s a -> FocusingWith w m s b -> FocusingWith w m s a Source # | |
| Applicative (Costar f a) | |
Defined in Data.Profunctor.Types Methods pure :: a0 -> Costar f a a0 Source # (<*>) :: Costar f a (a0 -> b) -> Costar f a a0 -> Costar f a b Source # liftA2 :: (a0 -> b -> c) -> Costar f a a0 -> Costar f a b -> Costar f a c Source # (*>) :: Costar f a a0 -> Costar f a b -> Costar f a b Source # (<*) :: Costar f a a0 -> Costar f a b -> Costar f a a0 Source # | |
| Applicative f => Applicative (Star f a) | |
Defined in Data.Profunctor.Types | |
| Applicative (ContT r m) | |
Defined in Control.Monad.Trans.Cont | |
| (Monoid a, Monoid b, Monoid c) => Applicative ((,,,) a b c) | Since: base-4.14.0.0 |
Defined in GHC.Internal.Base Methods pure :: a0 -> (a, b, c, a0) Source # (<*>) :: (a, b, c, a0 -> b0) -> (a, b, c, a0) -> (a, b, c, b0) Source # liftA2 :: (a0 -> b0 -> c0) -> (a, b, c, a0) -> (a, b, c, b0) -> (a, b, c, c0) Source # (*>) :: (a, b, c, a0) -> (a, b, c, b0) -> (a, b, c, b0) Source # (<*) :: (a, b, c, a0) -> (a, b, c, b0) -> (a, b, c, a0) Source # | |
| Applicative ((->) r) | Since: base-2.1 |
| (Applicative f, Applicative g) => Applicative (Compose f g) | Since: base-4.9.0.0 |
Defined in Data.Functor.Compose Methods pure :: a -> Compose f g a Source # (<*>) :: Compose f g (a -> b) -> Compose f g a -> Compose f g b Source # liftA2 :: (a -> b -> c) -> Compose f g a -> Compose f g b -> Compose f g c Source # (*>) :: Compose f g a -> Compose f g b -> Compose f g b Source # (<*) :: Compose f g a -> Compose f g b -> Compose f g a Source # | |
| (Monad f, Applicative f) => Applicative (WhenMatched f k x y) | Equivalent to Since: containers-0.5.9 |
Defined in Data.Map.Internal Methods pure :: a -> WhenMatched f k x y a Source # (<*>) :: WhenMatched f k x y (a -> b) -> WhenMatched f k x y a -> WhenMatched f k x y b Source # liftA2 :: (a -> b -> c) -> WhenMatched f k x y a -> WhenMatched f k x y b -> WhenMatched f k x y c Source # (*>) :: WhenMatched f k x y a -> WhenMatched f k x y b -> WhenMatched f k x y b Source # (<*) :: WhenMatched f k x y a -> WhenMatched f k x y b -> WhenMatched f k x y a Source # | |
| (Applicative f, Applicative g) => Applicative (f :.: g) | Since: base-4.9.0.0 |
Defined in GHC.Internal.Generics | |
| Applicative f => Applicative (M1 i c f) | Since: base-4.9.0.0 |
Defined in GHC.Internal.Generics | |
| Applicative (BazaarT p g a b) | |
Defined in Control.Lens.Internal.Bazaar Methods pure :: a0 -> BazaarT p g a b a0 Source # (<*>) :: BazaarT p g a b (a0 -> b0) -> BazaarT p g a b a0 -> BazaarT p g a b b0 Source # liftA2 :: (a0 -> b0 -> c) -> BazaarT p g a b a0 -> BazaarT p g a b b0 -> BazaarT p g a b c Source # (*>) :: BazaarT p g a b a0 -> BazaarT p g a b b0 -> BazaarT p g a b b0 Source # (<*) :: BazaarT p g a b a0 -> BazaarT p g a b b0 -> BazaarT p g a b a0 Source # | |
| Applicative (TakingWhile p f a b) | |
Defined in Control.Lens.Internal.Magma Methods pure :: a0 -> TakingWhile p f a b a0 Source # (<*>) :: TakingWhile p f a b (a0 -> b0) -> TakingWhile p f a b a0 -> TakingWhile p f a b b0 Source # liftA2 :: (a0 -> b0 -> c) -> TakingWhile p f a b a0 -> TakingWhile p f a b b0 -> TakingWhile p f a b c Source # (*>) :: TakingWhile p f a b a0 -> TakingWhile p f a b b0 -> TakingWhile p f a b b0 Source # (<*) :: TakingWhile p f a b a0 -> TakingWhile p f a b b0 -> TakingWhile p f a b a0 Source # | |
| (Monoid s, Monoid w, Monad m) => Applicative (EffectRWS w st m s) | |
Defined in Control.Lens.Internal.Zoom Methods pure :: a -> EffectRWS w st m s a Source # (<*>) :: EffectRWS w st m s (a -> b) -> EffectRWS w st m s a -> EffectRWS w st m s b Source # liftA2 :: (a -> b -> c) -> EffectRWS w st m s a -> EffectRWS w st m s b -> EffectRWS w st m s c Source # (*>) :: EffectRWS w st m s a -> EffectRWS w st m s b -> EffectRWS w st m s b Source # (<*) :: EffectRWS w st m s a -> EffectRWS w st m s b -> EffectRWS w st m s a Source # | |
| Applicative (k (Freed f m s)) => Applicative (FocusingFree f m k s) | |
Defined in Control.Lens.Internal.Zoom Methods pure :: a -> FocusingFree f m k s a Source # (<*>) :: FocusingFree f m k s (a -> b) -> FocusingFree f m k s a -> FocusingFree f m k s b Source # liftA2 :: (a -> b -> c) -> FocusingFree f m k s a -> FocusingFree f m k s b -> FocusingFree f m k s c Source # (*>) :: FocusingFree f m k s a -> FocusingFree f m k s b -> FocusingFree f m k s b Source # (<*) :: FocusingFree f m k s a -> FocusingFree f m k s b -> FocusingFree f m k s a Source # | |
| Reifies s (ReifiedApplicative f) => Applicative (ReflectedApplicative f s) | |
Defined in Data.Reflection Methods pure :: a -> ReflectedApplicative f s a Source # (<*>) :: ReflectedApplicative f s (a -> b) -> ReflectedApplicative f s a -> ReflectedApplicative f s b Source # liftA2 :: (a -> b -> c) -> ReflectedApplicative f s a -> ReflectedApplicative f s b -> ReflectedApplicative f s c Source # (*>) :: ReflectedApplicative f s a -> ReflectedApplicative f s b -> ReflectedApplicative f s b Source # (<*) :: ReflectedApplicative f s a -> ReflectedApplicative f s b -> ReflectedApplicative f s a Source # | |
| (Functor m, Monad m) => Applicative (RWST r w s m) | |
Defined in Control.Monad.Trans.RWS.CPS Methods pure :: a -> RWST r w s m a Source # (<*>) :: RWST r w s m (a -> b) -> RWST r w s m a -> RWST r w s m b Source # liftA2 :: (a -> b -> c) -> RWST r w s m a -> RWST r w s m b -> RWST r w s m c Source # (*>) :: RWST r w s m a -> RWST r w s m b -> RWST r w s m b Source # (<*) :: RWST r w s m a -> RWST r w s m b -> RWST r w s m a Source # | |
| (Monoid w, Functor m, Monad m) => Applicative (RWST r w s m) | |
Defined in Control.Monad.Trans.RWS.Lazy Methods pure :: a -> RWST r w s m a Source # (<*>) :: RWST r w s m (a -> b) -> RWST r w s m a -> RWST r w s m b Source # liftA2 :: (a -> b -> c) -> RWST r w s m a -> RWST r w s m b -> RWST r w s m c Source # (*>) :: RWST r w s m a -> RWST r w s m b -> RWST r w s m b Source # (<*) :: RWST r w s m a -> RWST r w s m b -> RWST r w s m a Source # | |
| (Monoid w, Functor m, Monad m) => Applicative (RWST r w s m) | |
Defined in Control.Monad.Trans.RWS.Strict Methods pure :: a -> RWST r w s m a Source # (<*>) :: RWST r w s m (a -> b) -> RWST r w s m a -> RWST r w s m b Source # liftA2 :: (a -> b -> c) -> RWST r w s m a -> RWST r w s m b -> RWST r w s m c Source # (*>) :: RWST r w s m a -> RWST r w s m b -> RWST r w s m b Source # (<*) :: RWST r w s m a -> RWST r w s m b -> RWST r w s m a Source # | |
(*>) :: Applicative f => f a -> f b -> f b infixl 4 Source #
Sequence actions, discarding the value of the first argument.
Examples
If used in conjunction with the Applicative instance for Maybe,
you can chain Maybe computations, with a possible "early return"
in case of Nothing.
>>>Just 2 *> Just 3Just 3
>>>Nothing *> Just 3Nothing
Of course a more interesting use case would be to have effectful computations instead of just returning pure values.
>>>import Data.Char>>>import GHC.Internal.Text.ParserCombinators.ReadP>>>let p = string "my name is " *> munch1 isAlpha <* eof>>>readP_to_S p "my name is Simon"[("Simon","")]
(<*) :: Applicative f => f a -> f b -> f a infixl 4 Source #
Sequence actions, discarding the value of the second argument.
(<$>) :: Functor f => (a -> b) -> f a -> f b infixl 4 Source #
An infix synonym for fmap.
The name of this operator is an allusion to $.
Note the similarities between their types:
($) :: (a -> b) -> a -> b (<$>) :: Functor f => (a -> b) -> f a -> f b
Whereas $ is function application, <$> is function
application lifted over a Functor.
Examples
Convert from a to a Maybe Int using Maybe
Stringshow:
>>>show <$> NothingNothing
>>>show <$> Just 3Just "3"
Convert from an to an
Either Int IntEither IntString using show:
>>>show <$> Left 17Left 17
>>>show <$> Right 17Right "17"
Double each element of a list:
>>>(*2) <$> [1,2,3][2,4,6]
Apply even to the second element of a pair:
>>>even <$> (2,2)(2,True)
liftA :: Applicative f => (a -> b) -> f a -> f b Source #
Lift a function to actions.
Equivalent to Functor's fmap but implemented using only Applicative's methods:
liftA f a = pure f <*> a
As such this function may be used to implement a Functor instance from an Applicative one.
Examples
Using the Applicative instance for Lists:
>>>liftA (+1) [1, 2][2,3]
Or the Applicative instance for Maybe
>>>liftA (+1) (Just 3)Just 4
liftA2 :: Applicative f => (a -> b -> c) -> f a -> f b -> f c Source #
Lift a binary function to actions.
Some functors support an implementation of liftA2 that is more
efficient than the default one. In particular, if fmap is an
expensive operation, it is likely better to use liftA2 than to
fmap over the structure and then use <*>.
This became a typeclass method in 4.10.0.0. Prior to that, it was
a function defined in terms of <*> and fmap.
Example
>>>liftA2 (,) (Just 3) (Just 5)Just (3,5)
>>>liftA2 (+) [1, 2, 3] [4, 5, 6][5,6,7,6,7,8,7,8,9]
liftA3 :: Applicative f => (a -> b -> c -> d) -> f a -> f b -> f c -> f d Source #
Lift a ternary function to actions.