packages feed

derive-lifted-instances 0.2.2 → 0.3

raw patch · 4 files changed

+28/−17 lines, 4 filesdep ~basedep ~template-haskellPVP ok

version bump matches the API change (PVP)

Dependency ranges changed: base, template-haskell

API changes (from Hackage documentation)

+ Data.DeriveLiftedInstances.Internal: tyVarName :: TyVarBndr s -> Name

Files

Data/DeriveLiftedInstances.hs view
@@ -1,7 +1,7 @@ {-# LANGUAGE CPP #-} {-# LANGUAGE ViewPatterns #-} {-# LANGUAGE TemplateHaskell #-}-{-# OPTIONS_GHC -fno-warn-orphans #-}+{-# OPTIONS_GHC -fno-warn-orphans -Wno-noncanonical-monoid-instances #-} ----------------------------------------------------------------------------- -- | -- Module      :  Data.DeriveLiftedInstances@@ -23,8 +23,6 @@  import Language.Haskell.TH import Data.DeriveLiftedInstances.Internal--import Control.Applicative (liftA2)  import Data.Biapplicative import Data.Bifoldable
Data/DeriveLiftedInstances/Internal.hs view
@@ -18,7 +18,10 @@ module Data.DeriveLiftedInstances.Internal where  import Language.Haskell.TH-import Language.Haskell.TH.Syntax (Lift)+#if MIN_VERSION_template_haskell(2,23,0)+#else+import Language.Haskell.TH.Syntax+#endif import Data.Char (isAlpha) import Data.Data (Data, gmapQl, cast) import Data.Maybe (fromMaybe, catMaybes)@@ -93,11 +96,7 @@ deriveInstance' :: Derivator -> Cxt -> Name -> Type -> Q [Dec] deriveInstance' deriv ctx clsName typ = do   ClassI (ClassD _ _ tvs _ decs) _ <- reify clsName-#if MIN_VERSION_template_haskell(2,17,0)-  let KindedTV tvn _ _ = last tvs-#else-  let KindedTV tvn _ = last tvs-#endif+  let tvn = tyVarName (last tvs)   impl <- for decs $ \case     SigD nm tp -> do       dec <- reify nm@@ -110,6 +109,16 @@     _ -> pure Nothing   pure [InstanceD Nothing ctx typ $ catMaybes impl] +#if MIN_VERSION_template_haskell(2,17,0)+tyVarName :: TyVarBndr s -> Name+tyVarName (PlainTV n _) = n+tyVarName (KindedTV n _ _) = n+#else+tyVarName :: TyVarBndr -> Name+tyVarName (PlainTV n) = n+tyVarName (KindedTV n _) = n+#endif+ buildOperation :: Derivator -> Name -> Type -> Q Exp -> Q ([Name], Exp) buildOperation d nm (AppT (AppT ArrowT h) t) e | hasVar nm h = do   varNm <- newName "var"@@ -148,8 +157,11 @@ contains nm = gmapQl (||) False (\d -> maybe (contains nm d) (== nm) $ cast d)  +#if MIN_VERSION_template_haskell(2,23,0)+#else deriving instance Lift Fixity deriving instance Lift FixityDirection+#endif  -- | Helper for showing infix expressions data ShowsPrec = ShowsPrec (Int -> String -> String) | ShowOp2 Fixity (Int -> String -> String) | ShowOp1 Fixity (Int -> String -> String)
README.md view
@@ -1,8 +1,7 @@ derive-lifted-instances ======================= -[![Hackage](https://img.shields.io/hackage/v/derive-lifted-instances.svg)](https://hackage.haskell.org/package/derive-lifted-instances)-[![Build Status](https://travis-ci.org/sjoerdvisscher/derive-lifted-instances.svg?branch=master)](https://travis-ci.org/github/sjoerdvisscher/derive-lifted-instances)+[![Hackage](https://img.shields.io/hackage/v/derive-lifted-instances.svg)](https://hackage.haskell.org/package/derive-lifted-instances) [![Build Status](https://github.com/sjoerdvisscher/derive-lifted-instances/workflows/Haskell-CI/badge.svg)](https://github.com/sjoerdvisscher/derive-lifted-instances/actions?query=workflow%3AHaskell-CI)  `derive-lifted-instances` generates type class instances using Template Haskell. @@ -28,7 +27,7 @@ |              | `class C x where dialg :: f x -> g x` |--------------|--- | `x` iso `y`  | `(Functor f, Functor g, C y)`-| `x=m`        | `(Foldable f, Porinted g, Monoid m)`+| `x=m`        | `(Foldable f, Pointed g, Monoid m)` | `x=t a`      | `(Traversable f, Applicative g, Applicative t, Traversable t, C a)` | `x=t a b`    | `(Traversable f, Applicative g, Biapplicative t, Bitraversable t, C a, C b)` | `x` a record | `(Traversable f, Applicative g, All C flds)`
derive-lifted-instances.cabal view
@@ -1,5 +1,5 @@ name:                derive-lifted-instances-version:             0.2.2+version:             0.3 synopsis:            Derive class instances though various kinds of lifting description:         Helper functions to use Template Haskell for generating class instances. homepage:            https://github.com/sjoerdvisscher/derive-lifted-instances@@ -11,10 +11,12 @@ category:            Data, Generics, Development build-type:          Simple cabal-version:       2.0-tested-with:         GHC==9.0.0.20200925, GHC==8.10.1, GHC==8.8.3+tested-with:         GHC==9.6.7, GHC==9.8.4, GHC==9.10.3, GHC==9.12.2, GHC==9.14.1  extra-source-files:   examples/*.hs++extra-doc-files:   README.md   CHANGELOG.md @@ -24,8 +26,8 @@     Data.DeriveLiftedInstances.Internal    build-depends:-      base >= 4.13 && < 4.16-    , template-haskell >= 2.15 && < 2.18+      base >= 4.18 && < 4.23+    , template-haskell >= 2.20 && < 2.25     , bifunctors >= 5.5.7 && < 6     , reflection >= 2.1 && < 3 @@ -34,4 +36,4 @@  source-repository head   type:     git-  location: git://github.com/sjoerdvisscher/derive-lifted-instances.git+  location: https://github.com/sjoerdvisscher/derive-lifted-instances