Live data from Hacker News

Basic Category Theory for Scala Programmers

blog.scalents.com

11–18 of 18 posts

Re: Basic Category Theory for Scala Programmers

#11
post #9
post #4

How important is this to understand in practice for a Scala programmer?

I'm the author of Scala.js, so supposedly a Scala "expert", and I still don't understand category theory. Does that answer the question?

It gives me some idea, yes :)

Re: Basic Category Theory for Scala Programmers

#12
post #4

How important is this to understand in practice for a Scala programmer?

My understanding is that, just like the abstract algebra, category theory is a useful tool to help you recognize patterns and provide you some level of certainty about their behavior. Rather than figuring out yourself if you should do something one way or the other, you can say: Hey, I know it's X, and people smarter than me have proven that X will behave in a certain way and that I can do certain stuff with it. When building complex systems this can save you a lot of time and nerves. However, with a common, simpler software that most of us build, it's more about writing the eloquent and stylish code, than an absolute necessity for a programmer. You definitely can work in scala for years without knowing anything about it.

Re: Basic Category Theory for Scala Programmers

#13

Bartosz Milewski has a series of posts (a book, really) and recorded lectures that teach category theory with Haskell and C++ as reference points. HN discussion: https://news.ycombinator.com/item?id=14026360 .

This is a great set of articles, thanks for sharing.

I place category theory within the same realm as the lambda calculus. Understanding category theory will enrich your understanding of the underlying computer science concepts, particularly with respect to functional programming. However, it's far more in the realms of computer science than software engineering. Software engineers can benefit from a conceptual overview, which this blog post provides in excellent form.

Unless your work involves formal proofs, I can't see many software engineering use cases where a more in-depth exposition would carry significant utility.

Re: Basic Category Theory for Scala Programmers

#14

Bartosz Milewski has a series of posts (a book, really) and recorded lectures that teach category theory with Haskell and C++ as reference points. HN discussion: https://news.ycombinator.com/item?id=14026360 .

We started a project to translate all Haskell sample code to scala in Bartosz's Category theory for programmers book https://github.com/typelevel/CT_from_Programmers.scala

Re: Basic Category Theory for Scala Programmers

#15
post #4

How important is this to understand in practice for a Scala programmer?

I wrote introductory blog post answer that. https://tech.iheart.com/why-fp-its-the-composition-f585d17b0... TLDR; It's about the ability to compose. Category theory enables more general and powerful composition of components. That is not to say that without CT you won't be able to compose, it's just more cumbersome and less flexible.

Re: Basic Category Theory for Scala Programmers

#16

Bartosz Milewski has a series of posts (a book, really) and recorded lectures that teach category theory with Haskell and C++ as reference points. HN discussion: https://news.ycombinator.com/item?id=14026360 .

We started a project to translate all Haskell sample code to scala in Bartosz's Category theory for programmers book https://github.com/typelevel/CT_from_Programmers.scala

Very cool! It's nice to have a Rosetta Stone available for reference to help convey deeper understanding of the book's Haskell examples.

Re: Basic Category Theory for Scala Programmers

#18

Scala’s category theory faculties are so incredibly awkward without an outside library like Cats, I never thought I was writing “good code” in the functional style in Scala until I started using Monads et al via Cats/Scalaz. Don’t get me wrong, I could compose my function A then B then C, but now I’m passing around these awkward Function1 instances that are hard to reuse and honestly just look unstructured. It feels…

You're right and I struggled with the idea to add more in the first post, but I've decided to leave the more interesting stuff (Functors!) for the next part.
Post reply on HN