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

Add support for function returning tuples #203

Open
n-osborne opened this issue Feb 21, 2024 · 3 comments
Open

Add support for function returning tuples #203

n-osborne opened this issue Feb 21, 2024 · 3 comments

Comments

@n-osborne
Copy link
Collaborator

Functions returning tuples are filtered out in Ir_of_gospel.no_functional_arg_or_returned_tuple
Then it is possible to follow where the code need to be amended as there are some failwith talking about tuples.

@jmid
Copy link

jmid commented Feb 21, 2024

I hand-wrote support for a 6-tuple when I first needed it as part of testing weak hash sets:
https://github.com/ocaml-multicore/multicoretests/blob/7b9b1c123286f1f4db7d13e773f68198ca9b04cd/src/weak/stm_tests_hashset.ml#L112-L122

IIUC, it should be possible to generate similar lines (on demand) from the plugin, if we encounter a returned (or argument?) tuple. 🤔

@shym
Copy link
Contributor

shym commented Feb 21, 2024

As QCheck.Print.tupn are defined up to 9 only, I wondered whether it’s worth the effort of generating them rather than writing them once and for all.
(We might still be gentle and include in the generated file only the required tuples, though)

@jmid
Copy link

jmid commented Feb 22, 2024

True, tuples in OCaml APIs are relatively rare - and a 2-digit one more so! 😃
Down the line we may want to extend the support further, e.g., to record types, where a print function is not available.
At that point, ppx_deriving show may be an option.

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

No branches or pull requests

3 participants