dhall-lang / dhall-json

This repository has moved to https://github.com/dhall-lang/dhall-haskell/tree/master/dhall-json
BSD 3-Clause "New" or "Revised" License
65 stars 6 forks source link

Record output should have sorted keys #33

Closed justinwoo closed 6 years ago

justinwoo commented 6 years ago

Right now the records output will output whatever order the record was constructed. There should probably be some aeson-pretty options for this?

Nobody should use the observed insertion order anyways

justinwoo commented 6 years ago

Necroposting here, I realized that the actual Dhall Record type is a insertion order preserving hashmap, which I find to be quite undesirable, especially for working with the actual output JSON for some purposes, especially diffing (can't always only look at Dhall diffs, unfortunately).

If this is really so important to some users, could we reach some compromise in some way like adding optional flags here, and maybe revisiting how the insertion order information is preserved and worked with?

Gabriella439 commented 6 years ago

I'm totally fine with adding an option to sort keys

justinwoo commented 6 years ago

Sorry, I realized upon revisiting this that I was talking about record fields in dhall files through dhall-haskell. The lack of reordering of fields in Dhall records really bothers me, but isn't an issue with dhall-json (since it has already been fixed here)

Gabriella439 commented 6 years ago

See: https://github.com/dhall-lang/dhall-haskell/issues/244

justinwoo commented 6 years ago

Should I open a new issue there? Since it seems like most of the issue was about changing of formatting overall and I don't see anything that suggests defining a function to preserve ordering of information isn't the thing you should do anyway

Gabriella439 commented 6 years ago

Go ahead and open a new issue there