hsx 0.4.4 → 0.4.5
raw patch · 4 files changed
+26/−17 lines, 4 filesdep +utf8-string
Dependencies added: utf8-string
Files
- hsx.cabal +5/−4
- src/HSX/Transform.hs +13/−10
- src/HSX/XMLGenerator.hs +6/−2
- src/Trhsx.hs +2/−1
hsx.cabal view
@@ -1,8 +1,8 @@ Name: hsx-Version: 0.4.4+Version: 0.4.5 License: BSD3 License-File: LICENSE-Author: Niklas Broberg, Joel Bjornson+Author: Niklas Broberg, Joel Björnson Maintainer: Niklas Broberg <nibro@cs.chalmers.se> Stability: Experimental@@ -29,7 +29,7 @@ Homepage: http://code.google.com/hsp -Build-Depends: base>3, mtl, haskell-src-exts>=0.3.2+Build-Depends: base>3, mtl, haskell-src-exts>=0.3.2, utf8-string Build-Type: Simple Tested-With: GHC==6.8.3 @@ -46,7 +46,8 @@ TypeFamilies, TypeSynonymInstances, FlexibleContexts,- TypeOperators+ TypeOperators,+ CPP Executable: trhsx Main-Is: Trhsx.hs
src/HSX/Transform.hs view
@@ -227,7 +227,8 @@ -- ... and lift the values into the XML datatype. return $ paren $ metaGenElement name as mattr cs' - where -- | Transform expressions appearing in child position of an xml tag.+ where+ -- | Transform expressions appearing in child position of an xml tag. -- Expressions are first transformed, then wrapped in a call to -- @toXml@. transformChild :: HsExp -> HsxM HsExp@@ -396,8 +397,7 @@ let gs' = case gs of [] -> [] [g] -> [mkDeclGuard g ws]- _ -> error "This should not happen since we \ - \ have called renameLetDecls already!"+ _ -> error "This should not happen since we have called renameLetDecls already!" -- Generated attribute guards should also be added as declarations, -- but with no where clauses. ags' = map (flip mkDeclGuard $ []) ags@@ -1018,7 +1018,8 @@ -- that lifts that function into the matcher monad. HsRPPat p -> mkBaseDecl s linear p - where -- | Generate declarations for matching ordinary Haskell patterns+ where+ -- | Generate declarations for matching ordinary Haskell patterns mkBaseDecl :: SrcLoc -> Bool -> HsPat -> Tr MFunMetaInfo mkBaseDecl s linear p = case p of -- We can simplify a lot if the pattern is a wildcard or a variable@@ -1152,7 +1153,8 @@ nvts <- mapM (trRPat s linear) rps mkSeqDecl s nvts - where -- | Generate a match function for a sequence of regular patterns,+ where+ -- | Generate a match function for a sequence of regular patterns, -- flattening any special sub-patterns into normal elements of the list mkSeqDecl :: SrcLoc -> [MFunMetaInfo] -> Tr MFunMetaInfo mkSeqDecl s nvts = do@@ -1229,7 +1231,8 @@ -- The type of the value is unchanged. return (n, (v:vs), mt) - where -- | Generate a declaration for a @: binding.+ where+ -- | Generate a declaration for a \@: binding. mkCAsDecl :: SrcLoc -> MFunMetaInfo -> Tr HsName mkCAsDecl = asDecl $ app consFun -- should become lists when applied to [] @@ -1249,10 +1252,10 @@ | otherwise -> case v of HsIdent n -> fail $ "Attempting to bind variable "++n++ " inside the context of a numerable regular pattern"- _ -> fail $ "This should never ever ever happen...\- \ how the #% did you do it??!?"+ _ -> fail $ "This should never ever ever happen... how the #% did you do it??!?" - where -- | Generate a declaration for a @ binding.+ where+ -- | Generate a declaration for a \@ binding. mkAsDecl :: SrcLoc -> MFunMetaInfo -> Tr HsName mkAsDecl = asDecl metaConst -- should be constant when applied to [] @@ -1285,7 +1288,7 @@ nvt2 <- trRPat s False rp2 -- ... and create a declaration that can choose between them. mkEitherDecl s nvt1 nvt2- -- | Generate declarations for either patterns, i.e. ( | )+ -- Generate declarations for either patterns, i.e. ( | ) where mkEitherDecl :: SrcLoc -> MFunMetaInfo -> MFunMetaInfo -> Tr MFunMetaInfo mkEitherDecl s nvt1@(_, vs1, t1) nvt2@(_, vs2, t2) = do -- Eine namen, bitte!
src/HSX/XMLGenerator.hs view
@@ -44,7 +44,7 @@ genEElement n ats = genElement n ats [] xmlToChild :: XML m -> Child m --- | Type synonyms to avoid writing out the XMLGenT all the time +-- | Type synonyms to avoid writing out the XMLnGenT all the time type GenXML m = XMLGenT m (XML m) type GenXMLList m = XMLGenT m [XML m] type GenChild m = XMLGenT m (Child m) @@ -68,7 +68,11 @@ instance XMLGen m => EmbedAsChild m (Child m) where asChild = return . return -instance XMLGen m => EmbedAsChild m (XML m) where +#if __GLASGOW_HASKELL__ >= 610 +instance (XMLGen m, XML m ~ x) => EmbedAsChild m x where +#else +instance (XMLGen m) => EmbedAsChild m (XML m) where +#endif asChild = return . return . xmlToChild
src/Trhsx.hs view
@@ -1,7 +1,8 @@ module Main where import Language.Haskell.Exts-+import Prelude hiding (readFile, writeFile)+import System.IO.UTF8 (readFile, writeFile) import HSX.Transform import System.Environment (getArgs)