neurocat icon indicating copy to clipboard operation
neurocat copied to clipboard

Use RequireMsg or RequireMsgSym to improve error messages

Open soronpo opened this issue 8 years ago • 5 comments

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 avatar Dec 14 '17 08:12 soronpo

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

mandubian avatar Dec 14 '17 08:12 mandubian

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

soronpo avatar Dec 14 '17 09:12 soronpo

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?

mandubian avatar Dec 14 '17 09:12 mandubian

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]

soronpo avatar Dec 14 '17 09:12 soronpo

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]

mandubian avatar Dec 14 '17 09:12 mandubian