Ad
Parsing
Algorithms
Logic
Strings
Monads
Data Structures
Functional Programming

http://www.willamette.edu/~fruehr/haskell/seuss.html

A parser for a thing
Is a function from a string
To a list of pairs
Of things and strings!

This monadic parser is missing many basic functions and several important typeclass instances.

{-# LANGUAGE DeriveFunctor, TupleSections #-}
module MonadicParsing where

newtype Parser a = Parser { runParser :: String -> [(a, String)] }
    deriving Functor
    
instance Monad Parser where
    return a = Parser $ return . (a,)
    Parser p >>= f = Parser $ \s -> concatMap (uncurry (runParser.f)) $ p s