Gentoo Archives: gentoo-commits

From: Sergei Trofimovich <slyfox@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-haskell/json/files/, dev-haskell/json/
Date: Sat, 14 Dec 2019 21:27:23
Message-Id: 1576358812.d5dbd873fae620fe8f73c2946ae2a5d75768123f.slyfox@gentoo
1 commit: d5dbd873fae620fe8f73c2946ae2a5d75768123f
2 Author: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
3 AuthorDate: Sat Dec 14 20:08:52 2019 +0000
4 Commit: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
5 CommitDate: Sat Dec 14 21:26:52 2019 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d5dbd873
7
8 dev-haskell/json: bump up to 0.9.3
9
10 Package-Manager: Portage-2.3.81, Repoman-2.3.20
11 Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>
12
13 dev-haskell/json/Manifest | 1 +
14 dev-haskell/json/files/json-0.9.3-ghc-8.8.patch | 172 ++++++++++++++++++++++++
15 dev-haskell/json/json-0.9.3.ebuild | 37 +++++
16 3 files changed, 210 insertions(+)
17
18 diff --git a/dev-haskell/json/Manifest b/dev-haskell/json/Manifest
19 index 0763e7dbb70..99269fc1f1d 100644
20 --- a/dev-haskell/json/Manifest
21 +++ b/dev-haskell/json/Manifest
22 @@ -1 +1,2 @@
23 DIST json-0.9.1.tar.gz 22568 BLAKE2B b1c73771e24ccafb2019ffff61e392f2eec18768c4bdd09f1a5ee8275c92d8982cda3fab4d91222f726fae65324776c9e79ccd602dbd4ac9c435749d61a1015e SHA512 537257fed476683d0657c6474e465ca437e43e36b60ab132c0f584cece99a18d222ef9a33171543689ba5589434bc78cf2e0e5ff550804ff8969052d09430d57
24 +DIST json-0.9.3.tar.gz 22562 BLAKE2B 8947d2b4bea1ee86eea19e25b73b991d186274c7a6beaff09e8f346756e870d440c4511c599d6ee5f82df08975076e47f0f528cc03cabb5063fb768506b9a660 SHA512 836ae920ef19e0cff5b617a579090ea1d760e253513d3fb28c56650a1fa413c0bd852165be487c211a52be6246eac3241a97f729342223be10275917a34230a6
25
26 diff --git a/dev-haskell/json/files/json-0.9.3-ghc-8.8.patch b/dev-haskell/json/files/json-0.9.3-ghc-8.8.patch
27 new file mode 100644
28 index 00000000000..d8dc402ae19
29 --- /dev/null
30 +++ b/dev-haskell/json/files/json-0.9.3-ghc-8.8.patch
31 @@ -0,0 +1,172 @@
32 +commit a0d8bcde5ab5329d11be8cd89c407e6aa0db83a4
33 +Author: Fumiaki Kinoshita <fumiexcel@×××××.com>
34 +Date: Tue Apr 30 18:37:40 2019 +0900
35 +
36 + Support GHC 8.8
37 +
38 +diff --git a/Text/JSON.hs b/Text/JSON.hs
39 +index f2e2618..6f80949 100644
40 +--- a/Text/JSON.hs
41 ++++ b/Text/JSON.hs
42 +@@ -37,7 +37,7 @@ module Text.JSON (
43 + -- ** Instance helpers
44 + , makeObj, valFromObj
45 + , JSKey(..), encJSDict, decJSDict
46 +-
47 ++
48 + ) where
49 +
50 + import Text.JSON.Types
51 +@@ -60,7 +60,7 @@ import qualified Data.Text as T
52 +
53 + ------------------------------------------------------------------------
54 +
55 +--- | Decode a String representing a JSON value
56 ++-- | Decode a String representing a JSON value
57 + -- (either an object, array, bool, number, null)
58 + --
59 + -- This is a superset of JSON, as types other than
60 +@@ -137,7 +137,9 @@ instance MonadPlus Result where
61 +
62 + instance Monad Result where
63 + return x = Ok x
64 ++#if !MIN_VERSION_base(4,13,0)
65 + fail x = Error x
66 ++#endif
67 + Ok a >>= f = f a
68 + Error x >>= _ = Error x
69 +
70 +@@ -199,7 +201,7 @@ instance JSON Ordering where
71 + showJSON = encJSString show
72 + readJSON = decJSString "Ordering" readOrd
73 + where
74 +- readOrd x =
75 ++ readOrd x =
76 + case x of
77 + "LT" -> return Prelude.LT
78 + "EQ" -> return Prelude.EQ
79 +@@ -460,7 +462,7 @@ instance JSKey Int where
80 + instance JSKey String where
81 + toJSKey = id
82 + fromJSKey = Just
83 +-
84 ++
85 + -- | Encode an association list as 'JSObject' value.
86 + encJSDict :: (JSKey a, JSON b) => [(a,b)] -> JSValue
87 + encJSDict v = makeObj [ (toJSKey x, showJSON y) | (x,y) <- v ]
88 +@@ -477,5 +479,3 @@ decJSDict l (JSObject o) = mapM rd (fromJSObject o)
89 + "unable to read dict; invalid object key")
90 +
91 + decJSDict l _ = mkError ("readJSON{"++l ++ "}: unable to read dict; expected JSON object")
92 +-
93 +-
94 +diff --git a/Text/JSON/String.hs b/Text/JSON/String.hs
95 +index 51463cd..67fdca8 100644
96 +--- a/Text/JSON/String.hs
97 ++++ b/Text/JSON/String.hs
98 +@@ -1,7 +1,8 @@
99 ++{-# LANGUAGE CPP #-}
100 + -- | Basic support for working with JSON values.
101 +
102 +-module Text.JSON.String
103 +- (
104 ++module Text.JSON.String
105 ++ (
106 + -- * Parsing
107 + --
108 + GetJSON
109 +@@ -35,6 +36,7 @@ import Text.JSON.Types (JSValue(..),
110 + JSObject, toJSObject, fromJSObject)
111 +
112 + import Control.Monad (liftM, ap)
113 ++import qualified Control.Monad.Fail as Fail
114 + import Control.Applicative((<$>))
115 + import qualified Control.Applicative as A
116 + import Data.Char (isSpace, isDigit, digitToInt)
117 +@@ -52,9 +54,14 @@ instance A.Applicative GetJSON where
118 + pure = return
119 + (<*>) = ap
120 +
121 ++instance Fail.MonadFail GetJSON where
122 ++ fail x = GetJSON (\_ -> Left x)
123 ++
124 + instance Monad GetJSON where
125 + return x = GetJSON (\s -> Right (x,s))
126 +- fail x = GetJSON (\_ -> Left x)
127 ++#if !MIN_VERSION_base(4,13,0)
128 ++ fail = Fail.fail
129 ++#endif
130 + GetJSON m >>= f = GetJSON (\s -> case m s of
131 + Left err -> Left err
132 + Right (a,s1) -> un (f a) s1)
133 +@@ -93,7 +100,7 @@ tryJSNull k = do
134 + xs <- getInput
135 + case xs of
136 + 'n':'u':'l':'l':xs1 -> setInput xs1 >> return JSNull
137 +- _ -> k
138 ++ _ -> k
139 +
140 + -- | Read the JSON Bool type
141 + readJSBool :: GetJSON JSValue
142 +@@ -111,8 +118,8 @@ readJSString = do
143 + case x of
144 + '"' : cs -> parse [] cs
145 + _ -> fail $ "Malformed JSON: expecting string: " ++ context x
146 +- where
147 +- parse rs cs =
148 ++ where
149 ++ parse rs cs =
150 + case cs of
151 + '\\' : c : ds -> esc rs c ds
152 + '"' : ds -> do setInput ds
153 +@@ -153,22 +160,22 @@ readJSRational = do
154 + '-' : ds -> negate <$> pos ds
155 + _ -> pos cs
156 +
157 +- where
158 ++ where
159 + pos [] = fail $ "Unable to parse JSON Rational: " ++ context []
160 + pos (c:cs) =
161 + case c of
162 + '0' -> frac 0 cs
163 +- _
164 ++ _
165 + | not (isDigit c) -> fail $ "Unable to parse JSON Rational: " ++ context cs
166 + | otherwise -> readDigits (digitToIntI c) cs
167 +
168 + readDigits acc [] = frac (fromInteger acc) []
169 + readDigits acc (x:xs)
170 +- | isDigit x = let acc' = 10*acc + digitToIntI x in
171 ++ | isDigit x = let acc' = 10*acc + digitToIntI x in
172 + acc' `seq` readDigits acc' xs
173 + | otherwise = frac (fromInteger acc) (x:xs)
174 +
175 +- frac n ('.' : ds) =
176 ++ frac n ('.' : ds) =
177 + case span isDigit ds of
178 + ([],_) -> setInput ds >> return n
179 + (as,bs) -> let x = read as :: Integer
180 +@@ -320,15 +327,15 @@ showJSRational :: Rational -> ShowS
181 + showJSRational r = showJSRational' False r
182 +
183 + showJSRational' :: Bool -> Rational -> ShowS
184 +-showJSRational' asFloat r
185 ++showJSRational' asFloat r
186 + | denominator r == 1 = shows $ numerator r
187 + | isInfinite x || isNaN x = showJSNull
188 + | asFloat = shows xf
189 + | otherwise = shows x
190 +- where
191 ++ where
192 + x :: Double
193 + x = realToFrac r
194 +-
195 ++
196 + xf :: Float
197 + xf = realToFrac r
198 +
199 +@@ -382,4 +389,3 @@ encJSString jss ss = go (fromJSString jss)
200 + | x < '\x1000' -> 'u' : '0' : hexxs
201 + | otherwise -> 'u' : hexxs
202 + where hexxs = showHex (fromEnum x) xs
203 +-
204
205 diff --git a/dev-haskell/json/json-0.9.3.ebuild b/dev-haskell/json/json-0.9.3.ebuild
206 new file mode 100644
207 index 00000000000..ce29d269323
208 --- /dev/null
209 +++ b/dev-haskell/json/json-0.9.3.ebuild
210 @@ -0,0 +1,37 @@
211 +# Copyright 1999-2019 Gentoo Authors
212 +# Distributed under the terms of the GNU General Public License v2
213 +
214 +EAPI=7
215 +
216 +# ebuild generated by hackport 0.6.9999
217 +
218 +CABAL_FEATURES="lib profile haddock hoogle hscolour"
219 +inherit haskell-cabal
220 +
221 +DESCRIPTION="Support for serialising Haskell to and from JSON"
222 +HOMEPAGE="http://hackage.haskell.org/package/json"
223 +SRC_URI="https://hackage.haskell.org/package/${P}/${P}.tar.gz"
224 +
225 +LICENSE="BSD"
226 +SLOT="0/${PV}"
227 +KEYWORDS="~amd64 ~ppc64 ~x86 ~amd64-linux"
228 +IUSE="mapdict +parsec +pretty"
229 +
230 +RDEPEND="dev-haskell/mtl:=[profile?]
231 + >=dev-haskell/syb-0.3.3:=[profile?]
232 + dev-haskell/text:=[profile?]
233 + >=dev-lang/ghc-7.4.1:=
234 + parsec? ( dev-haskell/parsec:=[profile?] )
235 +"
236 +DEPEND="${RDEPEND}
237 + >=dev-haskell/cabal-1.6
238 +"
239 +
240 +PATCHES=( "${FILESDIR}"/${PN}-0.9.3-ghc-8.8.patch )
241 +
242 +src_configure() {
243 + haskell-cabal_src_configure \
244 + $(cabal_flag mapdict mapdict) \
245 + $(cabal_flag parsec parsec) \
246 + $(cabal_flag pretty pretty)
247 +}