microlens-th 0.2.0.0 → 0.2.1.0
raw patch · 3 files changed
+15/−10 lines, 3 filesdep ~basedep ~containersdep ~microlensPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: base, containers, microlens
API changes (from Hackage documentation)
Files
- CHANGELOG.md +4/−0
- microlens-th.cabal +6/−5
- src/Lens/Micro/TH.hs +5/−5
CHANGELOG.md view
@@ -1,3 +1,7 @@+# 0.2.1.0++* Bumped `base` version.+ # 0.2.0.0 * `createClass` was removed because it doesn't seem to be useful without `lensClass`.
microlens-th.cabal view
@@ -1,5 +1,5 @@ name: microlens-th-version: 0.2.0.0+version: 0.2.1.0 synopsis: Automatic generation of record lenses for microlens description: This package lets you automatically generate lenses for data types; code@@ -31,10 +31,11 @@ exposed-modules: Lens.Micro.TH -- other-modules: -- other-extensions: - build-depends: base >=4.4 && <5- , microlens ==0.1.*- , containers >=0.4- , template-haskell >=2.7+ build-depends: base >=4.5 && <5+ , microlens >=0.1 && <0.3+ , containers >=0.4.0 && <0.6+ -- lens has >=2.4, but GHC 7.4 shipped with 2.7+ , template-haskell >=2.7 && <2.11 if flag(inlining) cpp-options: -DINLINING
src/Lens/Micro/TH.hs view
@@ -70,13 +70,13 @@ -- Lens functions which would've been in Lens.Micro if it wasn't “micro” elemOf :: Eq a => Getting (Endo [a]) s a -> a -> s -> Bool-elemOf l x = elem x . toListOf l+elemOf l x s = elem x (s ^.. l) lengthOf :: Getting (Endo [a]) s a -> s -> Int-lengthOf l = length . toListOf l+lengthOf l s = length (s ^.. l) setOf :: Ord a => Getting (Endo [a]) s a -> s -> Set a-setOf l = Set.fromList . toListOf l+setOf l s = Set.fromList (s ^.. l) _ForallT :: Traversal' Type ([TyVarBndr], Cxt, Type) _ForallT f (ForallT a b c) = (\(x, y, z) -> ForallT x y z) <$> f (a, b, c)@@ -600,7 +600,7 @@ makeFieldOpticsForDec' rules tyName (tyName `conAppsT` args) [con] _ -> fail "makeFieldOptics: Expected data or newtype type-constructor" where- mkS tyName vars = tyName `conAppsT` map VarT (toListOf typeVars vars)+ mkS tyName vars = tyName `conAppsT` map VarT (vars ^.. typeVars) -- Compute the field optics for a deconstructed Dec@@ -608,7 +608,7 @@ makeFieldOpticsForDec' :: LensRules -> Name -> Type -> [Con] -> DecsQ makeFieldOpticsForDec' rules tyName s cons = do fieldCons <- traverse normalizeConstructor cons- let allFields = toListOf (folded . _2 . folded . _1 . folded) fieldCons+ let allFields = fieldCons ^.. folded._2.folded._1.folded let defCons = over normFieldLabels (expandName allFields) fieldCons allDefs = setOf (normFieldLabels . folded) defCons perDef <- sequenceA (fromSet (buildScaffold rules s defCons) allDefs)