| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
Data.Optics.Operators
Synopsis
- (+=) :: (Is k A_Setter, MonadState s m, Num a) => Optic' k is s a -> a -> m ()
- (-=) :: (Is k A_Setter, MonadState s m, Num a) => Optic' k is s a -> a -> m ()
- (*=) :: (Is k A_Setter, MonadState s m, Num a) => Optic' k is s a -> a -> m ()
- (//=) :: (Is k A_Setter, MonadState s m, Fractional a) => Optic' k is s a -> a -> m ()
Documentation
(+=) :: (Is k A_Setter, MonadState s m, Num a) => Optic' k is s a -> a -> m () infixr 4 Source #
Modify the target of the optic by adding a value.
data Person = Person { age :: Int } deriving (Generic)
f :: MonadState Person m => m ()
f = #age += 1
(-=) :: (Is k A_Setter, MonadState s m, Num a) => Optic' k is s a -> a -> m () infixr 4 Source #
Modify the target of the optic by subtracting a value.
data Person = Person { age :: Int } deriving (Generic)
f :: MonadState Person m => m ()
f = #age -= 1
(*=) :: (Is k A_Setter, MonadState s m, Num a) => Optic' k is s a -> a -> m () infixr 4 Source #
Modify the target of the optic by multiplying a value.
data Person = Person { age :: Int } deriving (Generic)
f :: MonadState Person m => m ()
f = #age *= 1
(//=) :: (Is k A_Setter, MonadState s m, Fractional a) => Optic' k is s a -> a -> m () infixr 4 Source #
Modify the target of the optic by dividing a value.
data Person = Person { age :: Int } deriving (Generic)
f :: MonadState Person m => m ()
f = #age //= 1