data-lens-template 0.1 → 1.8.0
raw patch · 2 files changed
+11/−23 lines, 2 filesdep +data-lensdep −comonad-transformersdep −utility-htnew-uploaderPVP ok
version bump matches the API change (PVP)
Dependencies added: data-lens
Dependencies removed: comonad-transformers, utility-ht
API changes (from Hackage documentation)
Files
- Data/Lens/Template.hs +4/−14
- data-lens-template.cabal +7/−9
Data/Lens/Template.hs view
@@ -13,8 +13,6 @@ import Control.Monad (liftM, when) import Data.Maybe (catMaybes) import Data.List (nub)-import Data.List.HT (viewR)- import Data.Lens.Common -- |@deriveAccessors n@ where @n@ is the name of a data type@@ -52,9 +50,10 @@ deriveAccessors n = nameDeriveAccessors n stripUnderscore stripUnderscore :: String -> Maybe String-stripUnderscore s = do- (stem,'_') <- viewR s- return stem+stripUnderscore [] = Nothing+stripUnderscore s + | last s == '_' = Just (init s)+ | otherwise = Nothing namedFields :: Con -> [VarStrictType] namedFields (RecC _ fs) = fs@@ -127,12 +126,3 @@ ] #endif---- first :: Lens TestData Int--- first = Lens $ \(TestData x y z) -> store (\x' -> TestData x' y z) x--- --- second :: Lens TestData Int--- second = lens (\(TestData x y z) -> y) (\y' (TestData x y z) -> (TestData x y' z))--- --- third :: Lens TestData String--- third = Lens $ \(TestData x y z) -> store (\z' -> TestData x y z') z
data-lens-template.cabal view
@@ -1,21 +1,20 @@ Name : data-lens-template-Version : 0.1+Version : 1.8.0 License : BSD3 License-File : LICENSE Author : Joel Burget <joelburget@gmail.com>-Maintainer : Joel Burget <joelburget@gmail.com>+Maintainer : Edward Kmett <ekmett@gmail.com> Category : Data Synopsis : Utilities for Data.Lens-Description : Automatically derive a @Lens@ instance for your data type for use with @Data.Lens@. Note: the code is derived from data-accessor-template <http://hackage.haskell.org/package/data-accessor-template> by Luke Palmer and Henning Thielemann.+Description : Automatically derive @Lens@es for your data type for use with @Data.Lens@. Note: the code is derived from data-accessor-template <http://hackage.haskell.org/package/data-accessor-template> by Luke Palmer and Henning Thielemann. Build-Type : Simple Cabal-Version : >= 1.6 Library Build-Depends:- comonad-transformers >= 1.6- , utility-ht >= 0.0.1 && < 0.1- , base >= 1.0 && < 5- , template-haskell >= 2.4 && < 2.6+ data-lens >= 1.8 && < 1.9+ , base >= 1.0 && < 5+ , template-haskell >= 2.4 && < 2.6 Exposed-Modules: Data.Lens.Template@@ -23,7 +22,6 @@ Extensions : CPP, TemplateHaskell GHC-Options: -Wall - Source-repository head type : git- location: git@github.com:joelburget/data-lens-template.git+ location: git@github.com:ekmett/data-lens-template.git