zio-sql icon indicating copy to clipboard operation
zio-sql copied to clipboard

Support support context bounds on `FunctionDef`s

Open bertlebee opened this issue 5 years ago • 1 comments

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

bertlebee avatar Nov 21 '20 03:11 bertlebee

Yes, we need to fix this. It's a big usability problem.

jdegoes avatar Nov 22 '20 02:11 jdegoes