optics-core-0.3.0.1: Optics as an abstract interface: core definitions

Safe HaskellNone
LanguageHaskell2010

Optics.Internal.Utils

Description

This module is intended for internal use only, and may change without warning in subsequent releases.

Synopsis

Documentation

data Identity' a Source #

Constructors

Identity' !() a 
Instances
Functor Identity' Source # 
Instance details

Defined in Optics.Internal.Utils

Methods

fmap :: (a -> b) -> Identity' a -> Identity' b #

(<$) :: a -> Identity' b -> Identity' a #

Applicative Identity' Source # 
Instance details

Defined in Optics.Internal.Utils

Methods

pure :: a -> Identity' a #

(<*>) :: Identity' (a -> b) -> Identity' a -> Identity' b #

liftA2 :: (a -> b -> c) -> Identity' a -> Identity' b -> Identity' c #

(*>) :: Identity' a -> Identity' b -> Identity' b #

(<*) :: Identity' a -> Identity' b -> Identity' a #

Mapping (Star Identity') Source # 
Instance details

Defined in Optics.Internal.Utils

Methods

roam :: ((a -> b) -> s -> t) -> Star Identity' i a b -> Star Identity' i s t #

iroam :: ((i -> a -> b) -> s -> t) -> Star Identity' j a b -> Star Identity' (i -> j) s t #

Mapping (IxStar Identity') Source # 
Instance details

Defined in Optics.Internal.Utils

Methods

roam :: ((a -> b) -> s -> t) -> IxStar Identity' i a b -> IxStar Identity' i s t #

iroam :: ((i -> a -> b) -> s -> t) -> IxStar Identity' j a b -> IxStar Identity' (i -> j) s t #

wrapIdentity' :: a -> Identity' a Source #

Mark a value for evaluation to whnf.

This allows us to, when applying a setter to a structure, evaluate only the parts that we modify. If an optic focuses on multiple targets, Applicative instance of Identity' makes sure that we force evaluation of all of them, but we leave anything else alone.

newtype Traversed f a Source #

Helper for traverseOf_ and the like for better efficiency than the foldr-based version.

Note that the argument a of the result should not be used.

Constructors

Traversed (f a) 
Instances
Applicative f => Semigroup (Traversed f a) Source # 
Instance details

Defined in Optics.Internal.Utils

Methods

(<>) :: Traversed f a -> Traversed f a -> Traversed f a #

sconcat :: NonEmpty (Traversed f a) -> Traversed f a #

stimes :: Integral b => b -> Traversed f a -> Traversed f a #

Applicative f => Monoid (Traversed f a) Source # 
Instance details

Defined in Optics.Internal.Utils

Methods

mempty :: Traversed f a #

mappend :: Traversed f a -> Traversed f a -> Traversed f a #

mconcat :: [Traversed f a] -> Traversed f a #

runTraversed :: Functor f => Traversed f a -> f () Source #

data OrT f a Source #

Helper for failing family to visit the first fold only once.

Constructors

OrT !Bool (f a) 
Instances
Functor f => Functor (OrT f) Source # 
Instance details

Defined in Optics.Internal.Utils

Methods

fmap :: (a -> b) -> OrT f a -> OrT f b #

(<$) :: a -> OrT f b -> OrT f a #

Applicative f => Applicative (OrT f) Source # 
Instance details

Defined in Optics.Internal.Utils

Methods

pure :: a -> OrT f a #

(<*>) :: OrT f (a -> b) -> OrT f a -> OrT f b #

liftA2 :: (a -> b -> c) -> OrT f a -> OrT f b -> OrT f c #

(*>) :: OrT f a -> OrT f b -> OrT f b #

(<*) :: OrT f a -> OrT f b -> OrT f a #

wrapOrT :: f a -> OrT f a Source #

Wrap the applicative action in OrT so that we know later that it was executed.

(#.) :: Coercible b c => (b -> c) -> (a -> b) -> a -> c infixr 9 #

Composition operator where the first argument must be an identity function up to representational equivalence (e.g. a newtype wrapper or unwrapper), and will be ignored at runtime.

(.#) :: Coercible a b => (b -> c) -> (a -> b) -> a -> c infixl 8 #

Composition operator where the second argument must be an identity function up to representational equivalence (e.g. a newtype wrapper or unwrapper), and will be ignored at runtime.

uncurry' :: (a -> b -> c) -> (a, b) -> c Source #

uncurry with no lazy pattern matching for more efficient code.

Since: 0.3