Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix quasiquote free variable interpolation #1091

Merged
merged 1 commit into from
Oct 13, 2023

Conversation

ners
Copy link
Contributor

@ners ners commented Oct 8, 2023

Before this PR, HNix provided an implementation for interpolating free variables as Nix expressions. This was not called correctly, because the types did not match: it looked for NExprLoc instead of NExpr.

This PR fixes interpolation such that the following code works as expected:

let foo = "foo" :: String
[nix|
{
  foo = foo;
}
|]

produces:

{
  foo = "foo";
}

To do this, we fix the ToExpr typeclass to generate NExpr. We also provide some additional instances.

The diff also includes some lines that have been reformatted when running Brittany on the source file.

@ners ners force-pushed the interpolations branch 7 times, most recently from 660ed4b to bec2ba0 Compare October 9, 2023 19:16
Co-authored-by: Viktor Kleen <[email protected]>
Co-authored-by: Tom Westerhout <[email protected]>
@Anton-Latukha
Copy link
Collaborator

Thank you for fixing it.

@Anton-Latukha Anton-Latukha merged commit 2c7552d into haskell-nix:master Oct 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants