mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-28 06:14:46 +00:00
add comments
This commit is contained in:
parent
afbffc50c1
commit
0cac94d11d
1 changed files with 9 additions and 0 deletions
|
@ -39,13 +39,22 @@ pub enum Layout<'a> {
|
||||||
|
|
||||||
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
|
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
|
||||||
pub enum UnionLayout<'a> {
|
pub enum UnionLayout<'a> {
|
||||||
|
/// A non-recursive tag union
|
||||||
|
/// e.g. `Result a e : [ Ok a, Err e ]`
|
||||||
NonRecursive(&'a [&'a [Layout<'a>]]),
|
NonRecursive(&'a [&'a [Layout<'a>]]),
|
||||||
|
/// A recursive tag union
|
||||||
|
/// e.g. `RoseTree a : [ Tree a (List (RoseTree a)) ]`
|
||||||
Recursive(&'a [&'a [Layout<'a>]]),
|
Recursive(&'a [&'a [Layout<'a>]]),
|
||||||
|
/// A recursive tag union where the non-nullable variant(s) store the tag id
|
||||||
|
/// e.g. `FingerTree a : [ Empty, Single a, More (Some a) (FingerTree (Tuple a)) (Some a) ]`
|
||||||
|
/// see also: https://youtu.be/ip92VMpf_-A?t=164
|
||||||
NullableWrapped {
|
NullableWrapped {
|
||||||
nullable_id: i64,
|
nullable_id: i64,
|
||||||
nullable_layout: Builtin<'a>,
|
nullable_layout: Builtin<'a>,
|
||||||
other_tags: &'a [&'a [Layout<'a>]],
|
other_tags: &'a [&'a [Layout<'a>]],
|
||||||
},
|
},
|
||||||
|
// A recursive tag union where the non-nullable variant does NOT store the tag id
|
||||||
|
// e.g. `ConsList a : [ Nil, Cons a (ConsList a) ]`
|
||||||
// NullableUnwrapped,
|
// NullableUnwrapped,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue