From c3ef9aa13ea90c15f0ef6252bc05ae992cc1a26a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juraj=20Petr=C3=A1=C5=A1?= Date: Mon, 2 Sep 2024 23:05:05 +0200 Subject: [PATCH] fix: wrong code in docs --- pages/quickstart.md | 4 ++-- src/toy.gleam | 16 ++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/pages/quickstart.md b/pages/quickstart.md index db2e7dc..cd4a135 100644 --- a/pages/quickstart.md +++ b/pages/quickstart.md @@ -310,7 +310,7 @@ pub fn user_decoder() { _ -> Ok(Nil) } })) - toy.decoded(User(:name)) + toy.decoded(User(name:)) } ``` @@ -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:)) } ``` diff --git a/src/toy.gleam b/src/toy.gleam index e4457dc..cba6702 100644 --- a/src/toy.gleam +++ b/src/toy.gleam @@ -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( @@ -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( @@ -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( @@ -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( @@ -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) { @@ -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)) { @@ -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), @@ -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),