Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- type family HasLabelled (opt :: Type) (k :: Type) (s :: Type) (labels :: [(Symbol, Type)]) :: Constraint where ...
- type HasLabelledGetters (k :: Type) (s :: Type) (labels :: [(Symbol, Type)]) = HasLabelled A_Getter k s labels
- inspect :: forall (m :: Type -> Type) (r :: Type) (k :: Type) (is :: [Type]) (a :: Type). (MonadReader r m, Is k A_Getter) => Optic' k is r a -> m a
- inspects :: forall (m :: Type -> Type) (r :: Type) (k :: Type) (is :: [Type]) (a :: Type) (b :: Type). (MonadReader r m, Is k A_Getter) => Optic' k is r a -> (a -> b) -> m b
- guarantee :: forall (k :: Type) (is :: [Type]) (s :: Type) (a :: Type). Is k An_AffineFold => a -> Optic' k is s a -> s -> a
- guarantees :: forall (k :: Type) (is :: [Type]) (s :: Type) (a :: Type) (b :: Type). Is k An_AffineFold => b -> Optic' k is s a -> (a -> b) -> s -> b
Type families for constraints
type family HasLabelled (opt :: Type) (k :: Type) (s :: Type) (labels :: [(Symbol, Type)]) :: Constraint where ... Source #
Describes that a type s
has a collection of labelled optics, all of type
k
, which is at least as capable as opt
(though could be more so).
labels
describes which optics s
must have, as name-result pairs.
Note
This type family unfortunately has two caveats to its use:
- Redundant constraints resulting from its use won't be picked up by GHC warnings.
- If
labels
is empty, you will get an overlapping instances error.
Keep these in mind when using.
Since: 3.15.2
HasLabelled opt k s '[] = k `Is` opt | |
HasLabelled opt k s ('(sym, t) ': labels) = (LabelOptic sym k s s t t, HasLabelled opt k s labels) |
type HasLabelledGetters (k :: Type) (s :: Type) (labels :: [(Symbol, Type)]) = HasLabelled A_Getter k s labels Source #
Deprecated: Use HasLabelled A_Getter instead.
Short for
.HasLabelled
A_Getter
Note from Koz: To avoid breaking everything, I've made this a type synonym for now, while folks act on the deprecation warning. Not ideal, but far less damaging.
Since: 3.10.3
Helper functions
inspect :: forall (m :: Type -> Type) (r :: Type) (k :: Type) (is :: [Type]) (a :: Type). (MonadReader r m, Is k A_Getter) => Optic' k is r a -> m a Source #
view
the MonadReader
environment using the provided optic.
Since: 3.14.3
inspects :: forall (m :: Type -> Type) (r :: Type) (k :: Type) (is :: [Type]) (a :: Type) (b :: Type). (MonadReader r m, Is k A_Getter) => Optic' k is r a -> (a -> b) -> m b Source #