snoyberg / yaml

Support for serialising Haskell to and from Yaml.
162 stars 78 forks source link

Add interpolation to the quasiquoter? #166

Open thomasjm opened 5 years ago

thomasjm commented 5 years ago

It would be really handy if you could interpolate values in the yamlQQ quasiquoter using #{...} notation, just like how aeson-qq provides this for JSON.

snoyberg commented 5 years ago

PR welcome, but I don't have any plans on adding that myself for now.

sjshuck commented 3 years ago

Just thinking out loud. I guess the two biggest issues would be

  1. Parsing embedded Haskell in aeson-qq works via the haskell-src-meta package, which pulls in significant dependencies such as haskell-src-exts. Installing haskell-src-meta takes 3 extra minutes on my machine after installing yaml.
  2. aeson-qq has the nice property that # or $ are always invalid JSON in that context, and therefore function unambiguously. In YAML, there's isn't a reliable choice of characters that would violate the syntax: in particular, the # in an unquoted scalar introduces a comment, and the $ can just occur normally in a mapping key.

It seems like an external library would be better suited to implement this functionality.