[Haskell-cafe] Template Haskell: let statement in a splice put in the "main = do" part of a program?
TP
paratribulations at free.fr
Sat Aug 24 18:36:19 CEST 2013
Brandon Allbery wrote:
>> main = do
>>
>> $(makeLetStatement "a")
>> -- print a
>>
>
> Is that the actual indentation you used? Because it's wrong if so, and the
> error you would get is the one you're reporting. Indentation matters in
> Haskell.
Yes, it matters, but not after "main = do": all the lines can start at the
beginning of the line. Am I wrong? Or do I not understand what you say?
> In an equation for `main': main = do { $(makeLetStatement "a") }
>>
>
> You cannot *end* a do with a let-statement; it requires something else
> following it. You have nothing following it, as shown by the above
> fragment from the error message.
Yes, I have explained why: to be able to see the evaluation of the splice;
otherwise I obtain "Not in scope: `a'" if I uncomment "-- print a" at the
end of my code; I have explained everything in my initial post.
TP
More information about the Haskell-Cafe
mailing list