O'Reilly logo

Haskell Cookbook by Yogesh Sajanikar

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Writing INI parser

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

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required