Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- open Js_of_ocaml
- open BatPervasives
- open Eliom_content
- module MatchCapture = struct
- type buyCapture = {
- buyId : int;
- quantity : int;
- } [@@deriving yojson]
- type t = {
- sellId : int;
- buyCaptures : buyCapture list;
- } [@@deriving yojson]
- let buyOrder (buyId, quantity) = {buyId=buyId; quantity=quantity}
- let of_tuple (sellId, buyCaptures) = {sellId=sellId; buyCaptures=buyCaptures}
- let of_dom sellId buy_tuples =
- let buyOrder (buyId, quantity_input) =
- let quantity_input' = Eliom_content.Html.To_dom.of_input quantity_input in
- let order_quantity = (int_of_string % Js.to_string) quantity_input'##.value
- in buyOrder (buyId, order_quantity) in
- let buyOrders = List.map buyOrder buy_tuples
- in of_tuple (sellId, buyOrders)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement