diff --git a/CHANGELOG.md b/CHANGELOG.md index a0f80f7..289155f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +### 3.11.5 +* Support `Generically` and `Generically1` from `base-4.17` (GHC 9.4) or later in addition to `FromGeneric` and `FromGeneric1`. + ### 3.11.4 [2026.06.19] * Make the test suite report source locations for test failures accurately. diff --git a/src/TextShow.hs b/src/TextShow.hs index e64946d..ddb48bb 100644 --- a/src/TextShow.hs +++ b/src/TextShow.hs @@ -89,5 +89,6 @@ import Prelude () import TextShow.Classes import TextShow.FromStringTextShow +import TextShow.Generic () import TextShow.Instances () import TextShow.Utils (toString, toText, lengthB, unlinesB, unwordsB) diff --git a/src/TextShow/Generic.hs b/src/TextShow/Generic.hs index 6c46276..700559f 100644 --- a/src/TextShow/Generic.hs +++ b/src/TextShow/Generic.hs @@ -25,9 +25,12 @@ {-# LANGUAGE UndecidableInstances #-} #if __GLASGOW_HASKELL__ >= 806 +{-# LANGUAGE DerivingVia #-} {-# LANGUAGE QuantifiedConstraints #-} #endif +{-# OPTIONS_GHC -Wno-orphans #-} + {-| Module: TextShow.Generic Copyright: (C) 2014-2017 Ryan Scott @@ -219,6 +222,23 @@ instance ( Generic1 f ) => TextShow1 (FromGeneric1 f) where liftShowbPrec sp sl p = genericLiftShowbPrec sp sl p . fromGeneric1 +#if MIN_VERSION_base(4,17,0) +-- | The 'TextShow' instance for 'Generically' behaves exactly like the instance for 'FromGeneric'. +-- +-- /Since: 3.11.5/ +deriving via FromGeneric a instance (Generic a, GTextShowB (Rep a ())) => TextShow (Generically a) + +-- | The 'TextShow' instance for 'Generically1' behaves exactly like the instance for 'FromGeneric1'. +-- +-- /Since: 3.11.5/ +deriving via FromGeneric1 f a instance (Generic1 f, GTextShowB (Rep1 f a)) => TextShow (Generically1 f a) + +-- | The 'TextShow1' instance for 'Generically1' behaves exactly like the instance for 'FromGeneric1'. +-- +-- /Since: 3.11.5/ +deriving via FromGeneric1 (f :: * -> *) instance (Generic1 f, GTextShowB1 (Rep1 f)) => TextShow1 (Generically1 f) +#endif + -- | A 'Generic' implementation of 'showt'. -- -- /Since: 2/