[Template-haskell] functions and quasi-quote

Bulat Ziganshin bulat.ziganshin at gmail.com
Tue May 16 12:26:37 EDT 2006


Hello Creighton,

Tuesday, May 16, 2006, 7:32:09 PM, you wrote:


>> I can do something such as [|(+)|] just fine, but what I *want* is
>> to do something like (\x -> [|x|]) (+) for example.
(\x ->>> [|x|]) can be applied to numbers just fine, but not functions because it doesn't have an instance for Lift 
>> I'm just confused by this.

> WHAT you want to do at last?

> Maybe I should just rephrase my question.
> I thought that [| |] was shorthand for putting something in the
> Quasi Monad, just like how [ ] is shorthand for putting something in the List Monad.
> Now then since I can write something silly like (\x -> [x]) to put
> a thing into a list, I thought that I could do (\x -> [|x|]) to put objects into Quasi. 
> This *doesn't* work, at least not the way I'd expect, and I was wondering why.

because it's not the way to put object in quasi monad (you should use
"return" to do it), but syntax sugar for writing TH representations of
Haskell expressions. afair, "th tutorial" on hawiki describes this in
more details, otherwise you can see my unfinished attempt to write TH
docs at http://freearc.narod.ru/thdoc.htm


-- 
Best regards,
 Bulat                            mailto:Bulat.Ziganshin at gmail.com



More information about the template-haskell mailing list