Skip to content

Parsing parsed parsables, from music to megaparsec

Photo of Doug Beardsley
Hosted By
Doug B. and 2 others
Parsing parsed parsables, from music to megaparsec

Details

7pm: Parsing parsed parsables, from music to megaparsec
by Stuart Popejoy

Parsing is a core "selling point" of Haskell, as one of the major reasons why Haskellers aren't afraid of language engineering. However, the notion of a parser combinator easily extends past recognizing character strings, at least in theory: in practice, using combinators on non-character streams or trees is considerably harder from a coding perspective. In this talk, I will recount my journey from building an "element parser" to recognize MusicXML sequences, to overhauling the parser and compiler of the Pact smart contract language to make arbitrary sexp-based languages embeddable in Pact syntax, while having the proper Pact "compiler" recognize parsed productions. Along the way we will show a trivial StateT + Except based implementation before demonstrating the Pact solution, which uses new features in the megaparsec package to support arbitrary stream parsing, and challenges therein.

Stuart Popejoy is a Haskeller, musician and entrepreneur in Brooklyn NY. He is a founder of Kadena, a leading smart-contract blockchain platform provider, and has been a professional software engineer for over 20 years, working in Haskell since 2014. Stuart is an active player in the NYC creative music scene, and has performed original compositions of music generated using Haskell code, as described in past Haskell talks.

Photo of New York Haskell Users Group group
New York Haskell Users Group
See more events
Digital Asset
96 Spring Street, 7th Floor · New York, NY