rank2classes 1.4.1 → 1.4.2
raw patch · 6 files changed
+38/−6 lines, 6 filesdep ~template-haskell
Dependency ranges changed: template-haskell
Files
- CHANGELOG.md +4/−0
- README.md +10/−0
- rank2classes.cabal +2/−2
- src/Rank2.hs +4/−4
- src/Rank2/TH.hs +8/−0
- test/MyModule.lhs +10/−0
CHANGELOG.md view
@@ -1,3 +1,7 @@+Version 1.4.2+---------------+* Fixed compatibility with GHC 9 - PR by Felix Yan+ Version 1.4.1 --------------- * Fixed the templates for multi-constructor records
README.md view
@@ -207,6 +207,16 @@ -- father=(Identity Nothing)})]} ~~~ +### Related works ###++This package is one of several implementations of a pattern that is often called *Higher-Kinded Data*. Other examples+include [hkd-lens](https://hackage.haskell.org/package/hkd-lens),+[barbies](https://hackage.haskell.org/package/barbies), and [hiddledy](https://hackage.haskell.org/package/higgledy).+ Grammars are another use case that is almost, but not quite, completely unlike database records. See [grammatical-parsers](https://github.com/blamario/grampa/tree/master/grammatical-parsers) or [construct](https://hackage.haskell.org/package/construct) for examples.++Both database records and grammars are flat structures. If your use case involves trees of rank-2 records, this+package will probably not suffice. Consider using+[deep-transformations](https://hackage.haskell.org/package/deep-transformations) instead.
rank2classes.cabal view
@@ -1,5 +1,5 @@ name: rank2classes-version: 1.4.1+version: 1.4.2 synopsis: standard type constructor class hierarchy, only with methods of rank 2 types description: A mirror image of the standard type constructor class hierarchy rooted in 'Functor', except with methods of rank 2@@ -43,7 +43,7 @@ distributive < 0.7 if flag(use-template-haskell)- build-depends: template-haskell >= 2.11 && < 2.17+ build-depends: template-haskell >= 2.11 && < 2.18 exposed-modules: Rank2.TH test-suite doctests
src/Rank2.hs view
@@ -415,16 +415,16 @@ (x1 Generics.:*: y1) <*> (x2 Generics.:*: y2) = (x1 <*> x2) Generics.:*: (y1 <*> y2) instance Applicative Empty where- pure = const Empty+ pure _ = Empty instance Applicative Proxy where- pure = const Proxy+ pure _ = Proxy instance (Semigroup x, Monoid x) => Applicative (Const x) where- pure = const (Const mempty)+ pure _ = Const mempty instance Applicative (Only x) where- pure = Only+ pure f = Only f instance Applicative g => Applicative (Identity g) where pure f = Identity (pure f)
src/Rank2/TH.hs view
@@ -7,6 +7,7 @@ -- -- or, if you're picky, you can invoke only 'deriveFunctor' and whichever other instances you need instead. +{-# Language CPP #-} {-# Language TemplateHaskell #-} -- Adapted from https://wiki.haskell.org/A_practical_Template_Haskell_Tutorial @@ -98,10 +99,17 @@ NewtypeD _ nm tyVars kind c _ -> return (nm, tyVars, kind, [c]) _ -> fail "deriveApply: tyCon may not be a type synonym." +#if MIN_VERSION_template_haskell(2,17,0)+ let (KindedTV tyVar () (AppT (AppT ArrowT StarT) StarT)) = last tyVars+ instanceType = conT cls `appT` foldl apply (conT tyConName) (init tyVars)+ apply t (PlainTV name _) = appT t (varT name)+ apply t (KindedTV name _ _) = appT t (varT name)+#else let (KindedTV tyVar (AppT (AppT ArrowT StarT) StarT)) = last tyVars instanceType = conT cls `appT` foldl apply (conT tyConName) (init tyVars) apply t (PlainTV name) = appT t (varT name) apply t (KindedTV name _) = appT t (varT name)+#endif putQ (Deriving tyConName tyVar) return (instanceType, cs)
test/MyModule.lhs view
@@ -207,6 +207,16 @@ -- father=(Identity Nothing)})]} ~~~ +### Related works ###++This package is one of several implementations of a pattern that is often called *Higher-Kinded Data*. Other examples+include [hkd-lens](https://hackage.haskell.org/package/hkd-lens),+[barbies](https://hackage.haskell.org/package/barbies), and [hiddledy](https://hackage.haskell.org/package/higgledy).+ Grammars are another use case that is almost, but not quite, completely unlike database records. See [grammatical-parsers](https://github.com/blamario/grampa/tree/master/grammatical-parsers) or [construct](https://hackage.haskell.org/package/construct) for examples.++Both database records and grammars are flat structures. If your use case involves trees of rank-2 records, this+package will probably not suffice. Consider using+[deep-transformations](https://hackage.haskell.org/package/deep-transformations) instead.