At Hasura, we have recently used this technique to rewrite the code that generates a GraphQL schema and checks an incoming GraphQL query against it. While it’s possible to use those libraries without caring about how they work, I think it’s fascinating to develop a mental model for their inner design namely, monadic parser combinators, as it is a simple and elegant technique that is useful beyond the use case of parsing raw text. Parsing is ubiquitous, and most Haskell programs will use Parsec or one of its variants (megaparsec or attoparsec). Today, I want to explore Parsec, and most specifically how Parsec works. ![]() Exploring some of the most used libraries, and understanding what makes them so ubiquitous: QuickCheck, Lens… and Parsec.Learning more about the different ways to structure a program (such as monad transformers or effect systems).Going further with the language itself: learning about language extensions, the theory behind them, and the advanced features they provide.There’s roughly three categories of topics one might want to explore: ![]() There’s a lot more that could be covered, but none of it is as fundamental. The next big step is, of course, monads, the infamous m-word, and how we use them to structure our programs.īut then, when you’ve started to develop an intuition for monads… the path becomes unclear. ![]() First, you need to get acquainted with the language itself, especially if you arrive at it without any knowledge of functional programming: its unusual syntax, laziness, the lack of mutable state… From there, you can move to functions and type declarations, familiarize yourself with the Prelude functions (and their known warts), and start writing your first programs. Most people’s journey with Haskell will follow the same first steps.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |