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

Achim Schneider barsoap at web.de
Fri Oct 17 14:31:23 EDT 2008


Robert Greayer <robgreayer at yahoo.com> wrote:

> --- On Fri, 10/17/08, Achim Schneider <barsoap at web.de> wrote:
> > > > declarations = [d|
> > > >    foo = "bar"
> > > >    bar = "foo"
> > > > |]
> > -fth doesn't make a difference here, I'm using
> > -XTemplateHaskell with
> > ghc 6.8.3
> > 
> 
> The following lines, verbatim, pasted into a file, work for me with
> 6.8.3 with no command line options:
> 
> {-# LANGUAGE TemplateHaskell #-}
> module TH where
> import Language.Haskell.TH
> 
> declarations = [d|
>    foo = "bar"
>    bar = "foo"
>    |]
> 
Argh. Yes. They do. While I certainly am in favour of layout rules, I'm
not in favour of one that gives raises an error if you don't indent the
closing |] by at least one whitespace.

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

doesn't work, either, as 

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

-- 
(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.



More information about the Haskell-Cafe mailing list