Hello community, here is the log from the commit of package ghc-lucid for openSUSE:Factory checked in at 2016-11-10 13:24:37 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/ghc-lucid (Old) and /work/SRC/openSUSE:Factory/.ghc-lucid.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ghc-lucid" Changes: -------- --- /work/SRC/openSUSE:Factory/ghc-lucid/ghc-lucid.changes 2016-11-02 12:34:37.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.ghc-lucid.new/ghc-lucid.changes 2016-11-10 13:24:39.000000000 +0100 @@ -1,0 +2,5 @@ +Thu Sep 15 07:03:45 UTC 2016 - psim...@suse.com + +- Update to version 2.9.6 revision 0 with cabal2obs. + +------------------------------------------------------------------- Old: ---- lucid-2.9.5.tar.gz New: ---- lucid-2.9.6.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ ghc-lucid.spec ++++++ --- /var/tmp/diff_new_pack.RmVCGH/_old 2016-11-10 13:24:40.000000000 +0100 +++ /var/tmp/diff_new_pack.RmVCGH/_new 2016-11-10 13:24:40.000000000 +0100 @@ -19,15 +19,14 @@ %global pkg_name lucid %bcond_with tests Name: ghc-%{pkg_name} -Version: 2.9.5 +Version: 2.9.6 Release: 0 Summary: Clear to write, read and edit DSL for HTML License: BSD-3-Clause -Group: System/Libraries +Group: Development/Languages/Other Url: https://hackage.haskell.org/package/%{pkg_name} Source0: https://hackage.haskell.org/package/%{pkg_name}-%{version}/%{pkg_name}-%{version}.tar.gz BuildRequires: ghc-Cabal-devel -# Begin cabal-rpm deps: BuildRequires: ghc-blaze-builder-devel BuildRequires: ghc-bytestring-devel BuildRequires: ghc-containers-devel @@ -45,7 +44,6 @@ BuildRequires: ghc-hspec-devel BuildRequires: ghc-parsec-devel %endif -# End cabal-rpm deps %description Clear to write, read and edit DSL for HTML. See the 'Lucid' module for @@ -65,20 +63,14 @@ %prep %setup -q -n %{pkg_name}-%{version} - %build %ghc_lib_build - %install %ghc_lib_install - %check -%if %{with tests} -%{cabal} test -%endif - +%cabal_test %post devel %ghc_pkg_recache ++++++ lucid-2.9.5.tar.gz -> lucid-2.9.6.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lucid-2.9.5/CHANGELOG.md new/lucid-2.9.6/CHANGELOG.md --- old/lucid-2.9.5/CHANGELOG.md 2016-03-07 09:46:01.000000000 +0100 +++ new/lucid-2.9.6/CHANGELOG.md 2016-09-02 11:49:27.000000000 +0200 @@ -1,3 +1,9 @@ +## 2.9.6 + +* Fix compilation of benchmarks +* Add @athanclark's version of relaxHtmlT +* Add a utility to generalize the underlying monad from Identity + ## 2.9.5 * Add ToHtml instance for ByteString (both) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lucid-2.9.5/README.md new/lucid-2.9.6/README.md --- old/lucid-2.9.5/README.md 2015-11-05 20:49:29.000000000 +0100 +++ new/lucid-2.9.6/README.md 2016-09-02 11:50:06.000000000 +0200 @@ -1,4 +1,4 @@ -lucid [![Hackage](https://img.shields.io/hackage/v/lucid.svg?style=flat)](https://hackage.haskell.org/package/lucid) +lucid [![Hackage](https://img.shields.io/hackage/v/lucid.svg?style=flat)](https://hackage.haskell.org/package/lucid) [![Build Status](https://travis-ci.org/chrisdone/lucid.png)](https://travis-ci.org/chrisdone/lucid) ===== Clear to write, read and edit DSL for writing HTML diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lucid-2.9.5/benchmarks/HtmlBenchmarks.hs new/lucid-2.9.6/benchmarks/HtmlBenchmarks.hs --- old/lucid-2.9.5/benchmarks/HtmlBenchmarks.hs 1970-01-01 01:00:00.000000000 +0100 +++ new/lucid-2.9.6/benchmarks/HtmlBenchmarks.hs 2015-11-05 20:49:29.000000000 +0100 @@ -0,0 +1,135 @@ +-- | This is a collection of HTML benchmarks for BlazeMarkup. + +-- +{-# LANGUAGE ExtendedDefaultRules #-} +{-# LANGUAGE OverloadedStrings, ExistentialQuantification #-} +{-# OPTIONS_GHC -fno-warn-unused-do-bind #-} +module HtmlBenchmarks where + +import Data.Monoid (Monoid,mappend,mempty) +import qualified Data.Text as T +-- import qualified Data.Text.Lazy.Builder as B + +import qualified Prelude as P +import Prelude hiding (div, id) +import Data.String + +-- import BenchmarkUtils +import Lucid +import Lucid.Base +-- import qualified BenchmarkUtils as H + +-- | Description of an HTML benchmark +-- +data HtmlBenchmark = forall a. HtmlBenchmark + String -- ^ Name. + (a -> Html ()) -- ^ Rendering function. + a -- ^ Data. + (Html ()) -- ^ Longer description. + +-- | List containing all benchmarks. +-- +benchmarks :: [HtmlBenchmark] +benchmarks = + [ HtmlBenchmark "bigTable" bigTable bigTableData $ + let h = toHtml $ show $ length bigTableData + w = toHtml $ show $ length $ P.head bigTableData + in "Rendering of a big (" >> h >> "x" >> w >> ") HTML table" + , HtmlBenchmark "basic" basic basicData + "A simple, small basic template with a few holes to fill in" + , HtmlBenchmark "wideTree" wideTree wideTreeData $ + "A very wide tree (" >> toHtml (show (length wideTreeData)) >> " elements)" + , HtmlBenchmark "wideTreeEscaping" wideTree wideTreeEscapingData $ do + "A very wide tree (" >> toHtml (show (length wideTreeData)) >> " elements)" + " with lots of escaping" + , HtmlBenchmark "deepTree" deepTree deepTreeData $ do + "A really deep tree (" >> toHtml (show deepTreeData) >> " nested templates)" + , HtmlBenchmark "manyAttributes" manyAttributes manyAttributesData $ do + "A single element with " >> toHtml (show (length manyAttributesData)) + " attributes." + , HtmlBenchmark "customAttribute" customAttributes customAttributesData $ + "Creating custom attributes" + ] + +rows :: Int +rows = 1000 + +bigTableData :: [[Int]] +bigTableData = replicate rows [1..10] +{-# NOINLINE bigTableData #-} + +basicData :: (String, String, [String]) +basicData = ("Just a test", "joe", items) +{-# NOINLINE basicData #-} + +items :: [String] +items = map (("Number " `mappend`) . show) [1 :: Int .. 14] +{-# NOINLINE items #-} + +wideTreeData :: [String] +wideTreeData = take 5000 $ + cycle ["λf.(λx.fxx)(λx.fxx)", "These old days", "Foobar", "lol", "x ∈ A"] +{-# NOINLINE wideTreeData #-} + +wideTreeEscapingData :: [String] +wideTreeEscapingData = take 1000 $ + cycle ["<><>", "\"lol\"", "<&>", "'>>'"] +{-# NOINLINE wideTreeEscapingData #-} + +deepTreeData :: Int +deepTreeData = 1000 +{-# NOINLINE deepTreeData #-} + +manyAttributesData :: [String] +manyAttributesData = wideTreeData + +customAttributesData :: [(String, String)] +customAttributesData = zip wideTreeData wideTreeData + +-- | Render the argument matrix as an HTML table. +-- +bigTable :: [[Int]] -- ^ Matrix. + -> Html () -- ^ Result. +bigTable t = table_ (mapM_ row t) + +row :: [Int] -> Html () +row r = tr_ (mapM_ (td_ . toHtml . show) r) + +-- | Render a simple HTML page with some data. +-- +basic :: (String, String, [String]) -- ^ (Title, User, Items) + -> Html () -- ^ Result. +basic (title', user, items') = html_ $ do + head_ $ title_ $ toHtml title' + body_ $ do + with div_ [id_ "header"] $ (h1_ $ toHtml title') + p_ $ do "Hello, "; toHtml user; "!" + p_ $ "Hello, me!" + p_ $ "Hello, world!" + h2_ $ "loop" + ol_ $ mapM_ (li_ . toHtml) items' + with div_ [id_ "footer"] mempty + +-- | A benchmark producing a very wide but very shallow tree. +-- +wideTree :: [String] -- ^ Text to create a tree from. + -> Html () -- ^ Result. +wideTree = div_ . mapM_ ((with p_ [id_ "foo"]) . toHtml) + +-- | Create a very deep tree. +-- +deepTree :: Int -- ^ Depth of the tree. + -> Html () -- ^ Result. +deepTree 0 = "foo" +deepTree n = p_ $ table_ $ tr_ $ td_ $ div_ $ deepTree (n - 1) + +-- | Create an element with many attributes. +-- +manyAttributes :: [String] -- ^ List of attribute values. + -> Html () -- ^ Result. +manyAttributes as = img_ (map (id_ . T.pack) as) + +customAttributes :: [(String, String)] -- ^ List of attribute name, value pairs + -> Html () -- ^ Result +customAttributes xs = + img_ (map (\(key,val) -> makeAttribute (fromString key) (T.pack val)) xs) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lucid-2.9.5/lucid.cabal new/lucid-2.9.6/lucid.cabal --- old/lucid-2.9.5/lucid.cabal 2016-03-07 09:46:03.000000000 +0100 +++ new/lucid-2.9.6/lucid.cabal 2016-09-02 11:49:34.000000000 +0200 @@ -1,5 +1,5 @@ name: lucid -version: 2.9.5 +version: 2.9.6 synopsis: Clear to write, read and edit DSL for HTML description: Clear to write, read and edit DSL for HTML. See the 'Lucid' module for description and documentation. @@ -51,6 +51,7 @@ type: exitcode-stdio-1.0 hs-source-dirs: benchmarks main-is: Main.hs + other-modules: HtmlBenchmarks build-depends: base, deepseq, criterion, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lucid-2.9.5/src/Lucid/Base.hs new/lucid-2.9.6/src/Lucid/Base.hs --- old/lucid-2.9.5/src/Lucid/Base.hs 2016-03-07 09:45:20.000000000 +0100 +++ new/lucid-2.9.6/src/Lucid/Base.hs 2016-03-07 09:54:39.000000000 +0100 @@ -18,6 +18,7 @@ ,execHtmlT ,evalHtmlT ,runHtmlT + ,relaxHtmlT -- * Combinators ,makeElement ,makeElementNoEnd @@ -344,6 +345,19 @@ do (f,_) <- runHtmlT m return (f mempty) +-- | Generalize the underlying monad. +-- +-- Some builders are happy to deliver results in a pure underlying +-- monad, here 'Identity', but have trouble maintaining the polymorphic +-- type. This utility generalizes from 'Identity'. +relaxHtmlT :: Monad m + => HtmlT Identity a -- ^ The HTML generated purely. + -> HtmlT m a -- ^ Same HTML accessible in a polymorphic context. +relaxHtmlT = hoist go + where + go :: Monad m => Identity a -> m a + go = return . runIdentity + -- | Evaluate the HTML to its return value. Analogous to @evalState@. -- -- Use this if you want to ignore the HTML output of an action