packages feed

persistent 2.14.5.0 → 2.14.5.1

raw patch · 7 files changed

+31/−12 lines, 7 filesdep ~template-haskell

Dependency ranges changed: template-haskell

Files

ChangeLog.md view
@@ -1,5 +1,12 @@ # Changelog for persistent +## 2.14.5.1++* [#1496](https://github.com/yesodweb/persistent/pull/1496)+    * Fixes name shadowing error at the generated `keyFromRecordM` function.+* [#1505](https://github.com/yesodweb/persistent/pull/1505)+    * Fixes the comment line parsing rule so that accommodates paragraph breaks.+ ## 2.14.5.0  * [#1469](https://github.com/yesodweb/persistent/pull/1469)
Database/Persist/PersistValue.hs view
@@ -23,7 +23,7 @@ import Numeric (readHex, showHex) import qualified Data.Text as Text import Data.Text (Text)-import Data.ByteString (ByteString, foldl')+import Data.ByteString as BS (ByteString, foldl') import Data.Time (Day, TimeOfDay, UTCTime) import Web.PathPieces (PathPiece(..)) import qualified Data.Aeson as A@@ -235,7 +235,7 @@           -- taken from crypto-api          bs2i :: ByteString -> Integer-         bs2i bs = foldl' (\i b -> (i `shiftL` 8) + fromIntegral b) 0 bs+         bs2i bs = BS.foldl' (\i b -> (i `shiftL` 8) + fromIntegral b) 0 bs          {-# INLINE bs2i #-}           -- showHex of n padded with leading zeros if necessary to fill d digits
Database/Persist/Quasi/Internal.hs view
@@ -53,8 +53,8 @@ import Prelude hiding (lines)  import Control.Applicative (Alternative((<|>)))-import Data.Char (isDigit, isLower, isSpace, isUpper, toLower) import Control.Monad+import Data.Char (isDigit, isLower, isSpace, isUpper, toLower) import Data.List (find, foldl') import Data.List.NonEmpty (NonEmpty(..)) import qualified Data.List.NonEmpty as NEL@@ -238,7 +238,7 @@ tokenize :: Text -> [Token] tokenize t     | T.null t = []-    | Just txt <- T.stripPrefix "-- | " t = [DocComment txt]+    | Just txt <- T.stripPrefix "-- |" t = [DocComment (T.stripStart txt)]     | "--" `T.isPrefixOf` t = [] -- Comment until the end of the line.     | "#" `T.isPrefixOf` t = [] -- Also comment to the end of the line, needed for a CPP bug (#110)     | T.head t == '"' = quotes (T.tail t) id
Database/Persist/TH.hs view
@@ -141,6 +141,7 @@ conp :: Name -> [Pat] -> Pat conp name pats = ConP name [] pats #else+conp :: Name -> [Pat] -> Pat conp = ConP #endif @@ -1994,18 +1995,20 @@     [keyFromRecordM'] <-         case unboundPrimarySpec entDef of             NaturalKey ucd -> do-                let-                    keyCon =-                        keyConName entDef-                    keyFields' =-                        fieldNameToRecordName mps entDef <$> unboundCompositeCols ucd+                let keyFields' = fieldNameToRecordName mps entDef <$> unboundCompositeCols ucd+                keyFieldNames' <- forM keyFields' $ \fieldName -> do+                                         fieldVarName <- newName (nameBase fieldName)+                                         return (fieldName, fieldVarName)++                let keyCon = keyConName entDef                     constr =                         foldl'                             AppE                             (ConE keyCon)-                            (VarE <$> keyFields')+                            (VarE . snd <$> keyFieldNames')                     keyFromRec = varP 'keyFromRecordM-                    lam = LamE [RecP name [(n, VarP n) | n <- toList keyFields']] constr+                    fieldPat = [(fieldName, VarP fieldVarName) | (fieldName, fieldVarName) <- toList keyFieldNames']+                    lam = LamE [RecP name fieldPat ] constr                 [d|                     $(keyFromRec) = Just $(pure lam)                     |]
persistent.cabal view
@@ -1,5 +1,5 @@ name:            persistent-version:         2.14.5.0+version:         2.14.5.1 license:         MIT license-file:    LICENSE author:          Michael Snoyman <michael@snoyman.com>
test/Database/Persist/QuasiSpec.hs view
@@ -236,6 +236,13 @@                             [ DocComment "this is a comment"                             ]                         )+            it "recognizes empty line" $ do+                parseLine "-- |" `shouldBe`+                    Just+                        ( Line 0+                            [ DocComment ""+                            ]+                        )              it "works if comment is indented" $ do                 parseLine "  -- | comment" `shouldBe`
test/Database/Persist/TH/CompositeKeyStyleSpec.hs view
@@ -10,6 +10,8 @@ {-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE UndecidableInstances #-} +{-# OPTIONS_GHC -Wname-shadowing -Werror=name-shadowing #-}+ module Database.Persist.TH.CompositeKeyStyleSpec where  import Data.Data (Data, constrFields, toConstr)