Category Theory
Zulip Server
Archive

You're reading the public-facing archive of the Category Theory Zulip server.
To join the server you need an invite. Anybody can get an invite by contacting Matteo Capucci at name dot surname at gmail dot com.
For all things related to this archive refer to the same person.


Stream: theory: applied category theory

Topic: programming


view this post on Zulip Henry Story (Jun 29 2021 at 15:34):

Not sure if this is too practical for the Category Theory Zulip.
Here is a very nice talk Scale By The Bay 2018: Greg Pfeil, Duality and How to Delete Half (minus ε) of Your Code.

view this post on Zulip Fintan Halpenny (Jun 29 2021 at 19:30):

I've worked with Greg in the past and meet with him regularly :grinning_face_with_smiling_eyes: he's been working at Kitty Hawk on compiling to categories in Haskell. They plan to open source it at some point soon :fingers_crossed:

view this post on Zulip Henry Story (Jun 29 2021 at 20:25):

Ah, so I wonder if the scala code he showed in that talk ended up in some library. It would be nice to be able to study it, and even use it...

view this post on Zulip Fintan Halpenny (Jun 29 2021 at 20:32):

I can ask him :ok:

view this post on Zulip Henry Story (Jun 29 2021 at 20:41):

Thanks :smile:
No hurry though: I am currently studying Cofun with Cofree Comonads an older Haskell talk with a blog post to go with it.
I am hoping I'll slowly get the theory I have been learning over the past few years to start composing with the coding skills.

view this post on Zulip Fintan Halpenny (Jun 30 2021 at 09:55):

Here's the repo for dualizing :) https://github.com/sellout/dualizer

view this post on Zulip Nick Hu (Jun 30 2021 at 10:11):

nice username

view this post on Zulip Jon Awbrey (Jun 30 2021 at 18:04):

This reminds me of the general theme of exploiting symmetry groups to reduce complexity.

view this post on Zulip Henry Story (Jun 30 2021 at 18:06):

Fintan Halpenny said:

Here's the repo for dualizing :) https://github.com/sellout/dualizer

Thanks, very interesting!
It looks like the Scala code was more of a sketch, and the full code is in Haskell.
Perhaps with Scala3 now out, someone will follow up on these ideas there too. That would be interesting,

view this post on Zulip Henry Story (Jul 02 2021 at 12:13):

Over on Discord (Scala) Cats Theory channel zhukpauk asked:

Can someone recommend something to read to understand the difference between types and classes in scala? I am not experienced that much with OOP and getting confused when reading theory about classes and types, where they differ, where they similar, when they should be used etc. Even haskell types were less confusing to me than this

I answered the following (it seems a good hypothesis):

One way to think of them is that they are the same.
Another way, could be to think of classes as duals to types perhaps, in that classes are coalgebraic and types algebraic, or classes are codata types as opposed to data types. So classes in Java are specified by their interfaces, which can have multiple implementations. As long as those implementations agree on what is visible and what results they give when interacted with they are the same, or more precisely bisimilar. Look at the papers in the list I cited above by Bart Jacobs.

view this post on Zulip Henry Story (Jul 02 2021 at 12:27):

Ah well one of the answers point to this being actually a distinction that has already been worked on, and I was just trying to guess at that distinction.

A type is a compile time label that statically proves the absence of certain behavior. A class is a runtime tag that is used for dispatch
Some features work at runtime in terms of classes, eg pattern matching or overriding. Other work at compile time in terms of types, eg implicit resolution or overloading. If you want a haskell comparison, data constructors in haskell are like classes, and types are... Well types

Here is an article on types being more than classes...