Posts

Showing posts from January, 2021

Trying to Make Sense of Monads

I'm not really a functional programming person, so when I read that "For a monad m , a value of type m a represents having access to a value of type a within the context of the monad." (C. A. McCann) as on the Wikipedia page, I can confidently say that I understood what a monad was exactly as much before and after that explanation. The only thing this led me to conclude was that a monad must be some really simple thing if so many of the explanations I've found of it are barely a step beyond "it is what it is". After digging around, though, I think I've made some sense of things. In order to compute some output (a result ), we need some input ( arguments or a state ) and some algorithm to feed those inputs through (a function ). So, we have something like      algorithm: input -> output or     function: state -> result Easy enough, right? However, we usually think of the function as something permanent, something that might get put into a libr