packages feed

persistent-template 2.1.6 → 2.1.7

raw patch · 3 files changed

+56/−12 lines, 3 files

Files

ChangeLog.md view
@@ -1,3 +1,7 @@+## 2.1.7++* Support for GHC 8 [#556](https://github.com/yesodweb/persistent/issues/556)+ ## 2.1.6  * aeson 0.11
Database/Persist/TH.hs view
@@ -47,7 +47,11 @@ import Database.Persist import Database.Persist.Sql (Migration, migrate, SqlBackend, PersistFieldSql) import Database.Persist.Quasi-import Language.Haskell.TH.Lib (varE)+import Language.Haskell.TH.Lib (+#if MIN_VERSION_template_haskell(2,11,0)+    conT,+#endif+    varE) import Language.Haskell.TH.Quote import Language.Haskell.TH.Syntax import Data.Char (toLower, toUpper)@@ -396,14 +400,21 @@         Just (a, b) -> cons (toUpper a) b         Nothing -> t -dataTypeDec :: MkPersistSettings -> EntityDef -> Dec-dataTypeDec mps t =-    DataD [] nameFinal paramsFinal constrs-    $ map (mkName . unpack) $ entityDerives t+dataTypeDec :: MkPersistSettings -> EntityDef -> Q Dec+dataTypeDec mps t = do+    let names = map (mkName . unpack) $ entityDerives t+#if MIN_VERSION_template_haskell(2,11,0)+    DataD [] nameFinal paramsFinal+                Nothing+                constrs+                <$> mapM conT names+#else+    return $ DataD [] nameFinal paramsFinal constrs names+#endif   where     mkCol x fd@FieldDef {..} =         (mkName $ unpack $ recName mps x fieldHaskell,-         if fieldStrict then IsStrict else NotStrict,+         if fieldStrict then isStrict else notStrict,          maybeIdType mps fd Nothing Nothing         )     (nameFinal, paramsFinal)@@ -420,7 +431,7 @@      sumCon fd = NormalC         (sumConstrName mps t fd)-        [(NotStrict, maybeIdType mps fd Nothing Nothing)]+        [(notStrict, maybeIdType mps fd Nothing Nothing)]  sumConstrName :: MkPersistSettings -> EntityDef -> FieldDef -> Name sumConstrName mps t FieldDef {..} = mkName $ unpack $ concat@@ -435,6 +446,9 @@ uniqueTypeDec mps t =     DataInstD [] ''Unique         [genericDataType mps (entityHaskell t) backendT]+#if MIN_VERSION_template_haskell(2,11,0)+            Nothing+#endif             (map (mkUnique mps t) $ entityUniques t)             [] @@ -449,7 +463,7 @@      go :: (FieldDef, IsNullable) -> (Strict, Type)     go (_, Nullable _) | not force = error nullErrMsg-    go (fd, y) = (NotStrict, maybeIdType mps fd Nothing (Just y))+    go (fd, y) = (notStrict, maybeIdType mps fd Nothing (Just y))      lookup3 :: Text -> [FieldDef] -> (FieldDef, IsNullable)     lookup3 s [] =@@ -691,9 +705,16 @@                         bi <- backendKeyI                         return (bi, allInstances) +#if MIN_VERSION_template_haskell(2,11,0)+    cxti <- mapM conT i     let kd = if useNewtype+               then NewtypeInstD [] k [recordType] Nothing dec cxti+               else DataInstD    [] k [recordType] Nothing [dec] cxti+#else+    let kd = if useNewtype                then NewtypeInstD [] k [recordType] dec i                else DataInstD    [] k [recordType] [dec] i+#endif     return (kd, instDecs)   where     keyConE = keyConExp t@@ -827,9 +848,9 @@     backendKeyType         | mpsGeneric mps = ConT ''BackendKey `AppT` backendT         | otherwise      = ConT ''BackendKey `AppT` mpsBackend mps-    idKeyVar ft = (unKeyName t, NotStrict, ft)+    idKeyVar ft = (unKeyName t, notStrict, ft)     primaryKeyVar fd = ( keyFieldName mps t fd-                       , NotStrict+                       , notStrict                        , ftToType $ fieldType fd                        ) @@ -939,8 +960,9 @@     let instanceConstraint = if not (mpsGeneric mps) then [] else           [mkClassP ''PersistStore [backendT]] +    dtd <- dataTypeDec mps t     return $ addSyn $-       dataTypeDec mps t : mconcat fkc `mappend`+       dtd : mconcat fkc `mappend`       ([ TySynD (keyIdName t) [] $             ConT ''Key `AppT` ConT (mkName nameS)       , InstanceD instanceConstraint clazz $@@ -960,6 +982,9 @@             [ genDataType             , VarT $ mkName "typ"             ]+#if MIN_VERSION_template_haskell(2,11,0)+            Nothing+#endif             (map fst fields)             []         , FunD 'persistFieldDef (map snd fields)@@ -1559,6 +1584,21 @@ #else mkEqualP = EqualP #endif++#if MIN_VERSION_template_haskell(2,11,0)+notStrict :: Bang+notStrict = Bang NoSourceUnpackedness NoSourceStrictness++isStrict :: Bang+isStrict = Bang NoSourceUnpackedness SourceStrict+#else+notStrict :: Strict+notStrict = NotStrict++isStrict :: Strict+isStrict = IsStrict+#endif+  -- entityUpdates :: EntityDef -> [(HaskellName, FieldType, IsNullable, PersistUpdate)] -- entityUpdates =
persistent-template.cabal view
@@ -1,5 +1,5 @@ name:            persistent-template-version:         2.1.6+version:         2.1.7 license:         MIT license-file:    LICENSE author:          Michael Snoyman <michael@snoyman.com>