barbies-th 0.1.10 → 0.1.11
raw patch · 4 files changed
+26/−12 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)
Files
- CHANGELOG.md +4/−0
- barbies-th.cabal +5/−5
- src/Barbies/TH.hs +10/−7
- tests/Main.hs +7/−0
CHANGELOG.md view
@@ -1,5 +1,9 @@ # Revision history for barbies-th +## 0.1.11++* Relaxed version bounds+ ## 0.1.10 * Added `bnestedFieldNames` to `FieldNamesB`
barbies-th.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.4 name: barbies-th-version: 0.1.10+version: 0.1.11 synopsis: Create strippable HKD via TH description: Please see Data.Barbie.TH homepage: https://github.com/fumieval/barbies-th@@ -32,8 +32,8 @@ Barbies.TH.Config Data.Barbie.TH other-extensions: RankNTypes, PolyKinds, DataKinds, KindSignatures, TemplateHaskell, TypeFamilies- build-depends: base >= 4.12 && <4.17- , template-haskell >= 2.14 && <2.19+ build-depends: base >= 4.12 && <4.18+ , template-haskell >= 2.14 && <2.20 , barbies ^>= 2.0.1 , split ^>= 0.2 hs-source-dirs: src@@ -46,7 +46,7 @@ hs-source-dirs: tests build-depends:- base >=4.7 && <5+ base , barbies , barbies-th default-language: Haskell2010@@ -57,7 +57,7 @@ hs-source-dirs: tests build-depends:- base >=4.7 && <5+ base , barbies , barbies-th default-language: Haskell2010
src/Barbies/TH.hs view
@@ -214,11 +214,14 @@ [varE fd | (fd, _, _) <- fields] ) instance TraversableB $(pure coveredType) where- btraverse f $(conP nDataCon $ map varP xs) = $(fst $ foldl'- (\(l, op) r -> (infixE (Just l) (varE op) (Just r), '(<*>)))- (conE nDataCon, '(<$>))- (mapMembers (appE (varE 'f)) (\x -> [|btraverse f $x|]) (varE <$> xs))- )+ btraverse f $(conP nDataCon $ map varP xs) = $(+ case xs of+ [] -> appE (varE 'pure) (conE nDataCon)+ _ -> fst $ foldl'+ (\(l, op) r -> (infixE (Just l) (varE op) (Just r), '(<*>)))+ (conE nDataCon, '(<$>))+ (mapMembers (appE (varE 'f)) (\x -> [|btraverse f $x|]) (varE <$> xs))+ ) {-# INLINE btraverse #-} instance ConstraintsB $(pure coveredType) where type AllB $(varT nConstr) $(pure coveredType) = $(allConstr)@@ -255,9 +258,9 @@ [ (strat, pure t) | (_, DerivClause strat preds) <- classes', t <- preds ] return $ DataD [] dataName #if MIN_VERSION_template_haskell(2,17,0)- (tvbs ++ [PlainTV nSwitch (), PlainTV nWrap ()])+ (tvbs ++ [PlainTV nSwitch (), KindedTV nWrap () (AppT (AppT ArrowT StarT) StarT)]) #else- (tvbs ++ [PlainTV nSwitch, PlainTV nWrap])+ (tvbs ++ [PlainTV nSwitch, KindedTV nWrap (AppT (AppT ArrowT StarT) StarT)]) #endif Nothing [transformed]
tests/Main.hs view
@@ -37,6 +37,10 @@ } |] +declareBareB [d|+ data EmptyRecord = EmptyRecord {}+ |]+ test_con :: Foo Covered [] test_con = Foo { foo = [0]@@ -48,6 +52,9 @@ test_upd :: Foo Covered [] test_upd = test_con { foo = [], bar = [] }++test_empty :: (EmptyRecord Covered [], EmptyRecord Covered Maybe)+test_empty = (EmptyRecord, EmptyRecord) main = pure ()