@@ -385,7 +385,7 @@ pub fn run(data: Dynamic, decoder: Decoder(t)) -> Result(t, List(DecodeError)) {
385
385
/// ```
386
386
///
387
387
/// ```gleam
388
- /// dynamic.from(Nil )
388
+ /// dynamic.nil( )
389
389
/// |> decode.run(decode.optional(decode.int))
390
390
/// // -> Ok(option.None)
391
391
/// ```
@@ -621,7 +621,7 @@ fn run_dynamic_function(
621
621
/// # Examples
622
622
///
623
623
/// ```gleam
624
- /// let result = decode.run(dynamic.from ("Hello!"), decode.string)
624
+ /// let result = decode.run(dynamic.string ("Hello!"), decode.string)
625
625
/// assert result == Ok("Hello!")
626
626
/// ```
627
627
///
@@ -648,7 +648,7 @@ fn dynamic_string(from data: Dynamic) -> Result(String, String) {
648
648
/// # Examples
649
649
///
650
650
/// ```gleam
651
- /// let result = decode.run(dynamic.from (True), decode.bool)
651
+ /// let result = decode.run(dynamic.bool (True), decode.bool)
652
652
/// assert result == Ok(True)
653
653
/// ```
654
654
///
@@ -670,7 +670,7 @@ fn decode_bool(data: Dynamic) -> #(Bool, List(DecodeError)) {
670
670
/// # Examples
671
671
///
672
672
/// ```gleam
673
- /// let result = decode.run(dynamic.from (147), decode.int)
673
+ /// let result = decode.run(dynamic.int (147), decode.int)
674
674
/// assert result == Ok(147)
675
675
/// ```
676
676
///
@@ -689,7 +689,7 @@ fn dynamic_int(data: Dynamic) -> Result(Int, Int)
689
689
/// # Examples
690
690
///
691
691
/// ```gleam
692
- /// let result = decode.run(dynamic.from (3.14), decode.float)
692
+ /// let result = decode.run(dynamic.float (3.14), decode.float)
693
693
/// assert result == Ok(3.14)
694
694
/// ```
695
695
///
@@ -708,8 +708,8 @@ fn dynamic_float(data: Dynamic) -> Result(Float, Float)
708
708
/// # Examples
709
709
///
710
710
/// ```gleam
711
- /// let result = decode.run(dynamic.from (3.14), decode.dynamic)
712
- /// assert result == Ok(dynamic.from (3.14))
711
+ /// let result = decode.run(dynamic.float (3.14), decode.dynamic)
712
+ /// assert result == Ok(dynamic.float (3.14))
713
713
/// ```
714
714
///
715
715
pub const dynamic : Decoder ( Dynamic ) = Decoder ( decode_dynamic )
@@ -723,7 +723,7 @@ fn decode_dynamic(data: Dynamic) -> #(Dynamic, List(DecodeError)) {
723
723
/// # Examples
724
724
///
725
725
/// ```gleam
726
- /// let result = decode.run(dynamic.from (<<5, 7>>), decode.bit_array)
726
+ /// let result = decode.run(dynamic.bit_array (<<5, 7>>), decode.bit_array)
727
727
/// assert result == Ok(<<5, 7>>)
728
728
/// ```
729
729
///
@@ -744,7 +744,10 @@ fn dynamic_bit_array(data: Dynamic) -> Result(BitArray, BitArray)
744
744
///
745
745
/// ```gleam
746
746
/// let result =
747
- /// decode.run(dynamic.from([1, 2, 3]), decode.list(of: decode.int))
747
+ /// [1, 2, 3]
748
+ /// |> list.map(dynamic.int)
749
+ /// |> dynamic.list
750
+ /// |> decode.run(decode.list(of: decode.int))
748
751
/// assert result == Ok([1, 2, 3])
749
752
/// ```
750
753
///
@@ -770,13 +773,13 @@ fn decode_list(
770
773
/// # Examples
771
774
///
772
775
/// ```gleam
773
- /// let values = dict.from_list ([
774
- /// #("one", 1 ),
775
- /// #("two", 2 ),
776
+ /// let values = dynamic.properties ([
777
+ /// #(dynamic.string( "one"), dynamic.int(1) ),
778
+ /// #(dynamic.string( "two"), dynamic.int(2) ),
776
779
/// ])
777
780
///
778
781
/// let result =
779
- /// decode.run(dynamic.from( values) , decode.dict(decode.string, decode.int))
782
+ /// decode.run(values, decode.dict(decode.string, decode.int))
780
783
/// assert result == Ok(values)
781
784
/// ```
782
785
///
@@ -837,12 +840,12 @@ fn decode_dict(data: Dynamic) -> Result(Dict(Dynamic, Dynamic), Nil)
837
840
/// # Examples
838
841
///
839
842
/// ```gleam
840
- /// let result = decode.run(dynamic.from (100), decode.optional(decode.int))
843
+ /// let result = decode.run(dynamic.int (100), decode.optional(decode.int))
841
844
/// assert result == Ok(option.Some(100))
842
845
/// ```
843
846
///
844
847
/// ```gleam
845
- /// let result = decode.run(dynamic.from(Nil ), decode.optional(decode.int))
848
+ /// let result = decode.run(dynamic.nil( ), decode.optional(decode.int))
846
849
/// assert result == Ok(option.None)
847
850
/// ```
848
851
///
@@ -864,7 +867,7 @@ pub fn optional(inner: Decoder(a)) -> Decoder(Option(a)) {
864
867
///
865
868
/// ```gleam
866
869
/// let decoder = decode.int |> decode.map(int.to_string)
867
- /// let result = decode.run(dynamic.from (1000), decoder)
870
+ /// let result = decode.run(dynamic.int (1000), decoder)
868
871
/// assert result == Ok("1000")
869
872
/// ```
870
873
///
@@ -897,7 +900,7 @@ pub fn map_errors(
897
900
///
898
901
/// ```gleam
899
902
/// let decoder = decode.string |> decode.collapse_errors("MyThing")
900
- /// let result = decode.run(dynamic.from (1000), decoder)
903
+ /// let result = decode.run(dynamic.int (1000), decoder)
901
904
/// assert result == Error([DecodeError("MyThing", "Int", [])])
902
905
/// ```
903
906
///
@@ -941,7 +944,7 @@ pub fn then(decoder: Decoder(a), next: fn(a) -> Decoder(b)) -> Decoder(b) {
941
944
/// decode.int |> decode.map(int.to_string),
942
945
/// decode.float |> decode.map(float.to_string),
943
946
/// ])
944
- /// decode.run(dynamic.from (1000), decoder)
947
+ /// decode.run(dynamic.int (1000), decoder)
945
948
/// // -> Ok("1000")
946
949
/// ```
947
950
///
0 commit comments