Published 30th of March, 2020, by Nikos Baxevanis. Tagged as haskell.

The rhyme of the altered Parser

Fritz Ruehr’s rhyme gives us the essence of parsers:

A Parser for Things is a function from Strings to Lists of Pairs of Things and Strings!

This rhyme was made popular, I believe, in Programming in Haskell book by Graham Hutton.

Altered parsers

I may be coming back later on to add examples and resources on parsers, but now I’d like to mention Vaibhav Sagar’s post on Revisiting ‘Monadic Parsing in Haskell’.

Altered rhymes

Once you read Vaibhav Sagar’s post, followed by the HN discussion, you’ll notice two new rhymes coming out: the rhyme of the altered parser, and the rhyme of the yoctoparsec.

The rhyme of the altered Parser:

A parser for things is a function from strings to potentially a pair of that thing and its string.

The rhyme of the yoctoparsec:

A parser just means A function from streams To maybe a pair, One in which there Is the stream, and the thing that it means.

I might be trying out yoctoparsec. The only place I’ve seen it being used is in Eric Mertens’s Day 8 solution of a past Advent of Code.

Wish to comment?

You can discuss this post on Twitter or elsewhere with a permalink.

I'm on Twitter as @nikosbaxevanis. I check my Twitter mentions pretty regularly. That's the best way to contact me.

© Nikos Baxevanis 2020, with help from Jekyll and motherfucking website.