Skip to content

Commit

Permalink
fix: wrong code in docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Hackder committed Sep 2, 2024
1 parent 0dfb632 commit c3ef9aa
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions pages/quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ pub fn user_decoder() {
_ -> Ok(Nil)
}
}))
toy.decoded(User(:name))
toy.decoded(User(name:))
}
```

Expand All @@ -326,7 +326,7 @@ will actually modify the result of the decoder.
```gleam
pub fn user_decoder() {
use name <- toy.field("name", toy.string |> toy.string_min(1) |> toy.nullable)
toy.decoded(User(:name))
toy.decoded(User(name:))
}
```

Expand Down
16 changes: 8 additions & 8 deletions src/toy.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ fn index(
/// ```gleam
/// pub fn user_decoder() {
/// use name <- toy.field("name", toy.string)
/// toy.decoded(User(:name))
/// toy.decoded(User(name:))
/// }
/// ```
pub fn field(
Expand Down Expand Up @@ -132,7 +132,7 @@ pub fn field(
/// ```gleam
/// pub fn reservation_decoder() {
/// use note <- toy.optional_field("note", toy.string)
/// toy.decoded(User(:name))
/// toy.decoded(User(name:))
/// }
/// ```
pub fn optional_field(
Expand Down Expand Up @@ -217,7 +217,7 @@ fn deep_index(
/// ```gleam
/// pub fn user_decoder() {
/// use name <- toy.subfield(["person", "name"], toy.string)
/// toy.decoded(User(:name))
/// toy.decoded(User(name:))
/// }
/// ```
pub fn subfield(
Expand Down Expand Up @@ -279,7 +279,7 @@ pub fn subfield(
/// ```gleam
/// pub fn user_decoder() {
/// use name <- toy.optional_subfield(["person", "name"], toy.string)
/// toy.decoded(User(:name))
/// toy.decoded(User(name:))
/// }
/// ```
pub fn optional_subfield(
Expand Down Expand Up @@ -338,7 +338,7 @@ pub fn optional_subfield(
/// ```gleam
/// pub fn user_decoder() {
/// use name <- toy.field("name', toy.string)
/// toy.decoded(User(:name))
/// toy.decoded(User(name:))
/// }
/// ```
pub fn decoded(value: a) -> Decoder(a) {
Expand Down Expand Up @@ -587,7 +587,7 @@ fn try_map_with_index(
/// pub fn fruits_decoder() {
/// toy.list({
/// use name <- toy.field("name", toy.string)
/// toy.decoded(Fruit(:name))
/// toy.decoded(Fruit(name:))
/// })
/// }
pub fn list(item: Decoder(a)) -> Decoder(List(a)) {
Expand Down Expand Up @@ -1289,7 +1289,7 @@ pub fn map(dec: Decoder(a), fun: fn(a) -> b) -> Decoder(b) {
/// _ -> Ok(Nil)
/// }
/// }))
/// toy.decoded(User(:name))
/// toy.decoded(User(name:))
/// }
pub fn refine(
dec: Decoder(a),
Expand Down Expand Up @@ -1347,7 +1347,7 @@ pub fn is_equal(dec: Decoder(a), literal: a) -> Decoder(a) {
/// _ -> Ok(string.uppercase(name))
/// }
/// }))
/// toy.decoded(User(:name))
/// toy.decoded(User(name:))
/// }
pub fn try_map(
dec: Decoder(a),
Expand Down

0 comments on commit c3ef9aa

Please sign in to comment.