A monad is just a monoid in the category of endofunctors, what's the problem?

A monad is just a monoid in the category of endofunctors, what's the problem?

Attached: 800px-Monad_unit_explicit.svg.png (800x535, 33K)

Other urls found in this thread:

fsharpforfunandprofit.com/rop/
twitter.com/NSFWRedditImage

There is no problem. Everyone knows that.

the problum is mu

> monoid
> endofunctor

I know none of these words, but then I am not a fagskeller.

An endofunctor is just a function that takes a type A and returns a type A. Like

string myfunction1(string whatever)

or

int myfunction1(int whatever)

But can it play Crysis?

Attached: 1501631622001.png (741x568, 29K)

what you are describing is an endomorphisms not an endofunctor.

Endofunctors are functors that go from a category to itself. In programming (most of the times) functors are endofunctors, because we mainly deal with a category of types (given by the type system of the given language).

>what's the problem?
The problem is that I'm a brainlet who understands nothing from this. Any books I can read to address this issue?

I don't have a good way to explain it, but this might stimulate your imagination.

Basically it's programmable semicolons. You know how if you're programming in C# or Java you're constantly inserting
if (variable == null) {
return null;
}

before you actually do something with variable? Monads give you a way to make that AUTOMATIC! You can just do a whole bunch of shit in a `do` block and if anything in the middle returns null, the whole thing is null without you having to check all the time.

But that's just one thing it can do, the "programmable semicolons" can do lots like automatically logging each statement, etc.

For what to read.. there's lots of resources, the "haskell from first principles" book does a good job at explaining it, but it's very long and paid, if you want something cheap to peek at maybe this page fsharpforfunandprofit.com/rop/

its literally just a wrapper for a type. a list is a monad because it wraps types and has monad functions

does it even matter in context of computer science?

What's the difference between a functor and a function?

if a function maps a set of values to another set of values, a functor maps a type to another type

Can you provide an example of a functor that is not a function?

Shut the fuck up you monerd lmao

the list constructor. it takes in a type and returns a type wrapped in a list.

Ok.. but that's not Endofunctor

maybe

I prefer to think of them as lax 2-functors from the terminal bicategory.

Attached: 1520108487767.jpg (960x1200, 1.14M)

A function (or rather morphism) maps an object to an object within 1 category. A functor maps a category to a category.

That's too abstract, can you dumb it down for a php-let?

On CS not so much, the word functor is for the most part a synonym of endofunctor because there is usually just one category to work with (types of a laguange).

But you can have functors that go from the category of types of a language to a smaller collection of types that also form a category. In this sense the distinction of functor and endofuctor maybe worth something.

Perhaps for stuff on program correctness the use of subcategories of types is useful, but I really don't know.

it is an endofunctor.

In this case the category is a category of types, the list constructor takes types and produces types. So it maps types into types, therefore it can be used to define an endofunctor.

this means shit mathematically
a function can map any two things, there is no need to invent special names for special functions

>there is no need to invent special names for special functions
no

everything is a function in haskell you have to differentiate it somehow

>a function can map any two things, there is no need to invent special names for special functions

Yes, in a sense functors are kinda like functions because they map things into things. But functors are not functions, and there several good reasons why the distinction is necessary. A big one (and pedantic) is that functions are defined between sets while functors are defined between categories.

A more interesting usecase is the fact that functors give us a framework to study how functions transform into other functions (morphisms in general). In that sense, functors are higher level functions (morphisms).

ok there seems to be different conventions
the more general one is that a functor is a special type of mapping and a mapping is a special type function
But some authors takes function as a special type of mapping where the codomain is a set of numbers

I never understood those diagrams.
I find these more confusing than helpful.

Attached: 1544533658375.png (565x289, 303K)

>there is no need to invent special names for special functions
haven't you been following along at home?

>there is no need to invent special names for special functions
There is. It is done all over mathematics, "real valued" "harmonic" "continuous" "operator" "matrix" "bijection" "injection" "surjection" etc. all describe special cases of functions.

>a function can map any two things
No, they are defined as mappings between sets.

Monad is just horizontal categorification of monoid.

"just"

Much easier to picture than the retarded malformed definition in OP.

At least "a monoid in the category of endofunctors" makes sense

If horizontal categorification doesn't make sense to you, i very seriously doubt you know what "monad", " category" or "endofunctor" is.

It just says that it does nit matter how you apply this Greek symbol everything will tun out the same. Think of it like order of operation.