commit ghc-generics-sop for openSUSE:Factory
Hello community, here is the log from the commit of package ghc-generics-sop for openSUSE:Factory checked in at 2016-08-24 10:07:36 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/ghc-generics-sop (Old) and /work/SRC/openSUSE:Factory/.ghc-generics-sop.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "ghc-generics-sop" Changes: -------- --- /work/SRC/openSUSE:Factory/ghc-generics-sop/ghc-generics-sop.changes 2016-07-21 08:03:54.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.ghc-generics-sop.new/ghc-generics-sop.changes 2016-08-24 10:07:37.000000000 +0200 @@ -1,0 +2,5 @@ +Fri Jul 22 05:58:36 UTC 2016 - psimons@suse.com + +- Update to version 0.2.2.0 revision 0 with cabal2obs. + +------------------------------------------------------------------- Old: ---- generics-sop-0.2.1.0.tar.gz New: ---- generics-sop-0.2.2.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ ghc-generics-sop.spec ++++++ --- /var/tmp/diff_new_pack.ejVCa9/_old 2016-08-24 10:07:38.000000000 +0200 +++ /var/tmp/diff_new_pack.ejVCa9/_new 2016-08-24 10:07:38.000000000 +0200 @@ -18,7 +18,7 @@ %global pkg_name generics-sop Name: ghc-%{pkg_name} -Version: 0.2.1.0 +Version: 0.2.2.0 Release: 0 Summary: Generic Programming using True Sums of Products License: BSD-3-Clause @@ -27,10 +27,8 @@ Source0: https://hackage.haskell.org/package/%{pkg_name}-%{version}/%{pkg_name}-%{version}.tar.gz BuildRequires: ghc-Cabal-devel BuildRequires: ghc-rpm-macros -# Begin cabal-rpm deps: BuildRequires: ghc-template-haskell-devel BuildRoot: %{_tmppath}/%{name}-%{version}-build -# End cabal-rpm deps %description A library to support the definition of generic functions. Datatypes are viewed @@ -96,5 +94,6 @@ %files devel -f %{name}-devel.files %defattr(-,root,root,-) +%doc CHANGELOG.md %changelog ++++++ generics-sop-0.2.1.0.tar.gz -> generics-sop-0.2.2.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/generics-sop-0.2.1.0/CHANGELOG.md new/generics-sop-0.2.2.0/CHANGELOG.md --- old/generics-sop-0.2.1.0/CHANGELOG.md 1970-01-01 01:00:00.000000000 +0100 +++ new/generics-sop-0.2.2.0/CHANGELOG.md 2016-07-10 08:07:10.000000000 +0200 @@ -0,0 +1,140 @@ +# 0.2.2.0 + +* Introduced `unZ` to destruct a unary sum. + +* Add Haddock `@since` annotations for various functions. + +# 0.2.1.0 (2016-02-08) + +* Now includes a CHANGELOG. + +* Should now work with ghc-8.0.1-rc1 and -rc2 (thanks to + Oleg Grenrus). + +* Introduced `hd` and `tl` to project out of a product, and + `Projection` and `projections` as duals of `Injection` and + `injections`. + +# 0.2 (2015-10-23) + +* Now tested with ghc-7.10 + +* Introduced names `hmap`, `hcmap`, `hzipWith`, `hczipWith` for + `hliftA`, `hcliftA`, `hliftA2`, `hcliftA2`, respectively. + Similarly for the specialized versions of these functions. + +* The constraint transformers `All` and `All2` are now defined + as type classes, not type families. As a consequence, the + partial applications `All c` and `All2 c` are now possible. + +* Because of the redefinition of `All` and `All2`, some special + cases are no longer necessary. For example, `cpure_POP` can + now be implemented as a nested application of `pure_NP`. + +* Because of the redefinition of `All` and `All2`, the functions + `hcliftA'` and variants (with prime!) are now deprecated. + One can easily use the normal versions instead. + For example, the definition of `hcliftA'` is now simply + + hcliftA' p = hcliftA (allP p) + where + allP :: proxy c -> Proxy (All c) + allP _ = Proxy + +* Because `All` and `All2` are now type classes, they now have + superclass constraints implying that the type-level lists they + are ranging over must have singletons. + + class (SListI xs, ...) => All c xs + class (SListI xss, ...) => All2 c xss + + Some type signatures can be simplified due to this. + +* The `SingI` typeclass and `Sing` datatypes are now deprecated. + The replacements are called `SListI` and `SList`. + The `sing` method is now called `sList`. The difference + is that the new versions reveal only the spine of the list, and + contain no singleton representation for the elements anymore. + + For one-dimensional type-level lists, replace + + SingI xs => ... + + by + + SListI xs => ... + + For two-dimensional type-level lists, replace + + SingI xss => ... + + by + + All SListI xss => ... + + Because All itself implies `SListI xss` (see above), this + constraint is equivalent to the old `Sing xss`. + + The old names are provided for (limited) backward + compatibility. They map to the new constructs. This will + work in some, but not all scenarios. + + The function `lengthSing` has also been renamed to + `lengthSList` for consistency, and the old name is + deprecated. + +* All `Proxy c` arguments have been replaced by `proxy c` + flexible arguments, so that other type constructors can be + used as proxies. + +* Class-level composition (`Compose`), pairing (`And`), and + a trivial constraint (`Top`) have been added. Type-level map + (`Map`) has been removed. Occurrences such as + + All c (Map f xs) + + should now be replaced with + + All (c `Compose` f) xs + +* There is a new module called `Generics.SOP.Dict` that contains + functions for manipulating dictionaries explicitly. These can + be used to prove theorems about non-trivial class constraints + such as the ones that get built using `All` and `All2`. Some + such theorems are provided. + +* There is a new TH function `deriveGenericFunctions` that + derives the code of a datatype and conversion functions, but + does not create a class instance. (Contributed by Oleg Grenrus.) + +* There is a new TH function `deriveMetadataValue` that + derives a `DatatypeInfo` value for a datatype, but does + not create an instance of `HasDatatypeInfo`. (Contributed by + Oleg Grenrus.) + +* There is a very simple example file. (Contributed by Oleg + Grenrus.) + +* The function `hcollapse` for `NS` now results in an `a` rather + than an `I a`, matching the specialized version `collapse_NS`. + (Suggested by Roman Cheplyaka.) + +# 0.1.1.2 (2015-03-27) + +* Updated version bounds for ghc-prim (for ghc-7.10). + +# 0.1.1.1 (2015-03-20) + +* Preparations for ghc-7.10. + +* Documentation fix. (Contributed by Roman Cheplyaka.) + +# 0.1.1 (2015-01-06) + +* Documentation fixes. + +* Add superclass constraint (TODO). + +* Now derive tuple instance for tuples up to 30 components. + (Contributed by Michael Orlitzky.) + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/generics-sop-0.2.1.0/generics-sop.cabal new/generics-sop-0.2.2.0/generics-sop.cabal --- old/generics-sop-0.2.1.0/generics-sop.cabal 2016-02-08 11:29:09.000000000 +0100 +++ new/generics-sop-0.2.2.0/generics-sop.cabal 2016-07-10 08:07:10.000000000 +0200 @@ -1,5 +1,5 @@ name: generics-sop -version: 0.2.1.0 +version: 0.2.2.0 synopsis: Generic Programming using True Sums of Products description: A library to support the definition of generic functions. @@ -36,6 +36,7 @@ category: Generics build-type: Simple cabal-version: >=1.10 +extra-source-files: CHANGELOG.md tested-with: GHC == 7.6.3, GHC == 7.8.4, GHC == 7.10.3, GHC == 8.0.1 source-repository head diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/generics-sop-0.2.1.0/src/Generics/SOP/Classes.hs new/generics-sop-0.2.2.0/src/Generics/SOP/Classes.hs --- old/generics-sop-0.2.1.0/src/Generics/SOP/Classes.hs 2016-02-08 11:29:09.000000000 +0100 +++ new/generics-sop-0.2.2.0/src/Generics/SOP/Classes.hs 2016-07-10 08:07:10.000000000 +0200 @@ -222,10 +222,21 @@ hliftA3 f xs ys zs = hpure (fn_3 f) `hap` xs `hap` ys `hap` zs -- | Another name for 'hliftA'. +-- +-- @since 0.2 +-- hmap :: (SListIN (Prod h) xs, HAp h) => (forall a. f a -> f' a) -> h f xs -> h f' xs + -- | Another name for 'hliftA2'. +-- +-- @since 0.2 +-- hzipWith :: (SListIN (Prod h) xs, HAp h, HAp (Prod h)) => (forall a. f a -> f' a -> f'' a) -> Prod h f xs -> h f' xs -> h f'' xs + -- | Another name for 'hliftA3'. +-- +-- @since 0.2 +-- hzipWith3 :: (SListIN (Prod h) xs, HAp h, HAp (Prod h)) => (forall a. f a -> f' a -> f'' a -> f''' a) -> Prod h f xs -> Prod h f' xs -> h f'' xs -> h f''' xs hmap = hliftA @@ -267,10 +278,21 @@ hcliftA3 p f xs ys zs = hcpure p (fn_3 f) `hap` xs `hap` ys `hap` zs -- | Another name for 'hcliftA'. +-- +-- @since 0.2 +-- hcmap :: (AllN (Prod h) c xs, HAp h) => proxy c -> (forall a. c a => f a -> f' a) -> h f xs -> h f' xs + -- | Another name for 'hcliftA2'. +-- +-- @since 0.2 +-- hczipWith :: (AllN (Prod h) c xs, HAp h, HAp (Prod h)) => proxy c -> (forall a. c a => f a -> f' a -> f'' a) -> Prod h f xs -> h f' xs -> h f'' xs + -- | Another name for 'hcliftA3'. +-- +-- @since 0.2 +-- hczipWith3 :: (AllN (Prod h) c xs, HAp h, HAp (Prod h)) => proxy c -> (forall a. c a => f a -> f' a -> f'' a -> f''' a) -> Prod h f xs -> Prod h f' xs -> h f'' xs -> h f''' xs hcmap = hcliftA diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/generics-sop-0.2.1.0/src/Generics/SOP/Constraint.hs new/generics-sop-0.2.2.0/src/Generics/SOP/Constraint.hs --- old/generics-sop-0.2.1.0/src/Generics/SOP/Constraint.hs 2016-02-08 11:29:09.000000000 +0100 +++ new/generics-sop-0.2.2.0/src/Generics/SOP/Constraint.hs 2016-07-10 08:07:10.000000000 +0200 @@ -98,18 +98,24 @@ -- 'NS'. For example, in order to denote that all elements on an -- @'NP' f xs@ satisfy 'Show', we can say @'All' ('Show' :. f) xs@. -- +-- @since 0.2 +-- class (f (g x)) => (f `Compose` g) x instance (f (g x)) => (f `Compose` g) x infixr 9 `Compose` -- | Pairing of constraints. -- +-- @since 0.2 +-- class (f x, g x) => (f `And` g) x instance (f x, g x) => (f `And` g) x infixl 7 `And` -- | A constraint that can always be satisfied. -- +-- @since 0.2 +-- class Top x instance Top x diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/generics-sop-0.2.1.0/src/Generics/SOP/Dict.hs new/generics-sop-0.2.2.0/src/Generics/SOP/Dict.hs --- old/generics-sop-0.2.1.0/src/Generics/SOP/Dict.hs 2016-02-08 11:29:09.000000000 +0100 +++ new/generics-sop-0.2.2.0/src/Generics/SOP/Dict.hs 2016-07-10 08:07:10.000000000 +0200 @@ -30,20 +30,31 @@ -- second argument so that @'Dict' c@ is of the correct -- kind to be used directly as a parameter to e.g. 'NP'. -- +-- @since 0.2 +-- data Dict (c :: k -> Constraint) (a :: k) where Dict :: c a => Dict c a -- | A proof that the trivial constraint holds -- over all type-level lists. +-- +-- @since 0.2 +-- pureAll :: SListI xs => Dict (All Top) xs pureAll = all_NP (hpure Dict) -- | A proof that the trivial constraint holds -- over all type-level lists of lists. +-- +-- @since 0.2 +-- pureAll2 :: All SListI xss => Dict (All2 Top) xss pureAll2 = all_POP (hpure Dict) -- | Lifts a dictionary conversion over a type-level list. +-- +-- @since 0.2 +-- mapAll :: forall c d xs . (forall a . Dict c a -> Dict d a) -> Dict (All c) xs -> Dict (All d) xs @@ -51,6 +62,9 @@ -- | Lifts a dictionary conversion over a type-level list -- of lists. +-- +-- @since 0.2 +-- mapAll2 :: forall c d xss . (forall a . Dict c a -> Dict d a) -> Dict (All2 c) xss -> Dict (All2 d) xss @@ -59,12 +73,18 @@ -- | If two constraints 'c' and 'd' hold over a type-level -- list 'xs', then the combination of both constraints holds -- over that list. +-- +-- @since 0.2 +-- zipAll :: Dict (All c) xs -> Dict (All d) xs -> Dict (All (c `And` d)) xs zipAll dc @ Dict dd = all_NP (hzipWith (\ Dict Dict -> Dict) (unAll_NP dc) (unAll_NP dd)) -- | If two constraints 'c' and 'd' hold over a type-level -- list of lists 'xss', then the combination of both constraints -- holds over that list of lists. +-- +-- @since 0.2 +-- zipAll2 :: All SListI xss => Dict (All2 c) xss -> Dict (All2 d) xss -> Dict (All2 (c `And` d)) xss zipAll2 dc dd = all_POP (hzipWith (\ Dict Dict -> Dict) (unAll_POP dc) (unAll_POP dd)) -- TODO: I currently don't understand why the All constraint in the beginning @@ -73,17 +93,26 @@ -- | If we have a constraint 'c' that holds over a type-level -- list 'xs', we can create a product containing proofs that -- each individual list element satisfies 'c'. +-- +-- @since 0.2 +-- unAll_NP :: forall c xs . Dict (All c) xs -> NP (Dict c) xs unAll_NP Dict = hcpure (Proxy :: Proxy c) Dict -- | If we have a constraint 'c' that holds over a type-level -- list of lists 'xss', we can create a product of products -- containing proofs that all the inner elements satisfy 'c'. +-- +-- @since 0.2 +-- unAll_POP :: forall c xss . Dict (All2 c) xss -> POP (Dict c) xss unAll_POP Dict = hcpure (Proxy :: Proxy c) Dict -- | If we have a product containing proofs that each element -- of 'xs' satisfies 'c', then 'All c' holds for 'xs'. +-- +-- @since 0.2 +-- all_NP :: NP (Dict c) xs -> Dict (All c) xs all_NP Nil = Dict all_NP (Dict :* ds) = withDict (all_NP ds) Dict @@ -91,19 +120,31 @@ -- | If we have a product of products containing proofs that -- each inner element of 'xss' satisfies 'c', then 'All2 c' -- holds for 'xss'. +-- +-- @since 0.2 +-- all_POP :: SListI xss => POP (Dict c) xss -> Dict (All2 c) xss all_POP = all2 . all_NP . hmap all_NP . unPOP -- TODO: Is the constraint necessary? -- | The constraint 'All2 c' is convertible to 'All (All c)'. +-- +-- @since 0.2 +-- unAll2 :: Dict (All2 c) xss -> Dict (All (All c)) xss unAll2 Dict = Dict -- | The constraint 'All (All c)' is convertible to 'All2 c'. +-- +-- @since 0.2 +-- all2 :: Dict (All (All c)) xss -> Dict (All2 c) xss all2 Dict = Dict -- | If we have an explicit dictionary, we can unwrap it and -- pass a function that makes use of it. +-- +-- @since 0.2 +-- withDict :: Dict c a -> (c a => r) -> r withDict Dict x = x diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/generics-sop-0.2.1.0/src/Generics/SOP/NP.hs new/generics-sop-0.2.2.0/src/Generics/SOP/NP.hs --- old/generics-sop-0.2.1.0/src/Generics/SOP/NP.hs 2016-02-08 11:29:09.000000000 +0100 +++ new/generics-sop-0.2.2.0/src/Generics/SOP/NP.hs 2016-07-10 08:07:10.000000000 +0200 @@ -259,10 +259,16 @@ -- * Destructing products -- | Obtain the head of an n-ary product. +-- +-- @since 0.2.1.0 +-- hd :: NP f (x ': xs) -> f x hd (x :* _xs) = x -- | Obtain the tail of an n-ary product. +-- +-- @since 0.2.1.0 +-- tl :: NP f (x ': xs) -> NP f xs tl (_x :* xs) = xs diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/generics-sop-0.2.1.0/src/Generics/SOP/NS.hs new/generics-sop-0.2.2.0/src/Generics/SOP/NS.hs --- old/generics-sop-0.2.1.0/src/Generics/SOP/NS.hs 2016-02-08 11:29:09.000000000 +0100 +++ new/generics-sop-0.2.2.0/src/Generics/SOP/NS.hs 2016-07-10 08:07:10.000000000 +0200 @@ -5,6 +5,7 @@ ( -- * Datatypes NS(..) , SOP(..) + , unZ , unSOP -- * Constructing sums , Injection @@ -101,6 +102,22 @@ deriving instance All (Eq `Compose` f) xs => Eq (NS f xs) deriving instance (All (Eq `Compose` f) xs, All (Ord `Compose` f) xs) => Ord (NS f xs) +-- | Extract the payload from a unary sum. +-- +-- For larger sums, this function would be partial, so it is only +-- provided with a rather restrictive type. +-- +-- /Example:/ +-- +-- >>> unZ (Z (I 'x')) +-- I 'x' +-- +-- @since 0.2.2.0 +-- +unZ :: NS f '[x] -> f x +unZ (Z x) = x +unZ _ = error "inaccessible" -- needed even in GHC 8.0.1 + -- | A sum of products. -- -- This is a 'newtype' for an 'NS' of an 'NP'. The elements of the diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/generics-sop-0.2.1.0/src/Generics/SOP/Sing.hs new/generics-sop-0.2.2.0/src/Generics/SOP/Sing.hs --- old/generics-sop-0.2.1.0/src/Generics/SOP/Sing.hs 2016-02-08 11:29:09.000000000 +0100 +++ new/generics-sop-0.2.2.0/src/Generics/SOP/Sing.hs 2016-07-10 08:07:10.000000000 +0200 @@ -35,6 +35,8 @@ -- list elements; we do not require a singleton representation -- for them. -- +-- @since 0.2 +-- data SList :: [k] -> * where SNil :: SList '[] SCons :: SListI xs => SList (x ': xs) @@ -52,6 +54,8 @@ -- The class 'SListI' should have instances that match the -- constructors of 'SList'. -- +-- @since 0.2 +-- class SListI (xs :: [k]) where -- | Get hold of the explicit singleton (that one can then -- pattern match on). @@ -97,6 +101,9 @@ SCons -> ShapeCons shape -- | The length of a type-level list. +-- +-- @since 0.2 +-- lengthSList :: forall (xs :: [k]) proxy. SListI xs => proxy xs -> Int lengthSList _ = lengthShape (shape :: Shape xs) where diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/generics-sop-0.2.1.0/src/Generics/SOP/TH.hs new/generics-sop-0.2.2.0/src/Generics/SOP/TH.hs --- old/generics-sop-0.2.1.0/src/Generics/SOP/TH.hs 2016-02-08 11:29:09.000000000 +0100 +++ new/generics-sop-0.2.2.0/src/Generics/SOP/TH.hs 2016-07-10 08:07:10.000000000 +0200 @@ -90,6 +90,8 @@ -- > toTree (SOP (S (Z (I l :* I r :* Nil)))) = Node l r -- > toTree _ = error "unreachable" -- to avoid GHC warnings -- +-- @since 0.2 +-- deriveGenericFunctions :: Name -> String -> String -> String -> Q [Dec] deriveGenericFunctions n codeName fromName toName = do let codeName' = mkName codeName @@ -120,6 +122,9 @@ -- > (Constructor "Leaf" :* Constructor "Node" :* Nil) -- -- /Note:/ CodeType need to be derived with 'deriveGenericFunctions'. +-- +-- @since 0.2 +-- deriveMetadataValue :: Name -> String -> String -> Q [Dec] deriveMetadataValue n codeName datatypeInfoName = do let codeName' = mkName codeName diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/generics-sop-0.2.1.0/src/Generics/SOP.hs new/generics-sop-0.2.2.0/src/Generics/SOP.hs --- old/generics-sop-0.2.1.0/src/Generics/SOP.hs 2016-02-08 11:29:09.000000000 +0100 +++ new/generics-sop-0.2.2.0/src/Generics/SOP.hs 2016-07-10 08:07:10.000000000 +0200 @@ -52,7 +52,7 @@ -- -- To create 'Generic' instances for @A@ and @B@ via "GHC.Generics", we say -- --- > {-# LANGUAGE DeriveGenerics #-} +-- > {-# LANGUAGE DeriveGeneric #-} -- > -- > import qualified GHC.Generics as GHC -- > import Generics.SOP @@ -221,6 +221,7 @@ -- * n-ary datatypes , NP(..) , NS(..) + , unZ , SOP(..) , unSOP , POP(..)
participants (1)
-
root@hilbert.suse.de