… and i've read a lot of fucking haskell code lol
Okay, so check out this Haskell module:
The whole repository is interesting, but I want to draw attention to the following two lines of code from the above module:
instance Foldable (Either a)
This first line is not very surprising. That looks like an ordinary Foldable instance for Either a, just like the one we already have in base
instance Foldable Either
Okay, this second line is absolutely wild. Apparently this module defines a poly-kinded Foldable class and WHAT DOES IT EVEN MEAN TO HAVE A FOLDABLE INSTANCE FOR EITHER BY ITSELF?
So let's check out the Foldable instance provided by this module to get a better understanding of what is going on:
class Functor f => Foldable (f :: i -> j) where
foldMap :: Monoid (m :: j) => (a ⋔ m) ~> (f a ⋔ m)
… and it just goes downhill from there. This is, like, Haskell necronomicon shit that will inflict untold psychic damage on you if you keep digging into it. And there is a whole repository full of this sort of stuff.
This is what non-Haskellers think all Haskell code is like, i'm pretty sure! :D
But, wow, yeah, this looks... well, honestly, it looks fun? In a terrifying way, in a "do not make your colleagues review and maintain this unless they're somehow all as incredibly proficient as you" kind of way, in a "i know so terrifyingly little" kind of way.
...i want to play with this now.
