Monadic parsers

Day 2 /  / Track 2  /  RU / Hardcore. Really hard and demanding talk, you'll understand only if you're an experienced engineer.

A frequent question in the C++ developer community is: "Who does even need monads?" There are common examples of monadic use of types like std::optional, std::future, and std::expected, but list of monads most frequently used in the functional programming world is much more longer. For example, in Haskell there are the following monads: Maybe (std::optional), Either (std::expected), IO, State, Reader, STM, Par (std::future). But instead of trying to grasp what a monad is and how does it work, it might be more useful to learn how to use specific monads and which tasks they solve, getting this way a basic understanding that could be applied for any monad.

In this session, we'll discuss monadic parsers: what's the difference between this parsing approach and the other ones (parser combinators such as Boost::Spirit, parser generators, ad hoc solutions — for example, parser finite state machine, etc.), what are its advantages and disadvantages, and what's the role of such important concepts of functional programming as functors, applicative functors, and monads.