Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package ghc-lucid for openSUSE:Factory 
checked in at 2021-12-19 17:34:13
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/ghc-lucid (Old)
 and      /work/SRC/openSUSE:Factory/.ghc-lucid.new.2520 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "ghc-lucid"

Sun Dec 19 17:34:13 2021 rev:7 rq:932795 version:2.11.0

Changes:
--------
--- /work/SRC/openSUSE:Factory/ghc-lucid/ghc-lucid.changes      2021-11-11 
21:38:28.688978627 +0100
+++ /work/SRC/openSUSE:Factory/.ghc-lucid.new.2520/ghc-lucid.changes    
2021-12-19 17:34:15.704257554 +0100
@@ -1,0 +2,10 @@
+Wed Nov 10 10:02:26 UTC 2021 - [email protected]
+
+- Update lucid to version 2.11.0 revision 1.
+  ## 2.11.0
+
+  * Change internal attributes to `Seq Attribute`. This preserves
+    ordering. Attributes are merged in a left-biased way, preserving the
+    key order as first encountered.
+
+-------------------------------------------------------------------

Old:
----
  lucid-2.10.0.tar.gz

New:
----
  lucid-2.11.0.tar.gz
  lucid.cabal

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ ghc-lucid.spec ++++++
--- /var/tmp/diff_new_pack.zxjV5t/_old  2021-12-19 17:34:17.064258512 +0100
+++ /var/tmp/diff_new_pack.zxjV5t/_new  2021-12-19 17:34:17.072258517 +0100
@@ -19,12 +19,13 @@
 %global pkg_name lucid
 %bcond_with tests
 Name:           ghc-%{pkg_name}
-Version:        2.10.0
+Version:        2.11.0
 Release:        0
 Summary:        Clear to write, read and edit DSL for HTML
 License:        BSD-3-Clause
 URL:            https://hackage.haskell.org/package/%{pkg_name}
 Source0:        
https://hackage.haskell.org/package/%{pkg_name}-%{version}/%{pkg_name}-%{version}.tar.gz
+Source1:        
https://hackage.haskell.org/package/%{pkg_name}-%{version}/revision/1.cabal#/%{pkg_name}.cabal
 BuildRequires:  ghc-Cabal-devel
 BuildRequires:  ghc-blaze-builder-devel
 BuildRequires:  ghc-bytestring-devel
@@ -69,6 +70,7 @@
 
 %prep
 %autosetup -n %{pkg_name}-%{version}
+cp -p %{SOURCE1} %{pkg_name}.cabal
 
 %build
 %ghc_lib_build

++++++ lucid-2.10.0.tar.gz -> lucid-2.11.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lucid-2.10.0/CHANGELOG.md 
new/lucid-2.11.0/CHANGELOG.md
--- old/lucid-2.10.0/CHANGELOG.md       2021-10-17 16:14:14.000000000 +0200
+++ new/lucid-2.11.0/CHANGELOG.md       2021-11-09 16:50:11.000000000 +0100
@@ -1,3 +1,9 @@
+## 2.11.0
+
+* Change internal attributes to `Seq Attribute`. This preserves
+  ordering. Attributes are merged in a left-biased way, preserving the
+  key order as first encountered.
+
 ## 2.9.13
 
 * Change internal attributes representation from HashMap to Map. This
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lucid-2.10.0/lucid.cabal new/lucid-2.11.0/lucid.cabal
--- old/lucid-2.10.0/lucid.cabal        2021-10-18 10:30:56.000000000 +0200
+++ new/lucid-2.11.0/lucid.cabal        2021-11-09 16:50:26.000000000 +0100
@@ -1,5 +1,5 @@
 name:                lucid
-version:             2.10.0
+version:             2.11.0
 synopsis:            Clear to write, read and edit DSL for HTML
 description:
   Clear to write, read and edit DSL for HTML.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lucid-2.10.0/src/Lucid/Base.hs 
new/lucid-2.11.0/src/Lucid/Base.hs
--- old/lucid-2.10.0/src/Lucid/Base.hs  2021-10-17 16:11:19.000000000 +0200
+++ new/lucid-2.11.0/src/Lucid/Base.hs  2021-11-09 16:50:11.000000000 +0100
@@ -1,4 +1,5 @@
 {-# LANGUAGE CPP #-}
+{-# LANGUAGE BangPatterns #-}
 {-# LANGUAGE FunctionalDependencies #-}
 {-# LANGUAGE FlexibleInstances #-}
 {-# LANGUAGE MultiParamTypeClasses #-}
@@ -53,7 +54,6 @@
 import qualified Data.ByteString.Lazy as L
 import qualified Data.ByteString as S
 import           Data.Functor.Identity
-import           Data.Map.Strict (Map)
 import qualified Data.Map.Strict as M
 import           Data.Hashable (Hashable(..))
 import           Data.Semigroup (Semigroup (..))
@@ -65,11 +65,18 @@
 import qualified Data.Text.Encoding as T
 import           Data.Typeable (Typeable)
 import           Prelude
+import           Data.Maybe
+import           Data.Sequence (Seq)
+import qualified Data.Sequence as Seq
+import           Data.Foldable (toList)
+import qualified Data.Set as Set
 
 
--------------------------------------------------------------------------------
 -- Types
 
--- | A simple attribute. Don't use the constructor, use 'makeAttribute'.
+-- | A simple attribute. Don't use the constructor, use
+-- 'makeAttribute'.  Attributes are case sensitive, so if you want
+-- attributes to be merged properly, use a single case representation.
 data Attribute = Attribute !Text !Text
   deriving (Show,Eq,Typeable)
 
@@ -85,8 +92,11 @@
 
 -- | A monad transformer that generates HTML. Use the simpler 'Html'
 -- type if you don't want to transform over some other monad.
+--
+-- Don't rely on the internal representation of this type. Use the
+-- monad and functor classes.
 newtype HtmlT m a =
-  HtmlT {runHtmlT :: m (Map Text Text -> Builder,a)
+  HtmlT {runHtmlT :: m (Seq Attribute -> Builder,a)
          -- ^ This is the low-level way to run the HTML transformer,
          -- finally returning an element builder and a value. You can
          -- pass 'mempty' for this argument for a top-level call. See
@@ -342,21 +352,15 @@
 instance (Functor m) => With (HtmlT m a) where
   with f = \attr -> HtmlT (mk attr <$> runHtmlT f)
     where
-      mk attr ~(f',a) = (\attr' -> f' (unionArgs (M.fromListWith (<>) (map 
toPair attr)) attr')
+      mk attr ~(f',a) = (\attr' -> f' (attr' <> Seq.fromList attr)
                         ,a)
-      toPair (Attribute x y) = (x,y)
 
 -- | For the contentful elements: 'Lucid.Html5.div_'
 instance (Functor m) => With (HtmlT m a -> HtmlT m a) where
   with f = \attr inner -> HtmlT (mk attr <$> runHtmlT (f inner))
     where
-      mk attr ~(f',a) = (\attr' -> f' (unionArgs (M.fromListWith (<>) (map 
toPair attr)) attr')
+      mk attr ~(f',a) = (\attr' -> f' (attr' <> Seq.fromList attr)
                         ,a)
-      toPair (Attribute x y) = (x,y)
-
--- | Union two sets of arguments and append duplicate keys.
-unionArgs :: Map Text Text -> Map Text Text -> Map Text Text
-unionArgs = M.unionWith (<>)
 
 
--------------------------------------------------------------------------------
 -- Running
@@ -529,8 +533,27 @@
      else s "=\"" <> Blaze.fromHtmlEscapedText val <> s "\""
 
 -- | Folding and monoidally appending attributes.
-foldlMapWithKey :: Monoid m => (k -> v -> m) -> Map k v -> m
-foldlMapWithKey f = M.foldlWithKey' (\m k v -> m `mappend` f k v) mempty
+foldlMapWithKey :: (Text -> Text -> Builder) -> Seq Attribute -> Builder
+foldlMapWithKey f attributes =
+  case nubOrdMaybe (map fst pairs) of
+    Just keyList ->
+      foldMap (\k -> fromMaybe mempty (fmap (f k) (M.lookup k values))) keyList
+      where values = M.fromListWith (<>) pairs
+    Nothing -> foldMap (\(Attribute k v) -> f k v) attributes
+  where
+    pairs = map (\(Attribute k v) -> (k,v)) (toList attributes)
+
+-- | Do a nubOrd, but only return Maybe if it actually removes anything.
+nubOrdMaybe :: Ord a => [a] -> Maybe [a]
+nubOrdMaybe = go False Set.empty []
+  where
+    go (!removed) set acc (x:xs)
+      | x `Set.member` set = go True set acc xs
+      | otherwise = go removed (Set.insert x set) (x : acc) xs
+    go removed _set acc [] =
+      if removed
+        then pure (reverse acc)
+        else Nothing
 
 -- | Convenience function for constructing builders.
 s :: String -> Builder
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lucid-2.10.0/test/Main.hs 
new/lucid-2.11.0/test/Main.hs
--- old/lucid-2.10.0/test/Main.hs       2021-05-19 23:27:44.000000000 +0200
+++ new/lucid-2.11.0/test/Main.hs       2021-11-09 16:50:11.000000000 +0100
@@ -193,7 +193,7 @@
          "<div class=\" container \">Foo!</div>")
      it "bootstrap-attributes-extended" $
         renderText (container_ [class_ "bar",id_ "zot"] "Foo!") ==?*
-        [ "<div id=\"zot\" class=\" container bar\">Foo!</div>"
+        [ "<div class=\" container bar\" id=\"zot\">Foo!</div>"
         , "<div class=\" container bar\" id=\"zot\">Foo!</div>"
         ]
 

++++++ lucid.cabal ++++++
name:                lucid
version:             2.11.0
x-revision: 1
synopsis:            Clear to write, read and edit DSL for HTML
description:
  Clear to write, read and edit DSL for HTML.
  .
  * Names are consistent, and do not conflict with base or are keywords (all 
have suffix @_@)
  .
  * Same combinator can be used for attributes and elements (e.g. 'style_')
  .
  * For more, read <https://chrisdone.com/posts/lucid the blog post>
  .
  See the "Lucid" module for more documentation.
homepage:            https://github.com/chrisdone/lucid
license:             BSD3
license-file:        LICENSE
author:              Chris Done
maintainer:          [email protected], [email protected]
copyright:           2014-2017 Chris Done
category:            Web
build-type:          Simple
cabal-version:       >=1.10
extra-source-files:  README.md, CHANGELOG.md
tested-with:         
GHC==7.10.3,GHC==8.0.2,GHC==8.2.2,GHC==8.4.4,GHC==8.6.5,GHC==8.8.4,GHC==8.10.4,GHC==9.0.1

library
  default-language:  Haskell2010
  hs-source-dirs:    src/
  ghc-options:       -Wall -O2
  exposed-modules:   Lucid
                     Lucid.Base
                     Lucid.Html5
                     Lucid.Bootstrap

  -- GHC boot libraries
  build-depends:     base                   >=4.8      && <4.17
                   , bytestring             >=0.10.6.0
                   , containers             >=0.5.6.2
                   , transformers           >=0.4.2.0

  -- GHC boot libraries since 8.4.
  build-depends:     mtl                    >=2.2
                   , text                   >=1.2.0.2

  -- compat packages
  if !impl(ghc >= 8.0)
    build-depends:   semigroups            >=0.16.1

  -- other dependencies
  build-depends:     blaze-builder         >=0.4.0.0
                   , hashable              >=1.2.3.2
                   , mmorph                >=1.0.3
                   , unordered-containers  >=0.2.5.1

source-repository head
  type:     git
  location: https://github.com/chrisdone/lucid.git

test-suite test
    default-language: Haskell2010
    type: exitcode-stdio-1.0
    main-is: Main.hs
    hs-source-dirs: test
    other-modules: Example1
    build-depends: base,
                   lucid,
                   HUnit,
                   hspec,
                   parsec,
                   bifunctors,
                   text,
                   mtl

benchmark bench
  default-language: Haskell2010
  type:             exitcode-stdio-1.0
  hs-source-dirs:   benchmarks
  main-is:          Main.hs
  other-modules:    HtmlBenchmarks
  build-depends:    base,
                    deepseq,
                    criterion,
                    blaze-builder,
                    text,
                    bytestring,
                    lucid
  ghc-options:      -O2

benchmark bench-io
  default-language: Haskell2010
  type:             exitcode-stdio-1.0
  hs-source-dirs:   benchmarks
  main-is:          IO.hs
  build-depends:    base,
                    criterion,
                    transformers,
                    text,
                    lucid
  ghc-options:      -O2

Reply via email to