These are chat archives for non/algebra

7th
Jul 2015
FrankRaiser
@FrankRaiser
Jul 07 2015 20:18
@non I would appreciate a pointer for starting though.. I assume there's a better way than to overload fromAll for various numbers of arguments.. as the type parameter can change for each function varargs or a seq wouldn't work well
actually it seems more of a problem for byAll.. if I get your example you'd assume the same type for the functions in fromAll.. makes sense too
Erik Osheim
@non
Jul 07 2015 20:20
@FrankRaiser I think fromAll should be able to work with simple varargs, since each argument will be (A, A) => Int
as far as byAll goes, you are right that it gets a bit more complicated. I'm not sure what hte best option is -- feel free to defer that part if you want.
FrankRaiser
@FrankRaiser
Jul 07 2015 20:22
ok.. I'll leave a comment then and will try to send a pull request your way within a few days
@johnynek I'm not familiar with macros at all.. would it be ok to implement it with varargs despite your comment?
Erik Osheim
@non
Jul 07 2015 20:26
@FrankRaiser hm, now i'm reconsidering. i think the performance gains from macros may be worth it. it would be nice to have varargs code for a test case if nothing else, but i can't promise we would use the code.
so -- i guess you should feel free to work on it, but we might go with macros, so if that uncertainty bothers you then maybe i would hold off?
FrankRaiser
@FrankRaiser
Jul 07 2015 20:29
doesn't bother me really.. I wanted to dive into cats/algebra a bit more anyways, so it's just part of the learning curve for me anyways
Erik Osheim
@non
Jul 07 2015 20:30
cool! then go for it! thanks! :clap:
FrankRaiser
@FrankRaiser
Jul 07 2015 20:30
let's just say I'll work on it and either you get it done via macros, or you get a sudden pull request from me and can feel free to replace it later on.. or show me how to do that macro thing ;-)
Erik Osheim
@non
Jul 07 2015 20:30
sounds good.
FrankRaiser
@FrankRaiser
Jul 07 2015 20:32
hm.. is my IntelliJ-foo bad, or is the current Order.from not covered by any test?
Erik Osheim
@non
Jul 07 2015 20:32
it easily could be overlooked. we'd definitely appreciate a test covering it!
FrankRaiser
@FrankRaiser
Jul 07 2015 20:34
ok.. I'd need to add ones for the fromAll anyways.. is core the right place for that? seems you only have instances defined there and the actual tests all in laws?
Erik Osheim
@non
Jul 07 2015 20:35
yeah the tests are all in laws right now.
the concrete instances (e.g. Order[Int]) are defined in std, and the type classes themselves are defined in core.
FrankRaiser
@FrankRaiser
Jul 07 2015 20:38
I see.. though neither uses the factory methods of the companion object