4 ms·
You might be interested in dhall[0] and dhal-to-nix[1] which provides a really neat haskell-like language that compiles to nix. [0]: https://github.com/Gabriel
by regnat 9y ago
You might be interested in dhall[0] and dhal-to-nix[1] which provides a really neat haskell-like language that compiles to nix.
[0]: https://github.com/Gabriel439/Haskell-Dhall-Library https://github.com/Gabriel439/Haskell-Dhall-Library
[1]: https://github.com/Gabriel439/Haskell-Dhall-Library https://github.com/Gabriel439/Haskell-Dhall-Library
- atemerev 9y agoIf only Haskellers knew that "a blog post" and "type definitions in Hackage" are not documentation... Also, the comma-first syntax like { foo = "bar" , baz = "qux" } drives me nuts. In the name of all good things in the world, why?
- radarsat1 9y ago> comma-first syntax oooh but this is one of those trivial things that I really liked in my brief days of using Haskell, and that has sometimes carried over to my C++, e.g. in initializer lists. I find it super useful because everything lines up nicely, and from the point of view of version control you don't have to edit the previous line to change '}' to ',' when adding a new line.
- coldtea 9y agoHow about allowing for bloody danging commas?
- wereHamster 9y agoIs there any real disadvantage to comma-first, other than aesthetics (which is entirely a personal preference)?
- weberc2 9y agoIt's another thing to learn, and the total learning curve is the product of all of these idiosyncrasies (and features) (not the sum). And there's absolutely no advantage to comma-first.
- ykler 9y agoYes, when the commas are at the beginning of the line they are really obvious. I have used commas-first style in JavaScript, and it definitely reduced the amount of times I forgot a comma. I wonder if people's aversion to commas first has something to do with the fact that commas have a very familiar use in ordinary writing, and there they always follow a word. It is very common to see BNF grammars written with leading vertical bars, and no one seems to mind that -- in fact it would be unusual to use trailing vertical bars. By the way, a bunch of languages permit a trailing comma after the last element of a list. This is also nice because it means that if you put each list item on a line, the list items all have the same format (thing plus comma). With the Haskell syntax, you lose this, but there is no reason a language couldn't support a leading comma before the first element of a list.
- icebraining 9y agoMy aversion has to do with the fact that the first element doesn't have one. The irregularity is annoying not just aesthetically, but also if you want to swap lines around, etc.
- cwyers 9y agoBut there's always a line without a comma -- comma-last has it on the last line instead of the first. So you can have the same line-swapping problem in either arrangement. Comma first just makes it easier to spot.
- icebraining 9y agoBut there's always a line without a comma -- comma-last has it on the last line instead of the first. Not if the language allows trailing commas on the last line, like Python and Go do.
- coldtea 9y agoNot if you allow dangling commas (trailing commas as the sibling comment calls them, I think it's the more generic term)... Then you have a comma at the end in ALL lines, including the last one, without an issue. That was what I proposed above (and lots of languages do it, I think JS is adding it too).
- coldtea 9y agoThe wrath of God that it imposes on people who think it's acceptable, for one...
- Jweb_Guru 9y agoIt makes git diffs inaccurate compared to trailing commas.
- mbrock 9y agoHow so?
- viraptor 9y agoInserting a new element with comma-first changes 2 lines: - { old-one + { new-one + , old-one While trailing commas allow you to insert an element anywhere with just one line addition. This doesn't break anything, but it makes looking at "git blame" so much easier.
- dragonwriter 9y agoThis is only true if you insert at the head. And it's not really leading comma placement but the choice to put the first element in the line with the brace that is the culprit, though both are typical of comma-first.
- viraptor 9y agoWith separating comma, it either affects the first or the last position, depending on where you put the commas. But those are the most common places you modify lists.
- deleted 9y ago[deleted]
- weberc2 9y agoGo solves this problem by permitting foo := Foo{ x: 10, y: 24, }