Skip to content

Commit

Permalink
Some better wordings
Browse files Browse the repository at this point in the history
  • Loading branch information
fhammerschmidt committed Oct 22, 2023
1 parent abb6f43 commit 9176a31
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pages/docs/manual/latest/record.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ type c = {
}
```

Record type spreads act as a 'copy-paste' mechanism for fields from one or more records into a new record. This operation inlines the fields from the spread records directly into the new record definition, while preserving their original properties, such as whether they are optional or mandatory. It's important to note that duplicate field names are not allowed across the records being spread, even if the fields share the same type.
Record type spreads act as a 'copy-paste' mechanism for fields from one or more records into a new record. This operation inlines the fields from the spread records directly into the new record definition, while preserving their original properties, such as whether they are optional or mandatory. It's important to note that duplicate field names are not allowed across the records being spread, even if the fields have the same type.

## Record Type Coercion

Expand Down
7 changes: 3 additions & 4 deletions pages/docs/manual/latest/variant.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -346,18 +346,17 @@ let getBestFriendsAge = user =>
}
```

> Notice how `@as` allows us to say that an unboxed variant case should map to a specific underlying _primitive_. `Present` has a type variable, so it can hold any type. And since it's an unboxed type, only the payloads `'a` or `null` will be kept at runtime. That's where the magic comes from.
> Notice how `@as` allows us to say that an untagged variant case should map to a specific underlying _primitive_. `Present` has a type variable, so it can hold any type. And since it's an unboxed type, only the payloads `'a` or `null` will be kept at runtime. That's where the magic comes from.
### Decoding and encoding JSON idiomatically

With unboxed variants, we have everything we need to define a JSON type:
With untagged variants, we have everything we need to define a JSON type:

```rescript
@unboxed
type rec json =
| @as(false) False
| @as(true) True
| @as(null) Null
| Boolean(bool)
| String(string)
| Number(float)
| Object(Js.Dict.t<json>)
Expand Down

0 comments on commit 9176a31

Please sign in to comment.