packages feed

id 0.0.5 → 0.0.6

raw patch · 3 files changed

+161/−1 lines, 3 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ Data.BiId: identityLeftBifunctor :: forall (p :: Type -> Type -> Type) (p' :: Type -> Type -> Type) (t :: Type -> Type) a b (t' :: Type -> Type) a' b'. (Bifunctor p, Bifunctor p') => Iso (BiIdIdentityLeft p t a b) (BiIdIdentityLeft p' t' a' b') (p a (t b)) (p' a' (t' b'))
+ Data.BiId: identityLeftBifunctorProfunctor :: forall (p :: Type -> Type -> Type) (p' :: Type -> Type -> Type) (t :: Type -> Type) a b (t' :: Type -> Type) a' b'. (Bifunctor p, Profunctor p') => Iso (BiIdIdentityLeft p t a b) (BiIdIdentityLeft p' t' a' b') (p a (t b)) (p' a' (t' b'))
+ Data.BiId: identityLeftProfunctor :: forall (p :: Type -> Type -> Type) (p' :: Type -> Type -> Type) (t :: Type -> Type) a b (t' :: Type -> Type) a' b'. (Profunctor p, Profunctor p') => Iso (BiIdIdentityLeft p t a b) (BiIdIdentityLeft p' t' a' b') (p a (t b)) (p' a' (t' b'))
+ Data.BiId: identityLeftProfunctorBifunctor :: forall (p :: Type -> Type -> Type) (p' :: Type -> Type -> Type) (t :: Type -> Type) a b (t' :: Type -> Type) a' b'. (Profunctor p, Bifunctor p') => Iso (BiIdIdentityLeft p t a b) (BiIdIdentityLeft p' t' a' b') (p a (t b)) (p' a' (t' b'))
+ Data.BiId: identityRightBifunctor :: forall (p :: Type -> Type -> Type) (p' :: Type -> Type -> Type) (s :: Type -> Type) a b (s' :: Type -> Type) a' b'. (Bifunctor p, Bifunctor p') => Iso (BiIdIdentityRight p s a b) (BiIdIdentityRight p' s' a' b') (p (s a) b) (p' (s' a') b')
+ Data.BiId: identityRightBifunctorProfunctor :: forall (p :: Type -> Type -> Type) (p' :: Type -> Type -> Type) (s :: Type -> Type) a b (s' :: Type -> Type) a' b'. (Bifunctor p, Profunctor p') => Iso (BiIdIdentityRight p s a b) (BiIdIdentityRight p' s' a' b') (p (s a) b) (p' (s' a') b')
+ Data.BiId: identityRightProfunctor :: forall (p :: Type -> Type -> Type) (p' :: Type -> Type -> Type) (s :: Type -> Type) a b (s' :: Type -> Type) a' b'. (Profunctor p, Profunctor p') => Iso (BiIdIdentityRight p s a b) (BiIdIdentityRight p' s' a' b') (p (s a) b) (p' (s' a') b')
+ Data.BiId: identityRightProfunctorBifunctor :: forall (p :: Type -> Type -> Type) (p' :: Type -> Type -> Type) (s :: Type -> Type) a b (s' :: Type -> Type) a' b'. (Profunctor p, Bifunctor p') => Iso (BiIdIdentityRight p s a b) (BiIdIdentityRight p' s' a' b') (p (s a) b) (p' (s' a') b')
+ Data.BiId: type BiIdIdentityLeft (p :: Type -> Type -> Type) (t :: Type -> Type) a b = BiId p Identity t a b
+ Data.BiId: type BiIdIdentityRight (p :: Type -> Type -> Type) (s :: Type -> Type) a b = BiId p s Identity a b

Files

changelog.md view
@@ -1,3 +1,9 @@+0.0.6++* Add BiIdIdentityLeft and BiIdIdentityRight type aliases+* Add identityLeft optic family (identityLeftProfunctor, identityLeftProfunctorBifunctor, identityLeftBifunctorProfunctor, identityLeftBifunctor)+* Add identityRight optic family (identityRightProfunctor, identityRightProfunctorBifunctor, identityRightBifunctorProfunctor, identityRightBifunctor)+ 0.0.5  * Use deriving for standard instances where possible
id.cabal view
@@ -1,6 +1,6 @@ cabal-version:        2.4 name:                 id-version:              0.0.5+version:              0.0.6 synopsis:             Id (f a) and BiId (p (s a) (t b)) data types description:                       Id (f a) and BiId (p (s a) (t b)) data types, with optics and functions for switching the type constructors
src/Data/BiId.hs view
@@ -24,9 +24,19 @@     identityProfunctor,     identityProfunctorBifunctor,     identityBifunctorProfunctor,+    identityRightBifunctor,+    identityRightProfunctor,+    identityRightProfunctorBifunctor,+    identityRightBifunctorProfunctor,+    identityLeftBifunctor,+    identityLeftProfunctor,+    identityLeftProfunctorBifunctor,+    identityLeftBifunctorProfunctor,      -- * Type aliases     BiIdIdentity,+    BiIdIdentityLeft,+    BiIdIdentityRight,     Product,     Coproduct,     Exponential,@@ -124,6 +134,10 @@  type BiIdIdentity p a b = BiId p Identity Identity a b +type BiIdIdentityLeft p t a b = BiId p Identity t a b++type BiIdIdentityRight p s a b = BiId p s Identity a b+ -- | -- >>> view identityBifunctor (BiId (Identity 3, Identity True) :: BiIdIdentity (,) Int Bool) -- (3,True)@@ -202,6 +216,146 @@ {-# INLINE identityBifunctorProfunctor #-} {-# SPECIALIZE identityBifunctorProfunctor :: Iso (BiIdIdentity (,) a b) (BiIdIdentity (->) a' b') ((,) a b) ((->) a' b') #-} {-# SPECIALIZE identityBifunctorProfunctor :: Iso (BiIdIdentity Either a b) (BiIdIdentity (->) a' b') (Either a b) ((->) a' b') #-}++-- |+-- >>> view identityRightProfunctor (BiId (Tagged (Identity True)) :: BiIdIdentityRight Tagged [] Int Bool)+-- Tagged True+--+-- >>> view (from identityRightProfunctor) (Tagged True) :: BiIdIdentityRight Tagged [] Int Bool+-- BiId (Tagged (Identity True))+identityRightProfunctor ::+  (Profunctor p, Profunctor p') =>+  Iso+    (BiIdIdentityRight p s a b)+    (BiIdIdentityRight p' s' a' b')+    (p (s a) b)+    (p' (s' a') b')+identityRightProfunctor =+  iso+    (\(BiId x) -> rmap runIdentity x)+    (BiId . rmap Identity)+{-# INLINE identityRightProfunctor #-}++-- |+-- >>> view identityRightProfunctorBifunctor (BiId (Tagged (Identity True)) :: BiIdIdentityRight Tagged [] Int Bool)+-- Tagged True+identityRightProfunctorBifunctor ::+  (Profunctor p, Bifunctor p') =>+  Iso+    (BiIdIdentityRight p s a b)+    (BiIdIdentityRight p' s' a' b')+    (p (s a) b)+    (p' (s' a') b')+identityRightProfunctorBifunctor =+  iso+    (\(BiId x) -> rmap runIdentity x)+    (BiId . second Identity)+{-# INLINE identityRightProfunctorBifunctor #-}++-- |+-- >>> view identityRightBifunctorProfunctor (BiId (Tagged (Identity True)) :: BiIdIdentityRight Tagged [] Int Bool)+-- Tagged True+identityRightBifunctorProfunctor ::+  (Bifunctor p, Profunctor p') =>+  Iso+    (BiIdIdentityRight p s a b)+    (BiIdIdentityRight p' s' a' b')+    (p (s a) b)+    (p' (s' a') b')+identityRightBifunctorProfunctor =+  iso+    (\(BiId x) -> second runIdentity x)+    (BiId . rmap Identity)+{-# INLINE identityRightBifunctorProfunctor #-}++-- |+-- >>> view identityRightBifunctor (BiId ([1,2], Identity True) :: BiIdIdentityRight (,) [] Int Bool)+-- ([1,2],True)+--+-- >>> view (from identityRightBifunctor) ([1,2], True) :: BiIdIdentityRight (,) [] Int Bool+-- BiId ([1,2],Identity True)+identityRightBifunctor ::+  (Bifunctor p, Bifunctor p') =>+  Iso+    (BiIdIdentityRight p s a b)+    (BiIdIdentityRight p' s' a' b')+    (p (s a) b)+    (p' (s' a') b')+identityRightBifunctor =+  iso+    (\(BiId x) -> second runIdentity x)+    (BiId . second Identity)+{-# INLINE identityRightBifunctor #-}++-- |+-- >>> view identityLeftProfunctor (BiId (Tagged (Identity True)) :: BiIdIdentityLeft Tagged Identity Int Bool)+-- Tagged (Identity True)+--+-- >>> view (from identityLeftProfunctor) (Tagged (Identity True)) :: BiIdIdentityLeft Tagged Identity Int Bool+-- BiId (Tagged (Identity True))+identityLeftProfunctor ::+  (Profunctor p, Profunctor p') =>+  Iso+    (BiIdIdentityLeft p t a b)+    (BiIdIdentityLeft p' t' a' b')+    (p a (t b))+    (p' a' (t' b'))+identityLeftProfunctor =+  iso+    (\(BiId x) -> lmap Identity x)+    (BiId . lmap runIdentity)+{-# INLINE identityLeftProfunctor #-}++-- |+-- >>> view identityLeftProfunctorBifunctor (BiId (Tagged (Identity True)) :: BiIdIdentityLeft Tagged Identity Int Bool)+-- Tagged (Identity True)+identityLeftProfunctorBifunctor ::+  (Profunctor p, Bifunctor p') =>+  Iso+    (BiIdIdentityLeft p t a b)+    (BiIdIdentityLeft p' t' a' b')+    (p a (t b))+    (p' a' (t' b'))+identityLeftProfunctorBifunctor =+  iso+    (\(BiId x) -> lmap Identity x)+    (BiId . first Identity)+{-# INLINE identityLeftProfunctorBifunctor #-}++-- |+-- >>> view identityLeftBifunctorProfunctor (BiId (Tagged (Identity True)) :: BiIdIdentityLeft Tagged Identity Int Bool)+-- Tagged (Identity True)+identityLeftBifunctorProfunctor ::+  (Bifunctor p, Profunctor p') =>+  Iso+    (BiIdIdentityLeft p t a b)+    (BiIdIdentityLeft p' t' a' b')+    (p a (t b))+    (p' a' (t' b'))+identityLeftBifunctorProfunctor =+  iso+    (\(BiId x) -> first runIdentity x)+    (BiId . lmap runIdentity)+{-# INLINE identityLeftBifunctorProfunctor #-}++-- |+-- >>> view identityLeftBifunctor (BiId (Identity 3, Identity True) :: BiIdIdentityLeft (,) Identity Int Bool)+-- (3,Identity True)+--+-- >>> view (from identityLeftBifunctor) (3, Identity True) :: BiIdIdentityLeft (,) Identity Int Bool+-- BiId (Identity 3,Identity True)+identityLeftBifunctor ::+  (Bifunctor p, Bifunctor p') =>+  Iso+    (BiIdIdentityLeft p t a b)+    (BiIdIdentityLeft p' t' a' b')+    (p a (t b))+    (p' a' (t' b'))+identityLeftBifunctor =+  iso+    (\(BiId x) -> first runIdentity x)+    (BiId . first Identity)+{-# INLINE identityLeftBifunctor #-}  instance   (BiId p s t a b ~ x) =>