packages feed

generics-sop-lens 0.2 → 0.2.0.1

raw patch · 2 files changed

+43/−92 lines, 2 filesdep ~basedep ~generics-sopdep ~lensPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

Dependency ranges changed: base, generics-sop, lens

API changes (from Hackage documentation)

- Generics.SOP.Lens: _POP :: forall (f :: k -> *) xss yss. Iso (POP f xss) (POP f yss) (NP (NP f) xss) (NP (NP f) yss)
+ Generics.SOP.Lens: _POP :: forall k (f :: k -> Type) xss yss. Iso (POP f xss) (POP f yss) (NP (NP f) xss) (NP (NP f) yss)
- Generics.SOP.Lens: _S :: forall (f :: k -> *) x ys zs. Prism (NS f (x : ys)) (NS f (x : zs)) (NS f ys) (NS f zs)
+ Generics.SOP.Lens: _S :: forall k (f :: k -> Type) x ys zs. Prism (NS f (x : ys)) (NS f (x : zs)) (NS f ys) (NS f zs)
- Generics.SOP.Lens: _SOP :: forall (f :: k -> *) xss yss. Iso (SOP f xss) (SOP f yss) (NS (NP f) xss) (NS (NP f) yss)
+ Generics.SOP.Lens: _SOP :: forall k (f :: k -> Type) xss yss. Iso (SOP f xss) (SOP f yss) (NS (NP f) xss) (NS (NP f) yss)
- Generics.SOP.Lens: _Z :: forall (f :: k -> *) x y zs. Prism (NS f (x : zs)) (NS f (y : zs)) (f x) (f y)
+ Generics.SOP.Lens: _Z :: forall k (f :: k -> Type) x y zs. Prism (NS f (x : zs)) (NS f (y : zs)) (f x) (f y)
- Generics.SOP.Lens: npHead :: forall (f :: k -> *) x y zs. Lens (NP f (x : zs)) (NP f (y : zs)) (f x) (f y)
+ Generics.SOP.Lens: npHead :: forall k (f :: k -> Type) x y zs. Lens (NP f (x : zs)) (NP f (y : zs)) (f x) (f y)
- Generics.SOP.Lens: npSingleton :: forall (f :: k -> *) x y. Iso (NP f '[x]) (NP f '[y]) (f x) (f y)
+ Generics.SOP.Lens: npSingleton :: forall k (f :: k -> Type) x y. Iso (NP f '[x]) (NP f '[y]) (f x) (f y)
- Generics.SOP.Lens: npTail :: forall (f :: k -> *) x ys zs. Lens (NP f (x : ys)) (NP f (x : zs)) (NP f ys) (NP f zs)
+ Generics.SOP.Lens: npTail :: forall k (f :: k -> Type) x ys zs. Lens (NP f (x : ys)) (NP f (x : zs)) (NP f ys) (NP f zs)
- Generics.SOP.Lens: nsSingleton :: forall (f :: k -> *) x y. Iso (NS f '[x]) (NS f '[y]) (f x) (f y)
+ Generics.SOP.Lens: nsSingleton :: forall k (f :: k -> Type) x y. Iso (NS f '[x]) (NS f '[y]) (f x) (f y)
- Generics.SOP.Lens: pop :: forall (f :: k -> *) xss yss. Iso (POP f xss) (POP f yss) (NP (NP f) xss) (NP (NP f) yss)
+ Generics.SOP.Lens: pop :: forall k (f :: k -> Type) xss yss. Iso (POP f xss) (POP f yss) (NP (NP f) xss) (NP (NP f) yss)
- Generics.SOP.Lens: sop :: forall (f :: k -> *) xss yss. Iso (SOP f xss) (SOP f yss) (NS (NP f) xss) (NS (NP f) yss)
+ Generics.SOP.Lens: sop :: forall k (f :: k -> Type) xss yss. Iso (SOP f xss) (SOP f yss) (NS (NP f) xss) (NS (NP f) yss)

Files

generics-sop-lens.cabal view
@@ -1,40 +1,34 @@-name:           generics-sop-lens-version:        0.2-synopsis:       Lenses for types in generics-sop-description:    Lenses for types in generics-sop package-category:       Generics, Data-homepage:       https://github.com/phadej/generics-sop-lens#readme-bug-reports:    https://github.com/phadej/generics-sop-lens/issues-author:         Oleg Grenrus <oleg.grenrus@iki.fi>-maintainer:     Oleg Grenrus <oleg.grenrus@iki.fi>-license:        BSD3-license-file:   LICENSE+name:               generics-sop-lens+version:            0.2.0.1+synopsis:           Lenses for types in generics-sop+description:        Lenses for types in generics-sop package+category:           Generics, Data+homepage:           https://github.com/phadej/generics-sop-lens#readme+bug-reports:        https://github.com/phadej/generics-sop-lens/issues+author:             Oleg Grenrus <oleg.grenrus@iki.fi>+maintainer:         Oleg Grenrus <oleg.grenrus@iki.fi>+license:            BSD3+license-file:       LICENSE tested-with:-  GHC==7.8.4,-  GHC==7.10.3,-  GHC==8.0.2,-  GHC==8.2.2,-  GHC==8.4.4,-  GHC==8.6.5-build-type:     Simple-cabal-version:  >= 1.10+  GHC ==8.0.2 || ==8.2.2 || ==8.4.4 || ==8.6.5 || ==8.8.3 || ==8.10.1 +build-type:         Simple+cabal-version:      >=1.10 extra-source-files:-    CHANGELOG.md-    README.md+  CHANGELOG.md+  README.md  source-repository head-  type: git+  type:     git   location: https://github.com/phadej/generics-sop-lens  library-  hs-source-dirs:-      src-  ghc-options: -Wall+  hs-source-dirs:   src+  ghc-options:      -Wall   build-depends:-      base                  >=4.7      && <4.13-    , generics-sop          >=0.2      && <0.6-    , lens                  >=4.7      && <4.18-  exposed-modules:-      Generics.SOP.Lens+      base          >=4.9  && <4.15+    , generics-sop  >=0.5  && <0.6+    , lens          >=4.14 && <4.20++  exposed-modules:  Generics.SOP.Lens   default-language: Haskell2010
src/Generics/SOP/Lens.hs view
@@ -10,8 +10,8 @@ {-# LANGUAGE TypeOperators         #-} {-# OPTIONS_GHC -fno-warn-orphans  #-} -#ifndef MIN_VERSION_generics_sop-#define MIN_VERSION_generics_sop(x,y,z) 1+#if __GLASGOW_HASKELL__ <804+{-# LANGUAGE TypeInType            #-} #endif  -- | Lenses for "Generics.SOP"@@ -45,18 +45,15 @@     Generics.SOP.Lens.datatypeName,     Generics.SOP.Lens.constructorInfo,     Generics.SOP.Lens.constructorName,-#if MIN_VERSION_generics_sop(0,5,0)     Generics.SOP.Lens.strictnessInfo,-#endif     ) where -import Control.Lens-import Generics.SOP hiding (from)-import qualified Generics.SOP as SOP+import           Control.Lens+import           Data.Kind             (Type)+import           Generics.SOP          hiding (from)+import qualified Generics.SOP          as SOP+import           Generics.SOP.Metadata -#if MIN_VERSION_generics_sop(0,5,0)-import Generics.SOP.Metadata-#endif  ------------------------------------------------------------------------------- -- Representations@@ -74,11 +71,7 @@ -- >>> ('x', True) ^. productRep -- I 'x' :* I True :* Nil ---#if MIN_VERSION_generics_sop(0,3,1) productRep :: (IsProductType a xs, IsProductType b ys) => Iso a b (NP I xs) (NP I ys)-#else-productRep :: (Generic a, Generic b, Code a ~ '[xs], Code b ~ '[ys]) =>  Iso a b (NP I xs) (NP I ys)-#endif productRep = rep . sop . nsSingleton  -------------------------------------------------------------------------------@@ -90,25 +83,25 @@ -- >>> Just 'x' ^. rep . sop -- S (Z (I 'x' :* Nil)) sop ::-    forall (f :: k -> *) xss yss.+    forall k (f :: k -> Type) xss yss.     Iso (SOP f xss) (SOP f yss) (NS (NP f) xss) (NS (NP f) yss) sop = iso unSOP SOP  -- | Alias for 'sop'. _SOP ::-    forall (f :: k -> *) xss yss.+    forall k (f :: k -> Type) xss yss.     Iso (SOP f xss) (SOP f yss) (NS (NP f) xss) (NS (NP f) yss) _SOP = sop  -- | The only field of 'POP'. pop ::-    forall (f :: k -> *) xss yss.+    forall k (f :: k -> Type) xss yss.     Iso (POP f xss) (POP f yss) (NP (NP f) xss) (NP (NP f) yss) pop = iso unPOP POP  -- | Alias for 'pop'. _POP ::-    forall (f :: k -> *) xss yss.+    forall k (f :: k -> Type) xss yss.     Iso (POP f xss) (POP f yss) (NP (NP f) xss) (NP (NP f) yss) _POP = pop @@ -147,15 +140,12 @@ -------------------------------------------------------------------------------  npSingleton ::-    forall (f :: k -> *) x y.+    forall k (f :: k -> Type) x y.     Iso (NP f '[x]) (NP f '[y]) (f x) (f y) npSingleton = iso g s   where     g :: NP f '[x] -> f x     g (x  :* Nil)   = x-#if __GLASGOW_HASKELL__ < 800-    g _ = error "_NPSingleton"-#endif      s :: f y -> NP f '[y]     s y = y :* Nil@@ -169,7 +159,7 @@     _Wrapped' = nsSingleton  npHead ::-    forall (f :: k -> *) x y zs.+    forall k (f :: k -> Type) x y zs.     Lens (NP f (x ': zs)) (NP f (y ': zs)) (f x) (f y) npHead = lens g s   where@@ -180,7 +170,7 @@     s (_x :*  zs) y = y :* zs  npTail ::-    forall (f :: k -> *) x ys zs.+    forall k (f :: k -> Type) x ys zs.     Lens (NP f (x ': ys)) (NP f (x ': zs)) (NP f ys) (NP f zs) npTail = lens g s   where@@ -222,20 +212,16 @@ -------------------------------------------------------------------------------  nsSingleton ::-    forall (f :: k -> *) x y.+    forall k (f :: k -> Type) x y.     Iso (NS f '[x]) (NS f '[y]) (f x) (f y) nsSingleton = iso g Z   where     g :: NS f '[x] -> f x     g (Z x)   = x-#if __GLASGOW_HASKELL__ < 800-    g _ = error "singletonS"-#else     g (S v) = case v of {}-#endif  _Z ::-    forall (f :: k -> *) x y zs.+    forall k (f :: k -> Type) x y zs.     Prism (NS f (x ': zs)) (NS f (y ': zs)) (f x) (f y) _Z = prism Z p   where@@ -244,13 +230,13 @@     p (S xs) = Left (S xs)  _S ::-    forall (f :: k -> *) x ys zs.+    forall k (f :: k -> Type) x ys zs.     Prism (NS f (x ': ys)) (NS f (x ': zs)) (NS f ys) (NS f zs) _S = prism S p   where     p :: NS f (x ': ys) -> Either (NS f (x ': zs)) (NS f ys)     p (Z x)  = Left $ Z x-    p (S xs) = Right $ xs+    p (S xs) = Right xs  ------------------------------------------------------------------------------- -- DatatypeInfo@@ -260,61 +246,34 @@ moduleName = lens g s   where     g :: DatatypeInfo xss -> ModuleName-#if MIN_VERSION_generics_sop(0,5,0)     g (ADT m _ _ _)   = m-#else-    g (ADT m _ _)     = m-#endif     g (Newtype m _ _) = m      s :: DatatypeInfo xss -> ModuleName -> DatatypeInfo xss-#if MIN_VERSION_generics_sop(0,5,0)     s (ADT _ n cs ss) m = ADT m n cs ss-#else-    s (ADT _ n cs)    m = ADT m n cs-#endif     s (Newtype _ n c) m = Newtype m n c  datatypeName :: Lens' (DatatypeInfo xss) DatatypeName datatypeName = lens g s   where     g :: DatatypeInfo xss -> DatatypeName-#if MIN_VERSION_generics_sop(0,5,0)     g (ADT _ n _ _)   = n-#else-    g (ADT _ n _)     = n-#endif     g (Newtype _ n _) = n      s :: DatatypeInfo xss -> DatatypeName -> DatatypeInfo xss-#if MIN_VERSION_generics_sop(0,5,0)     s (ADT m _ cs ss) n = ADT m n cs ss-#else-    s (ADT m _ cs)    n = ADT m n cs-#endif     s (Newtype m _ c) n = Newtype m n c  constructorInfo :: Lens' (DatatypeInfo xss) (NP ConstructorInfo xss) constructorInfo = lens g s   where     g :: DatatypeInfo xss -> NP ConstructorInfo xss-#if MIN_VERSION_generics_sop(0,5,0)     g (ADT _ _ cs _)  = cs-#else-    g (ADT _ _ cs)    = cs-#endif     g (Newtype _ _ c) = c :* Nil      s :: DatatypeInfo xss -> NP ConstructorInfo xss -> DatatypeInfo xss-#if MIN_VERSION_generics_sop(0,5,0)     s (ADT m n _ ss)  cs          = ADT m n cs ss-#else-    s (ADT m n _)     cs          = ADT m n cs-#endif     s (Newtype m n _) (c :* Nil)  = Newtype m n c-#if __GLASGOW_HASKELL__ < 800-    s _ _ = error "constructorInfo set: impossible happened"-#endif  -- | /Note:/ 'Infix' constructor has operator as a 'ConstructorName'. Use as -- setter with care.@@ -323,9 +282,7 @@ constructorName f (Infix       n a fix) = (\ n' -> Infix       n' a fix) `fmap` f n constructorName f (Record      n finfo) = (\ n' -> Record      n' finfo) `fmap` f n -#if MIN_VERSION_generics_sop(0,5,0) -- | Strictness info is only aviable for 'ADT' data. This combinator is available only with @generics-sop@ 0.5 or later. strictnessInfo :: Traversal' (DatatypeInfo xss) (POP StrictnessInfo xss)-strictnessInfo _ di@(Newtype {}) = pure di+strictnessInfo _ di@Newtype {}   = pure di strictnessInfo f (ADT m n cs ss) = ADT m n cs <$> f ss-#endif