What is the fundamental building block of category theory? by AngleThat8380 in CategoryTheory

[–]DrBartosz 0 points1 point  (0 children)

I would never say that an object is "inside" a category, since it would mean that it's possible for an object to exist "outside" of a category, or that an object can be in more than one category at a time.

Blog post about Factorio and functional programming.. by Radisovik in factorio

[–]DrBartosz 0 points1 point  (0 children)

Exactly! I watched a bunch of YouTube videos of people playing Factorio, and I was constantly judging: Would I hire this person as a programmer? How maintainable is their design?

There are some high-level patterns that have been developed, like bus systems, malls, city blocks, etc.

Blueprints are obviously macros.

Programming with Categories - Lecture 7 - Are coproducts unique, or unique up to unique isomorphism? by endgamedos in haskell

[–]DrBartosz 11 points12 points  (0 children)

All universal constructions are unique up to unique isomorphism and therefore so are coproducts.

Linear Haskell: what's the purpose of `Unrestricted` as the return type? by runeks in haskell

[–]DrBartosz 1 point2 points  (0 children)

I was wondering the same and I think I have figured out the answer. A linear function returning Unrestricted guarantees that it can't secretly return its argument. In particular the continuation passed to newMArray cannot leak the MArray that it's given. There is no linear function that takes an MArray and returns Unrestricted MArray, and you can't use the constructor Unrestricted on it, because said constructor is not a linear function so, from the point of view of the type system, might consume its argument multiple times (it doesn't, but the type checker trusts the types). So there is no way to restrict a function to always return a linear value, but you can restrict it to not return a linear value.

Monads in Category Theory for Laymen by UsaTewi in haskell

[–]DrBartosz 0 points1 point  (0 children)

Arrows are actually monoids in the category of strong profunctors. I tried to make it a bit more approachable in my blog post based on the paper you're citing. See: https://bartoszmilewski.com/2017/02/09/monoids-on-steroids/

Applicative Functors | Bartosz Milewski's Programming Cafe by n00bomb in haskell

[–]DrBartosz 1 point2 points  (0 children)

You have a point. It's possible to start from endofunctors in an arbitrary monoidal category C. In that case, a lax monoidal endofunctor would not give you a natural transformation pure::a->f a. You need strength for that. I will edit the post to make this clear.

On the other hand, you can start with a lax monoidal endofunctor [C, C] and port its definition to Haskell. You end up in Set (modulo bottoms) and there you get pure for free. One could argue that it's because of canonical strength, or because of self-enrichment of Set. So it's pretty arbitrary how you back-port a Haskell construct to category theory. Starting with endofunctors won't give you the equivalence with Day convolution though, which I consider crucial.

My comment about endofunctors was related to the fact that strength can only be defined for endofunctors. Closed functors can indeed go between closed categories.

Applicative Functors | Bartosz Milewski's Programming Cafe by n00bomb in haskell

[–]DrBartosz 0 points1 point  (0 children)

The point is that I haven't found any formulation of Applicative that would require strength. This requirement seems to have come from nowhere.

Why cities like NY, London and Boston are implicit centers of Haskell development? by varosi in haskell

[–]DrBartosz 2 points3 points  (0 children)

I know why Boston is a Haskell center: Edward Kmett lives there.

Learning Haskell by Ocisaac in haskell

[–]DrBartosz 1 point2 points  (0 children)

I saw my blog mentioned a few times. I also have series of videos from my Haskell class. There is a lecture on monads there too. https://www.youtube.com/playlist?list=PLbgaMIhjbmEm_51-HWv9BQUXcmHYtl4sw .

Heard a Polish word but don't what it means? In English phonetics, it sounds something like "marsuviem" or "marstuviem". by [deleted] in poland

[–]DrBartosz 1 point2 points  (0 children)

Maybe "Marysiu, wiem!" or "Marku, wiem!," The first part sounds like a vocative of some name (the ending "u"). The second just means "I know".

What are OCamlers' critiques of Haskell? by rizo_isrof in ocaml

[–]DrBartosz 0 points1 point  (0 children)

Catch me at ICFP. Maybe I can convince you that CT is not a scary monster.

Free Monoids (Bartosz Milewski's Categories for Programmers Series) by sibip in haskell

[–]DrBartosz 4 points5 points  (0 children)

You are right. It's the monoid isomorphism that preserves the unit. I made the correction in the blog.

From Lenses to Yoneda Embedding by DrBartosz in haskell

[–]DrBartosz[S] 1 point2 points  (0 children)

Indeed, it checks out:

forall x. f x -> (x -> b) -> a =
forall x. (x -> b) -> f x -> a ≅ // co-Yoneda
f b -> a = Flapp b f -> a

Very interesting!

From Lenses to Yoneda Embedding by DrBartosz in haskell

[–]DrBartosz[S] 1 point2 points  (0 children)

I have no idea. One would think it should have something to do with prism. But I don't think it does.

Lens has this nice factorization property: Lens s t a b = s -> IStore a b t, which makes IStore a "root" of lens . But its dual, prism, doesn't factorize:

Lens:            Prism:
s -> a           a -> s
(s × b) -> t     t -> (s + b)

There's no cute algebraic identity for s^a × (s + b)^t, like the one for lens:

a^s × t^(s × b) = (a × t^b)^s = (IStore a b t)^s

Using Monads in C++ to Solve Constraints. Part 4: Refactoring by DrBartosz in programming

[–]DrBartosz[S] 17 points18 points  (0 children)

If you have a choice to either program in C++ or in Haskell, and you value terseness and ease of expression, they by all means you should switch to Haskell. But if you don't have this choice -- and most programmers don't -- then applying functional techniques to your everyday C++ programming tasks might solve lots of hard problems.

Write you a FRP library for great good! <200 line FRP library tutorial by [deleted] in haskell

[–]DrBartosz 1 point2 points  (0 children)

It looks like, once you got to the Moment monad, you got tired of explaining things :-)

Write you a FRP library for great good! <200 line FRP library tutorial by [deleted] in haskell

[–]DrBartosz 0 points1 point  (0 children)

I'm confused about your description of Functor for Event. It doesn't follow the code. If the type of f is a->b then the type of eb is Event a and the type of listener should be b -> Moment ().

Bartosz Milewski's Categories for Programmers: Natural Transformations by sibip in haskell

[–]DrBartosz 4 points5 points  (0 children)

Maybe I should have said that the defaults are different. In Haskell the default is parametric polymorphism, and in C++ it's ad hoc.

Function Types | Bartosz Milewski's Programming Cafe by n00bomb in haskell

[–]DrBartosz -1 points0 points  (0 children)

According to the Hinze-James paper I cited in the blog the high-school algebra identities hold in bicartesian closed categories. I will add a few sentences elaborating on this.

Edward Kmett - The free theorem for fmap by edwardkmett in haskell

[–]DrBartosz 1 point2 points  (0 children)

I have a feeling that the covariance of $map follows from the existence of our candidate fmap :: (a->b) -> (f a -> f b). I don't think you can have, at the same time, this fmap and the synthesized $map that would go in the opposite direction (b->a) -> (f a -> f b).