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

Use RequireMsg or RequireMsgSym to improve error messages #2

Open
soronpo opened this issue Dec 14, 2017 · 5 comments
Open

Use RequireMsg or RequireMsgSym to improve error messages #2

soronpo opened this issue Dec 14, 2017 · 5 comments

Comments

@soronpo
Copy link

soronpo commented Dec 14, 2017

I took a brief look at your nice library that uses singleton-ops, and I recommend to use RequireMsg or RequireMsgSym to improve your error messages instead of the default implicitNotFound message.

@soronpo soronpo changed the title Use RequireMsg or RequireMsgSym to improve error message Use RequireMsg or RequireMsgSym to improve error messages Dec 14, 2017
@mandubian
Copy link
Owner

Thanks! I'll try!
This is a very draft version for now and I just wanted to prove it can work with singleton-ops & the concepts in the paper...
now I need to see how to improve things

@soronpo
Copy link
Author

soronpo commented Dec 14, 2017

OK. I just wanted to help and mention this, since it might have been missed due to singleton-ops' lacking documentation (my fault).

@mandubian
Copy link
Owner

I confirm I had missed it ;)
I also was wondering: for now, it seems impossible to extend existing operators in singleton-ops externally to the lib, you must add it to the lib directly, am I right?

@soronpo
Copy link
Author

soronpo commented Dec 14, 2017

Sadly you're right, and I don't see how can this be done otherwise. Fortunately, composition works flawlessly, so you should get most functionality from that. e.g.
type MyFunc[A,B,C] = A * B - math.Sqrt[C]

@mandubian
Copy link
Owner

Ideally, independently of singletons, I'd like to be able to write something like that with a bit of genericity:

def mult(m1: Dim2[A, B], m2: Dim2[B, C])(implicit r: Dim2[A, B] * Dim2[B, C] ===> Dim2[A, C]): Dim2[A, C]

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

2 participants