janestreet / bonsai

A library for building dynamic webapps, using Js_of_ocaml
MIT License
368 stars 39 forks source link

Error in example code from the website #26

Closed exit91 closed 1 year ago

exit91 commented 2 years ago

When visiting the project website https://opensource.janestreet.com/bonsai/ I'm greeted with some example code:

let apply_action ~inject:_ ~schedule_event:_ model = function
  | Action.New -> Map.add_exn model ~key:(Map.length model) ~data:0
  | Update (location, diff) ->
    Map.update model location ~f:(function
      | None -> 1
      | Some x -> x + 1)
;;

The last line should probably read | Some x -> x + diff, one reason being that the variable isn't used otherwise. I'm not sure where best to report this, so I'm sorry if this isn't the appropriate place.

askvortsov1 commented 1 year ago

Seems to be fixed

exit91 commented 1 year ago

It is indeed