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

NonEmpty list of worksheets #130

Open
amigalemming opened this issue Apr 15, 2020 · 3 comments
Open

NonEmpty list of worksheets #130

amigalemming opened this issue Apr 15, 2020 · 3 comments

Comments

@amigalemming
Copy link

If I understand the ECMA standard correctly, then a Spreadsheet contains at least one worksheet.
Could we express this with types like so:

xlSheets :: Lens' Xlsx (NonEmpty (Text, Worksheet))

Maybe there are more occurrences of non-empty structures.

@qrilka
Copy link
Owner

qrilka commented Apr 15, 2020

Thanks, with NonEmpty now in base this seems to be a good thing to look into. First look confirms your point:

sml_CT_Sheets = element sheet { sml_CT_Sheet }+

@amigalemming
Copy link
Author

For now I will use this conversion as workaround:

nonEmpty :: Lens.Iso' [a] (NonEmpty a)
nonEmpty = Lens.iso NonEmpty.fromList NonEmpty.toList

@qrilka
Copy link
Owner

qrilka commented Apr 15, 2020

It looks like this would be a rather large change as there are other places where the same holds, so looks to be a good idea for the next major version

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