Hello community, here is the log from the commit of package ghc-glaze for openSUSE:Factory checked in at 2017-08-31 20:51:10 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/ghc-glaze (Old) and /work/SRC/openSUSE:Factory/.ghc-glaze.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "ghc-glaze" Thu Aug 31 20:51:10 2017 rev:2 rq:513255 version:0.3.0.1 Changes: -------- --- /work/SRC/openSUSE:Factory/ghc-glaze/ghc-glaze.changes 2017-04-14 13:35:19.395723891 +0200 +++ /work/SRC/openSUSE:Factory/.ghc-glaze.new/ghc-glaze.changes 2017-08-31 20:51:11.771810395 +0200 @@ -1,0 +2,5 @@ +Thu Jul 27 14:06:59 UTC 2017 - psimons@suse.com + +- Update to version 0.3.0.1. + +------------------------------------------------------------------- Old: ---- glaze-0.2.0.2.tar.gz New: ---- glaze-0.3.0.1.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ ghc-glaze.spec ++++++ --- /var/tmp/diff_new_pack.Ec4o7D/_old 2017-08-31 20:51:12.655686324 +0200 +++ /var/tmp/diff_new_pack.Ec4o7D/_new 2017-08-31 20:51:12.659685763 +0200 @@ -18,7 +18,7 @@ %global pkg_name glaze Name: ghc-%{pkg_name} -Version: 0.2.0.2 +Version: 0.3.0.1 Release: 0 Summary: Framework for rendering things with metadata/headers and values License: BSD-3-Clause ++++++ glaze-0.2.0.2.tar.gz -> glaze-0.3.0.1.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/glaze-0.2.0.2/LICENSE new/glaze-0.3.0.1/LICENSE --- old/glaze-0.2.0.2/LICENSE 2016-12-28 09:42:35.000000000 +0100 +++ new/glaze-0.3.0.1/LICENSE 2017-03-06 21:31:21.000000000 +0100 @@ -1,4 +1,4 @@ -Copyright Author name here (c) 2016 +Copyright Louis Pan (c) 2016 All rights reserved. @@ -13,7 +13,7 @@ disclaimer in the documentation and/or other materials provided with the distribution. - * Neither the name of Author name here nor the names of other + * Neither the name of Louis Pan nor the names of other contributors may be used to endorse or promote products derived from this software without specific prior written permission. @@ -27,4 +27,4 @@ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/glaze-0.2.0.2/glaze.cabal new/glaze-0.3.0.1/glaze.cabal --- old/glaze-0.2.0.2/glaze.cabal 2017-01-29 13:37:58.000000000 +0100 +++ new/glaze-0.3.0.1/glaze.cabal 2017-03-06 21:37:24.000000000 +0100 @@ -1,5 +1,5 @@ name: glaze -version: 0.2.0.2 +version: 0.3.0.1 synopsis: Framework for rendering things with metadata/headers and values description: Please see README.md homepage: https://github.com/louispan/glaze#readme diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/glaze-0.2.0.2/src/Glaze.hs new/glaze-0.3.0.1/src/Glaze.hs --- old/glaze-0.2.0.2/src/Glaze.hs 2017-01-29 13:39:27.000000000 +0100 +++ new/glaze-0.3.0.1/src/Glaze.hs 2017-02-15 11:51:01.000000000 +0100 @@ -1,9 +1,6 @@ {-# LANGUAGE DeriveFunctor #-} -{-# LANGUAGE FlexibleInstances #-} -{-# LANGUAGE FunctionalDependencies #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE RankNTypes #-} -{-# LANGUAGE TemplateHaskell #-} -- | Framework for rendering things (or list of things, or things that contain things) that have metadata/header information as well as values. module Glaze where @@ -13,98 +10,85 @@ -- | Glaze is something that knows how to render some header information -- and given a value, how to render the value. --- Ie, the value has been glaze with meta information. +-- Ie, the value has been glazeed with meta information. data Glaze a r = Glaze - { glazeRenderedMeta :: r - , glazeValueRenderer :: a -> r - } deriving Functor - --- makeFields ''Glaze --- Manually pasting the splices to get around haddock bug -class HasRenderedMeta s a | s -> a where - renderedMeta :: Lens' s a - -instance HasRenderedMeta (Glaze a r) r where - {-# INLINE renderedMeta #-} - renderedMeta f (Glaze x1 x2) - = fmap (\y1 -> Glaze y1 x2) (f x1) - -class HasValueRenderer s a | s -> a where - valueRenderer :: Lens' s a - -instance HasValueRenderer (Glaze a r) (a -> r) where - {-# INLINE valueRenderer #-} - valueRenderer f (Glaze x1 x2) - = fmap (\y1 -> Glaze x1 y1) (f x2) + { renderedMeta :: r + , valueRenderer :: a -> r + } deriving (Functor) +-- FIXME: is this lawful? instance Applicative (Glaze a) where pure a = Glaze a (const a) x <*> y = Glaze - ((x ^. renderedMeta) (y ^. renderedMeta)) - (\a -> (x ^. valueRenderer) a ((y ^. valueRenderer) a)) + (renderedMeta x $ renderedMeta y) + (\a -> valueRenderer x a $ valueRenderer y a) -- | Given a wrapping function for the meta and renderer value, -- and Glaze instructions for a, run them all together. -renderWith :: (r -> r -> b) -> Glaze a r -> a -> b -renderWith mainWrapper rdr a = - mainWrapper (rdr ^. renderedMeta) ((rdr ^. valueRenderer) a) +unglazeWith :: (r -> r -> b) -> Glaze a r -> a -> b +unglazeWith mainWrapper rdr a = + mainWrapper (renderedMeta rdr) (valueRenderer rdr a) -- | Lifts glazing function into an Applicative -glazeA :: - (Traversable t, Applicative m) => - (wrapper -> meta -> t rs -> r) -> m wrapper -> m meta -> t (m rs) -> m r -glazeA f wrapper meta rs = f <$> wrapper <*> meta <*> sequenceA rs +-- This is used to transform functions like 'glazeList' into 'glazeListA' +glazedA + :: (Traversable t, Applicative m) + => (wrapper -> meta -> t rs -> r) -> m wrapper -> m meta -> t (m rs) -> m r +glazedA f wrapper meta rs = f <$> wrapper <*> meta <*> sequenceA rs -- | This can be used to make a Glaze for a list of things to render as a table. -- Given (mainWrapper :: rows -> final render, headerRowWrapper:: fields -> header row, valueRowWrapper -> value row) --- the rendered meta, and a list of @Glaze a@, transform it to a Glaze for a list of as. -glazeList :: ([row] -> r, [field] -> row, [field] -> row) - -> r - -> [Glaze a field] - -> Glaze [a] r +-- the rendered meta, and a list of @Glaze a@ columns to use, transform it to a Glaze for a list of as. +glazeList :: ([row] -> r, [field] -> row, [field] -> row) -- how to merge subresults + -> r -- meta for the final glaze + -> [Glaze a field] -- descriptions of columns to use + -> Glaze [a] r -- know how to render list of as. glazeList (mainWrapper, headerRowWrapper, valueRowWrapper) meta rs = Glaze meta glazeList' where - rs' = sequenceA rs - glazeList' as = - mainWrapper $ - headerRowWrapper (rs' ^. renderedMeta) : - (valueRowWrapper . view valueRenderer rs' <$> as) + -- rs' :: Glaze a [field] + rs' = sequenceA rs + glazeList' as = + mainWrapper $ + headerRowWrapper (renderedMeta rs') : + (valueRowWrapper . valueRenderer rs' <$> as) -- | Applicative version of glazeList -glazeListA :: - Applicative f => - f ([row] -> r, [field] -> row, [field] -> row) - -> f r -> [f (Glaze a field)] -> f (Glaze [a] r) -glazeListA = glazeA glazeList +glazeListA + :: Applicative f + => f ([row] -> r, [field] -> row, [field] -> row) + -> f r + -> [f (Glaze a field)] + -> f (Glaze [a] r) +glazeListA = glazedA glazeList -- | This can be used to generate a Glaze for a larger supercomponent. -- Given (wrapper :: list of (meta, rendered value) to final render) --- the rendered meta, and a list of @Glaze a@, transform it to a Glaze for a single a. +-- the rendered meta, and a list of @Glaze a@ field to use, transform it to a Glaze for a single a. -- In this case, use 'reglaze' to generate @Glaze a@ for each subcomponent to use as the list of @Glaze a@ -glazeFields :: ([(b, b)] -> r) -> r -> [Glaze a b] -> Glaze a r +glazeFields :: ([(b, b)] -> r) -- how to merge results + -> r -- meta for this glaze + -> [Glaze a b] -- description of sub components to use + -> Glaze a r -- know how to render the composite a glazeFields wrapper meta rs = - Glaze meta (\a -> wrapper $ (\r -> (r ^. renderedMeta, (r ^. valueRenderer) a)) <$> rs) + Glaze meta (\a -> wrapper $ (\r -> (renderedMeta r, valueRenderer r a)) <$> rs) -- | Applicative versino of glazeFields -glazeFieldsA :: - Applicative f => - f ([(b, b)] -> r) -> f r -> [f (Glaze a b)] -> f (Glaze a r) -glazeFieldsA = glazeA glazeFields +glazeFieldsA + :: Applicative f + => f ([(b, b)] -> r) -> f r -> [f (Glaze a b)] -> f (Glaze a r) +glazeFieldsA = glazedA glazeFields -- | Makes a glaze of the type of a larger component, but only using -- the information of a smaller component. --- Given a factory function that can create glazes from Proxy a --- and a Lens into subcomponent a, create the glaze of the type of the larger component. -reglaze :: (Proxy a -> Glaze a r) -> Getter s a -> Glaze s r -reglaze f lns = Glaze - (rdr ^. renderedMeta) - (\s -> (rdr ^. valueRenderer) (s ^. lns)) - where - rdr = f (Proxy :: Proxy a) +-- Given a Glaze and Lens into subcomponent a, create the glaze of the type of the larger component. +reglaze :: Glaze a r -> Getter s a -> Glaze s r +reglaze rdr lns = Glaze + (renderedMeta rdr) + (\s -> valueRenderer rdr (s ^. lns)) -- | Applicative version of reglaze -reglazeA :: Applicative f => (Proxy a -> f (Glaze a r)) -> Getter s a -> f (Glaze s r) -reglazeA f lns = (\rdr -> Glaze - (rdr ^. renderedMeta) - (\s -> (rdr ^. valueRenderer) (s ^. lns))) <$> f (Proxy :: Proxy a) +reglazeA :: Applicative f => f (Glaze a r) -> Getter s a -> f (Glaze s r) +reglazeA rdr lns = (\rdr' -> Glaze + (renderedMeta rdr') + (\s -> valueRenderer rdr' (s ^. lns))) <$> rdr