From wchogg at gmail.com Mon May 15 11:30:48 2006 From: wchogg at gmail.com (Creighton Hogg) Date: Mon May 15 11:24:12 2006 Subject: [Template-haskell] functions and quasi-quote Message-ID: <814617240605150830s6e515ff5if1c8b4bf277098db@mail.gmail.com> Hi, So I was playing with template Haskell earlier and there's something that I don't really understand. 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. Is there something I fundamentally don't understand about the Quasi monad? -------------- next part -------------- An HTML attachment was scrubbed... URL: http://www.haskell.org//pipermail/template-haskell/attachments/20060515/05038ec2/attachment.htm From bulat.ziganshin at gmail.com Tue May 16 03:54:29 2006 From: bulat.ziganshin at gmail.com (Bulat Ziganshin) Date: Tue May 16 03:49:50 2006 Subject: [Template-haskell] functions and quasi-quote In-Reply-To: <814617240605150830s6e515ff5if1c8b4bf277098db@mail.gmail.com> References: <814617240605150830s6e515ff5if1c8b4bf277098db@mail.gmail.com> Message-ID: <74486826.20060516115429@gmail.com> Hello Creighton, Monday, May 15, 2006, 7:30:48 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 end? -- Best regards, Bulat mailto:Bulat.Ziganshin@gmail.com From wchogg at gmail.com Tue May 16 11:32:09 2006 From: wchogg at gmail.com (Creighton Hogg) Date: Tue May 16 11:25:30 2006 Subject: [Template-haskell] functions and quasi-quote In-Reply-To: <74486826.20060516115429@gmail.com> References: <814617240605150830s6e515ff5if1c8b4bf277098db@mail.gmail.com> <74486826.20060516115429@gmail.com> Message-ID: <814617240605160832i3b731fcfmbed584e946210b29@mail.gmail.com> On 5/16/06, Bulat Ziganshin wrote: > > Hello Creighton, > > Monday, May 15, 2006, 7:30:48 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. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://www.haskell.org//pipermail/template-haskell/attachments/20060516/20ede042/attachment.htm From bulat.ziganshin at gmail.com Tue May 16 12:26:37 2006 From: bulat.ziganshin at gmail.com (Bulat Ziganshin) Date: Tue May 16 19:08:52 2006 Subject: [Template-haskell] functions and quasi-quote In-Reply-To: <814617240605160832i3b731fcfmbed584e946210b29@mail.gmail.com> References: <814617240605150830s6e515ff5if1c8b4bf277098db@mail.gmail.com> <74486826.20060516115429@gmail.com> <814617240605160832i3b731fcfmbed584e946210b29@mail.gmail.com> Message-ID: <1348042778.20060516202637@gmail.com> 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@gmail.com