Comments (13)
This limitation is intentional. Imported Dhall expressions (such as ./template
) have to be closed (i.e. no free variables like value
in your example) so that they can be type-checked in isolation.
from dhall-lang.
Is there a way around it? E.g. to inject some textual value verbatim prior to the typechecker?
Iād rather not have a \(...) -> ''
first and ''
last line in say a HTML file.
from dhall-lang.
Yes, but only if you're willing to use the Haskell API to build your own tool. The Haskell API provides a typeWith
function that you can use to type-check expressions using your own custom context. Similarly, there is a normalizeWith
that you can use to inject custom values
from dhall-lang.
Could dhall-to-text
gain a primitive for that, hypothetically speaking?
from dhall-lang.
Yeah, I'd be fine with providing a utility function that bundles typeWith
+normalizeWith
+{adding single quotes before parsing}
from dhall-lang.
I would love this. I was thinking about making a Dhall compiler for Hakyll, and would probably end up implementing this myself if it weren't in the Dhall lib.
from dhall-lang.
Should we move this issue to dhall-haskell
?
As far as I understand it is about adding a flag (--wrap-text
?) to dhall-to-text
from dhall-lang.
@f-f: Yes, my understanding is that this is a dhall-haskell
-related issue, although I think the request here is for a new function in the Haskell API for ease of templating rather than a new command-line option.
from dhall-lang.
Having the ability to import templates from files sounds cool though.
I imagine the following: if file
contains "A ${string} with ${interpolations}"
, then (./file as Template) { string = "blah", interpolations = "blih" }
would normalize to the string "A blah with blih"
. That would allow big templates to be put separately, while still requiring imported expressions to be closed.
from dhall-lang.
@Nadrieril: See the discussion on the linked pull request:
... and also the discussion on this related issue:
from dhall-lang.
Oh. Too bad, I liked this idea, but you make convincing points
from dhall-lang.
dhall-lang/dhall-haskell#205 says
I'll go ahead and close this since it's unlikely to be added to the language standard
Should this issue also be closed?
from dhall-lang.
Yeah, I will close this issue, too
from dhall-lang.
Related Issues (20)
- `with` record update syntax removes other record fields HOT 4
- ABNF grammar should list "as Bytes" import mode
- Should the ABNF grammar disallow shebangs inside expressions? HOT 1
- eta-reducing to merge HOT 4
- Builtins operators reference: Missing record projection HOT 2
- ABNF grammar should explicitly disallow keywords as identifiers? HOT 2
- ABNF grammar should include a mandatory whitespace after `import-hashed`? HOT 1
- Improvements and fixes in the standard documentation HOT 3
- Is this an incorrect test file: `dhall-lang/tests/import/success/unit/ImportRelativeToHomeB.dhall`? HOT 2
- Link to non existing tweet
- A minimalistic proposal for do-notation
- Thoughts on introducing a minimum amount of type inference in Dhall HOT 1
- Introduce Bytes/length and Text/length as built-ins? HOT 3
- Is there a security hole: malicious sha256-protected cached content? HOT 1
- Eta-equivalence in `assert`? HOT 13
- A type level equivalent of the `with` keyword HOT 11
- Convert assertions to Leibniz equality types HOT 3
- A minimalistic proposal for adding row and column polymorphism to Dhall HOT 2
- A proposal for a "lightweight Dhall implementations" standard
- Year, Month, and Date extraction from a Date HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
š Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ššš
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ā¤ļø Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dhall-lang.