linear-generics 0.2 → 0.2.1
raw patch · 6 files changed
+30/−18 lines, 6 filesdep ~template-haskell
Dependency ranges changed: template-haskell
Files
- CHANGELOG.md +3/−0
- linear-generics.cabal +7/−5
- src/Generics/Linear/Class.hs +6/−5
- src/Generics/Linear/Instances/Base.hs +6/−0
- src/Generics/Linear/TH.hs +5/−5
- src/Generics/Linear/Unsafe/ViaGHCGenerics.hs +3/−3
CHANGELOG.md view
@@ -1,3 +1,6 @@+# 0.2.1+* Add a `Generic` instance for `Data.Void.Void`.+ # 0.2 * The `Generic1` instance for `Generically1` no longer uses `GHC.Generics.Generic1`; it now uses `GHC.Generics.Generic` instead. This
linear-generics.cabal view
@@ -1,5 +1,5 @@ name: linear-generics-version: 0.2+version: 0.2.1 synopsis: Generic programming library for generalised deriving. description: This package offers a version of@@ -59,8 +59,10 @@ stability: experimental build-type: Simple cabal-version: >= 1.10-tested-with: GHC == 9.0.1- , GHC == 9.2.1+tested-with: GHC == 9.0.2+ , GHC == 9.2.6+ , GHC == 9.4.4+ , GHC == 9.6.1 extra-source-files: CHANGELOG.md , README.md @@ -90,7 +92,7 @@ build-depends: base >= 4.15 && < 5 , containers >= 0.5.9 && < 0.7 , ghc-prim < 1- , template-haskell >= 2.16 && < 2.19+ , template-haskell >= 2.16 && < 2.20 , th-abstraction >= 0.4 && < 0.5 default-language: Haskell2010@@ -128,7 +130,7 @@ build-depends: base >= 4.15 && < 5 , linear-generics , hspec >= 2 && < 3- , template-haskell >= 2.16 && < 2.19+ , template-haskell >= 2.16 && < 2.20 build-tool-depends: hspec-discover:hspec-discover hs-source-dirs: tests default-language: Haskell2010
src/Generics/Linear/Class.hs view
@@ -50,8 +50,8 @@ to :: forall p m. Rep a p %m-> a from :: forall p m. a %m-> Rep a p --- | @Generic1@ is similar to @"GHC.Generics".'Generic1'@, but has a few--- differences.+-- | @Generic1@ is similar to @"GHC.Generics".'GHC.Generics.Generic1'@, but has+-- a few differences. -- -- == Multiplicity polymorphism --@@ -109,9 +109,9 @@ -- == Difference in specificity -- -- Users of type application will need to be aware that the kind parameter for--- 'Generic1' is marked as inferred, whereas for @"GHC.Generics".'Generic1'@ it--- is marked as specified. So you should use, for example, @to1 \@Maybe@ rather--- than @to1 \@_ \@Maybe@.+-- 'Generic1' is marked as inferred, whereas for+-- @"GHC.Generics".'GHC.Generics.Generic1'@ it is marked as specified. So you+-- should use, for example, @to1 \@Maybe@ rather than @to1 \@_ \@Maybe@. type Generic1 :: forall {k}. (k -> Type) -> Constraint class Generic1 (f :: k -> Type) where@@ -197,6 +197,7 @@ -- the generic instances below will have to change. MP1 :: f a %m-> MP1 m f a +-- | Extract the value from an 'MP1'. unMP1 :: MP1 m f a %n-> f a -- Making this a field selector seems to break the type of the @MP1@ -- constructor. Whoops!
src/Generics/Linear/Instances/Base.hs view
@@ -30,6 +30,7 @@ import Foreign.Ptr (Ptr) import Generics.Linear.TH import GHC.Tuple (Solo)+import Data.Void (Void) -- GHC.Tuple $(deriveGenericAnd1 ''Solo)@@ -148,6 +149,11 @@ -- Data.Functor.Product $(deriveGenericAnd1 ''FProd.Product)++-- Data.Void++-- | @since 0.2.1+$(deriveGeneric ''Void) -- Foreign.Ptr $(deriveGeneric ''Ptr)
src/Generics/Linear/TH.hs view
@@ -48,7 +48,7 @@ Template Haskell imposes some fairly harsh limitations on ordering and visibility within a module. In most cases, classes derived generically will need to be derived using @StandaloneDeriving@ /after/ the @deriveGeneric*@-invocation. For example, if @Generically@ is a class that uses a 'Generic'+invocation. For example, if @Generically@ is a class that uses a 'GLC.Generic' constraint for its instances, then you cannot write @@@ -110,7 +110,7 @@ import Language.Haskell.TH -- Imports for splices-import Generics.Linear.Class+import Generics.Linear.Class as GLC hiding ( uAddr#, uChar#, uDouble#, uFloat#, uInt#, uWord# , unM1, unK1, unPar1, unComp1) import Generics.Linear.TH.Insertions@@ -119,17 +119,17 @@ import GHC.Exts (Addr#, Char#, Int#, Word#, Double#, Float#) -- | Given the name of a type or data family constructor,--- derive a 'Generic' instance.+-- derive a 'GLC.Generic' instance. deriveGeneric :: Name -> Q [Dec] deriveGeneric = deriveGenericCommon True False -- | Given the name of a type or data family constructor,--- derive a 'Generic1' instance.+-- derive a 'GLC.Generic1' instance. deriveGeneric1 :: Name -> Q [Dec] deriveGeneric1 = deriveGenericCommon False True -- | Given the name of a type or data family constructor,--- derive a 'Generic' instance and a 'Generic1' instance.+-- derive a 'GLC.Generic' instance and a 'GLC.Generic1' instance. deriveGenericAnd1 :: Name -> Q [Dec] deriveGenericAnd1 = deriveGenericCommon True True
src/Generics/Linear/Unsafe/ViaGHCGenerics.hs view
@@ -13,7 +13,7 @@ {-# LANGUAGE UndecidableInstances #-} {-# LANGUAGE Unsafe #-} --- | 'DerivingVia' targets to instantiate 'Generic' and 'Generic1',+-- | @DerivingVia@ targets to instantiate 'Generic' and 'Generic1', -- both using @"GHC.Generics".'G.Generic'@. -- -- === Caution@@ -45,7 +45,7 @@ -- -- === Warnings ----- @GHCGenerically@ is intended for use as a 'DerivingVia' target.+-- @GHCGenerically@ is intended for use as a @DerivingVia@ target. -- Most other uses of its 'Generic' instance will be quite wrong. -- -- @GHCGenerically@ /must not/ be used with datatypes that have@@ -99,7 +99,7 @@ -- -- === Warning ----- @GHCGenerically1@ is intended for use as a 'DerivingVia' target.+-- @GHCGenerically1@ is intended for use as a @DerivingVia@ target. -- Most other uses of its 'Generic1' instance will be quite wrong. -- -- @GHCGenerically1@ /must not/ be used with datatypes that have