Hello,
I have attached patches to hsx, hjscript, and hsp updating them to
work with GHC > 7, and also updating the maintainer email address and
the source web pages. I did not patch HJavaScript, or any of the other
packages to update the maintainer information. Also, I did not change
where 'darcs send' goes. I think you can only change that by editing
your account information on patch-tag.
Additionally, there are some extra patches to HSX. In HSX.Transform, a
number of locations had code like:
(var nothing_name)
But Nothing is a constructor not a variable. This has not been a
problem until now because the pretty-printer does not care, and so
everything just works out ok in the end.
However, if you use haskell-src-meta to translate the HSE AST to TH,
then you will get a compile-time splice error because TH does care. So
I patch that (hopefully correctly).
Additionally, I renamed transformExp to transformExpM, and exported a
new function:
> transformExp :: Exp -> Exp
Using this new function it is now easy to implement a HSX
quasi-quoter. I have attached a prototype and a demo that uses it.
(The demo also requires haskell-src-meta and happstack-hsp).
Once the new HSX is released, I can release a package like, hsx-qq. Or
we could put the QuasiQuoter in HSX itself. It does add a dependency
on haskell-src-meta though. Not sure if that matters or not.
Using the new quoter you can now do:
> html :: (XMLGenerator m) => XMLGenT m (HSX.XML m)
> html = [hsx| <p><% map toUpper "hello, world!" %></p> |]
> main :: IO ()
> main = putStrLn $ renderAsHTML $ evalIdentity html
GHCi>
<p
>HELLO, WORLD!</p
This has a few advantages over trhsx:
1. it does not require an external pre-processor to be installed and
findable. Nor does it require the odd looking {-# OPTIONS_GHC -F
-pgmFtrhsx #-} pragma
2. It should leave haddock comments intact
3. line numbers in error messages are possibly more correct
4. it ought to work better if you want to use literal XML inside
normal TH (though some Lift instances are likely required)
5. it will make hamlet users feel more at home
The external trhxs tool is useful as well. This is intended to
compliment not replace it.
- jeremy
|
|
hjscript-fixes-for-ghc7.dpatch
20K
Download
|
|
|
hsx-bug-fixes-and-export-transformExp.dpatch
42K
Download
|