For some time now I've been saying that Tim and I are working on the design of some enhancements to Template Haskell. It's taken longer than I'd hoped, and we aren't done yet, but you can find a draft at http://research.microsoft.com/~simonpj/tmp/notes.ps The message below is a case in point. There's really no good way to do this in TH today, but it's one of the points addressed in our new design (see Section 5). Comments very welcome, folks. Nothing implemented yet, but it's getting near the front of the queue now. Simon | -----Original Message----- | From: glasgow-haskell-users-bounces@haskell.org [mailto:glasgow-haskell-users- | bounces@haskell.org] On Behalf Of MR K P SCHUPKE | Sent: 29 October 2003 17:46 | To: glasgow-haskell-users@haskell.org | Subject: Template Haskell... | | | Okay, I have got my template working, but its extremely unreadable... could | anyone tell me how to make this look more like normal Haskell code? | | stringType :: String -> Q [Dec] | stringType s = do | x <- gensym "x" | return [ | Newtype [] s [] (Constr s [(NonStrict,Tcon (TconName "String"))]) [], | Proto ("show"++s) (Tapp (Tapp (Tcon Arrow) (Tcon (TconName s))) (Tcon (TconName | "ShowS"))), | Fun ("show"++s) [Clause [Pcon s [Pvar x]] (Normal (App (Var "showString") (Var x))) []], | Instance [] (Tapp (Tcon (TconName "Show")) (Tcon (TconName s))) [ | Fun "showsPrec" [Clause [Pwild,Pvar x] (Normal (App (Var ("show"++s)) (Var x))) []]] ] | _______________________________________________ | Glasgow-haskell-users mailing list | Glasgow-haskell-users@haskell.org | http://www.haskell.org/mailman/listinfo/glasgow-haskell-users