Copyright | (c) 2017 Michael Walker |
---|---|
License | MIT |
Maintainer | Michael Walker <mike@barrucadu.co.uk> |
Stability | experimental |
Portability | CPP, ImpredicativeTypes |
Safe Haskell | Safe |
Language | Haskell2010 |
Types and functions for dealing with optics without depending on the lens library.
This module is NOT considered to form part of the public interface of this library.
- type Lens s t a b = forall f. Functor f => (a -> f b) -> s -> f t
- type Lens' s a = Lens s s a a
- type Getter s a = forall f. (Contravariant f, Functor f) => (a -> f a) -> s -> f s
- type Getting r s a = (a -> Const r a) -> s -> Const r s
- type Prism s t a b = forall p f. (Choice p, Applicative f) => p a (f b) -> p s (f t)
- type Prism' s a = Prism s s a a
- get :: Getting a s a -> s -> a
- set :: Lens' s a -> a -> s -> s
- modify :: Lens' s a -> (a -> a) -> s -> s
- preview :: Prism' s a -> s -> Maybe a
- snapshot :: MonadIO m => Getting (TVar a) s (TVar a) -> s -> m a
- snapshotModify :: MonadIO m => Lens' s (TVar a) -> (a -> STM (a, b)) -> s -> m b
Internal lens synonyms
type Getter s a = forall f. (Contravariant f, Functor f) => (a -> f a) -> s -> f s Source #
type Prism s t a b = forall p f. (Choice p, Applicative f) => p a (f b) -> p s (f t) Source #