You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Right now, unless --noMaps is specified, we expect dhall-to-json and dhall-to-yaml to compile values of type List { mapKey = t, mapValue = u } to objects. This works when the list is populated, but it seems that whatever process transforms non-empty association lists to objects is skipped for empty ones, so you end up with a different type in the compiled file. For example:
$ dhall-to-json <<< '[] : List { mapKey : Text, mapValue : Text }'
{}
If this is actually the desired behavior, please let me know! But if it is, I think it would still make sense to add this behavior as an option (maybe add a command line flag like --transformEmptyAssocs or something).
There are definitely practical applications of this new behavior. In my case, I'm compiling a docker compose configuration where I represent services and networks and such as association lists, e.g.
In my case, if no, say, networks have been specified, it needs to be an object rather than a list, or docker will reject it:
networks: {}
I have a work-around using Optional, but the ergonomics are dramatically better if I can allow networks = [] : List { mapKey = Text, mapValue = Network.Type } to be empty.
The text was updated successfully, but these errors were encountered:
Fixes#1559.
This requires aeson-yaml >= 1.0.5.0 since older versions
incorrectly encode empty objects.
The raised bound also fixes#1560. A regression test is included.
Fixes#1559.
This requires aeson-yaml >= 1.0.5.0 since older versions
incorrectly encode empty objects.
The raised bound also fixes#1560. A regression test is included.
Right now, unless
--noMaps
is specified, we expectdhall-to-json
anddhall-to-yaml
to compile values of typeList { mapKey = t, mapValue = u }
to objects. This works when the list is populated, but it seems that whatever process transforms non-empty association lists to objects is skipped for empty ones, so you end up with a different type in the compiled file. For example:Expected:
If this is actually the desired behavior, please let me know! But if it is, I think it would still make sense to add this behavior as an option (maybe add a command line flag like
--transformEmptyAssocs
or something).There are definitely practical applications of this new behavior. In my case, I'm compiling a docker compose configuration where I represent services and networks and such as association lists, e.g.
==>
In my case, if no, say, networks have been specified, it needs to be an object rather than a list, or docker will reject it:
I have a work-around using
Optional
, but the ergonomics are dramatically better if I can allownetworks = [] : List { mapKey = Text, mapValue = Network.Type }
to be empty.The text was updated successfully, but these errors were encountered: