packages feed

HStringTemplate 0.7.1 → 0.7.3

raw patch · 2 files changed

+3/−52 lines, 2 filesdep −syb-with-class

Dependencies removed: syb-with-class

Files

HStringTemplate.cabal view
@@ -1,5 +1,5 @@ name:                HStringTemplate-version:             0.7.1+version:             0.7.3 synopsis:            StringTemplate implementation in Haskell. description:         A port of the Java library by Terrence Parr. category:            Text@@ -12,26 +12,17 @@ build-Depends:       base Cabal-Version:       >= 1.6 -flag syb-with-class-   default: False-flag quasi-quotation  library-  if flag(syb-with-class)-    build-depends:   syb-with-class-    exposed-modules: Text.StringTemplate.GenericWithClass -  if flag(quasi-quotation)-    build-depends: template-haskell >= 2.3, mtl-    exposed-modules: Text.StringTemplate.QQ-   build-depends:   syb, base >= 4, base < 5, filepath, parsec < 4, containers, pretty >= 1.1.0.0,-                   time, old-time, old-locale, bytestring, directory, array, text, deepseq, utf8-string, blaze-builder, void+                   time, old-time, old-locale, bytestring, directory, array, text, deepseq, utf8-string, blaze-builder, void, template-haskell >= 2.3, mtl    exposed-modules:   Text.StringTemplate                      Text.StringTemplate.Base                      Text.StringTemplate.Classes                      Text.StringTemplate.GenericStandard+                     Text.StringTemplate.QQ   other-modules:     Text.StringTemplate.Instances                      Text.StringTemplate.Group                      Text.StringTemplate.Renderf
− Text/StringTemplate/GenericWithClass.hs
@@ -1,40 +0,0 @@-{-# LANGUAGE FlexibleInstances, OverlappingInstances, FlexibleContexts, UndecidableInstances, Rank2Types #-}-{-# OPTIONS_GHC -fno-warn-orphans #-}------------------------------------------------------------------------ | Generic Instance for ToSElem using syb-with-class.---   Inspired heavily-to-entirely by Alex Drummond's RJson.---------------------------------------------------------------------}--module Text.StringTemplate.GenericWithClass() where-import qualified Data.Map as M-import Text.StringTemplate.Classes-import Data.Generics.SYB.WithClass.Basics--stripInitialUnderscores :: String -> String-stripInitialUnderscores ('_':s) = stripInitialUnderscores s-stripInitialUnderscores s       = s--data ToSElemD a = ToSElemD { toSElemD :: Stringable b => a -> SElem b }--toSElemProxy :: Proxy ToSElemD-toSElemProxy = error "This value should never be evaluated!"--instance (ToSElem a, Data ToSElemD a) => Sat (ToSElemD a) where-   dict = ToSElemD { toSElemD = toSElem }--genericToSElem :: (Data ToSElemD a, ToSElem a, Stringable b) => a -> SElem b-genericToSElem x-       | isAlgType (dataTypeOf toSElemProxy x) =-           case (map stripInitialUnderscores (getFields x)) of-             [] -> LI (STR (showConstr (toConstr toSElemProxy x)) :-                           gmapQ toSElemProxy (toSElemD dict) x)-             fs -> SM (M.fromList (zip fs (gmapQ toSElemProxy (toSElemD dict) x)))-       | True =-               error ("Unable to serialize the primitive type '" ++-                      dataTypeName (dataTypeOf toSElemProxy x) ++ "'")--getFields :: Data ToSElemD a => a -> [String]-getFields = constrFields . toConstr toSElemProxy--instance Data ToSElemD t => ToSElem t where-   toSElem = genericToSElem