packages feed

HStringTemplate 0.3.1 → 0.3.2

raw patch · 3 files changed

+24/−11 lines, 3 filesdep ~parsec

Dependency ranges changed: parsec

Files

HStringTemplate.cabal view
@@ -1,5 +1,5 @@ name:                HStringTemplate-version:             0.3.1+version:             0.3.2 synopsis:            StringTemplate implementation in Haskell. description:         A port of the Java library by Terrence Parr. category:            Text@@ -25,7 +25,7 @@     exposed-modules: Text.StringTemplate.GenericStandard    if flag(small-base)-    build-depends:   base >= 3, filepath, parsec, containers, pretty, time, old-time, old-locale, bytestring, directory, array+    build-depends:   base >= 3, filepath, parsec < 3, containers, pretty, time, old-time, old-locale, bytestring, directory, array   else     build-depends:   base < 3, filepath, parsec   exposed-modules:   Text.StringTemplate
Text/StringTemplate/Base.hs view
@@ -190,7 +190,8 @@           stEncode = stFromString . senc snv  showStr :: Stringable a => String -> SEnv a -> a-showStr = flip showVal . STR+--showStr = flip showVal . STR+showStr s = const (stFromString $ s)  {--------------------------------------------------------------------   Utility Combinators@@ -368,9 +369,9 @@        <|> try (string "length") <|> string "last"   (fApply f .) <$> around '(' subexprn ')'       where fApply str (LI xs)-                | str == "first"  = head xs+                | str == "first"  = if null xs then SNull else head xs                 | str == "last"   = last xs-                | str == "rest"   = (LI . tail) xs+                | str == "rest"   = if null xs then SNull else (LI . tail) xs                 | str == "strip"  = LI . filter (not . liNil) $ xs                 | str == "length" = STR . show . length $ xs             fApply str x
Text/StringTemplate/Instances.hs view
@@ -2,7 +2,7 @@ {-# OPTIONS_GHC -fno-warn-orphans #-} {-# OPTIONS_HADDOCK not-home #-} -module Text.StringTemplate.Instances where+module Text.StringTemplate.Instances() where import Text.StringTemplate.Classes  import qualified Data.Map as M@@ -116,12 +116,24 @@ instance ToSElem ZonedTime where     toSElem = stShowsToSE ---Tuples+t2map :: [SElem a] -> SElem a+t2map = SM . M.fromList . zip (map show [(0::Int)..])+ instance (ToSElem a, ToSElem b) => ToSElem (a, b) where-   toSElem (a,b) = LI [toSElem a, toSElem b]+   toSElem (a,b) = t2map [toSElem a, toSElem b] instance (ToSElem a, ToSElem b, ToSElem c) => ToSElem (a, b, c) where-   toSElem (a,b,c) = LI [toSElem a, toSElem b, toSElem c]+   toSElem (a,b,c) = t2map [toSElem a, toSElem b, toSElem c] instance (ToSElem a, ToSElem b, ToSElem c, ToSElem d) => ToSElem (a, b, c, d) where-   toSElem (a,b,c,d) = LI [toSElem a, toSElem b, toSElem c, toSElem d]+   toSElem (a,b,c,d) = t2map [toSElem a, toSElem b, toSElem c, toSElem d] instance (ToSElem a, ToSElem b, ToSElem c, ToSElem d, ToSElem e) => ToSElem (a, b, c, d, e) where-   toSElem (a,b,c,d,e) = LI [toSElem a, toSElem b, toSElem c, toSElem d, toSElem e]+   toSElem (a,b,c,d,e) = t2map [toSElem a, toSElem b, toSElem c, toSElem d, toSElem e]+instance (ToSElem a, ToSElem b, ToSElem c, ToSElem d, ToSElem e, ToSElem f) => ToSElem (a, b, c, d, e, f) where+   toSElem (a,b,c,d,e, f) = t2map [toSElem a, toSElem b, toSElem c, toSElem d, toSElem e, toSElem f]+instance (ToSElem a, ToSElem b, ToSElem c, ToSElem d, ToSElem e, ToSElem f, ToSElem g) => ToSElem (a, b, c, d, e, f, g) where+   toSElem (a,b,c,d,e,f,g) = t2map [toSElem a, toSElem b, toSElem c, toSElem d, toSElem e, toSElem f, toSElem g]+instance (ToSElem a, ToSElem b, ToSElem c, ToSElem d, ToSElem e, ToSElem f, ToSElem g, ToSElem h) => ToSElem (a, b, c, d, e, f, g, h) where+   toSElem (a,b,c,d,e,f,g,h) = t2map [toSElem a, toSElem b, toSElem c, toSElem d, toSElem e, toSElem f, toSElem g, toSElem h]+instance (ToSElem a, ToSElem b, ToSElem c, ToSElem d, ToSElem e, ToSElem f, ToSElem g, ToSElem h, ToSElem i) => ToSElem (a, b, c, d, e, f, g, h, i) where+   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]