Skip to content

Adapt some pages to ReScript 11 including records and variants #730

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

Merged
merged 3 commits into from
Oct 23, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Variants: Add some TODOs
  • Loading branch information
fhammerschmidt committed Oct 22, 2023
commit c0e1d90205c9361ebcc200d729754929c25d3b5a
18 changes: 18 additions & 0 deletions pages/docs/manual/latest/variant.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,18 @@ let usersToJson = users => Array(users->Array.map(userToJson))

This can be extrapolated to many more cases.

// ### Unboxable types

// TODO #734: Add a list of what can currently be unboxed (and why), and a note that it's possible that more things could be unboxed in the future.

// ### Catch all

// TODO #733: Add a small section on the "catch all" trick, and what kind of things that enable.

// ## Variant spread

// TODO #732

## Coercion

You can convert a variant to a `string` or `int` at no cost:
Expand All @@ -452,6 +464,12 @@ var message = "Hello " + theCompany;

</CodeTab>

// TODO #731: expand this section with:
//
// Coercing between variants (and the constraints around that)
// Why you can sometimes coerce from variant to string/int/float, and how to think about that (runtime representation must match)
// The last additions of allowing coercing strings to unboxed variants with catch-all string cases

## Tips & Tricks

**Be careful** not to confuse a constructor carrying 2 arguments with a constructor carrying a single tuple argument:
Expand Down