I have made this abstracted snippet of code, with the full code working as intended in my codebase, but now I would like to freeze the definitions with an interface file.
I’m encountering a syntax issue on the let query where naively I would write in my .resi :
interface file
let query:
type data variables. (
module(Query.Operation with
type t = data
and type t_variables = variables
),
request<variables> => unit,
) => query
Unfortunately, the syntax is broken with the usage of the keywords “with”, “type” or “and” in a .resi
I tried to generate the file with the inferred types with bsc -i but it wouldn’t generate or output anything.
Also it feels I’m missing some understanding with the module syntax and in my .res file I could eventually get rid of the type data variables. (...) part thanks to an interface file.
Because, I think that all users who never wrote intensive code in Ocaml / F# / Haskell gonna wonder: how can it help me, and why should I use it ?
Same question about GADT, I still don’t understand why should I use it.
There could be a disclaimer about advanced usages, as this is a language feature and not a concept like GADTs in ReScript.
But I found surprising the fact some keywords don’t even appear in the syntax-lookup page!