Menu

Functional-Programming

Making a JSON Parser in Haskell

This article is different from my usual. I’m inviting you to join me in writing a JSON parser in Haskell. We’ll review the JSON RFC standards and create a Haskell data model for valid JSON. For parsing, I challenged myself to avoid consulting other implementations, believing such challenges enhance problem-solving skills. Modeling JSON To create a JSON parser, we must first model the available JSON values. Literal Values We begin with the basics. As per the RFC, three literal names are recognized as valid JSON values:

Monads (finally)

If you have searched for monads and reached this article, you probably have some degree of knowledge about monads. You may have already put a fair amount of effort into learning monads. In any way, whenever you’ve tried to learn monads, you have likely encountered two main approaches: The: Monads are simple, here’s a simple example of a monad. Or the famous: A monad is a monoid in the category of endofunctors. In both approaches, the layout is similar. We start with a strong statement like: A monad is a powerful concept when applied to programming, and later apologize for being one of the most difficult programming concepts to grasp. The reality is that all of these statements about monads are valid, and the truth lies somewhere in the middle.