These are chat archives for typelevel/cats

16th
Mar 2015
Erik Osheim
@non
Mar 16 2015 01:26
@adelbertc so -- the K suffix is maybe just weird (or a mistake)
if you look at scalaz, it overloads flatMap with two definitions
(i think this is to support certain for-comprehensions)
when I wrote kleisli i didn't like the overloading, but maybe just chose ill-advised names
Adelbert Chang
@adelbertc
Mar 16 2015 03:54
@non I think Scalaz has flatMap as Kleisli[F, A, B] => (B => Kleisli[F, A, C]) => Kleisli[F, A, C] https://github.com/scalaz/scalaz/blob/series/7.2.x/core/src/main/scala/scalaz/Kleisli.scala#L43-46
and it has flatMapK sa the unwrapped version of Kleisli
for me, the intuitive flatMap would be B => Kleisli[F, A, C] and flatMapK be the unwrapped version - similarly for OrT when it comes into existence
Michael Pilquist
@mpilquist
Mar 16 2015 11:39
Headed to San Fran now - hope to see you all!
Mark Farrell
@markfarrell
Mar 16 2015 12:01
what’s going on in SF?
Gary Pamparà
@gpampara
Mar 16 2015 12:10
scaladays
Pascal Voitot
@mandubian
Mar 16 2015 21:07
anything about cats at scaladays?
James Kionka
@kionka
Mar 16 2015 21:08
it’ll be mentioned in my talk, but only in passing
Pascal Voitot
@mandubian
Mar 16 2015 21:09
that's already something ;)
Miles Sabin
@milessabin
Mar 16 2015 21:09
Me too.
Ahh ... we never settled on whether we were going to try and arrange a Cats meetup ...
Alex Henning Johannessen
@ahjohannessen
Mar 16 2015 21:11
This message was deleted
Pascal Voitot
@mandubian
Mar 16 2015 21:26
shame... I will do it alone from France ;)
Miles Sabin
@milessabin
Mar 16 2015 21:27
@mandubian if you're at a loose end, see if you can whip up a derivation of Pointed for me ;-)
Pascal Voitot
@mandubian
Mar 16 2015 21:29
oh nice challenge ;)
Miles Sabin
@milessabin
Mar 16 2015 21:32
You should be able to get something that would work for Option and leafy trees easily. List is a bit more interesting, but can be done too.
Pascal Voitot
@mandubian
Mar 16 2015 21:32
I'll give it a try while you're enjoying a nice conference
Miles Sabin
@milessabin
Mar 16 2015 21:32
If you get it done before my talk on Wednesday I'll mention it :-)
Michael Pilquist
@mpilquist
Mar 16 2015 21:33
haha
Miles Sabin
@milessabin
Mar 16 2015 21:33
Hey! This is what open source is all about! ;-)
Pascal Voitot
@mandubian
Mar 16 2015 21:33
motivation :clap:
Pascal Voitot
@mandubian
Mar 16 2015 21:47
@milessabin is there Pointed in cats?
Miles Sabin
@milessabin
Mar 16 2015 21:47
Not at the moment. I was arguing for it in this channel because of it's usefulness in derivation.
Pascal Voitot
@mandubian
Mar 16 2015 21:48
ok so let's create it for the experiment
Stacy Curl
@stacycurl
Mar 16 2015 21:49
Do you mean something like this: trait Pointed[F[_]] { def pointA: F[A] } ?
Pascal Voitot
@mandubian
Mar 16 2015 21:49
I think so
Erik Osheim
@non
Mar 16 2015 21:49
haha, emoticonned
Stacy Curl
@stacycurl
Mar 16 2015 21:49
Hmm, that used to be in scalaz, but wasn’t it removed because it has no laws ?
Erik Osheim
@non
Mar 16 2015 21:50
trait Pointed[F[_]] { def point(a: A): F[A] }
Pascal Voitot
@mandubian
Mar 16 2015 21:50
it was removed I think
Miles Sabin
@milessabin
Mar 16 2015 21:50
Erik Osheim
@non
Mar 16 2015 21:50
right, it was removed because it has no laws (similar to something like Zero[A])
Miles Sabin
@milessabin
Mar 16 2015 21:50
See discussion from that point on.
If think that you can say that a Pointed instance is lawful if it gives rise to a lawful Monoid.
Erik Osheim
@non
Mar 16 2015 21:54
right -- or really, a MonoidK[F[_]] in this case.
trait Zero[A] { def zero: A } with laws is what gives you Monoid[A]
Miles Sabin
@milessabin
Mar 16 2015 21:54
Yup.
Erik Osheim
@non
Mar 16 2015 21:56
i think i am more sympathetic to Pointed[F[_]] than Zero[A] for what it's worth
since Pointed[F] only gets to rely on the structure of F to decide what to do, i think it's much less likely that it will be mismatched with a SemigroupK[F] you might have.
whereas it's trivial to find examples where Zero[A] and Semigroup[A] would be incompatible.
Miles Sabin
@milessabin
Mar 16 2015 21:57
Suppose we had a monomorphic list-like type ... that would have a Zero that could be read off its constructors.
Erik Osheim
@non
Mar 16 2015 22:00
sure -- but like i said, i don't think anyone should be using Zero[A] in their code.
Miles Sabin
@milessabin
Mar 16 2015 22:01
Well, yes and no. As part of a derivation, I think yes. Otherwise no.
Erik Osheim
@non
Mar 16 2015 22:02
i guess i'm not up enough on derivation. would you then use a derived semigroup to get a derived monoid?
is there a reason you wuoldn't just derive the monoid's operation + zero together?
Pascal Voitot
@mandubian
Mar 16 2015 22:03
Zero could be hidden in some way just used for derivation
Miles Sabin
@milessabin
Mar 16 2015 22:03
We've got a whole bunch of interrelated concepts here. I'd like us to be able to explicitly define the minimum and have the rest derived.
Which is the minimal set is going to vary case by case.
Some things have natural monoids which could be derived. Some don't, so a hand written instance would be needed.
Some types have a natural Pointed that's derivable (eg. List) but not a natural Monoid that's derivable. It'd be nice if you could help yourself to the derivable Pointed while defining the non-derivable Monoid.
Erik Osheim
@non
Mar 16 2015 22:08
does derivation prove things like associativity?
i guess i had assumed that it would be hard to ensure that, but maybe not?
Miles Sabin
@milessabin
Mar 16 2015 22:09
I guess it might in some cases. I'm not expecting that to happen often though.
Derivation doesn't mean we don't have to verify that the laws are satisfied, it just means that we don't have to write the code that's checked ;-)
Pascal Voitot
@mandubian
Mar 16 2015 22:11
It's crazy, I can't write Pointed, I always writer pointer... my C dev past comes back :fire:
Miles Sabin
@milessabin
Mar 16 2015 22:12
:D
Pascal Voitot
@mandubian
Mar 16 2015 22:17
@milessabin shapeless master compiles?
/shapeless/core/target/scala-2.11/src_managed/main/shapeless/tupletypeables.scala:27: object creation impossible, since method describe in trait Typeable of type => String is not defined [error] = new Typeable[Tuple1[A]] {
Miles Sabin
@milessabin
Mar 16 2015 22:18
Yes, definitely ... have you pulled from upstream recently?
Pascal Voitot
@mandubian
Mar 16 2015 22:18
let me refresh my sbt session
I thought I had but...
yes sorry it works