[ANN] dream-html & pure-html 3.5.2

[ANN] dream-html 3.8.0

Happy to announce some added power to the form decoding functionality. Three main things:

  1. Added Dream_html.form and query helper functions to wrap extracting the data directly from the Dream request and decoding it correspondingly from the body or query.
  2. Added the (monadic) chaining operator Dream_html.Form.( let* ) and ok and error helpers to allow sophisticated sequential decoding where decoding of some fields depend on others.
  3. Added optional parameters to constrain typed decoding of values eg int ~min:0 will succeed the decode if the value is an integer and at least 0. Also added unix_tm type decoder to decode timestamps into Unix.tm structs (not timezone-aware).

The last example on the page shows a fairly sophisticated form decoder which requires an id field and one or more of the fields days, weeks, months, and years, and fails if at least one is not provided.

Enjoy :slight_smile:

3 Likes