From c0e1d90205c9361ebcc200d729754929c25d3b5a Mon Sep 17 00:00:00 2001 From: Florian Hammerschmidt Date: Sun, 22 Oct 2023 21:52:48 +0200 Subject: [PATCH] Variants: Add some TODOs --- pages/docs/manual/latest/variant.mdx | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/pages/docs/manual/latest/variant.mdx b/pages/docs/manual/latest/variant.mdx index a0fbb8cab..1d4fdcc0e 100644 --- a/pages/docs/manual/latest/variant.mdx +++ b/pages/docs/manual/latest/variant.mdx @@ -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: @@ -452,6 +464,12 @@ var message = "Hello " + theCompany; +// 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: