persistent-template 2.7.3 → 2.7.4
raw patch · 3 files changed
+9/−24 lines, 3 filesdep +th-lift-instancesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependencies added: th-lift-instances
API changes (from Hackage documentation)
- Database.Persist.TH: instance (Database.Persist.TH.Lift' k, Database.Persist.TH.Lift' v) => Database.Persist.TH.Lift' (Data.Map.Internal.Map k v)
- Database.Persist.TH: instance Database.Persist.TH.Lift' Data.Text.Internal.Text
- Database.Persist.TH: instance Database.Persist.TH.Lift' a => Database.Persist.TH.Lift' [a]
- Database.Persist.TH: instance Database.Persist.TH.Lift' a => Language.Haskell.TH.Syntax.Lift a
Files
- ChangeLog.md +4/−0
- Database/Persist/TH.hs +3/−23
- persistent-template.cabal +2/−1
ChangeLog.md view
@@ -1,5 +1,9 @@ ## Unreleased changes +## 2.7.4++* Remove an overlapping instance for `Lift a`. [#998](https://github.com/yesodweb/persistent/pull/998)+ ## 2.7.3 * Update module documentation for `Database.Persist.TH` to better describe the purpose of the module [#968](https://github.com/yesodweb/persistent/pull/968)
Database/Persist/TH.hs view
@@ -70,6 +70,9 @@ import qualified Data.Text.Encoding as TE import GHC.Generics (Generic) import GHC.TypeLits+import Instances.TH.Lift ()+ -- Bring `Lift (Map k v)` instance into scope, as well as `Lift Text`+ -- instance on pre-1.2.4 versions of `text` import Language.Haskell.TH.Lib (conT, varE) import Language.Haskell.TH.Quote import Language.Haskell.TH.Syntax@@ -1655,29 +1658,6 @@ instance Lift ForeignDef where lift (ForeignDef a b c d e f g) = [|ForeignDef a b c d e f g|]---- | A hack to avoid orphans.-class Lift' a where- lift' :: a -> Q Exp-instance Lift' Text where- lift' = liftT-instance Lift' a => Lift' [a] where- lift' xs = do { xs' <- mapM lift' xs; return (ListE xs') }-instance (Lift' k, Lift' v) => Lift' (M.Map k v) where- lift' m = [|M.fromList $(fmap ListE $ mapM liftPair $ M.toList m)|]---- overlapping instances is for automatic lifting--- while avoiding an orphan of Lift for Text---- auto-lifting, means instances are overlapping-instance {-# OVERLAPPABLE #-} Lift' a => Lift a where- lift = lift'--liftT :: Text -> Q Exp-liftT t = [|pack $(lift (unpack t))|]--liftPair :: (Lift' k, Lift' v) => (k, v) -> Q Exp-liftPair (k, v) = [|($(lift' k), $(lift' v))|] instance Lift HaskellName where lift (HaskellName t) = [|HaskellName t|]
persistent-template.cabal view
@@ -1,5 +1,5 @@ name: persistent-template-version: 2.7.3+version: 2.7.4 license: MIT license-file: LICENSE author: Michael Snoyman <michael@snoyman.com>@@ -26,6 +26,7 @@ , path-pieces , template-haskell >= 2.11 , text >= 1.2+ , th-lift-instances >= 0.1.14 && < 0.2 , transformers >= 0.5 && < 0.6 , unordered-containers exposed-modules: Database.Persist.TH