summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrentYorgey <>2018-05-10 03:09:00 (GMT)
committerhdiff <hdiff@hdiff.luite.com>2018-05-10 03:09:00 (GMT)
commit5f0ac3da223c66da3b2e3a0cb14dc2ebd176e9ec (patch)
treef1c39152acea2b27d34cbae399af014188039001
parent788d324f27e92520e9c42d1319e60844da64543c (diff)
version 0.1.1HEAD0.1.1master
-rw-r--r--src/Graphics/Svg/Core.hs15
-rw-r--r--svg-builder.cabal12
2 files changed, 21 insertions, 6 deletions
diff --git a/src/Graphics/Svg/Core.hs b/src/Graphics/Svg/Core.hs
index 4a8fa9a..64a8e03 100644
--- a/src/Graphics/Svg/Core.hs
+++ b/src/Graphics/Svg/Core.hs
@@ -1,3 +1,4 @@
+{-# LANGUAGE CPP #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TypeFamilies #-}
@@ -39,7 +40,10 @@ import Data.ByteString.Lazy (ByteString)
import Data.Hashable (Hashable(..))
import Data.HashMap.Strict (HashMap)
import qualified Data.HashMap.Strict as M
-import Data.Monoid
+#if !MIN_VERSION_base(4,8,0)
+import Data.Monoid (Monoid(..))
+#endif
+import Data.Semigroup (Semigroup(..))
import Data.String
import Data.Text (Text)
import qualified Data.Text.Lazy as LT
@@ -61,9 +65,14 @@ newtype Element = Element (HashMap Text Text -> Builder)
instance Show Element where
show e = LT.unpack . renderText $ e
+instance Semigroup Element where
+ Element e1 <> Element e2 = Element (e1 <> e2)
+
instance Monoid Element where
mempty = Element mempty
- mappend (Element e1) (Element e2) = Element (e1 <> e2)
+#if !(MIN_VERSION_base(4,11,0))
+ mappend = (<>)
+#endif
instance IsString Element where
fromString = toElement
@@ -140,7 +149,7 @@ makeElementNoEnd name = Element $ \a -> go a
-- | Folding and monoidally appending attributes.
foldlMapWithKey :: Monoid m => (k -> v -> m) -> HashMap k v -> m
-foldlMapWithKey f = M.foldlWithKey' (\m k v -> m <> f k v) mempty
+foldlMapWithKey f = M.foldlWithKey' (\m k v -> m `mappend` f k v) mempty
s2b :: String -> Builder
s2b = BB.fromString
diff --git a/svg-builder.cabal b/svg-builder.cabal
index a0d959a..3e8a686 100644
--- a/svg-builder.cabal
+++ b/svg-builder.cabal
@@ -1,8 +1,8 @@
name: svg-builder
-version: 0.1.0.2
+version: 0.1.1
synopsis: DSL for building SVG.
description: Fast, easy to write SVG.
-homepage: http://github.com/jeffreyrosenbluth/svg-builder.git
+homepage: https://github.com/diagrams/svg-builder.git
license: BSD3
license-file: LICENSE
author: Jeffrey Rosenbluth
@@ -13,6 +13,10 @@ build-type: Simple
extra-source-files: README.md
cabal-version: >=1.10
+source-repository head
+ type: git
+ location: https://github.com/diagrams/svg-builder.git
+
library
ghc-options: -Wall -fsimpl-tick-factor=200
exposed-modules: Graphics.Svg,
@@ -20,11 +24,13 @@ library
Graphics.Svg.Path,
Graphics.Svg.Elements,
Graphics.Svg.Attributes
- build-depends: base >= 4.5 && < 4.10,
+ build-depends: base >= 4.5 && < 4.12,
blaze-builder >= 0.4 && < 0.5,
bytestring >= 0.10 && < 0.11,
hashable >= 1.1 && < 1.3,
text >= 0.11 && < 1.3,
unordered-containers >= 0.2 && < 0.3
+ if !impl(ghc >= 8.0)
+ build-depends: semigroups >= 0.16.1 && < 0.19
hs-source-dirs: src
default-language: Haskell2010