From 72dcaec214f8d801a740b3c9382ed2862624e896 Mon Sep 17 00:00:00 2001 From: Nick Date: Tue, 30 Jan 2024 16:34:57 +0000 Subject: [PATCH 1/2] Add Ord instance to Aeson. --- src/Database/PostgreSQL/Simple/Newtypes.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Database/PostgreSQL/Simple/Newtypes.hs b/src/Database/PostgreSQL/Simple/Newtypes.hs index 1978db6..c13bbb9 100644 --- a/src/Database/PostgreSQL/Simple/Newtypes.hs +++ b/src/Database/PostgreSQL/Simple/Newtypes.hs @@ -37,7 +37,7 @@ import qualified Data.Aeson as Aeson -- -- @since 0.6.3 newtype Aeson a = Aeson a - deriving (Eq, Show, Read, Typeable, Functor) + deriving (Eq, Ord, Show, Read, Typeable, Functor) getAeson :: Aeson a -> a getAeson (Aeson a) = a From e75145b6cdf725d3b2d6b0316bc1726079d1d164 Mon Sep 17 00:00:00 2001 From: Nick Date: Tue, 30 Jan 2024 16:51:43 +0000 Subject: [PATCH 2/2] Derive FromJSON and ToJSON instances for Aeson. --- src/Database/PostgreSQL/Simple/Newtypes.hs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Database/PostgreSQL/Simple/Newtypes.hs b/src/Database/PostgreSQL/Simple/Newtypes.hs index c13bbb9..609eb1b 100644 --- a/src/Database/PostgreSQL/Simple/Newtypes.hs +++ b/src/Database/PostgreSQL/Simple/Newtypes.hs @@ -1,5 +1,6 @@ {-# LANGUAGE DeriveFunctor #-} {-# LANGUAGE DeriveDataTypeable #-} +{-# LANGUAGE GeneralisedNewtypeDeriving #-} -- | Module with newtypes suitable to usage with @DerivingVia@ or standalone. -- -- The newtypes are named after packages they wrap. @@ -37,7 +38,7 @@ import qualified Data.Aeson as Aeson -- -- @since 0.6.3 newtype Aeson a = Aeson a - deriving (Eq, Ord, Show, Read, Typeable, Functor) + deriving (Eq, Ord, Show, Read, Typeable, Functor, Aeson.FromJSON, Aeson.ToJSON) getAeson :: Aeson a -> a getAeson (Aeson a) = a