zio-sql
zio-sql copied to clipboard
Support support context bounds on `FunctionDef`s
There are lots of FunctionDefs that should work for multiple types specified by existing parameter bounds e.g.
val Sign = FunctionDef[Double, Int](FunctionName("sign"))
it would be good to be able to do something like:
def Sign[A: IsNumeric] = FunctionDef[A, Int](FunctionName("sign"))
This doesn't work because we're using the FunctionDef syntax class - the type of the argument passed to the apply method on the returned FunctionCall is not known when Sign is called, meaning we have to specify the type when calling the function and explicity call apply which is not exactly a nice nice UX
select(Sign[Double].apply(30.0)) from ???
this issue was discovered from some work with @saucam & @brbrown25 on other functions
Yes, we need to fix this. It's a big usability problem.