Safe Haskell | None |
---|---|
Language | Haskell2010 |
Minimal redefine + re-export of a lens package, fclabels
- type (:->) f o = Lens Total f o
- type Lens a b = a :-> b
- (^*) :: (a :-> b) -> (b :-> c) -> a :-> c
- (^.) :: a -> (a :-> b) -> b
- (^=) :: (a :-> b) -> b -> a -> a
- (^$=) :: (a :-> b) -> (b -> b) -> a -> a
- getL :: (f :-> a) -> f -> a
- (=.) :: MonadState f m => Lens ((->) LiftedRep LiftedRep) f o -> (o -> o) -> m ()
- (=:) :: MonadState f m => Lens ((->) LiftedRep LiftedRep) f o -> o -> m ()
- (=$:) :: MonadState f m => (f :-> o) -> (o -> o) -> m ()
- modifyAndGet :: MonadState f m => Lens ((->) LiftedRep LiftedRep) f o -> (o -> (a, o)) -> m a
- (=$^:) :: MonadState f m => (f :-> o) -> (o -> (a, o)) -> m a
- modL :: MonadState f m => (f :-> o) -> (o -> (a, o)) -> m a
- getl :: MonadState f m => (f :-> o) -> m o
- focus :: (MonadState a m, MonadState b m) => (a :-> b) -> m c -> m c
- mkLabel :: Name -> Q [Dec]
- fstl :: ArrowApply arr => Lens arr ((a, b) -> (o, b)) (a -> o)
- sndl :: ArrowApply arr => Lens arr ((a, b) -> (a, o)) (b -> o)
- fst3l :: ArrowApply arr => Lens arr ((a, b, c) -> (o, b, c)) (a -> o)
- snd3l :: ArrowApply arr => Lens arr ((a, b, c) -> (a, o, c)) (b -> o)
- trd3l :: ArrowApply arr => Lens arr ((a, b, c) -> (a, b, o)) (c -> o)
- isoMb :: String -> (f :-> Maybe o) -> f :-> o
- isoMbWithDefault :: o -> (f :-> Maybe o) -> f :-> o
Documentation
Access
(^=) :: (a :-> b) -> b -> a -> a infixr 4 Source #
functional setter, which acts like a field assigner
(=.) :: MonadState f m => Lens ((->) LiftedRep LiftedRep) f o -> (o -> o) -> m () infixr 2 #
Alias for modify
that reads more or less like an assignment.
(=:) :: MonadState f m => Lens ((->) LiftedRep LiftedRep) f o -> o -> m () infixr 2 #
Alias for puts
that reads like an assignment.
(=$:) :: MonadState f m => (f :-> o) -> (o -> o) -> m () infixr 4 Source #
monadic modify & set
modifyAndGet :: MonadState f m => Lens ((->) LiftedRep LiftedRep) f o -> (o -> (a, o)) -> m a #
Modify a value with a function somewhere in the state, pointed to by the specified lens. Additionally return a separate value based on the modification.
(=$^:) :: MonadState f m => (f :-> o) -> (o -> (a, o)) -> m a infixr 4 Source #
monadic modify & set & get
modL :: MonadState f m => (f :-> o) -> (o -> (a, o)) -> m a Source #
monadic modify & set & get
getl :: MonadState f m => (f :-> o) -> m o Source #
Alias for gets
avoiding conflict with MonadState
Misc
focus :: (MonadState a m, MonadState b m) => (a :-> b) -> m c -> m c Source #
Zoom state in on substructure. This regretfully does not really work, because of MonadState fundep.
Derive labels including type signatures for all the record selectors in a single datatype. The types will be polymorphic and can be used in an arbitrary context.
Tuple accessors
fstl :: ArrowApply arr => Lens arr ((a, b) -> (o, b)) (a -> o) Source #
sndl :: ArrowApply arr => Lens arr ((a, b) -> (a, o)) (b -> o) Source #
fst3l :: ArrowApply arr => Lens arr ((a, b, c) -> (o, b, c)) (a -> o) Source #
snd3l :: ArrowApply arr => Lens arr ((a, b, c) -> (a, o, c)) (b -> o) Source #
trd3l :: ArrowApply arr => Lens arr ((a, b, c) -> (a, b, o)) (c -> o) Source #