Simon Jakobi
Simon Jakobi
Thanks for the report! > I understand from #1187 that it would be very difficult to preserve key order from dhall records, but I am hoping that since the dhall...
We use `aeson-pretty` for the `Value -> ByteString` conversion. Apparently that uses lexicographic sorting. Apparently we could [customize the field order](http://hackage.haskell.org/package/aeson-pretty-0.8.8/docs/Data-Aeson-Encode-Pretty.html#g:3) in that step, but I don't see how to...
Oh, so what you could do is encode your schema with the [`Prelude.JSON`](https://github.com/dhall-lang/dhall-lang/tree/master/Prelude/JSON) type, and then use `Prelude.JSON.render` to convert to `Text`:
@german1608 We translate these `Prelude.Map`s to `RecordLit`s in `convertToHomogenousMaps`: https://github.com/dhall-lang/dhall-haskell/blob/b9cbc63691bd497b1b3825351ebfb0a794b6cf93/dhall-json/src/Dhall/JSON.hs#L877-L926 The translation from `RecordLit` to `Value` then happens here: https://github.com/dhall-lang/dhall-haskell/blob/b9cbc63691bd497b1b3825351ebfb0a794b6cf93/dhall-json/src/Dhall/JSON.hs#L435-L502 > I think that we could enumerate every key from...
Maybe we should just create our own YAML type. Better leave parsing and encoding to other libraries though. It's a huge mess. **EDIT:** I made a question about available libraries...
Indeed. We could consider allowing some non-`Text` key types too, as requested in https://github.com/dhall-lang/dhall-haskell/issues/1379.
For the record: https://github.com/dhall-lang/dhall-haskell/pull/1740 was the first step to implement the plan in https://github.com/dhall-lang/dhall-haskell/issues/1592#issuecomment-562965613.
I recently had a run-in with this issue. I think I would have torn my hair out, if it was long enough to do so! ;) @Gabriel439 I see that...
@Gabriel439 Thanks! With `Earley` we'd still have a hand-written parser, right? It can't be generated from `dhall.abnf` as some other implementations seem to do?
@ocharles just shared his `Earley`-based parser in https://hub.darcs.net/ocharles/dhalli/browse/lib/Dhalli/Syntax.hs with me. Might be a good resource when we finally make the switch! :)