Live data from Hacker News

The Dhall Configuration Language

dhall-lang.org

51–60 of 192 posts

Re: The Dhall Configuration Language

#51
post #16
post #5

{ home = "/home/bill" , privateKey = "/home/bill/.ssh/id_ed25519" , publicKey = "/home/blil/.ssh/id_ed25519.pub" } This is the most awkward abuse of formatting I've seen in a long time. Just allow/require a final trailing comma, and this nonsense goes away

Or allow a leading comma: { , home = "/home/bill" , privateKey = "/home/bill/.ssh/id_ed25519" , publicKey = "/home/blil/.ssh/id_ed25519.pub" } Or, to make it markdown-ish: { - home = "/home/bill" - privateKey = "/home/bill/.ssh/id_ed25519" - publicKey = "/home/blil/.ssh/id_ed25519.pub" } This is just to play with the idea that leading punctuation may be preferable because it all aligns in the same column.

> Or allow a leading comma

This actually works just fine.

Re: The Dhall Configuration Language

#52

I love seeing useful languages that aren’t turing complete. Tooling gets much more interesting when you don’t have so many impossibility results around all the interesting stuff.

What practical advantages are there? Someone can always write a program that runs until the heat death of the universe even in a Turing-incomplete language.

In theory that's true for many of the kinds of Turing-incomplete languages we care about. (Eg it's not true for JPG or for (proper) regular expressions.)

From Dhall's docs (emphasis mine):

> Note that a “finite amount of time” can still be very long. For example, there are some short pathological programs that take longer than the heat death of the universe to evaluate. The main benefit of evaluation being finite is not to eliminate long-running programs but to make them significantly less probable. In practice, you will discover that you will rarely author a configuration file that takes a long time to evaluate by accident.

> For example, Dhall does not provide language support for recursion. If you try to define a recursive expression or function you will get a type error. Lists are the only recursive data structure and the only way to build or consume lists is through safe primitives guaranteed to terminate, like List/fold. This restrictive programming style keeps code simple and makes expensive code more obvious (both to the code author and reviewer).

Re: The Dhall Configuration Language

#53
post #19

Dhall is my favorite configuration language that I never get around to using. I manage DNS in Terraform, and since every Terraform provider uses different objects definitions, and every object definition is rather verbose, Dhall would be a way to specify my own DRY types and leave the provider-specific details in one place. Adding new DNS entries and moving several domains between providers would be a matter of chang…

I use tanka/jsonnet and cringe everytime I read a helm chart. Type safety would be nice, but the k8s api can verify the validity on the server. https://tanka.dev/

Tanka is what I want to use when the time comes.

Are there any pitfalls you have learned to avoid?

Re: The Dhall Configuration Language

#55

I wonder if a version of Python with types with some way to force programs to be total would be a 'good enough' substitute. JavaScript has `"use strict";`, `# use total` could ban recursion and loops over non-constants. You'd have to work hard to ensure things were really total, e.g. ban assigning functions to variables, but maybe you could make it hard enough to pay off.

Assigning functions to variables doesn't have to ruin your totality.

But yeah, you'd need to carefully select your subset of the language that is both useful and total, and practical to implement.

Re: The Dhall Configuration Language

#56
I've always wanted an excuse to use this but never had a reason. The closest I come is using Nix, and I know there is a Dhall-to-Nix compiler, but Dhall can't represent everything possible in Nix I haven't seen any good reason to use it.

Re: The Dhall Configuration Language

#57
post #6
post #5

{ home = "/home/bill" , privateKey = "/home/bill/.ssh/id_ed25519" , publicKey = "/home/blil/.ssh/id_ed25519.pub" } This is the most awkward abuse of formatting I've seen in a long time. Just allow/require a final trailing comma, and this nonsense goes away

This is a by-product of Dhall coming from the Haskell community where this formatting was preferred instead of final trailing commas. It has been internalised and was carried on. I say this as someone who looks at this code and thinks "This is totally fine." -- but I admit, I'm environmentally damaged.

Yes. And, alas, you can't just allow a final trailing comma everywhere in Haskell.

Eg ("Foo", 2,) is different from ("Foo", 2) in Haskell thanks to TupleSections. For innocent bystanders: in Haskell ("Foo", 2) is the tuple you'd expect it to be. But ("Foo", 2,) is a function that takes another argument and creates a three-tuple. A Python equivalent would be

lambda x: ("Foo", 2, x)

Re: The Dhall Configuration Language

#58

Why wouldn't you use Python as your configuration language?

For one thing, Dhall is not Turing complete. You can also freeze imports to prevent supply chain hacks, so it is much safer in theory.

They have a great writeup on their safety here: https://docs.dhall-lang.org/discussions/Safety-guarantees.ht...

Re: The Dhall Configuration Language

#59
post #5

{ home = "/home/bill" , privateKey = "/home/bill/.ssh/id_ed25519" , publicKey = "/home/blil/.ssh/id_ed25519.pub" } This is the most awkward abuse of formatting I've seen in a long time. Just allow/require a final trailing comma, and this nonsense goes away

I much prefer this style, I use it wherever I can because I can comment out lines without a trailing comma causing a syntax error. SQL, Ruby… wherever I can. Try it, I doubt you'll go back (unless someone's stupid parser doesn't let you).

You can do the same, if your language allows a final comma.

(And that's what the comment you reply to suggests: make Dhall allow a final comma.)

Re: The Dhall Configuration Language

#60

Earlier quoted context omitted.

I would actually prefer no comma's {:home "/home/bill" :private-key "/home/bill/.ssh/id_ed25519" :public-key "/home/bill/.ssh/id_ed25519.pub"}

That's the same as a leading comma.

Are you mixing up the colons with the separator?
Post reply on HN