patch for aeson-2
This commit is contained in:
parent
d8f6c4ec4c
commit
7edd9384e2
|
@ -0,0 +1,49 @@
|
||||||
|
From 33971287445c5e2531d9605a287486dfc3cbe1da Mon Sep 17 00:00:00 2001
|
||||||
|
From: mirokuratczyk <miro.kuratczyk@gmail.com>
|
||||||
|
Date: Thu, 27 Jan 2022 13:55:24 -0500
|
||||||
|
Subject: [PATCH] aeson-2.0.0.0 support
|
||||||
|
|
||||||
|
---
|
||||||
|
src/Text/Toml/Types.hs | 15 +++++++++++++++
|
||||||
|
1 file changed, 15 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/src/Text/Toml/Types.hs b/src/Text/Toml/Types.hs
|
||||||
|
index 4027802..06a95f8 100644
|
||||||
|
--- a/src/Text/Toml/Types.hs
|
||||||
|
+++ b/src/Text/Toml/Types.hs
|
||||||
|
@@ -1,3 +1,4 @@
|
||||||
|
+{-# LANGUAGE CPP #-}
|
||||||
|
{-# LANGUAGE FlexibleInstances #-}
|
||||||
|
{-# LANGUAGE OverloadedStrings #-}
|
||||||
|
|
||||||
|
@@ -19,6 +20,9 @@ import Text.Parsec
|
||||||
|
import Data.Aeson.Types
|
||||||
|
import Data.HashMap.Strict (HashMap)
|
||||||
|
import qualified Data.HashMap.Strict as M
|
||||||
|
+#if MIN_VERSION_aeson(2,0,0)
|
||||||
|
+import qualified Data.Aeson.KeyMap as KM
|
||||||
|
+#endif
|
||||||
|
import Data.Int (Int64)
|
||||||
|
import Data.List (intersect)
|
||||||
|
import Data.Set (Set)
|
||||||
|
@@ -190,9 +194,20 @@ instance (ToBsJSON a) => ToBsJSON (Vector a) where
|
||||||
|
|
||||||
|
-- | Provide a 'toBsJSON' instance to the 'NTable'.
|
||||||
|
instance (ToBsJSON v) => ToBsJSON (M.HashMap Text v) where
|
||||||
|
+#if MIN_VERSION_aeson(2,0,0)
|
||||||
|
+ toBsJSON = Object . KM.fromHashMapText . M.map toBsJSON
|
||||||
|
+#else
|
||||||
|
toBsJSON = Object . M.map toBsJSON
|
||||||
|
+#endif
|
||||||
|
{-# INLINE toBsJSON #-}
|
||||||
|
|
||||||
|
+-- | 'ToBsJSON' instance for 'KeyMap'.
|
||||||
|
+#if MIN_VERSION_aeson(2,0,0)
|
||||||
|
+instance (ToBsJSON v) => ToBsJSON (KM.KeyMap v) where
|
||||||
|
+ toBsJSON = Object . KM.map toBsJSON
|
||||||
|
+ {-# INLINE toBsJSON #-}
|
||||||
|
+#endif
|
||||||
|
+
|
||||||
|
-- | 'ToBsJSON' instances for the 'TValue' type that produce Aeson (JSON)
|
||||||
|
-- in line with BurntSushi's language agnostic TOML test suite.
|
||||||
|
--
|
|
@ -17,6 +17,8 @@ Url: https://hackage.haskell.org/package/%{pkg_name}
|
||||||
Source0: https://hackage.haskell.org/package/%{pkgver}/%{pkgver}.tar.gz
|
Source0: https://hackage.haskell.org/package/%{pkgver}/%{pkgver}.tar.gz
|
||||||
Source1: https://hackage.haskell.org/package/%{pkgver}/%{pkg_name}.cabal#/%{pkgver}.cabal
|
Source1: https://hackage.haskell.org/package/%{pkgver}/%{pkg_name}.cabal#/%{pkgver}.cabal
|
||||||
# End cabal-rpm sources
|
# End cabal-rpm sources
|
||||||
|
# https://github.com/cies/htoml/pull/22
|
||||||
|
Patch0: https://patch-diff.githubusercontent.com/raw/cies/htoml/pull/22.patch
|
||||||
|
|
||||||
# Begin cabal-rpm deps:
|
# Begin cabal-rpm deps:
|
||||||
BuildRequires: dos2unix
|
BuildRequires: dos2unix
|
||||||
|
@ -88,10 +90,10 @@ This package provides the Haskell %{pkg_name} profiling library.
|
||||||
|
|
||||||
%prep
|
%prep
|
||||||
# Begin cabal-rpm setup:
|
# Begin cabal-rpm setup:
|
||||||
%setup -q -n %{pkgver}
|
%autosetup -p1 -n %{pkgver}
|
||||||
dos2unix -k -n %{SOURCE1} %{pkg_name}.cabal
|
dos2unix -k -n %{SOURCE1} %{pkg_name}.cabal
|
||||||
# End cabal-rpm setup
|
# End cabal-rpm setup
|
||||||
|
cabal-tweak-dep-ver aeson '< 2' '< 2.1'
|
||||||
|
|
||||||
%build
|
%build
|
||||||
# Begin cabal-rpm build:
|
# Begin cabal-rpm build:
|
||||||
|
|
Loading…
Reference in New Issue