Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for mixed type arrays #248

Open
basile-henry opened this issue Nov 13, 2019 · 1 comment
Open

Support for mixed type arrays #248

basile-henry opened this issue Nov 13, 2019 · 1 comment

Comments

@basile-henry
Copy link

Currently tomland disallows mixed type in TOML arrays.
From the documentation for the Value constructor Array:

{- | Array of values. According to TOML specification all values in array
should have the same type. This is guaranteed statically with this type.
@
arr1 = [ 1, 2, 3 ]
arr2 = [ "red", "yellow", "green" ]
arr3 = [ [ 1, 2 ], [3, 4, 5] ]
arr4 = [ "all", \'strings\', """are the same""", \'\'\'type\'\'\']
arr5 = [ [ 1, 2 ], ["a", "b", "c"] ]
arr6 = [ 1, 2.0 ] # INVALID
@
-}
Array :: [Value t] -> Value 'TArray

This seems to be in line with all the previous versions of the TOML specification, however it was recently changed in toml-lang/toml#676

Updating tomland to the latest version of the spec is probably quite involved, and would likely change the user facing API. The Value type being a GADT is most likely only to ensure that this invariant around arrays is held.

I am opening this issue to simply ask if there are any plans to support this new feature? And if so, if you need any help implementing it! 😄

@vrom911
Copy link
Member

vrom911 commented Nov 13, 2019

Hey @basile-henry , thanks for the report!
We are supporting the current version of the TOML specs — TOML-0.5.0. What you are talking about are unreleased changes in the master branch. It is still not confirmed that it is going to be in the next release and the date of the major upgrade could be too far away to spoil the library with unsupported changes.

Thanks for letting us know, but again I wouldn't be in a hurry to support such huge and not thought-through changes. Let's decide the future of the tomland when the time comes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants