Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
Edmund Noble
@edmundnoble
The reason is first you take the "free Functor" over F[_] to get a new functor G[_], then you use that G[_] in the other free monad
Yes that
Rob Norris
@tpolecat
case class Free[F[_], A](resume: Either[A, F[Free[F,A]]]) is a simpler implementation.
Edmund Noble
@edmundnoble
Yeah, that's the one which requires that it's a functor
There's a bit of intuition for this which I will try to give in my scala world talk ;)
Rob Norris
@tpolecat
:-)
Edmund Noble
@edmundnoble
But @djspiewak has a talk on inventing the free monad, or several
Aman Bhurji
@aman-rally
Oh man. I wish i could attend
Edmund Noble
@edmundnoble
It'll be filmed, you can see my jokes fall flat over and over to your heart's content
Aman Bhurji
@aman-rally
haha
Rob Norris
@tpolecat
Squeeee I can't wait!
Edmund Noble
@edmundnoble
LMAO
Rob Norris
@tpolecat
My scala world talk from last year touches on Free as a special case of Fix, which is another angle on getting an intuition. I didn't really get it until I approached it from that direction.
@edmundnoble what's your talk on?
Edmund Noble
@edmundnoble
TYPES
Rob Norris
@tpolecat
You're still TBD on the schedule, which is an improvement on the entire schedule being TBD as it was last year.
Edmund Noble
@edmundnoble
...in Scala
Rob Norris
@tpolecat
Types? pfft
what have types done for us lately
Mike (stew) O'Connor
@stew
proposition us
Edmund Noble
@edmundnoble
Data types and interface types are used for different reasons in OO than in pure FP, I'm going to explore the difference with a view to eliminating data types from almost all of your code
(well the pure stuff, anyway)
And making your code both more modular/parametric and more performant at the same time
Aman Bhurji
@aman-rally
Looking forward to that video!
Edmund Noble
@edmundnoble
Thanks :D me too
Alexander Konovalov
@alexknvl
case class Free[F[_], A](resume: Either[A, F[Free[F,A]]]) is "data" assuming F is, cats impl is always "co-data".
inductive, co-inductive?
Edmund Noble
@edmundnoble
You could look at it that way, I don't know how useful it is though
Seeing as you have to consume it all to interpret it
Whereas Cofree, you interpret other comonads into
Alexander Konovalov
@alexknvl
That's pretty useful if you want to guarantee termination :)
Although in most cases you don't.
Edmund Noble
@edmundnoble
Yeah that's the canonical issue with Free, all bottoms are the same in some sense
Rob Norris
@tpolecat
I think it's useful to play around with a strict/finite implementation because it's very simple.
The structure is totally obscured in the cats/scalaz impls.
Edmund Noble
@edmundnoble
It's also nice for just growing leafy trees
I appreciate step being constant-time
Jacob Barber
@Jacoby6000
Does cats have an implementation for ForAll? I can't find one
Edmund Noble
@edmundnoble
Nope
Jacob Barber
@Jacoby6000
D:
Any reason why?
I'll make a PR to add it if not.
Edmund Noble
@edmundnoble
Please do, take that from alexknvl/polymorphic probably
Jacob Barber
@Jacoby6000
:thumbsup:
Jacob Barber
@Jacoby6000
I can not so proudly say I don't understand that implementation at all. lol
Edmund Noble
@edmundnoble
It has no boxing and nice syntax
Alexander Konovalov
@alexknvl
And also the trick with unstable types...
And the trick with final class Foo(val b: Boolean = true) extends AnyVal
Edmund Noble
@edmundnoble
Ugh that trick gives me shame