Portability | GHC only |
---|---|

Maintainer | Simon Meier <iridcode@gmail.com> |

Safe Haskell | Safe-Infered |

Extensions to the first-class labels (fclabels) package.

- nthL :: Int -> [a] :-> a
- imageL :: Ord k => k -> Map k v :-> v
- fstL :: (a, b) :-> a
- sndL :: (a, b) :-> b
- module Data.Label
- liftLA :: Applicative f => (a :-> b) -> f a :-> f b
- modA :: Applicative f => (a :-> b) -> (b -> f b) -> a -> f a
- askM :: MonadReader r m => (r :-> a) -> m a
- setM :: MonadState s m => (s :-> a) -> a -> m ()
- getM :: MonadState s m => (s :-> a) -> m a
- modM :: MonadState s m => (s :-> a) -> (a -> a) -> m ()
- (=:) :: MonadState s m => :-> s a -> a -> m ()

# Documentation

module Data.Label

# Labels and applicative functors

liftLA :: Applicative f => (a :-> b) -> f a :-> f bSource

Lift a label into an applicative functor.

modA :: Applicative f => (a :-> b) -> (b -> f b) -> a -> f aSource

Effectful modification of a labeled value.

# Labels and Monads

askM :: MonadReader r m => (r :-> a) -> m aSource

Get part of the state from a reader.

setM :: MonadState s m => (s :-> a) -> a -> m ()Source

Set some part of the state.

getM :: MonadState s m => (s :-> a) -> m aSource

Get some part of the state.

modM :: MonadState s m => (s :-> a) -> (a -> a) -> m ()Source

Modify some part of the state.

(=:) :: MonadState s m => :-> s a -> a -> m ()

Alias for `puts`

that reads like an assignment.