-
Notifications
You must be signed in to change notification settings - Fork 42
Support for Tuple #20
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
Closed
Closed
Changes from 3 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
51142b3
Support for Tuple
jacereda 8aba8bf
Added another tuple test
jacereda 49139b9
Simplify asTuple with @kRITZCREEK's suggestion
jacereda fe03fe7
Fix nested tuples and n-tuples
jacereda 341cffe
Write unit as empty record
jacereda 3161287
Leave WriteForeign Unit as it was
jacereda 9f22a07
Warnings
jacereda e0b8e67
Get rid of unit reading/writing
jacereda 303f40f
Compromise solution, no overlapped instances, no support for Data.Tup…
jacereda File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh wait, I just realized now that you have a single array decoding. For reading, is there not a way we could somehow maybe read in the whole array and then map them back to the tuples? Might require some generics-rep code?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Like (a /\ b /\ c /\ d) should be [a,b,c,d]?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good. Separate PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Realized that some actually do encode nested array pairs though. I think probably it'd be best to go with whatever you need with this for now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, nested tuples don't serialise correctly, I'll try to fix it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure I understood what you mean... I need
ReadForeign Unit
for encoding Tuple3 & friends and used a brokenreadImpl
for now, but I guessData.Foreign
could provide that.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should never be using the value of Unit anywhere for reading or writing, it's only passed around like an opaque
foreign import data
declared type. You should always use an empty record for this.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unit's foreign representation should be
null
orundefined
or something anyway, the value is absolutely meaningless because it's never supposed to be inspected or used.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is that what you mean? How would that be better?
In any case, a generic n-tuple serialisation as array probably won't need unit anyway, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, as in no one will give you a stop element anyway. People expect (1 /\ 2 /\ 3) to become [1,2,3]