Module Decode.Pipeline

Pipeline Decoders

Pipeline decoders present an alternative to the mapN style. They read more naturally, but can lead to harder-to-understand type errors.

let person_decoder : person decoder =
  decode as_person
  |> required "name" string
  |> required "age" int
val decode : 'a -> 'a decoder
val required : string -> 'a decoder -> ( 'a -> 'b ) decoder -> 'b decoder
val required_at : string list -> 'a decoder -> ( 'a -> 'b ) decoder -> 'b decoder
val optional : string -> 'a decoder -> 'a -> ( 'a -> 'b ) decoder -> 'b decoder
val optional_at : string list -> 'a decoder -> 'a -> ( 'a -> 'b ) decoder -> 'b decoder
val custom : 'a decoder -> ( 'a -> 'b ) decoder -> 'b decoder