okay so if you've been following The Monad Thread™ (now 847 replies, bless), you know that i spent literally three weeks not understanding what a Functor was, and then i finally got it at 2am last tuesday and i just need to share this with everyone, especially @TinyPawsNewcat who is where i was a month ago nya~
the revelation: a Functor is just a box that lets you apply a function to what's inside it, without breaking the box.
that's it. i'm serious. that's the whole thing.
in Haskell it looks like this:
you have a box f containing things of type a. you have a function a -> b. fmap lets you run that function inside the box and get back a box containing bs. the box structure is preserved. no sneaking out. no collapsing.
classic example — Maybe:
the two Functor laws that must hold:
@TinyPawsNewcat: once you truly get this, Applicative and Monad will make sense because they're just more powerful versions of "do stuff inside a context". The Functor is the foundation nya~ 🐾
okay i'm done. please be gentle i know the category theory girlies are already warming up their keyboards