packages feed

chunks 2007.3.26 → 2007.4.18

raw patch · 2 files changed

+9/−6 lines, 2 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

- Text.HTML.Chunks: format :: (Chunk a) => a -> String
+ Text.HTML.Chunks: format :: Chunk a => a -> String

Files

chunks.cabal view
@@ -1,5 +1,5 @@ name: chunks-version: 2007.3.26+version: 2007.4.18 stability: Alpha copyright: Matthew Sackman category: Text
src/Text/HTML/Chunks/TH.hs view
@@ -62,18 +62,21 @@     where       instDec = instanceD (cxt []) (appT (conT chunkC) (conT name)) [func']       name = mkName (baseName ++ suffix)-      func = makeFormatterB recE suffix content [| "" |]+      (func, contentUsed) = makeFormatterB recE suffix content ([| "" |], False)       func' = funD formatN [clause [recP] (normalB func) []]       conName = mkName "content"       recE = varE conName-      recP = varP conName+      recP = varP conNameUsed+      conNameUsed = if contentUsed then conName else mkName "_"       chunkC = mkName "Chunk"       formatN = mkName $ "format" -makeFormatterB :: ExpQ -> String -> [P.Content] -> ExpQ -> ExpQ+makeFormatterB :: ExpQ -> String -> [P.Content] -> (ExpQ, Bool) -> (ExpQ, Bool) makeFormatterB _ _ [] acc = acc-makeFormatterB p n ((P.Text t):c) acc = makeFormatterB p n c [| $acc ++ $(lift t) |]-makeFormatterB p n ((P.Variable v):c) acc = makeFormatterB p n c [| $acc ++ $application |]+makeFormatterB p n ((P.Text t):c) (acc, contentUsed)+    = makeFormatterB p n c ([| $acc ++ $(lift t) |], contentUsed)+makeFormatterB p n ((P.Variable v):c) (acc, contentUsed)+    = makeFormatterB p n c ([| $acc ++ $application |], True)     where       fieldName = varE $ mkName $ n ++ "_" ++ v       application = [| $fieldName $p |]