Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

4
  • 3
    If the quasi quotation is in a function with input parameters, the string will be produced at runtime. Also to be fair, most serious languages support some form of constant string folding at compile time. Commented Jan 24, 2014 at 16:55
  • @Simon good point; I wasn't certain of this behaviour of QQ, was wondering if it would just error at compile as "cannot do that" or it would just elevate it to runtime, thanks for the detail! Commented Jan 24, 2014 at 17:13
  • 1
    Actually I believe that the inerpolated variables are typechecked. According to the doc it should compile only if they are instances of the Show typeclass. Commented Jan 24, 2014 at 17:20
  • @Simon ah so my intuition was right and they are expanded at compile time with a big "I'm afraid I cannot do that, Dave" if you try to give it something that wouldn't be compile time expandable. The type checking being the key here that other languages won't have such guarantees from their types that would allow this. That said good point, many languages do have a compile-time expansion mechanism. Commented Jan 24, 2014 at 17:35