diff --git a/CHANGELOG.md b/CHANGELOG.md index 339cd4b..0ba35e9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## next version +* `NoThunks` instance for `Data.Tuple.Solo`. * `NoThunks` instances for `Data.Semigroup` and `Data.Monoid` newtype wrappers. ## 0.1.5 -- 2023-10-29 diff --git a/src/NoThunks/Class.hs b/src/NoThunks/Class.hs index ea85f99..bc1af26 100644 --- a/src/NoThunks/Class.hs +++ b/src/NoThunks/Class.hs @@ -58,6 +58,9 @@ import Data.Ratio import Data.Sequence (Seq) import Data.Set (Set) import Data.Time +#if MIN_VERSION_base(4,16,0) +import Data.Tuple (Solo (..)) +#endif import Data.Void (Void) import Data.Word import GHC.Stack @@ -506,6 +509,20 @@ deriving via (Maybe a) instance NoThunks a => NoThunks (Monoid.Last a) deriving via (f a) instance NoThunks (f a) => NoThunks (Monoid.Alt f a) deriving via (f a) instance NoThunks (f a) => NoThunks (Monoid.Ap f a) +{------------------------------------------------------------------------------- + Solo +-------------------------------------------------------------------------------} + +#if MIN_VERSION_base(4,16,0) +-- GHC-9.2 +instance NoThunks a => NoThunks (Solo a) where + wNoThunks ctx (Solo a) = wNoThunks ("Solo" : ctx) a +#elif MIN_VERSION_base(4,17,0) +-- GHC-9.4 and newer +instance NoThunks a => NoThunks (Solo a) where + wNoThunks ctx (MkSolo a) = wNoThunks ("Solo" : ctx) a +#endif + {------------------------------------------------------------------------------- Mutable Vars -------------------------------------------------------------------------------}