Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- (&) :: a -> (a -> b) -> b
- (%) :: (Additive - Semigroup) i => Representable p => IndexedOptic p i b1 b2 a1 a2 -> IndexedOptic p i c1 c2 b1 b2 -> IndexedOptic p i c1 c2 a1 a2
- (#) :: (Additive - Semigroup) k => Corepresentable p => CoindexedOptic p k b1 b2 a1 a2 -> CoindexedOptic p k c1 c2 b1 b2 -> CoindexedOptic p k c1 c2 a1 a2
- (^.) :: s -> AView s a -> a
- (^%) :: (Additive - Monoid) i => s -> AIxview i s a -> (Maybe i, a)
- (#^) :: AReview t b -> b -> t
- (..~) :: Optic (->) s t a b -> (a -> b) -> s -> t
- (.~) :: Optic (->) s t a b -> b -> s -> t
- (%%~) :: (Additive - Monoid) i => AIxsetter i s t a b -> (i -> a -> b) -> s -> t
- (%~) :: (Additive - Monoid) i => AIxsetter i s t a b -> (i -> b) -> s -> t
- (##~) :: (Additive - Monoid) k => ACxsetter k s t a b -> (k -> a -> b) -> s -> t
- (#~) :: (Additive - Monoid) k => ACxsetter k s t a b -> (k -> b) -> s -> t
Documentation
(%) :: (Additive - Semigroup) i => Representable p => IndexedOptic p i b1 b2 a1 a2 -> IndexedOptic p i c1 c2 b1 b2 -> IndexedOptic p i c1 c2 a1 a2 infixr 8 Source #
(#) :: (Additive - Semigroup) k => Corepresentable p => CoindexedOptic p k b1 b2 a1 a2 -> CoindexedOptic p k c1 c2 b1 b2 -> CoindexedOptic p k c1 c2 a1 a2 infixr 8 Source #
Compose two coindexed traversals, combining indices.
Its precedence is one lower than that of function composition, which allows . to be nested in #.
If you only need the final index then use ..
(^.) :: s -> AView s a -> a infixl 8 Source #
View the focus of an optic.
Fixity and semantics are such that subsequent field accesses can be
performed with (.
).
>>>
("hello","world") ^. second'
"world"
>>>
5 ^. to succ
6
>>>
import Data.Complex
>>>
((0, 1 :+ 2), 3) ^. first' . second' . to magnitude
2.23606797749979
(^%) :: (Additive - Monoid) i => s -> AIxview i s a -> (Maybe i, a) infixl 8 Source #
View the focus of an indexed optic along with its index.
>>>
("foo", 42) ^% ifirst
(Just (),"foo")
(..~) :: Optic (->) s t a b -> (a -> b) -> s -> t infixr 4 Source #
Map over an optic.
>>>
Just 1 & just ..~ (+1)
Just 2
>>>
Nothing & just ..~ (+1)
Nothing
>>>
[1,2,3] & fmapped ..~ (*10)
[10,20,30]
>>>
(1,2) & first' ..~ (+1)
(2,2)
>>>
(10,20) & first' ..~ show
("10",20)
(.~) :: Optic (->) s t a b -> b -> s -> t infixr 4 Source #
Set all referenced fields to the given value.
(%%~) :: (Additive - Monoid) i => AIxsetter i s t a b -> (i -> a -> b) -> s -> t infixr 4 Source #
Map over an indexed optic.
See also ##~
.