Hello,
I know it is possible to chain props access in bucklescript, but I am not sure if it is possible to write bindings that call chained functions.
I know that you can define externals with bs.send and then they will be compiled to just chained calls, but If I want to build a helper function that is just several external calls chained it will be compiled to an actual function instead of a zero cost call.
To put an example, this is what I have:
external getDataRange : sheet -> range = "getDataRange" [@@bs.send]
external getValues : range -> Cell.t array array = "getValues" [@@bs.send]
let getAllValues sheet = getDataRange sheet |. getValues
But this is what I wanted:
external getDataRange : sheet -> range = "getDataRange" [@@bs.send]
external getValues : range -> Cell.t array array = "getValues" [@@bs.send]
external getAllValues : sheet -> Cell.t array array = "getDataRange().getValues" [@@bs.send]
But the above produces wrong JS code. If this even possible?