packages feed

persistent-template 1.1.2.3 → 1.1.2.4

raw patch · 2 files changed

+23/−2 lines, 2 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

Database/Persist/TH.hs view
@@ -440,7 +440,7 @@             (NormalB $ lens' `AppE` getId `AppE` setId)             []     if entitySum t-        then return [idClause]+        then return $ idClause : map (toSumClause lens' getVal dot keyName valName xName) (entityFields t)         else return $ idClause : map (toClause lens' getVal dot keyName valName xName) (entityFields t)   where     toClause lens' getVal dot keyName valName xName f = Clause@@ -457,6 +457,27 @@             $ ConE 'Entity `AppE` VarE keyName `AppE` RecUpdE                 (VarE valName)                 [(fieldName, VarE xName)]++    toSumClause lens' getVal dot keyName valName xName f = Clause+        [ConP (mkName $ unpack $ unHaskellName (entityHaskell t) ++ upperFirst (unHaskellName $ fieldHaskell f)) []]+        (NormalB $ lens' `AppE` getter `AppE` setter)+        []+      where+        fieldName = mkName $ unpack $ recName (unHaskellName $ entityHaskell t) (unHaskellName $ fieldHaskell f)+        getter = LamE+            [ ConP 'Entity [WildP, VarP valName]+            ] $ CaseE (VarE valName)+            [ Match (ConP (sumConstrName t f) [VarP xName]) (NormalB $ VarE xName) []++            -- FIXME It would be nice if the types expressed that the Field is+            -- a sum type and therefore could result in Maybe.+            , Match WildP (NormalB $ VarE 'error `AppE` LitE (StringL "Tried to use fieldLens on a Sum type")) []+            ]+        setter = LamE+            [ ConP 'Entity [VarP keyName, WildP]+            , VarP xName+            ]+            $ ConE 'Entity `AppE` VarE keyName `AppE` (ConE (sumConstrName t f) `AppE` VarE xName)  mkEntity :: MkPersistSettings -> EntityDef -> Q [Dec] mkEntity mps t = do
persistent-template.cabal view
@@ -1,5 +1,5 @@ name:            persistent-template-version:         1.1.2.3+version:         1.1.2.4 license:         MIT license-file:    LICENSE author:          Michael Snoyman <michael@snoyman.com>