Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support support context bounds on FunctionDefs #258

Open
robmwalsh opened this issue Nov 21, 2020 · 1 comment
Open

Support support context bounds on FunctionDefs #258

robmwalsh opened this issue Nov 21, 2020 · 1 comment

Comments

@robmwalsh
Copy link
Contributor

robmwalsh commented Nov 21, 2020

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

@jdegoes
Copy link
Member

jdegoes commented Nov 22, 2020

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants