* camlp4: Curried constructor error
@ 2007-04-02 13:20 Joel Reymont
2007-04-02 13:26 ` Joel Reymont
0 siblings, 1 reply; 3+ messages in thread
From: Joel Reymont @ 2007-04-02 13:20 UTC (permalink / raw)
To: Caml List
Folks,
I have a the following function and invocation:
let render = <:octalfile<templ.html>>
print_endline (Xml.to_string_fmt (Templ.render ~page ~visitor));;
I thought I would make render take an argument so I first tried
let render x = <:octalfile< x >>
print_endline (Xml.to_string_fmt (Templ.render "templ.html" ~page
~visitor));;
File "main.ml", line 31, characters 34-46:
This function is applied to too many arguments,
maybe you forgot a `;'
I thought I would make render take a couple more arguments
let render x y z = <:octalfile< x >> y z
but this complains
File "ghost-location", line 1, characters 0-0:
Parse error: currified constructor
What's the proper way to make render take a file name?
Thanks, Joel
--
http://wagerlabs.com/
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: camlp4: Curried constructor error
2007-04-02 13:20 camlp4: Curried constructor error Joel Reymont
@ 2007-04-02 13:26 ` Joel Reymont
2007-04-02 17:08 ` [Caml-list] " Nicolas Pouillard
0 siblings, 1 reply; 3+ messages in thread
From: Joel Reymont @ 2007-04-02 13:26 UTC (permalink / raw)
To: Caml List
Foot in mouth. camlp4 in this case is doing compile-time expansion
and cannot take runtime variables. Oh, well...
On Apr 2, 2007, at 2:20 PM, Joel Reymont wrote:
> Folks,
>
> I have a the following function and invocation:
>
> let render = <:octalfile<templ.html>>
>
> print_endline (Xml.to_string_fmt (Templ.render ~page ~visitor));;
--
http://wagerlabs.com/
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Caml-list] Re: camlp4: Curried constructor error
2007-04-02 13:26 ` Joel Reymont
@ 2007-04-02 17:08 ` Nicolas Pouillard
0 siblings, 0 replies; 3+ messages in thread
From: Nicolas Pouillard @ 2007-04-02 17:08 UTC (permalink / raw)
To: Joel Reymont; +Cc: Caml List
On 4/2/07, Joel Reymont <joelr1@gmail.com> wrote:
> Foot in mouth. camlp4 in this case is doing compile-time expansion
> and cannot take runtime variables. Oh, well...
camlp4 always do compile-time expansion but you can insert code using
antiquotations.
<:expr< Some >> x ==> WRONG
<:expr< Some $x$ >> ==> RIGHT
--
Nicolas Pouillard
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2007-04-02 17:09 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-04-02 13:20 camlp4: Curried constructor error Joel Reymont
2007-04-02 13:26 ` Joel Reymont
2007-04-02 17:08 ` [Caml-list] " Nicolas Pouillard
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox