summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xChangelog.md4
-rw-r--r--HaXml.cabal70
-rw-r--r--src/Text/XML/HaXml/ByteStringPP.hs6
-rw-r--r--src/Text/XML/HaXml/DtdToHaskell/Instance.hs5
-rw-r--r--src/Text/XML/HaXml/DtdToHaskell/TypeDef.hs5
-rw-r--r--src/Text/XML/HaXml/Html/Pretty.hs6
-rw-r--r--src/Text/XML/HaXml/Pretty.hs6
-rw-r--r--src/Text/XML/HaXml/Schema/PrettyHaskell.hs5
-rw-r--r--src/Text/XML/HaXml/Schema/PrettyHsBoot.hs5
-rw-r--r--src/Text/XML/HaXml/Schema/TypeConversion.hs14
-rw-r--r--src/Text/XML/HaXml/Schema/XSDTypeModel.hs23
-rw-r--r--src/Text/XML/HaXml/ShowXmlLazy.hs8
12 files changed, 117 insertions, 40 deletions
diff --git a/Changelog.md b/Changelog.md
new file mode 100755
index 0000000..0500c26
--- /dev/null
+++ b/Changelog.md
@@ -0,0 +1,4 @@
+## 1.25.5
+
+- GHC-8.4 and GHC-8.6 compatibility
+ - Monoids have Semigroup instances
diff --git a/HaXml.cabal b/HaXml.cabal
index 2d37740..ab28afd 100644
--- a/HaXml.cabal
+++ b/HaXml.cabal
@@ -1,23 +1,39 @@
-name: HaXml
-version: 1.25.4
-license: LGPL
-license-file: COPYRIGHT
-author: Malcolm Wallace <Malcolm.Wallace@me.com>
-maintainer: author
-homepage: http://projects.haskell.org/HaXml/
-category: Text, XML
-synopsis: Utilities for manipulating XML documents
+cabal-version: >= 1.8
+name: HaXml
+version: 1.25.5
+
+license: LGPL
+license-files: COPYRIGHT, LICENCE-GPL, LICENCE-LGPL
+author: Malcolm Wallace <Malcolm.Wallace@me.com>
+maintainer: author
+homepage: http://projects.haskell.org/HaXml/
+bug-reports: https://github.com/haskell-infra/hackage-trustees/issues
+category: Text, XML
+synopsis: Utilities for manipulating XML documents
description:
- Haskell utilities for parsing, filtering, transforming and
- generating XML documents.
+ This version, 1.25.5 is a Non-Maintainer Upload (NMU). Report issues to the Hackage Trustees issue tracker.
+ .
+ Haskell utilities for parsing, filtering, transforming and
+ generating XML documents.
build-type: Simple
-cabal-version: >=1.8
-extra-source-files: LICENCE-GPL, LICENCE-LGPL
+extra-source-files: Changelog.md
+
+tested-with:
+ GHC ==8.6.1
+ || ==8.4.4
+ || ==8.2.2
+ || ==8.0.2
+ || ==7.10.3
+ || ==7.8.4
+ || ==7.6.3
+ || ==7.4.2
+ || ==7.2.2
+ || ==7.0.4
-flag splitBase
- default: True
-flag bytestringInBase
- default: False
+source-repository this
+ type: git
+ location: https://github.com/hackage-trustees/malcolm-wallace-universe.git
+ tag: 1.25.5
library
exposed-modules:
@@ -67,15 +83,17 @@ library
exposed-modules:
Text.XML.HaXml.Schema.Schema
hs-source-dirs: src
- build-depends: polyparse >= 1.10, filepath
- if flag(splitBase)
- build-depends: base >= 3 && < 6, pretty, random, containers
- else
- build-depends: base < 3
- if flag(bytestringInBase)
- build-depends: base >= 2 && < 3
- else
- build-depends: base < 2 || >= 3, bytestring
+ build-depends:
+ base >= 4.3.1.0 && < 4.13,
+ bytestring >= 0.9.1.10 && < 0.11,
+ containers >= 0.4.0.0 && <0.7,
+ filepath >= 1.2.0.0 && <1.5,
+ pretty >= 1.0.1.2 && <1.2,
+ random >= 1.0 && <1.2,
+ polyparse >= 1.12.1 && <1.13
+ if !impl(ghc >= 8.0)
+ build-depends:
+ semigroups >= 0.18.5 && < 0.19
extensions: CPP, ExistentialQuantification
nhc98-options: -K10M
diff --git a/src/Text/XML/HaXml/ByteStringPP.hs b/src/Text/XML/HaXml/ByteStringPP.hs
index c782575..b9a3713 100644
--- a/src/Text/XML/HaXml/ByteStringPP.hs
+++ b/src/Text/XML/HaXml/ByteStringPP.hs
@@ -1,3 +1,4 @@
+{-# LANGUAGE CPP #-}
-- | This is a fast non-pretty-printer for turning the internal representation
-- of generic structured XML documents into Lazy ByteStrings.
-- Like in Text.Xml.HaXml.Pretty, there is one pp function for each type in
@@ -20,7 +21,12 @@ module Text.XML.HaXml.ByteStringPP
, cp
) where
+#if MIN_VERSION_base(4,11,0)
+import Prelude hiding (maybe,either,elem,concat,(<>))
+#else
import Prelude hiding (maybe,either,elem,concat)
+#endif
+
import Data.Maybe hiding (maybe)
import Data.List (intersperse)
--import Data.ByteString.Lazy hiding (pack,map,head,any,singleton,intersperse,join)
diff --git a/src/Text/XML/HaXml/DtdToHaskell/Instance.hs b/src/Text/XML/HaXml/DtdToHaskell/Instance.hs
index 0d7f9e8..bd210d5 100644
--- a/src/Text/XML/HaXml/DtdToHaskell/Instance.hs
+++ b/src/Text/XML/HaXml/DtdToHaskell/Instance.hs
@@ -1,7 +1,12 @@
+{-# LANGUAGE CPP #-}
module Text.XML.HaXml.DtdToHaskell.Instance
( mkInstance
) where
+#if MIN_VERSION_base(4,11,0)
+import Prelude hiding ((<>))
+#endif
+
import Data.List (intersperse)
import Text.XML.HaXml.DtdToHaskell.TypeDef
diff --git a/src/Text/XML/HaXml/DtdToHaskell/TypeDef.hs b/src/Text/XML/HaXml/DtdToHaskell/TypeDef.hs
index 6fa3da3..4228d37 100644
--- a/src/Text/XML/HaXml/DtdToHaskell/TypeDef.hs
+++ b/src/Text/XML/HaXml/DtdToHaskell/TypeDef.hs
@@ -1,3 +1,4 @@
+{-# LANGUAGE CPP #-}
-- | Defines an internal representation of Haskell data\/newtype definitions
-- that correspond to the XML DTD types, and provides pretty-printers to
-- convert these types into the 'Doc' type of "Text.PrettyPrint.HughesPJ".
@@ -18,6 +19,10 @@ module Text.XML.HaXml.DtdToHaskell.TypeDef
, name, name_, name_a, name_ac, name_f, mangle, manglef
) where
+#if MIN_VERSION_base(4,11,0)
+import Prelude hiding ((<>))
+#endif
+
import Data.Char (isLower, isUpper, toLower, toUpper, isDigit)
import Data.List (intersperse)
import Text.PrettyPrint.HughesPJ
diff --git a/src/Text/XML/HaXml/Html/Pretty.hs b/src/Text/XML/HaXml/Html/Pretty.hs
index f918f28..471e912 100644
--- a/src/Text/XML/HaXml/Html/Pretty.hs
+++ b/src/Text/XML/HaXml/Html/Pretty.hs
@@ -1,3 +1,4 @@
+{-# LANGUAGE CPP #-}
-- | This is a separate pretty-printer for HTML documents, recognising
-- some of the differences between HTML and true XML.
@@ -8,7 +9,12 @@ module Text.XML.HaXml.Html.Pretty
, content
) where
+#if MIN_VERSION_base(4,11,0)
+import Prelude hiding (maybe,either,(<>))
+#else
import Prelude hiding (maybe,either)
+#endif
+
import Data.Maybe hiding (maybe)
import Data.List (intersperse)
import Data.Char (isSpace)
diff --git a/src/Text/XML/HaXml/Pretty.hs b/src/Text/XML/HaXml/Pretty.hs
index 409a359..277e0f8 100644
--- a/src/Text/XML/HaXml/Pretty.hs
+++ b/src/Text/XML/HaXml/Pretty.hs
@@ -1,3 +1,4 @@
+{-# LANGUAGE CPP #-}
-- | This is a pretty-printer for turning the internal representation
-- of generic structured XML documents into the Doc type (which can
-- later be rendered using Text.PrettyPrint.HughesPJ.render).
@@ -21,7 +22,12 @@ module Text.XML.HaXml.Pretty
, cp
) where
+#if MIN_VERSION_base(4,11,0)
+import Prelude hiding (maybe,either,(<>))
+#else
import Prelude hiding (maybe,either)
+#endif
+
import Data.Maybe hiding (maybe)
import Data.List (intersperse)
--import Char (isSpace)
diff --git a/src/Text/XML/HaXml/Schema/PrettyHaskell.hs b/src/Text/XML/HaXml/Schema/PrettyHaskell.hs
index 2dbfcba..b711b52 100644
--- a/src/Text/XML/HaXml/Schema/PrettyHaskell.hs
+++ b/src/Text/XML/HaXml/Schema/PrettyHaskell.hs
@@ -1,3 +1,4 @@
+{-# LANGUAGE CPP #-}
-- | Pretty-print the internal Haskell model of XSD datatypes to a real
-- Haskell module containing type declarations, and instances for parsing
-- (and printing - though not yet implemented) values of those datatypes
@@ -10,6 +11,10 @@ module Text.XML.HaXml.Schema.PrettyHaskell
, ppvList
) where
+#if MIN_VERSION_base(4,11,0)
+import Prelude hiding ((<>))
+#endif
+
import Text.XML.HaXml.Types (QName(..),Namespace(..))
import Text.XML.HaXml.Schema.HaskellTypeModel
import Text.XML.HaXml.Schema.XSDTypeModel (Occurs(..))
diff --git a/src/Text/XML/HaXml/Schema/PrettyHsBoot.hs b/src/Text/XML/HaXml/Schema/PrettyHsBoot.hs
index 0808c9c..fa44318 100644
--- a/src/Text/XML/HaXml/Schema/PrettyHsBoot.hs
+++ b/src/Text/XML/HaXml/Schema/PrettyHsBoot.hs
@@ -1,3 +1,4 @@
+{-# LANGUAGE CPP #-}
-- | Pretty-print the internal Haskell model of XSD datatypes to a
-- Haskell hs-boot module containing only stub type declarations.
-- This approach is intended to work around issues of mutually recursive
@@ -10,6 +11,10 @@ module Text.XML.HaXml.Schema.PrettyHsBoot
, ppvList
) where
+#if MIN_VERSION_base(4,11,0)
+import Prelude hiding ((<>))
+#endif
+
import Text.XML.HaXml.Types (QName(..),Namespace(..))
import Text.XML.HaXml.Schema.HaskellTypeModel
import Text.XML.HaXml.Schema.XSDTypeModel (Occurs(..))
diff --git a/src/Text/XML/HaXml/Schema/TypeConversion.hs b/src/Text/XML/HaXml/Schema/TypeConversion.hs
index b46222f..c4c855c 100644
--- a/src/Text/XML/HaXml/Schema/TypeConversion.hs
+++ b/src/Text/XML/HaXml/Schema/TypeConversion.hs
@@ -12,10 +12,11 @@ import Text.XML.HaXml.Schema.NameConversion
import Text.XML.HaXml.Schema.Parse (xsd)
import qualified Data.Map as Map
+import Data.Semigroup (Semigroup (..))
import Data.Map (Map)
import Data.List (foldl')
import Data.Maybe (fromMaybe,fromJust,isNothing,isJust)
-import Data.Monoid
+import Data.Monoid (Monoid (..))
-- | Transform a Schema by lifting all locally-defined anonymous types to
-- the top-level, naming them, and planting a referend at their original
@@ -540,12 +541,15 @@ consolidate (Occurs min max) (UnorderedMaxLength,_,n) =
instance Monoid Occurs where
mempty = Occurs Nothing Nothing
- (Occurs Nothing Nothing) `mappend` o = o
- (Occurs (Just z) Nothing) `mappend` (Occurs min max)
+ mappend = (<>)
+
+instance Semigroup Occurs where
+ (Occurs Nothing Nothing) <> o = o
+ (Occurs (Just z) Nothing) <> (Occurs min max)
= Occurs (Just $ maybe z (*z) min) max
- (Occurs Nothing (Just x)) `mappend` (Occurs min max)
+ (Occurs Nothing (Just x)) <> (Occurs min max)
= Occurs min (Just $ maybe x (*x) max)
- (Occurs (Just z) (Just x)) `mappend` (Occurs min max)
+ (Occurs (Just z) (Just x)) <> (Occurs min max)
= Occurs (Just $ maybe z (*z) min)
(Just $ maybe x (*x) max)
diff --git a/src/Text/XML/HaXml/Schema/XSDTypeModel.hs b/src/Text/XML/HaXml/Schema/XSDTypeModel.hs
index 578dc7a..1d5b0da 100644
--- a/src/Text/XML/HaXml/Schema/XSDTypeModel.hs
+++ b/src/Text/XML/HaXml/Schema/XSDTypeModel.hs
@@ -2,7 +2,8 @@ module Text.XML.HaXml.Schema.XSDTypeModel
( module Text.XML.HaXml.Schema.XSDTypeModel
) where
-import Data.Monoid hiding (Any)
+import Data.Semigroup (Semigroup (..))
+import Data.Monoid (Monoid (..))
import Text.XML.HaXml.Types (Name,Namespace,QName)
data Schema = Schema
@@ -56,7 +57,7 @@ data SimpleType = Primitive { simple_primitive :: PrimitiveType }
deriving (Eq,Show)
data Restriction = RestrictSim1 { restrict_annotation :: Annotation
- , restrict_base :: Maybe QName
+ , restrict_base :: Maybe QName
, restrict_r1 :: Restriction1
}
| RestrictType { restrict_annotation :: Annotation
@@ -248,7 +249,7 @@ data PrimitiveType = String | Boolean | Decimal | Float | Double
| Base64Binary | HexBinary
| AnyURI | QName | Notation
deriving (Eq,Show)
-
+
data MyRestriction = Range Occurs
| Pattern Regexp
@@ -293,15 +294,21 @@ type TypeName = String
instance Monoid Annotation where
mempty = NoAnnotation "Monoid.mempty <Annotation>"
- (Documentation d) `mappend` (Documentation e) = Documentation (d++"\n"++e)
- _ `mappend` (Documentation e) = Documentation e
- ann `mappend` _ = ann
+ mappend = (<>)
--- This instance is pretty unsatisfactory, and is useful only for
+instance Semigroup Annotation where
+ (Documentation d) <> (Documentation e) = Documentation (d++"\n"++e)
+ _ <> (Documentation e) = Documentation e
+ ann <> _ = ann
+
+-- | This instance is pretty unsatisfactory, and is useful only for
-- building environments involving recursive modules. The /mappend/
-- method is left-biased, and the /mempty/ value contains lots of
-- undefined values.
instance Monoid Schema where
mempty = Schema{ schema_items=[] }
- s `mappend` t = s{ schema_items = schema_items s ++ schema_items t }
+ mappend = (<>)
+
+instance Semigroup Schema where
+ s <> t = s{ schema_items = schema_items s ++ schema_items t }
diff --git a/src/Text/XML/HaXml/ShowXmlLazy.hs b/src/Text/XML/HaXml/ShowXmlLazy.hs
index f8898fe..0665bee 100644
--- a/src/Text/XML/HaXml/ShowXmlLazy.hs
+++ b/src/Text/XML/HaXml/ShowXmlLazy.hs
@@ -1,11 +1,17 @@
+{-# LANGUAGE CPP #-}
module Text.XML.HaXml.ShowXmlLazy (showXmlLazy) where
import Text.XML.HaXml.Types
import Text.XML.HaXml.Namespaces
import Text.XML.HaXml.TypeMapping -- (toHType, toDTD, Tuple(), Defined, showHType)
-import qualified Text.XML.HaXml.XmlContent as X
+#if MIN_VERSION_base(4,11,0)
+import Prelude hiding (maybe,either,(<>))
+#else
import Prelude hiding (maybe,either)
+#endif
+
+import qualified Text.XML.HaXml.XmlContent as X
import Data.Maybe hiding (maybe)
import Data.List