Quantcast
Channel: ReScript Forum - Latest posts
Viewing all articles
Browse latest Browse all 2592

Ergonomic bindings to database drivers are so frustrating

$
0
0

Ok so I’ve got this

@unboxed type queryParamTypes = I(int) | S(string) | @as(undefined) Undefined

let f = (~x: int, ~y: string, ~z=Undefined) => {
  [I(x), S(y), z]
}

let r = f(~x=1, ~y="two")
Console.log(r) //=> [ 1, 'two', undefined ]
let r = f(~x=1, ~y="two", ~z=Undefined)
Console.log(r) //=> [ 1, 'two', undefined ]
let r = f(~x=1, ~y="two", ~z=I(100))
Console.log(r) //=> [ 1, 'two', 100 ]

Its pretty good. A little awkward, especially at the [I(x), S(y), z] part. Is that the ergonomic its gonna get?


Viewing all articles
Browse latest Browse all 2592

Trending Articles