In this recipe, we will further build on the concepts of Functor, Applicative, and monad, and build a parser for the INI file from scratch. We will write a simple parser, and define its Functor, Applicative, and monad instances. Then, we will slowly build upon the concept to finally build an INI parser.
The INI file is usually used as a configuration file. A typical INI file contains the number of sections, each section representing a set of name-value assignments. A sample INI file may look like this:
[Section]
name1 = value1
name2 = value2
[Section2]
name1 = value1
name3 = value3