auto-lift-classes 1 → 1.0.1
raw patch · 3 files changed
+42/−7 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ AutoLift: instance (forall y. GHC.Read.Read y => GHC.Read.Read (f a y), forall x y. GHC.Types.Coercible x y => GHC.Types.Coercible (f a x) (f a y)) => Data.Functor.Classes.Read1 (AutoLift.Reflected2 f a)
+ AutoLift: instance (forall y. GHC.Show.Show y => GHC.Show.Show (f a y), forall x y. GHC.Types.Coercible x y => GHC.Types.Coercible (f a x) (f a y)) => Data.Functor.Classes.Show1 (AutoLift.Reflected2 f a)
+ AutoLift: instance GHC.Read.Read (f a b) => GHC.Read.Read (AutoLift.Reflected2 f a b)
+ AutoLift: instance GHC.Read.Read (f a) => GHC.Read.Read (AutoLift.Reflected1 f a)
+ AutoLift: instance GHC.Show.Show (f a b) => GHC.Show.Show (AutoLift.Reflected2 f a b)
+ AutoLift: instance GHC.Show.Show (f a) => GHC.Show.Show (AutoLift.Reflected1 f a)
Files
- CHANGELOG.md +7/−3
- auto-lift-classes.cabal +4/−4
- src/AutoLift.hs +31/−0
CHANGELOG.md view
@@ -1,5 +1,9 @@-# Revision history for autoshow1+# Revision history for auto-lift-classes -## 0.1.0.0 -- YYYY-mm-dd+## 1.0.1 -- 2023-04-06 -* First version. Released on an unsuspecting world.+* Fix the build failure on GHC 9.6 (#2)++## 1 -- 2023-01-12++* First version.
auto-lift-classes.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.0 name: auto-lift-classes-version: 1+version: 1.0.1 synopsis: Deriving (Show|Read)(1|2) description: Deriving (Show|Read)(1|2) from the usual, stock deriveable instances like @Show a => Show (f a)@.@@ -11,13 +11,13 @@ copyright: (c) 2018-2023, Koji Miyazato category: Data, Reflection build-type: Simple-extra-source-files: CHANGELOG.md-tested-with: GHC ==8.6.5, GHC ==8.8.4, GHC ==8.10.7, GHC ==9.0.2, GHC ==9.2.5, GHC ==9.4.4+extra-doc-files: CHANGELOG.md+tested-with: GHC ==8.6.5, GHC ==8.8.4, GHC ==8.10.7, GHC ==9.0.2, GHC ==9.2.7, GHC ==9.4.4, GHC ==9.6.1 source-repository head type: git location: https://github.com/viercc/auto-lift-classes- branch: master+ branch: main library exposed-modules: AutoLift, AutoLift.Machinery
src/AutoLift.hs view
@@ -5,6 +5,9 @@ {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TypeApplications #-} {-# LANGUAGE UndecidableInstances #-}+{-# LANGUAGE StandaloneDeriving #-}+{-# LANGUAGE GeneralizedNewtypeDeriving #-}+{-# LANGUAGE DerivingStrategies #-} -- | Derive lifted version of 'Show' or 'Read' classes, like @'Show1' f@ or @'Read1' f@, -- from derivable instance @forall a. Show a => Show (f a)@.@@ -62,6 +65,8 @@ wrapReadDict1 :: ReadDict (f a) -> ReadDict (Reflected1 f a) wrapReadDict1 = coerce +deriving newtype instance Show (f a) => Show (Reflected1 f a)+ instance ( forall a. Show a => Show (f a), forall xx yy. Coercible xx yy => Coercible (f xx) (f yy)@@ -75,6 +80,8 @@ let showFB = wrapShowDict1 $ autoShow1 @f (ShowDict showsPrecB showListB) in _showList showFB +deriving newtype instance Read (f a) => Read (Reflected1 f a)+ instance ( forall a. Read a => Read (f a), forall xx yy. Coercible xx yy => Coercible (f xx) (f yy)@@ -126,6 +133,18 @@ wrapReadDict2 :: ReadDict (f a b) -> ReadDict (Reflected2 f a b) wrapReadDict2 = coerce +deriving newtype instance Show (f a b) => Show (Reflected2 f a b)++instance (forall y. Show y => Show (f a y),+ forall x y. Coercible x y => Coercible (f a x) (f a y)) => Show1 (Reflected2 f a) where+ liftShowsPrec showsPrecB showListB =+ let showFAB = wrapShowDict2 $ autoShow1 @(f a) (ShowDict showsPrecB showListB)+ in _showsPrec showFAB+ + liftShowList showsPrecB showListB = + let showFAB = wrapShowDict2 $ autoShow1 @(f a) (ShowDict showsPrecB showListB)+ in _showList showFAB+ instance ( forall a b. (Show a, Show b) => Show (f a b), forall x1 y1 x2 y2.@@ -140,6 +159,18 @@ liftShowList2 showsPrecC showListC showsPrecD showListD = let showFCD = wrapShowDict2 $ autoShow2 @f (ShowDict showsPrecC showListC) (ShowDict showsPrecD showListD) in _showList showFCD++deriving newtype instance Read (f a b) => Read (Reflected2 f a b)++instance (forall y. Read y => Read (f a y),+ forall x y. Coercible x y => Coercible (f a x) (f a y)) => Read1 (Reflected2 f a) where+ liftReadPrec readPrecB readListB =+ let readFAB = wrapReadDict2 $ autoRead1 @(f a) (ReadDict readPrecB readListB)+ in _readPrec readFAB+ + liftReadListPrec readPrecB readListB =+ let readFAB = wrapReadDict2 $ autoRead1 @(f a) (ReadDict readPrecB readListB)+ in _readListPrec readFAB instance ( forall a b. (Read a, Read b) => Read (f a b),