packages feed

groundhog-th 0.8.0.1 → 0.8.0.2

raw patch · 4 files changed

+11/−9 lines, 4 filesdep ~yamlPVP ok

version bump matches the API change (PVP)

Dependency ranges changed: yaml

API changes (from Hackage documentation)

Files

Database/Groundhog/TH.hs view
@@ -368,8 +368,7 @@   mkConstr cNum c = case c of     NormalC name params -> mkConstr' name $ zipWith (mkField (nameBase name)) params [0..]     RecC name params -> mkConstr' name $ zipWith (mkVarField (nameBase name)) params [0..]-    InfixC{} -> error $ "Types with infix constructors are not supported" ++ show dName-    ForallC{} -> error $ "Types with existential quantification are not supported" ++ show dName+    _ -> error $ "Only regular types and records are supported" ++ show dName    where     mkConstr' name params = THConstructorDef name (apply mkPhantomName) (apply mkDbConstrName) (Just $ apply mkDbConstrAutoKeyName) params [] where       apply f = f dName' (nameBase name) cNum@@ -392,8 +391,7 @@     [cons'] -> case cons' of       NormalC name params -> (name, zipWith (mkField (nameBase name)) params [0..])       RecC name params -> (name, zipWith (mkVarField (nameBase name)) params [0..])-      InfixC{} -> error $ "Types with infix constructors are not supported" ++ show dName-      ForallC{} -> error $ "Types with existential quantification are not supported" ++ show dName+      _ -> error $ "Only regular types and records are supported" ++ show dName     _ -> error $ "An embedded datatype must have exactly one constructor: " ++ show dName      mkField :: String -> StrictType -> Int -> THFieldDef
Database/Groundhog/TH/CodeGen.hs view
@@ -1,4 +1,4 @@-{-# LANGUAGE TemplateHaskell, RecordWildCards, DoAndIfThenElse, ExplicitForAll #-}
+{-# LANGUAGE TemplateHaskell, RecordWildCards, DoAndIfThenElse, ExplicitForAll, StandaloneDeriving #-}
 {-# LANGUAGE CPP #-}
 
 module Database.Groundhog.TH.CodeGen
@@ -35,7 +35,9 @@ import Data.Either (lefts, rights)
 import Data.List (findIndex, nub, partition)
 import Data.Maybe (catMaybes, mapMaybe)
-import qualified Text.Read as R
+import qualified GHC.Read as R
+import qualified Text.Read.Lex as R
+import qualified Text.ParserCombinators.ReadPrec as R
 
 mkEmbeddedPersistFieldInstance :: THEmbeddedDef -> Q [Dec]
 mkEmbeddedPersistFieldInstance def = do
@@ -358,8 +360,7 @@     mkRead (cName, fieldsNum, u) = do
       let key = foldl (\a b -> [| $a <*> $b |]) [| $(conE $ mkName cName) <$> R.step R.readPrec |]
             $ replicate (fieldsNum - 1) [| R.step R.readPrec |]
-          func = lamE [conP 'R.Ident [litP $ StringL cName]] key
-          body = [| R.parens $ R.prec 10 $ R.lexP >>= $func |]
+          body = [| R.parens $ R.prec 10 $ R.expectP (R.Ident $(litE $ StringL cName)) >> $key |]
       keyType <- [t| Key $(return entity) $u |]
       readPrec' <- funD 'R.readPrec [clause [] (normalB body) []]
       readListPrec' <- funD 'R.readListPrec [clause [] (normalB [| R.readListPrecDefault |]) []]
changelog view
@@ -1,3 +1,6 @@+0.8.0.2+* Fixed Template Haskell incomplete patterns+ 0.8.0.1 * Compatibility with template-haskell-2.12 
groundhog-th.cabal view
@@ -1,5 +1,5 @@ name:            groundhog-th-version:         0.8.0.1+version:         0.8.0.2 license:         BSD3 license-file:    LICENSE author:          Boris Lykah <lykahb@gmail.com>