A monoid is a category, a category is a monad, a monad is a monoid
graphicallinearalgebra.net
graphicallinearalgebra.net
"Information is inherently dynamic; the same ideas can be organized and reorganized in countless ways, and the ability to translate between such organizational structures is becoming increasingly important in the sciences. Category theory offers a unifying framework for information modeling that can facilitate the translation of knowledge between disciplines."
[1] https://mitpress.mit.edu/books/category-theory-sciences
[2] https://github.com/mmai/Category-Theory-for-the-Sciences
Not a criticism, just a note to anyone thinking of spending an hour with it.
[1]: http://www.lambdadays.org/lambdadays2016/philip-wadler
[2]: http://www.lambdadays.org/static/upload/media/14562260715188...
The very ending was awesome as well!
I'm not trying to be snarky, I'm legitimately interested. It seems like this class of knowledge is highly specialized, yet I see posts like these high up on NH frequently.
http://stackoverflow.com/questions/3870088/a-monad-is-just-a...
But I didn't really try to understand it.
Haskell, unfortunately, is still quite opaque to me.
What could be more practical than self-improvement?
I'll answer my own question: learning how to apply the same kinds of reasoning to improve how people interact.
Would you mind sharing?
Heh...and as I typed that, I came by some:
The concept of opposite categories is surprisingly useful & gives me comfort when worrying about messing with my mind. If my brain is simply one big personalized category, then anything it can learn can be unlearned.
The concept CT constructions have duals is also really helpful. One thing it suggests to me is anything learned accidentally (and/or temporarily) can be learned intentionally. A specific way this works: synesthesia (cross-wiring of senses, eg. seeing colors in response to hearing music) occurring accidentally, synesthesia temporarily occurring from drugs, and intentionally learning synesthesia. Dualism is a predictive tool in this case.
A way dualism helps me explain some things I've experienced is it suggests mental mechanisms (such as the creation of very different identities beyond the core identity) can fire in functional & dysfunctional ways. I accidentally spawned second & third identities, one of whom is female. It happened through a joyful process, though, and not trauma. The dissociation used is fairly superficial and the goal of creating more is as a continuous process of integrating all of them into a core identity. CT also helps me think about our relationships & how I'm growing through them.
One last example would be the law of composition in CT: if there exists A->B (an arrow from A to B) and B->C, then there exists A->C. Specifically, there exists a way to get from one mental state A to mental state Z that goes through B->...->Y and by experiencing that path, we can learn to shorten it til we can go straight from A to Z. I went through a bit of a path to accidentally create the second identity. The third one was a bit more intentional & took less time to pull off.
If that doesn't answer your question, would you be willing to ask a more specific question in terms of what you'd like to hear examples of?
The way I think about is to think of it is if "Design Patterns" helped show how to "engineer" software at the medium scale, category theory is a tool for helping us learn how to compose systems, and not just software.
I wish it were a little more approachable, but it seems like we are getting there.
There are people like Bartosz out there who really want to make it second nature.
https://bartoszmilewski.com/2014/11/04/category-the-essence-...
I mean just think, it wasn't that long ago nobody knew what the heck a lambda was ;)
We'll get there...
It was once a teeming garden world, but after replacing every species several times, the increasingly abstract creatures failed to thrive. Many wars were faught, poisoning the planet itself with leaky abstractions and broken factories.
They knew many years ago, the planet was dying. The most enterprisey scientists of the world gathered in secret to build a colony ship, free from abstraction. A chance to start over and build a more functional place.
And now on this new planet, they cast off the old ways of objects and threads, embracing monads and async promises for a better future. This time, the scientists reasoned, it would be better. And so they replaced their first species, the monoid.
For my own part, I find this kind of post fairly easy to digest, but that's almost certainly because I'm a Mathematician by training (PhD in numerical differential geometry, but did a lot of abstract algebra as an undergraduate). To me, a lot of the programming-related topics on HN seem to be written in some form of Ancient Greek, but they seem to be pretty popular and attract a lot of comments.
I think we have to simply assume that there are minorities of niche experts on HN, and that these minorities are large enough for such posts to do well.
This post is basically Ancient Greek to me, as you put it.
I think I largely became curious since "these types of posts" tend to be highly ranked with relatively few comments, yet they still show up frequently.
I'm also surrounded by a large number of varying types of programmers and engineers, and I get to hear evangelizing and discussion of a wide array of technologies, but pure math type stuff like this never comes up. So combined that with the aforementioned observation and I become increasingly curious how these posts do well.
It's actually a lot more accessible than it seems at first—these ideas are not complex, just abstract. Thinking at a high level of abstraction is very much a skill which requires specific training, but it's a skill worth training and, when you have it, learning things like this becomes much easier.
The same thing is true of programming, by the way: once you start "thinking like a programmer", it becomes much easier to learn a new programming language or to understand some low-level programming concepts. And thinking like a programmer is, in the grand scale of things, not that different from thinking like a mathematician!
Is Haskell (or other fp languages) commonly used at Target?
I work at Target and we have a weekly class on algebra, category theory and Haskell because people are interested
Wow, Target sounds like it has a nerdier crowd than Facebook.This stuff is a certain brand of abstract algebra. Abstract algebra is generally of a certain degree of usefulness to a programmer in that there's a similarity in discipline. Moreover, linear algebra can be very useful to many programers who do things related to applied mathematics---nearly all of it touches linear algebra. Linear algebra is a specific form of abstract algebra and this blog takes a particularly "abstract" approach to linear algebra.
The particular tools being used here are of a category theoretic flavor. Category theory is a sibling to abstract algebra especially popular in certain fields (topology, algebraic geometry, foundations and logic). It's furthermore pretty popular in the Haskell-like FP crowd since Haskell is a rich place for exploring very high-order abstraction and category theory helps provide some language for talking at very high abstraction. For that reason, a lot of Haskell hackers have some amount of experience with category theory.
Finally, hackers with any kind of pure math background have a decent chance at having been exposed to this stuff. Even if they weren't, there's a good chance they could read it with some fluency. Math is a lot like programming where once you get your water legs you have a significantly improved time digesting related subjects even without direct prior experience.
For myself I have a bit of a math background, was drawn to Haskell for that reason, discovered category theory via Haskell, then swung full circle and read about it as a branch of pure math to learn more about foundations and logic.
Edit: thank you all for your wonderfully encouraging and useful responses. I know what I'm playing with tonight!!!
[1] The problem with "easy to understand" is that it sometimes leads to oversimplified or wrong intuitions, but to be honest I found the book a nice -- if not immediately useful -- introduction to Haskell.
I will probably now re-read Learn You a Haskell and actually write some Haskell.
[1] https://drboolean.gitbooks.io/mostly-adequate-guide/content/
It's often thought that in order to program Haskell one must understand or use Monads since they are so often mentioned. That's often a mental hurdle for those interested in the language.
Two things to keep in mind here are:
-in the book "An introduction to functional programming systems using Haskell" by A. Davie (1992), Monads (or Functors or Monoids) aren't mentioned at all. That's because they hadn't been architected yet. Monads are not an inherent part of Haskell without which you can't learn or use the language.
-Monads are ordinary data types, even if syntactic sugar is provided. They are not a core aspect of the language.
An explanation I found most useful is http://blog.sigfpe.com/2006/08/you-could-have-invented-monad...
One can just start programming Haskell and ignore Monads if one wants. At some point you will design them or something much like them yourself, making their understanding an "Aha!" moment.
[1]: http://homepages.inf.ed.ac.uk/wadler/papers/marktoberdorf/ba...
0: http://www.youtube.com/playlist?list=PLbgaMIhjbmEnaH_LTkxLI7...
So you go to the Wikipedia and learn there is a word "class" (no more complex than a word "bunch" at all, in my opinion) and there exists simple, very much set-theoretical explanation of what is (or might be in different set-theory systems) a class, and why it might be not a set sometimes.
Then he starts with arrows, and again, from the explanation it isn't immediately obvious why he can't use a word "function" instead (and it is immediately obvious when you read definition of category on Wikipedia — and I got used to the fact Wikipedia isn't the best source by far when trying to learn math).
So, my real complaint is these guys are consciously not using mathematics (because math texts are "scary" — and, yeah, I agree, they often are) when essentially explaining mathematics. Category theory isn't some different discipline, it isn't "superset" of mathematics — it is mathematics. Informal is good when it isn't "imprecise", otherwise it's just useless and harmful. I sometimes think it might be easier to actually get used to (once more all over again) all math-talk and read something like "Categories for a working mathematician", instead of trying to decipher all these "simpler" informal explanations.
So to Leibniz, in the conception of an entity's identity, he posits that one must include all propositions related to that entity. So when we try to consider a property of an object of our mind, we are basically saying "it is what it is." Saying that Einstein is German is like saying "Einstein is Einstein." Where this conception of including propositions in identities gets weird is that his formulation also includes future propositions. In this respect, only God can truly understand anything fully, because only he can tell the future and can get the full identity of things.
So "x is x" shows up a lot.
Edit: As mentioned, Leibniz Monad != the Monad of category theory. I suppose I'm just looking for any excuse to talk about Leibniz. Also, I did say I didn't even get to that topic yet. Consider this a peep about the duality of that term.
To say "only God can understand the future" is an unnecessary personification of our incompleteness. I think the future of declarative functions is pretty clear. Today foo(x) = 2x, tomorrow foo(x) = 2x. Anything we can't say is simply a dearth of information. How useful is it to say we've a dearth of "future information"?
Anyway, we give names to sets of propositions, and that's a neat trick.
If god was all knowing, he could create a cryptosystem he himself could not break.
God is a bad measure of physical properties. Some things are just unknown.
Can somebody help with examples for the rest of structures? Additionally, it seems I don't really get concept of totality. I get what "total function" is, but what does this column really constraint in the context of different structures? I mean, what is a structure that lacks this "totality" thing?
An example which may speak to a programmer more: the set of functions which take a 32-bit int as argument and return a 32-bit int, where the operation is composition of functions. The identity is the identity function. Since not all functions are invertible, this monoid is not a group.
There are of course other examples of sets equipped with non-associative binary operations (for example, 3-dimensional vectors with the cross product), but those typically have extra structure that you will want to exploit which "non-associative magma" cannot capture, and talking about them as magmas will probably feel somewhat artificial unless you have a good reason for ignoring all that structure.
Why I learn this stuff: to more effectively change things about myself.
Category Theory is an abstract math of relationships. I use it to better understand how my mind and body work. How parts of me are related in the moment and/or across time. Understanding how things in me are related is essential to me dealing with PTSD & recovering from addiction, both of which can color every aspect of a person. Untangling them is insanely hard and has gotten much easier through CT.
I apply my programming intuition to my brain & body through CT. There exists a path from neuroanatomy to theoretical computer science that passes through category theory. I've been experimenting on myself for 6 months with the goal of changing my mind and body. I've been doing it by developing an intuition for category theory, developing an intuition for how neutral networks learn, adapting machine learning models with concepts from neuroscience and psychology, and mixing it all with my intuition for programming.
So far, I've:
• changed how I walk through a handful of sessions lasting a few minutes and no longer experience back pain I'd been seeing a chiropractor (saw him weekly for 3-4 months with little improvement, ending about 10 months people changing my gait)
• began learning how to identify and stop believing anxious thoughts
• accidentally started developing the ability to focus and direct my attention (way beyond anything I've ever experienced on my ADHD meds)
• accidentally stumbled on the Buddhist practice of deity visualization, which created a second conscious voice in my head. She helps me learn how to embody more than one new personality trait at a time easier than if I simply focused on being those things. It's weird/complicated, and I'm willing to go into more detail if people have questions.
Here are some of the few bits supporting my claims about neuroanatomy and category theory:
https://www.researchgate.net/publication/280219255_Conciliat...
One of the coauthors wrote the only book on the brain and category theory:
http://tierra.aslab.upm.es/documents/PhD/PhD-JGomez.pdf
If you understand a good bit of CT and would like to help me flesh out my framework, my contact info is in my profile.
I live in the Seattle area and would love to meet up with anyone interested.
I would love you to go into more detail, though probably only for all the wrong reasons (such as my own entertainment).
How I do it: associate the set of traits with an identity somewhat separate from my own. She's essentially a clone of my personality, except she identifies as a woman & embodies the following personality traits: gentleness, patience, valuing relationships based on emotional support available through them, emotional thinking, relational thinking, intuitive. While these traits are considered stereotypical female traits, I don't view them that way. I think the process I went through would've worked the same if I'd chosen to associate those traits with an animal or, as Buddhists do, some kind of humanoid deity.
She develops her own beliefs, behaviors, emotions, and motivations that emerge from her core values. I'm ultimately aware she's simply a part of my brain...a set of neural networks encoding a set of traits...so it's easy for me to adopt her perception as my own.
That's how we learn together. It's a collaborative relationship. We can practice new ways of communicating in my head. It's the difference between having a two-sided conversation aloud where you're using your own voice for both sides versus using a different voice for each side.
It's sometimes easier to hear ourselves when we hear what we're saying coming from someone else.
How was that? Are you not entertained? ;)
I'm far too much of a troglodyte to understand any of this stuff, but good on you for you trying to improve yourself (if that is indeed the intended goal).
I stopped showering for 4 days after initial success with trying to see a stick figure that moves with my body on the back of my closed eyelids.
The persistent thought haunting me?
"What if it's all in my head?"
Fucking with your mind fucks with your mind, typically in very funny ways.
As for not being able to understand any of this stuff, perception is key to learning. Perhaps practice choosing to believe things? Start with small, easy to believe things that are inconsequential to your life, but still meaningful. An example would be temporarily choosing to believe an opposing political stance has merit and then seeking the merit. Everyone has a reason for believing what they do, so go find perfectly valid reasons to believe something crazy. It'll get easier to do the more you practice.
If you want a simpler practice, go "look at the space between branches" and enjoy the different spaces you find. The skill progression comes from loosening your definition of the words in that phrase. Here's a starting point: go from finding 2D shapes to 3D ones.
The goal is to setup an open source, open participation science experiment for testing my hypotheses at ourfirstmind.com
As far as the rest, I'm largely right there with you. I also use what you call the "second conscious voice" as well, and agree it's extremely helpful if not abused, plus some of the other stuff too.
I used to live in Seattle btw but back in Europe for a while at the moment otherwise would have loved to chat.
You sound to be on a good path. Best.
Imagine yourself as a bounded poset if you don't make much money or a bounded proset if you do. By definition, you have both initial and terminal objects, called "bottom" & "top," respectively. For many, this concept may be tricky, as people's heads and asses are often indistinguishable. They're zero objects, so let's not worry about them. Also, don't confuse prosets with brosets (bounded prosets where all tops are fully faithful phalluses, ie. dickheads), as brosets do not preserve meaningful structure. Brosets use the "No homo" identity functor to demonstrate this property ("homo" being the notation for "homomorphism").
But I digress...
Identify a path from your bottom to your top. Apply the pullback of energy from the environment to yourself through your bottom and then use the pushout to the next object in the path. Make sure each object is an Abelian category or this won't work, BTW. It helps to sync the movement of your hips with your breathing, also. Same goes for hand gestures. When the energy reaches your top, tighten all of your muscles and hold your breath for the final pushout.
I find it helpful to visualize/fantasize a well-defined coeffects system for Idris.
(If your comment was serious, Google "energy orgasms" for way more than I can ever explain...I haven't really dug into it yet)