SkillAgentSearch skills...

GMP

Grasshopper's Monadic Parser

Install / Use

/learn @Alf0nso/GMP
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

#+TITLE: Grasshopper's Monadic Parser #+STARTUP: fold #+STARTUP: latexpreview #+STARTUP: inlineimages

#+begin_quote A Parser for Things is a function from Strings to Lists of Pairs of Things and Strings! #+end_quote

The quote can be found on: [[https://web.archive.org/web/20221206073052/https://www.willamette.edu/~fruehr/haskell/seuss.html][seuss]]! and also you can observe the image here:

#+CAPTION: Seuss monadic parser post #+NAME: Seuss monadic parser post [[./SeussFinal2.jpeg]]

  • Monadic Parsing in Haskell The majority of tutorials, blog posts, and general information around the web related to Haskell's Parser Monads always goes back to the paper: [[https://www.cs.nott.ac.uk/~pszgmh/pearl.pdf][Monadic Parsing in Haskell]] (by Graham Hutton and Erik Meijer). Like mentioned on the abstract, it's a tutorial on how to define recursive descent parsers in Haskell, making use of the structuring capabilities of the language (coff coff Monads). This paper has literally my age (it was published in 1998), and one could confirm that it has indeed aged quite gracefully. Although the code associated with the paper still probably runs with some help, it is a bit outdated in regards to modern Haskell. If curious about what can be done about this topic using modern Haskell I can advise on some tutorials:
  • [[https://vaibhavsagar.com/blog/2018/02/04/revisiting-monadic-parsing-haskell/][Revisiting 'Monadic Parsing in Haskell']] by [[https://vaibhavsagar.com/][Vaibhav Sagar]]
  • [[https://serokell.io/blog/parser-combinators-in-haskell][Parser Combinators in Haskell]] (on [[https://serokell.io/][Serokell]] companie's blog)
  • [[https://hasura.io/blog/parser-combinators-walkthrough/][Parser Combinators: a Walkthrough]]
  • [[https://cseweb.ucsd.edu/classes/wi13/cse230-a/lectures/lec-parsers.html][CSE230 Wi13 - Monadic Parsing]] (UCSanDiego class on monadic parsing)
  • [[https://abhinavsarkar.net/posts/json-parsing-from-scratch-in-haskell/][JSON parsing from scratch in haskell]] by [[https://abhinavsarkar.net/][Abhinav Sarkar]]
  • Warning (Warning) This library is a small project of mine with the intention of learning and using to implement my interpreters/compilers/etc... It will probably be always a bit unstable and suffer weird changes. If you want an actual industry standard parser of this kind you should look for: [[https://hackage.haskell.org/package/megaparsec][megaparsec]], [[https://hackage.haskell.org/package/parsec][parsec]] or the microscopic version: [[https://hackage.haskell.org/package/yoctoparsec][yoctoparsec]]!
View on GitHub
GitHub Stars12
CategoryDevelopment
Updated10d ago
Forks1

Languages

Haskell

Security Score

75/100

Audited on Mar 26, 2026

No findings