[Haskell-cafe] Temlpate Haskell: [d| ... |]

2008-10-17 Thread Achim Schneider
 [d| ... |], where the ... is a list of top-level declarations; the
 quotation has type Q [Dec].

(http://www.haskell.org/ghc/docs/latest/html/users_guide/template-haskell.html)

Can someone elaborate on what a list means here? Neither

declarations = [d| 
foo = bar
bar = foo 
|]

nor

declarations = [d| 
[ foo = bar
, bar = foo 
]
|]

work. I'm trying to automatically generate a bunch of functions out of
an xml file.

-- 
(c) this sig last receiving data processing entity. Inspect headers
for copyright history. All rights reserved. Copying, hiring, renting,
performance and/or quoting of this signature prohibited.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Temlpate Haskell: [d| ... |]

2008-10-17 Thread Philip Weaver
On Fri, Oct 17, 2008 at 9:26 AM, Achim Schneider [EMAIL PROTECTED] wrote:

  [d| ... |], where the ... is a list of top-level declarations; the
  quotation has type Q [Dec].

 (
 http://www.haskell.org/ghc/docs/latest/html/users_guide/template-haskell.html
 )

 Can someone elaborate on what a list means here? Neither

 declarations = [d|
foo = bar
bar = foo
 |]

 nor

 declarations = [d|
[ foo = bar
, bar = foo
]
 |]

 work. I'm trying to automatically generate a bunch of functions out of
 an xml file.


Works for me.  Note that -fth is needed.



 --
 (c) this sig last receiving data processing entity. Inspect headers
 for copyright history. All rights reserved. Copying, hiring, renting,
 performance and/or quoting of this signature prohibited.

 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe