packages feed

HStringTemplate 0.6.11 → 0.6.12

raw patch · 4 files changed

+6/−83 lines, 4 filesdep −dlistdep −ghc-primdep ~base

Dependencies removed: dlist, ghc-prim

Dependency ranges changed: base

Files

HStringTemplate.cabal view
@@ -1,5 +1,5 @@ name:                HStringTemplate-version:             0.6.11+version:             0.6.12 synopsis:            StringTemplate implementation in Haskell. description:         A port of the Java library by Terrence Parr. category:            Text@@ -29,10 +29,6 @@     build-depends:   syb, base >= 4, base < 5, filepath, parsec < 4, containers, pretty, time, old-time, old-locale, bytestring, directory, array, text, deepseq, utf8-string, blaze-builder   else     build-depends:   base > 3, base < 4, filepath, parsec < 4, containers, pretty, time, old-time, old-locale, bytestring, directory, array, text, utf8-string, blaze-builder--  if impl(ghc >= 7.2.1)-    cpp-options: -DGENERICS-    build-depends: ghc-prim >= 0.2, dlist >= 0.2    exposed-modules:   Text.StringTemplate                      Text.StringTemplate.Base
Text/StringTemplate.hs view
@@ -1,7 +1,3 @@-{-# LANGUAGE CPP #-}-#ifdef GENERICS-{-# LANGUAGE DefaultSignatures #-}-#endif ----------------------------------------------------------------------------- -- | -- Module      :  Text.StringTemplate@@ -40,9 +36,6 @@   StringTemplate, STGroup,   -- * Classes   ToSElem(..), StringTemplateShows(..), stShowsToSE, Stringable(..), SEType(..),-#ifdef GENERICS-    GToSElem(..),-#endif   -- * Creation   newSTMP, newAngleSTMP, getStringTemplate, getStringTemplate',   -- * Display@@ -64,5 +57,4 @@ import Text.StringTemplate.Base import Text.StringTemplate.Group import Text.StringTemplate.Renderf-import Text.StringTemplate.Classes import Text.StringTemplate.Instances()
Text/StringTemplate/Classes.hs view
@@ -1,15 +1,8 @@-{-# LANGUAGE CPP, ExistentialQuantification, FlexibleContexts, FlexibleInstances, StandaloneDeriving, GeneralizedNewtypeDeriving, TypeSynonymInstances #-}-#ifdef GENERICS-{-# LANGUAGE DefaultSignatures, DeriveGeneric #-}-#endif+{-# LANGUAGE ExistentialQuantification, FlexibleInstances, StandaloneDeriving, GeneralizedNewtypeDeriving, TypeSynonymInstances #-} {-# OPTIONS_HADDOCK not-home #-} module Text.StringTemplate.Classes     (SElem(..), StringTemplateShows(..), ToSElem(..), SMap, STShow(..),-     StFirst(..), Stringable(..),-#ifdef GENERICS-    GToSElem(..),-#endif-     stShowsToSE+     StFirst(..), Stringable(..), stShowsToSE     ) where import qualified Data.Map as M import Data.List@@ -24,13 +17,6 @@ import qualified Data.Text.Lazy.Encoding as LT import qualified Text.PrettyPrint.HughesPJ as PP -#ifdef GENERICS-import GHC.Generics--class GToSElem f where-    gToSElem :: Stringable b => f a -> SElem b-#endif- newtype StFirst a = StFirst { stGetFirst :: Maybe a }         deriving (Eq, Ord, Read, Show) instance Monoid (StFirst a) where@@ -56,10 +42,6 @@ -- inserted as attributes into a StringTemplate. class ToSElem a where     toSElem :: Stringable b => a -> SElem b-#ifdef GENERICS-    default toSElem :: (Stringable b, Generic a, GToSElem (Rep a)) => a -> SElem b-    toSElem = gToSElem . from-#endif     toSElemList :: Stringable b => [a] -> SElem b     toSElemList = LI . map toSElem 
Text/StringTemplate/Instances.hs view
@@ -1,12 +1,8 @@-{-# LANGUAGE FlexibleInstances, OverlappingInstances, CPP #-}-#ifdef GENERICS-{-# LANGUAGE DefaultSignatures, DeriveGeneric, TypeOperators #-}-#endif+{-# LANGUAGE FlexibleInstances, OverlappingInstances #-} {-# OPTIONS_GHC -fno-warn-orphans #-} {-# OPTIONS_HADDOCK not-home #-} -module Text.StringTemplate.Instances where---module Text.StringTemplate.Instances() where+module Text.StringTemplate.Instances() where import Text.StringTemplate.Classes  import qualified Data.Map as M@@ -24,28 +20,14 @@ import qualified Data.Text.Encoding as T import qualified Data.Text.Lazy as LT import qualified Data.Text.Lazy.Encoding as LT-#ifdef GENERICS-import GHC.Generics-#endif-import Debug.Trace + {--------------------------------------------------------------------   Additional instances for items that may be set as StringTemplate   attributes. The code should provide examples of how to proceed. --------------------------------------------------------------------}  --Basics--instance Stringable a => ToSElem (SElem a) where-    toSElem (STR s)  = STR s-    toSElem (BS x)   = BS x-    toSElem (STSH x) = STSH x-    toSElem (SM x)   = SM $ M.map toSElem x-    toSElem (LI xs)  = LI $ map toSElem xs-    toSElem (SBLE x) = STR $ stToString x-    toSElem (SNAT x) = STR $ stToString x-    toSElem SNull = SNull- instance ToSElem Char where     toSElem = STR . (:[])     toSElemList = STR@@ -174,32 +156,3 @@    toSElem (a,b,c,d,e,f,g,h,i) = t2map [toSElem a, toSElem b, toSElem c, toSElem d, toSElem e, toSElem f, toSElem g, toSElem h, toSElem i] instance (ToSElem a, ToSElem b, ToSElem c, ToSElem d, ToSElem e, ToSElem f, ToSElem g, ToSElem h, ToSElem i, ToSElem j) => ToSElem (a, b, c, d, e, f, g, h, i, j) where    toSElem (a,b,c,d,e,f,g,h,i,j) = t2map [toSElem a, toSElem b, toSElem c, toSElem d, toSElem e, toSElem f, toSElem g, toSElem h, toSElem i, toSElem j]-------#ifdef GENERICS-instance GToSElem V1-    where gToSElem = const SNull-instance GToSElem U1-    where gToSElem = const $ STR ""-instance  ToSElem a => GToSElem (K1 i a)-    where gToSElem = toSElem . unK1--- instance GToSElem a => GToSElem (M1 i c a)---    where gToSElem = gToSElem . unM1-instance (Constructor c, GToSElem a) => GToSElem (C1 c a)-    where gToSElem x = (gToSElem (unM1 x))-instance GToSElem a => GToSElem (D1 dt a)-    where gToSElem = gToSElem . unM1-instance (Selector s, GToSElem a) => GToSElem (S1 s a)-    where gToSElem x = (gToSElem (unM1 x))-instance (GToSElem a, GToSElem b) => GToSElem (a :*: b)-    where gToSElem (x :*: y) = trace "ay" $ LI [gToSElem x, gToSElem y] -- recursively recover-instance (GToSElem a, GToSElem b) => GToSElem (a :+: b) -- ditto-    where gToSElem (L1 x) = gToSElem x-          gToSElem (R1 x) = gToSElem x---- TODO special case tuple, list, maybe--data Foo a b = Baz {aasdf :: a, dfdfd :: b, dddd :: String} | Bar deriving Generic--#endif