diff --git a/docs/pattern-matching.md b/docs/pattern-matching.md index 4d997d4423..2d5c7c4e71 100644 --- a/docs/pattern-matching.md +++ b/docs/pattern-matching.md @@ -132,15 +132,15 @@ type point = { type t = | A((string, int)) - | B(r) + | B(point) | C(array(int)) - | D(list(r)); + | D(list(point)); -let x = D([{x: 2, y: 1.2}]); +let x = D([{x: 2, y: 1}]); switch (x) { | A(("hi", num)) => num -| B({x, y: 1.2}) => x +| B({x, y: 1}) => x | C([|x|]) => x | C([|2, 3, x|]) => x | D([]) => 2 @@ -156,8 +156,8 @@ switch (x) { ```reason switch (x) { | A(("hi", num)) as v => f(v) -| B({x: _, y: 1.2} as r) => g(r) -| D([{x: _, y: 1.2} as r, ..._]) => g(r) +| B({x: _, y: 1} as r) => g(r) +| D([{x: _, y: 1} as r, ..._]) => g(r) | _ => 42 }; ``` diff --git a/docs/recursion.md b/docs/recursion.md index 0c90de516c..e79684d901 100644 --- a/docs/recursion.md +++ b/docs/recursion.md @@ -76,10 +76,12 @@ Opt-out of recursive types using the `nonrec` keyword: ```reason type t = string; -type nonrec t = list(t); +module M = { + type nonrec t = list(t); +}; /* t is now list(string) */ -let x: t = ["hello", "world"]; +let x: M.t = ["Hello", "World"] ``` ## Mutually Recursive Types