packages feed

syb-with-class 0.6.1.5 → 0.6.1.6

raw patch · 2 files changed

+18/−4 lines, 2 filesdep ~template-haskellPVP: minor bump suggested

API additions: PVP suggests at least a minor version bump

Dependency ranges changed: template-haskell

API changes (from Hackage documentation)

+ Data.Generics.SYB.WithClass.Derive: escape :: String -> String

Files

Data/Generics/SYB/WithClass/Derive.hs view
@@ -69,6 +69,11 @@                     Maybe [Name], -- Name of the field selector, if any                     [Type])       -- Type of the constructor argument +escape :: String -> String+escape "" = ""+escape ('.' : more) = '_' : escape more+escape (c : more) = c : escape more+ -- | Takes a name of a algebraic data type, the number of parameters it --   has and a list of constructor pairs.  Each one of these constructor --   pairs consists of a constructor name and the number of type@@ -81,8 +86,8 @@ #ifdef __HADDOCK__  undefined #else- do theDataTypeName <- newName $ "dataType_sybwc_" ++ show name-    constrNames <- mapM (\(conName,_,_,_) -> newName $ "constr_sybwc_" ++ show conName) cons+ do theDataTypeName <- newName $ "dataType_sybwc_" ++ escape (show name)+    constrNames <- mapM (\(conName,_,_,_) -> newName $ "constr_sybwc_" ++ escape (show conName)) cons     let constrExps = map varE constrNames      let mkConstrDec :: Name -> Constructor -> Q [Dec]@@ -186,8 +191,13 @@         myType = foldl AppT (ConT name) typeParams        dataCxt typ = conT ''Data `appT` varT (mkName "ctx") `appT` return typ+#if MIN_VERSION_template_haskell(2,10,0)+       dataCxt' typ = (conT ''Data `appT` varT (mkName "ctx")) `appT` return typ+       satCxt typ = conT ''Sat `appT` (varT (mkName "ctx") `appT` return typ)+#else        dataCxt' typ = return $ ClassP ''Data [VarT (mkName "ctx"), typ]        satCxt typ = return $ ClassP ''Sat [VarT (mkName "ctx") `AppT` typ]+#endif        dataCxtTypes = filter (\x -> applied x /= ConT name) $ nub (typeParams ++ types)        satCxtTypes = nub (myType : types)        context = cxt (map dataCxt' dataCxtTypes ++ map satCxt satCxtTypes)@@ -201,7 +211,11 @@     decs <- qOfDecs     params <- replicateM nParam (newName "a")     let typeQParams = map varT params+#if MIN_VERSION_template_haskell(2,10,0)+        context = cxt (map (appT (conT ''Data)) typeQParams)+#else         context = cxt (map (\typ -> classP ''Data [typ]) typeQParams)+#endif         instanceType = foldl appT (conT name) typeQParams     inst <-instanceD context                      (conT ''Data `appT` instanceType)
syb-with-class.cabal view
@@ -1,5 +1,5 @@ Name:               syb-with-class-Version:            0.6.1.5+Version:            0.6.1.6 License:            BSD3 License-file:       LICENSE Copyright:          2004 - 2008 The University of Glasgow, CWI,@@ -25,7 +25,7 @@   location: http://patch-tag.com/r/Saizan/syb-with-class/  Library -    Build-Depends:      base >= 3 && < 5, template-haskell >= 2.4 && < 2.10, bytestring, array, containers+    Build-Depends:      base >= 3 && < 5, template-haskell >= 2.4 && < 2.11, bytestring, array, containers     Exposed-modules:         Data.Generics.SYB.WithClass.Basics         Data.Generics.SYB.WithClass.Context