Hi all,

With the following module:

-----8<----------8<----------8<----------8<----------8<-----
module Main (main) where

import Language.Haskell.THSyntax
import Text.PrettyPrint.HughesPJ

main :: IO ()
main = do ds <- runQ [d| {x = x+y; y = x+y; z = z} |]
          putStrLn $ render $ vcat $ map pprDec ds
-----8<----------8<----------8<----------8<----------8<-----

the output looks like this:

-----8<----------8<----------8<----------8<----------8<-----
z = z
x = x GHC.Num:+ y
y = x GHC.Num:+ y
-----8<----------8<----------8<----------8<----------8<-----

This is far from ideal if you want to have [def_x, def_y, def_z] rather
than ds on the left hand side (as I do, and it doesn't seem unreasonable
to me to expect it to do the obvious). At first I thought this was just
caused by reversed lists in the parser, but then I discovered that
something seems to be then reordering declarations that depend on each
other - I'm guessing the type checker or possibly renamer, but I'm not
familiar enough with the code to know. Is fixing this (and similar
reorderings) an easy task? Any pointers?


Thanks
Ian

_______________________________________________
Cvs-ghc mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/cvs-ghc

Reply via email to