[ANN] dream-html 3.8.0
Happy to announce some added power to the form decoding functionality. Three main things:
- 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.
- 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.
- 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 intoUnix.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