These are chat archives for non/algebra

21st
Aug 2016
Erik Osheim
@non
Aug 21 2016 19:30
hey folks -- i'm updating algebra to 0.7.0 today
also want to fix some performance issues we recently uncovered in cats-kernel
i'll ping you all here with the PR(s)
P. Oscar Boykin
@johnynek
Aug 21 2016 19:31
@non great!
Erik Osheim
@non
Aug 21 2016 19:38
@johnynek i was thinking of doing it in one PR, since the changes will overlap a bunch. but if you'd rather i can submit the improvement to map instances first, then once we merge that i can do the other stuff
do you have a preference?
P. Oscar Boykin
@johnynek
Aug 21 2016 19:39
Kinda like two atomic changes if it is not such a bummer.
Erik Osheim
@non
Aug 21 2016 19:39
ok sure that works
Erik Osheim
@non
Aug 21 2016 20:02
(1) non/algebra#157
i'm now making a PR based on that for the 0.7.0 upgrade
Erik Osheim
@non
Aug 21 2016 20:12
major changes needed for 0.7.0:
  • rename std -> instances
  • clean up the StaticMethods object
  • ???
Erik Osheim
@non
Aug 21 2016 20:32
(2) non/algebra#158
there was no third "???" -- i think everything should be OK there.
Erik Osheim
@non
Aug 21 2016 22:49
@johnynek is there anything you'd like to see in algebra before a release? if not i'll go ahead and start that moving now
P. Oscar Boykin
@johnynek
Aug 21 2016 22:50
I can’t think of anything at the moment. Let me look at the issues
no, it looks like we are good
P. Oscar Boykin
@johnynek
Aug 21 2016 23:06
@non if we can get mima wired in on cats-kernel now that 0.7.0 is here, and on algebra core, then I think the time is right to port algebird and spire to algebra, no?
Erik Osheim
@non
Aug 21 2016 23:48
so basically, yes. i had one question though --
do you think we should keep publishing algebra-instances separately from e.g. algebra-ring?
the bad thing about that design is that instances necessarily depends on everything else (ring, lattice, etc.) so you sort of lose the benefits of modularity
the good thing is that it gets the mixing-in right and makes it really convenient when you do want to use all of those together (e.g. in spire)
P. Oscar Boykin
@johnynek
Aug 21 2016 23:50
the alternative is what?
move them to core and have ring instances in ring?
so, one thing we should definitely forget: the idea that they are somehow examples or non-canonical.
Erik Osheim
@non
Aug 21 2016 23:51
right, agreed.
that hasn't been true for awhile.
P. Oscar Boykin
@johnynek
Aug 21 2016 23:51
we had this idea at first they were just toys. That is probably a bad idea. No users want toys.
the nice thing about keeping as is, is that we can keep core really stable.
Erik Osheim
@non
Aug 21 2016 23:52
more importantly interop works better if you use the same classes (more-or-less) in spire/algebird/etc
P. Oscar Boykin
@johnynek
Aug 21 2016 23:52
(and ring?) because instances are probably where you see the most churn
true.
at least semantically.
I think the main win will really be using some nice instance from spire or algebird elsewhere
like getting CMS in spire
Erik Osheim
@non
Aug 21 2016 23:53
so i think the other option would be to admit that the modularity here isn't worth it, fold ring and lattice into core, and put the instances there too
yes!!!
P. Oscar Boykin
@johnynek
Aug 21 2016 23:53
or some of your nice number types in Algebird/scalding
then algebra is basically one big package, huh.
Erik Osheim
@non
Aug 21 2016 23:53
i'm fine leaving things as-is, but i just wanted to bring up that the modularity isn't really working for us (at least if you want instances)
P. Oscar Boykin
@johnynek
Aug 21 2016 23:54
right, because we dont have core-instances, lattice-instances, etc...
Erik Osheim
@non
Aug 21 2016 23:54
exactly.
P. Oscar Boykin
@johnynek
Aug 21 2016 23:54
so, it easy to merge than unmerge
Erik Osheim
@non
Aug 21 2016 23:54
and in fact at this point core is totally vestigial
P. Oscar Boykin
@johnynek
Aug 21 2016 23:55
not really is it? Is all of core just cats kernel?
Erik Osheim
@non
Aug 21 2016 23:55
(it basically repackages cats-kernel in our own namespace)
it adds Priority that's it.
P. Oscar Boykin
@johnynek
Aug 21 2016 23:55
ha
okay, that is silly
do we even use that?
Erik Osheim
@non
Aug 21 2016 23:56
we haven't yet. i was gonna propose removing it
P. Oscar Boykin
@johnynek
Aug 21 2016 23:56
or is it just another Either?
yeah, I think that may make sense.
the standard library should give an implicit Either like that with a right bias.
Erik Osheim
@non
Aug 21 2016 23:56
well -- i think it's different than Either due to the implicits it has
P. Oscar Boykin
@johnynek
Aug 21 2016 23:57
?
Erik Osheim
@non
Aug 21 2016 23:57
object Priority extends FindPreferred {

  case class Preferred[P](get: P) extends Priority[P, Nothing]
  case class Fallback[F](get: F) extends Priority[Nothing, F]

  def apply[P, F](implicit ev: Priority[P, F]): Priority[P, F] = ev
}

private[algebra] trait FindPreferred extends FindFallback {
  implicit def preferred[P](implicit ev: P): Priority[P, Nothing] =
    Priority.Preferred(ev)
}

private[algebra] trait FindFallback {
  implicit def fallback[F](implicit ev: F): Priority[Nothing, F] =
    Priority.Fallback(ev)
}
that means if you have implicit F and P both in scope it chooses the right one
P. Oscar Boykin
@johnynek
Aug 21 2016 23:57
right, but if scala had that on Either, it would be fine, right?
Erik Osheim
@non
Aug 21 2016 23:58
maybe? it seems a bit too specific to implicit search to make sense on a general data structure
P. Oscar Boykin
@johnynek
Aug 21 2016 23:58
that’s fine.
Erik Osheim
@non
Aug 21 2016 23:58
a bit like creating an implicit A => List[A]
P. Oscar Boykin
@johnynek
Aug 21 2016 23:58
I mean, I like Priority
but no user code needs to know about it
Erik Osheim
@non
Aug 21 2016 23:58
i guess what i mean is that i can see both sides of that argument. if either had those implicits i'd definitely use them.
P. Oscar Boykin
@johnynek
Aug 21 2016 23:59
so you can always have it in a library
Erik Osheim
@non
Aug 21 2016 23:59
i'm just not sure i'd open a PR to scala and argue for them.
P. Oscar Boykin
@johnynek
Aug 21 2016 23:59
sure
okay.
well, seems like we need to think a bit.
I need to run
Erik Osheim
@non
Aug 21 2016 23:59
ok sounds good. maybe i should just release what we have here? and then we can open PR to restructure later?
or should i wait?
i can do either
P. Oscar Boykin
@johnynek
Aug 21 2016 23:59
seems like we should not release right this second if core is basically dead.
Erik Osheim
@non
Aug 21 2016 23:59
ok
P. Oscar Boykin
@johnynek
Aug 21 2016 23:59
that seems a bit crazy.