| Copyright | (C) 2012-16 Edward Kmett Michael Sloan |
|---|---|
| License | BSD-style (see the file LICENSE) |
| Maintainer | Edward Kmett <ekmett@gmail.com> |
| Stability | experimental |
| Portability | Rank2, MPTCs, fundeps |
| Safe Haskell | Trustworthy |
| Language | Haskell2010 |
Control.Lens.Wrapped
Description
The Wrapped class provides similar functionality as Control.Newtype,
from the newtype package, but in a more convenient and efficient form.
There are a few functions from newtype that are not provided here, because
they can be done with the Iso directly:
Control.Newtype.overSumf ≡_UnwrappingSum%~f Control.Newtype.underSumf ≡_WrappingSum%~f Control.Newtype.overFSumf ≡mapping(_UnwrappingSum)%~f Control.Newtype.underFSumf ≡mapping(_WrappingSum)%~f
under can also be used with _Unwrapping to provide the equivalent of
Control.Newtype.under. Also, most use cases don't need full polymorphism,
so only the single constructor _Wrapping functions would be needed.
These equivalences aren't 100% honest, because newtype's operators
need to rely on two Newtype constraints. This means that the wrapper used
for the output is not necessarily the same as the input.
Synopsis
- class Wrapped s where
- _Unwrapped' :: Wrapped s => Iso' (Unwrapped s) s
- _Wrapping' :: Wrapped s => (Unwrapped s -> s) -> Iso' s (Unwrapped s)
- _Unwrapping' :: Wrapped s => (Unwrapped s -> s) -> Iso' (Unwrapped s) s
- class Wrapped s => Rewrapped (s :: *) (t :: *)
- class (Rewrapped s t, Rewrapped t s) => Rewrapping s t
- _Wrapped :: Rewrapping s t => Iso s t (Unwrapped s) (Unwrapped t)
- _Unwrapped :: Rewrapping s t => Iso (Unwrapped t) (Unwrapped s) t s
- _Wrapping :: Rewrapping s t => (Unwrapped s -> s) -> Iso s t (Unwrapped s) (Unwrapped t)
- _Unwrapping :: Rewrapping s t => (Unwrapped s -> s) -> Iso (Unwrapped t) (Unwrapped s) t s
- op :: Wrapped s => (Unwrapped s -> s) -> s -> Unwrapped s
- ala :: (Functor f, Rewrapping s t) => (Unwrapped s -> s) -> ((Unwrapped t -> t) -> f s) -> f (Unwrapped s)
- alaf :: (Functor f, Functor g, Rewrapping s t) => (Unwrapped s -> s) -> (f t -> g s) -> f (Unwrapped t) -> g (Unwrapped s)
- pattern Wrapped :: Rewrapped s s => Unwrapped s -> s
- pattern Unwrapped :: Rewrapped t t => t -> Unwrapped t
- _GWrapped' :: (Generic s, D1 d (C1 c (S1 s' (Rec0 a))) ~ Rep s, Unwrapped s ~ GUnwrapped (Rep s)) => Iso' s (Unwrapped s)
Wrapping and Unwrapping monomorphically
class Wrapped s where Source #
Wrapped provides isomorphisms to wrap and unwrap newtypes or
data types with one constructor.
Minimal complete definition
Nothing
Methods
_Wrapped' :: Iso' s (Unwrapped s) Source #
An isomorphism between s and a.
If your type has a Generic instance, _Wrapped' will default to _GWrapped',
and you can choose to not override it with your own definition.
Instances
| Wrapped Any Source # | |
| Wrapped CInt Source # | |
| Wrapped CSize Source # | |
| Wrapped CChar Source # | |
| Wrapped CULong Source # | |
| Wrapped IntSet Source # | |
| Wrapped All Source # | |
| Wrapped CBlkCnt Source # | |
| Wrapped CBlkSize Source # | |
| Wrapped CBool Source # | |
| Wrapped CCc Source # | |
| Wrapped CClock Source # | |
| Wrapped CClockId Source # | |
| Wrapped CDev Source # | |
| Wrapped CDouble Source # | |
| Wrapped CFloat Source # | |
| Wrapped CFsBlkCnt Source # | |
| Wrapped CFsFilCnt Source # | |
| Wrapped CGid Source # | |
| Wrapped CId Source # | |
| Wrapped CIno Source # | |
| Wrapped CIntMax Source # | |
| Wrapped CIntPtr Source # | |
| Wrapped CKey Source # | |
| Wrapped CLLong Source # | |
| Wrapped CLong Source # | |
| Wrapped CMode Source # | |
| Wrapped CNlink Source # | |
| Wrapped COff Source # | |
| Wrapped CPid Source # | |
| Wrapped CPtrdiff Source # | |
| Wrapped CRLim Source # | |
| Wrapped CSChar Source # | |
| Wrapped CSUSeconds Source # | |
| Wrapped CShort Source # | |
| Wrapped CSigAtomic Source # | |
| Wrapped CSpeed Source # | |
| Wrapped CSsize Source # | |
| Wrapped CTcflag Source # | |
| Wrapped CTime Source # | |
| Wrapped CTimer Source # | |
| Wrapped CUChar Source # | |
| Wrapped CUInt Source # | |
| Wrapped CUIntMax Source # | |
| Wrapped CUIntPtr Source # | |
| Wrapped CULLong Source # | |
| Wrapped CUSeconds Source # | |
| Wrapped CUShort Source # | |
| Wrapped CUid Source # | |
| Wrapped CWchar Source # | |
| Wrapped Fd Source # | |
| Wrapped Errno Source # | |
| Wrapped AssertionFailed Source # | |
| Wrapped CompactionFailed Source # | |
| Wrapped NoMethodError Source # | |
| Wrapped PatternMatchFail Source # | |
| Wrapped RecConError Source # | |
| Wrapped RecSelError Source # | |
| Wrapped RecUpdError Source # | |
| Wrapped TypeError Source # | |
| Wrapped ErrorCall Source # | |
| Wrapped (Par1 p) Source # | |
| Wrapped (NonEmpty a) Source # | |
| Wrapped (Dual a) Source # | |
| Wrapped (Endo a) Source # | |
| Wrapped (Product a) Source # | |
| Wrapped (Sum a) Source # | |
| Wrapped (Identity a) Source # | |
| Wrapped (Comparison a) Source # | |
| Wrapped (Equivalence a) Source # | |
| Wrapped (Predicate a) Source # | |
| Wrapped (Vector a) Source # | |
| Prim a => Wrapped (Vector a) Source # | |
| Storable a => Wrapped (Vector a) Source # | |
| Unbox a => Wrapped (Vector a) Source # | |
| Wrapped (Seq a) Source # | |
| Wrapped (Down a) Source # | |
| Wrapped (ZipList a) Source # | |
| Wrapped (IntMap a) Source # | |
| Ord a => Wrapped (Set a) Source # | |
| Wrapped (First a) Source # | |
| Wrapped (Last a) Source # | |
| Wrapped (Max a) Source # | |
| Wrapped (Min a) Source # | |
| Wrapped (WrappedMonoid a) Source # | |
| Wrapped (Option a) Source # | |
| Wrapped (First a) Source # | |
| Wrapped (Last a) Source # | |
| (Hashable a, Eq a) => Wrapped (HashSet a) Source # | |
| Wrapped (ArrowMonad m a) Source # | |
| Wrapped (Op a b) Source # | |
| Ord k => Wrapped (Map k a) Source # | |
| Wrapped (ListT m a) Source # | |
| Wrapped (MaybeT m a) Source # | |
| Wrapped (WrappedMonad m a) Source # | |
| Wrapped (MaybeApply f a) Source # | |
| Wrapped (WrappedApplicative f a) Source # | |
| (Hashable k, Eq k) => Wrapped (HashMap k a) Source # | |
| Wrapped (Alt f a) Source # | |
| Wrapped (CoiterT w a) Source # | |
| Wrapped (CatchT m a) Source # | |
| Wrapped (IterT m a) Source # | |
| Wrapped (Rec1 f p) Source # | |
| Wrapped (Kleisli m a b) Source # | |
| Wrapped (Tagged s a) Source # | |
| Wrapped (IdentityT m a) Source # | |
| Wrapped (Alt f a) Source # | |
| Wrapped (Const a x) Source # | |
| Wrapped (ErrorT e m a) Source # | |
| Wrapped (ExceptT e m a) Source # | |
| Wrapped (ReaderT r m a) Source # | |
| Wrapped (StateT s m a) Source # | |
| Wrapped (StateT s m a) Source # | |
| Wrapped (WriterT w m a) Source # | |
| Wrapped (WriterT w m a) Source # | |
| Wrapped (Ap f a) Source # | |
| Wrapped (WrappedArrow a b c) Source # | |
| Wrapped (Join p a) Source # | |
| Wrapped (Backwards f a) Source # | |
| Wrapped (Constant a b) Source # | |
| Wrapped (Reverse f a) Source # | |
| Wrapped (TracedT m w a) Source # | |
| Wrapped (FreeT f m a) Source # | |
| Wrapped (ApT f g a) Source # | |
| Wrapped (CofreeT f w a) Source # | |
| Wrapped (Fix p a) Source # | |
| Wrapped (Compose f g a) Source # | |
| Wrapped (ComposeCF f g a) Source # | |
| Wrapped (ComposeFC f g a) Source # | |
| Wrapped (Static f a b) Source # | |
| Wrapped (K1 i c p) Source # | |
| Wrapped (Costar f d c) Source # | |
| Wrapped (Forget r a b) Source # | |
| Wrapped (Star f d c) Source # | |
| Wrapped (ContT r m a) Source # | |
| Wrapped (M1 i c f p) Source # | |
| Wrapped ((f :.: g) p) Source # | |
| Wrapped (Clown f a b) Source # | |
| Wrapped (Joker g a b) Source # | |
| Wrapped (Compose f g a) Source # | |
| Wrapped (WrappedArrow p a b) Source # | |
| Wrapped (RWST r w s m a) Source # | |
| Wrapped (RWST r w s m a) Source # | |
| Wrapped (Flip p a b) Source # | |
| Wrapped (WrappedBifunctor p a b) Source # | |
| Wrapped (Semi m a b) Source # | |
| Wrapped (WrappedCategory k3 a b) Source # | |
| Wrapped (Dual k3 a b) Source # | |
| Wrapped (Tannen f p a b) Source # | |
| Wrapped (Cayley f p a b) Source # | |
| Wrapped (Biff p f g a b) Source # | |
_Wrapping' :: Wrapped s => (Unwrapped s -> s) -> Iso' s (Unwrapped s) Source #
This is a convenient version of _Wrapped with an argument that's ignored.
The user supplied function is ignored, merely its type is used.
_Unwrapping' :: Wrapped s => (Unwrapped s -> s) -> Iso' (Unwrapped s) s Source #
This is a convenient version of _Wrapped with an argument that's ignored.
The user supplied function is ignored, merely its type is used.
Wrapping and unwrapping polymorphically
class Wrapped s => Rewrapped (s :: *) (t :: *) Source #
Instances
| t ~ Any => Rewrapped Any t Source # | |
Defined in Control.Lens.Wrapped | |
| Rewrapped CInt t Source # | |
Defined in Control.Lens.Wrapped | |
| Rewrapped CSize t Source # | |
Defined in Control.Lens.Wrapped | |
| Rewrapped CChar t Source # | |
Defined in Control.Lens.Wrapped | |
| Rewrapped CULong t Source # | |
Defined in Control.Lens.Wrapped | |
| t ~ IntSet => Rewrapped IntSet t Source # | Use |
Defined in Control.Lens.Wrapped | |
| t ~ All => Rewrapped All t Source # | |
Defined in Control.Lens.Wrapped | |
| Rewrapped CBlkCnt t Source # | |
Defined in Control.Lens.Wrapped | |
| Rewrapped CBlkSize t Source # | |
Defined in Control.Lens.Wrapped | |
| Rewrapped CBool t Source # | |
Defined in Control.Lens.Wrapped | |
| Rewrapped CCc t Source # | |
Defined in Control.Lens.Wrapped | |
| Rewrapped CClock t Source # | |
Defined in Control.Lens.Wrapped | |
| Rewrapped CClockId t Source # | |
Defined in Control.Lens.Wrapped | |
| Rewrapped CDev t Source # | |
Defined in Control.Lens.Wrapped | |
| Rewrapped CDouble t Source # | |
Defined in Control.Lens.Wrapped | |
| Rewrapped CFloat t Source # | |
Defined in Control.Lens.Wrapped | |
| Rewrapped CFsBlkCnt t Source # | |
Defined in Control.Lens.Wrapped | |
| Rewrapped CFsFilCnt t Source # | |
Defined in Control.Lens.Wrapped | |
| Rewrapped CGid t Source # | |
Defined in Control.Lens.Wrapped | |
| Rewrapped CId t Source # | |
Defined in Control.Lens.Wrapped | |
| Rewrapped CIno t Source # | |
Defined in Control.Lens.Wrapped | |
| Rewrapped CIntMax t Source # | |
Defined in Control.Lens.Wrapped | |
| Rewrapped CIntPtr t Source # | |
Defined in Control.Lens.Wrapped | |
| Rewrapped CKey t Source # | |
Defined in Control.Lens.Wrapped | |
| Rewrapped CLLong t Source # | |
Defined in Control.Lens.Wrapped | |
| Rewrapped CLong t Source # | |
Defined in Control.Lens.Wrapped | |
| Rewrapped CMode t Source # | |
Defined in Control.Lens.Wrapped | |
| Rewrapped CNlink t Source # | |
Defined in Control.Lens.Wrapped | |
| Rewrapped COff t Source # | |
Defined in Control.Lens.Wrapped | |
| Rewrapped CPid t Source # | |
Defined in Control.Lens.Wrapped | |
| Rewrapped CPtrdiff t Source # | |
Defined in Control.Lens.Wrapped | |
| Rewrapped CRLim t Source # | |
Defined in Control.Lens.Wrapped | |
| Rewrapped CSChar t Source # | |
Defined in Control.Lens.Wrapped | |
| Rewrapped CSUSeconds t Source # | |
Defined in Control.Lens.Wrapped | |
| Rewrapped CShort t Source # | |
Defined in Control.Lens.Wrapped | |
| Rewrapped CSigAtomic t Source # | |
Defined in Control.Lens.Wrapped | |
| Rewrapped CSpeed t Source # | |
Defined in Control.Lens.Wrapped | |
| Rewrapped CSsize t Source # | |
Defined in Control.Lens.Wrapped | |
| Rewrapped CTcflag t Source # | |
Defined in Control.Lens.Wrapped | |
| Rewrapped CTime t Source # | |
Defined in Control.Lens.Wrapped | |
| Rewrapped CTimer t Source # | |
Defined in Control.Lens.Wrapped | |
| Rewrapped CUChar t Source # | |
Defined in Control.Lens.Wrapped | |
| Rewrapped CUInt t Source # | |
Defined in Control.Lens.Wrapped | |
| Rewrapped CUIntMax t Source # | |
Defined in Control.Lens.Wrapped | |
| Rewrapped CUIntPtr t Source # | |
Defined in Control.Lens.Wrapped | |
| Rewrapped CULLong t Source # | |
Defined in Control.Lens.Wrapped | |
| Rewrapped CUSeconds t Source # | |
Defined in Control.Lens.Wrapped | |
| Rewrapped CUShort t Source # | |
Defined in Control.Lens.Wrapped | |
| Rewrapped CUid t Source # | |
Defined in Control.Lens.Wrapped | |
| Rewrapped CWchar t Source # | |
Defined in Control.Lens.Wrapped | |
| Rewrapped Fd t Source # | |
Defined in Control.Lens.Wrapped | |
| Rewrapped Errno t Source # | |
Defined in Control.Lens.Wrapped | |
| t ~ AssertionFailed => Rewrapped AssertionFailed t Source # | |
Defined in Control.Lens.Wrapped | |
| t ~ CompactionFailed => Rewrapped CompactionFailed t Source # | |
Defined in Control.Lens.Wrapped | |
| t ~ NoMethodError => Rewrapped NoMethodError t Source # | |
Defined in Control.Lens.Wrapped | |
| t ~ PatternMatchFail => Rewrapped PatternMatchFail t Source # | |
Defined in Control.Lens.Wrapped | |
| t ~ RecConError => Rewrapped RecConError t Source # | |
Defined in Control.Lens.Wrapped | |
| t ~ RecSelError => Rewrapped RecSelError t Source # | |
Defined in Control.Lens.Wrapped | |
| t ~ RecUpdError => Rewrapped RecUpdError t Source # | |
Defined in Control.Lens.Wrapped | |
| t ~ TypeError => Rewrapped TypeError t Source # | |
Defined in Control.Lens.Wrapped | |
| t ~ ErrorCall => Rewrapped ErrorCall t Source # | |
Defined in Control.Lens.Wrapped | |
| t ~ Par1 p' => Rewrapped (Par1 p) t Source # | |
Defined in Control.Lens.Wrapped | |
| t ~ NonEmpty b => Rewrapped (NonEmpty a) t Source # | |
Defined in Control.Lens.Wrapped | |
| t ~ Dual b => Rewrapped (Dual a) t Source # | |
Defined in Control.Lens.Wrapped | |
| t ~ Endo b => Rewrapped (Endo a) t Source # | |
Defined in Control.Lens.Wrapped | |
| t ~ Product b => Rewrapped (Product a) t Source # | |
Defined in Control.Lens.Wrapped | |
| t ~ Sum b => Rewrapped (Sum a) t Source # | |
Defined in Control.Lens.Wrapped | |
| t ~ Identity b => Rewrapped (Identity a) t Source # | |
Defined in Control.Lens.Wrapped | |
| t ~ Comparison b => Rewrapped (Comparison a) t Source # | |
Defined in Control.Lens.Wrapped | |
| t ~ Equivalence b => Rewrapped (Equivalence a) t Source # | |
Defined in Control.Lens.Wrapped | |
| t ~ Predicate b => Rewrapped (Predicate a) t Source # | |
Defined in Control.Lens.Wrapped | |
| t ~ Vector a' => Rewrapped (Vector a) t Source # | |
Defined in Control.Lens.Wrapped | |
| (Prim a, t ~ Vector a') => Rewrapped (Vector a) t Source # | |
Defined in Control.Lens.Wrapped | |
| (Storable a, t ~ Vector a') => Rewrapped (Vector a) t Source # | |
Defined in Control.Lens.Wrapped | |
| (Unbox a, t ~ Vector a') => Rewrapped (Vector a) t Source # | |
Defined in Control.Lens.Wrapped | |
| t ~ Seq a' => Rewrapped (Seq a) t Source # | |
Defined in Control.Lens.Wrapped | |
| t ~ Down b => Rewrapped (Down a) t Source # | |
Defined in Control.Lens.Wrapped | |
| t ~ ZipList b => Rewrapped (ZipList a) t Source # | |
Defined in Control.Lens.Wrapped | |
| t ~ IntMap a' => Rewrapped (IntMap a) t Source # | Use |
Defined in Control.Lens.Wrapped | |
| (t ~ Set a', Ord a) => Rewrapped (Set a) t Source # | Use |
Defined in Control.Lens.Wrapped | |
| t ~ First b => Rewrapped (First a) t Source # | |
Defined in Control.Lens.Wrapped | |
| t ~ Last b => Rewrapped (Last a) t Source # | |
Defined in Control.Lens.Wrapped | |
| t ~ Max b => Rewrapped (Max a) t Source # | |
Defined in Control.Lens.Wrapped | |
| t ~ Min b => Rewrapped (Min a) t Source # | |
Defined in Control.Lens.Wrapped | |
| t ~ WrappedMonoid b => Rewrapped (WrappedMonoid a) t Source # | |
Defined in Control.Lens.Wrapped | |
| t ~ Option b => Rewrapped (Option a) t Source # | |
Defined in Control.Lens.Wrapped | |
| t ~ First b => Rewrapped (First a) t Source # | |
Defined in Control.Lens.Wrapped | |
| t ~ Last b => Rewrapped (Last a) t Source # | |
Defined in Control.Lens.Wrapped | |
| (t ~ HashSet a', Hashable a, Eq a) => Rewrapped (HashSet a) t Source # | Use |
Defined in Control.Lens.Wrapped | |
| t ~ ArrowMonad m' a' => Rewrapped (ArrowMonad m a) t Source # | |
Defined in Control.Lens.Wrapped | |
| t ~ Op a' b' => Rewrapped (Op a b) t Source # | |
Defined in Control.Lens.Wrapped | |
| (t ~ Map k' a', Ord k) => Rewrapped (Map k a) t Source # | Use |
Defined in Control.Lens.Wrapped | |
| t ~ ListT n b => Rewrapped (ListT m a) t Source # | |
Defined in Control.Lens.Wrapped | |
| t ~ MaybeT n b => Rewrapped (MaybeT m a) t Source # | |
Defined in Control.Lens.Wrapped | |
| t ~ WrappedMonad m' a' => Rewrapped (WrappedMonad m a) t Source # | |
Defined in Control.Lens.Wrapped | |
| t ~ MaybeApply f' a' => Rewrapped (MaybeApply f a) t Source # | |
Defined in Control.Lens.Wrapped | |
| t ~ WrappedApplicative f' a' => Rewrapped (WrappedApplicative f a) t Source # | |
Defined in Control.Lens.Wrapped | |
| (t ~ HashMap k' a', Hashable k, Eq k) => Rewrapped (HashMap k a) t Source # | Use |
Defined in Control.Lens.Wrapped | |
| t ~ Alt f' a' => Rewrapped (Alt f a) t Source # | |
Defined in Control.Lens.Wrapped | |
| t ~ CoiterT w' a' => Rewrapped (CoiterT w a) t Source # | |
Defined in Control.Lens.Wrapped | |
| t ~ CatchT m' a' => Rewrapped (CatchT m a) t Source # | |
Defined in Control.Lens.Wrapped | |
| t ~ IterT m' a' => Rewrapped (IterT m a) t Source # | |
Defined in Control.Lens.Wrapped | |
| t ~ Rec1 f' p' => Rewrapped (Rec1 f p) t Source # | |
Defined in Control.Lens.Wrapped | |
| t ~ Kleisli m' a' b' => Rewrapped (Kleisli m a b) t Source # | |
Defined in Control.Lens.Wrapped | |
| t ~ Tagged s' a' => Rewrapped (Tagged s a) t Source # | |
Defined in Control.Lens.Wrapped | |
| t ~ IdentityT n b => Rewrapped (IdentityT m a) t Source # | |
Defined in Control.Lens.Wrapped | |
| t ~ Alt g b => Rewrapped (Alt f a) t Source # | |
Defined in Control.Lens.Wrapped | |
| t ~ Const a' x' => Rewrapped (Const a x) t Source # | |
Defined in Control.Lens.Wrapped | |
| t ~ ErrorT e' m' a' => Rewrapped (ErrorT e m a) t Source # | |
Defined in Control.Lens.Wrapped | |
| t ~ ExceptT e' m' a' => Rewrapped (ExceptT e m a) t Source # | |
Defined in Control.Lens.Wrapped | |
| t ~ ReaderT s n b => Rewrapped (ReaderT r m a) t Source # | |
Defined in Control.Lens.Wrapped | |
| t ~ StateT s' m' a' => Rewrapped (StateT s m a) t Source # | |
Defined in Control.Lens.Wrapped | |
| t ~ StateT s' m' a' => Rewrapped (StateT s m a) t Source # | |
Defined in Control.Lens.Wrapped | |
| t ~ WriterT w' m' a' => Rewrapped (WriterT w m a) t Source # | |
Defined in Control.Lens.Wrapped | |
| t ~ WriterT w' m' a' => Rewrapped (WriterT w m a) t Source # | |
Defined in Control.Lens.Wrapped | |
| t ~ Ap g b => Rewrapped (Ap f a) t Source # | |
Defined in Control.Lens.Wrapped | |
| t ~ WrappedArrow a' b' c' => Rewrapped (WrappedArrow a b c) t Source # | |
Defined in Control.Lens.Wrapped | |
| t ~ Join p' a' => Rewrapped (Join p a) t Source # | |
Defined in Control.Lens.Wrapped | |
| t ~ Backwards g b => Rewrapped (Backwards f a) t Source # | |
Defined in Control.Lens.Wrapped | |
| t ~ Constant a' b' => Rewrapped (Constant a b) t Source # | |
Defined in Control.Lens.Wrapped | |
| t ~ Reverse g b => Rewrapped (Reverse f a) t Source # | |
Defined in Control.Lens.Wrapped | |
| t ~ TracedT m' w' a' => Rewrapped (TracedT m w a) t Source # | |
Defined in Control.Lens.Wrapped | |
| t ~ FreeT f' m' a' => Rewrapped (FreeT f m a) t Source # | |
Defined in Control.Lens.Wrapped | |
| t ~ ApT f' g' a' => Rewrapped (ApT f g a) t Source # | |
Defined in Control.Lens.Wrapped | |
| t ~ CofreeT f' w' a' => Rewrapped (CofreeT f w a) t Source # | |
Defined in Control.Lens.Wrapped | |
| t ~ Fix p' a' => Rewrapped (Fix p a) t Source # | |
Defined in Control.Lens.Wrapped | |
| t ~ Compose f' g' a' => Rewrapped (Compose f g a) t Source # | |
Defined in Control.Lens.Wrapped | |
| t ~ ComposeCF f' g' a' => Rewrapped (ComposeCF f g a) t Source # | |
Defined in Control.Lens.Wrapped | |
| t ~ ComposeFC f' g' a' => Rewrapped (ComposeFC f g a) t Source # | |
Defined in Control.Lens.Wrapped | |
| t ~ Static f' a' b' => Rewrapped (Static f a b) t Source # | |
Defined in Control.Lens.Wrapped | |
| t ~ K1 i' c' p' => Rewrapped (K1 i c p) t Source # | |
Defined in Control.Lens.Wrapped | |
| t ~ Costar f' d' c' => Rewrapped (Costar f d c) t Source # | |
Defined in Control.Lens.Wrapped | |
| t ~ Forget r' a' b' => Rewrapped (Forget r a b) t Source # | |
Defined in Control.Lens.Wrapped | |
| t ~ Star f' d' c' => Rewrapped (Star f d c) t Source # | |
Defined in Control.Lens.Wrapped | |
| t ~ ContT r' m' a' => Rewrapped (ContT r m a) t Source # | |
Defined in Control.Lens.Wrapped | |
| t ~ M1 i' c' f' p' => Rewrapped (M1 i c f p) t Source # | |
Defined in Control.Lens.Wrapped | |
| t ~ (f' :.: g') p' => Rewrapped ((f :.: g) p) t Source # | |
Defined in Control.Lens.Wrapped | |
| t ~ Clown f' a' b' => Rewrapped (Clown f a b) t Source # | |
Defined in Control.Lens.Wrapped | |
| t ~ Joker g' a' b' => Rewrapped (Joker g a b) t Source # | |
Defined in Control.Lens.Wrapped | |
| t ~ Compose f' g' a' => Rewrapped (Compose f g a) t Source # | |
Defined in Control.Lens.Wrapped | |
| t ~ WrappedArrow p' a' b' => Rewrapped (WrappedArrow p a b) t Source # | |
Defined in Control.Lens.Wrapped | |
| t ~ RWST r' w' s' m' a' => Rewrapped (RWST r w s m a) t Source # | |
Defined in Control.Lens.Wrapped | |
| t ~ RWST r' w' s' m' a' => Rewrapped (RWST r w s m a) t Source # | |
Defined in Control.Lens.Wrapped | |
| t ~ Flip p' a' b' => Rewrapped (Flip p a b) t Source # | |
Defined in Control.Lens.Wrapped | |
| t ~ WrappedBifunctor p' a' b' => Rewrapped (WrappedBifunctor p a b) t Source # | |
Defined in Control.Lens.Wrapped | |
| t ~ Semi m' a' b' => Rewrapped (Semi m a b) t Source # | |
Defined in Control.Lens.Wrapped | |
| t ~ WrappedCategory k' a' b' => Rewrapped (WrappedCategory k6 a b) t Source # | |
Defined in Control.Lens.Wrapped | |
| t ~ Dual k' a' b' => Rewrapped (Dual k6 a b) t Source # | |
Defined in Control.Lens.Wrapped | |
| t ~ Tannen f' p' a' b' => Rewrapped (Tannen f p a b) t Source # | |
Defined in Control.Lens.Wrapped | |
| t ~ Cayley f' p' a' b' => Rewrapped (Cayley f p a b) t Source # | |
Defined in Control.Lens.Wrapped | |
| t ~ Biff p' f' g' a' b' => Rewrapped (Biff p f g a b) t Source # | |
Defined in Control.Lens.Wrapped | |
class (Rewrapped s t, Rewrapped t s) => Rewrapping s t Source #
Instances
| (Rewrapped s t, Rewrapped t s) => Rewrapping s t Source # | |
Defined in Control.Lens.Wrapped | |
_Wrapped :: Rewrapping s t => Iso s t (Unwrapped s) (Unwrapped t) Source #
Work under a newtype wrapper.
>>>Const "hello" & _Wrapped %~ Prelude.length & getConst5
_Wrapped≡from_Unwrapped_Unwrapped≡from_Wrapped
_Unwrapped :: Rewrapping s t => Iso (Unwrapped t) (Unwrapped s) t s Source #
_Wrapping :: Rewrapping s t => (Unwrapped s -> s) -> Iso s t (Unwrapped s) (Unwrapped t) Source #
This is a convenient version of _Wrapped with an argument that's ignored.
The user supplied function is ignored, merely its types are used.
_Unwrapping :: Rewrapping s t => (Unwrapped s -> s) -> Iso (Unwrapped t) (Unwrapped s) t s Source #
This is a convenient version of _Unwrapped with an argument that's ignored.
The user supplied function is ignored, merely its types are used.
Operations
ala :: (Functor f, Rewrapping s t) => (Unwrapped s -> s) -> ((Unwrapped t -> t) -> f s) -> f (Unwrapped s) Source #
This combinator is based on ala from Conor McBride's work on Epigram.
As with _Wrapping, the user supplied function for the newtype is ignored.
>>>ala Sum foldMap [1,2,3,4]10
>>>ala All foldMap [True,True]True
>>>ala All foldMap [True,False]False
>>>ala Any foldMap [False,False]False
>>>ala Any foldMap [True,False]True
>>>ala Product foldMap [1,2,3,4]24
You may want to think of this combinator as having the following, simpler, type.
ala :: Rewrapping s t => (Unwrapped s -> s) -> ((Unwrapped t -> t) -> e -> s) -> e -> Unwrapped s
alaf :: (Functor f, Functor g, Rewrapping s t) => (Unwrapped s -> s) -> (f t -> g s) -> f (Unwrapped t) -> g (Unwrapped s) Source #
This combinator is based on ala' from Conor McBride's work on Epigram.
As with _Wrapping, the user supplied function for the newtype is ignored.
alaf :: Rewrapping s t => (Unwrapped s -> s) -> ((r -> t) -> e -> s) -> (r -> Unwrapped t) -> e -> Unwrapped s
>>>alaf Sum foldMap Prelude.length ["hello","world"]10