@@ -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