git.iko.soy/typeable/cabal2nix
on master help sign in
Commit to aeson 1.x or later so that we can drop the CPP conditionals.
commiteabf258524e359ef82742fd251a986fca75ac019 authorPeter Simons <simons@cryp.to> dateSat 16 Mar 2019, 11:22 (8 years ago) parentbc62ff7
2 files changed+1−19
cabal2nix.cabal+1−1 src/Distribution/Nixpkgs/Haskell/FromCabal/Configuration.hs−18
cabal2nix.cabal+1−1
@@ -109,7 +109,7 @@ library
109109 hs-source-dirs: src
110110 build-depends: base > 4.11
111111 , Cabal > 2.4
112− , aeson
112+ , aeson > 1
113113 , ansi-wl-pprint
114114 , bytestring
115115 , containers
src/Distribution/Nixpkgs/Haskell/FromCabal/Configuration.hs−18
@@ -1,5 +1,4 @@
11{-# LANGUAGE RecordWildCards #-}
2−{-# LANGUAGE CPP #-}
32{-# LANGUAGE FlexibleInstances #-}
43{-# LANGUAGE OverloadedStrings #-}
54{-# LANGUAGE DeriveGeneric #-}
@@ -70,29 +69,12 @@ instance FromJSON Identifier where
7069 parseJSON (String s) = pure (review ident (T.unpack s))
7170 parseJSON s = fail ("parseJSON: " ++ show s ++ " is not a valid Nix identifier")
7271
73−#if MIN_VERSION_aeson(1,0,0)
74−
7572instance FromJSONKey Identifier where
7673 fromJSONKey = FromJSONKeyText parseKey
7774
7875instance FromJSONKey PackageName where
7976 fromJSONKey = FromJSONKeyText parseKey
8077
81−#elif MIN_VERSION_aeson(0,11,0)
82−
83−instance (FromJSON v) => FromJSON (Map Identifier v) where
84− parseJSON = fmap (Map.mapKeys parseKey) . parseJSON
85−
86−instance (FromJSON v) => FromJSON (Map PackageName v) where
87− parseJSON = fmap (Map.mapKeys parseKey) . parseJSON
88−
89−#else
90−
91−instance (Ord k, FromJSON k, FromJSON v) => FromJSON (Map k v) where
92− parseJSON = fmap (Map.mapKeys parseKey) . parseJSON
93−
94−#endif
95−
9678parseKey :: FromJSON k => Text -> k
9779parseKey s = either error id (parseEither parseJSON (String s))
9880