Fraser writes a simple applicative based parser from scratch showing the concepts. He then extends the applicative parser to be built around Cons to abstract away the stream and piecewise type that the parser is dealing with.
fmap :: (a -> b) -> f a -> f b class Functor f => Applicative (f :: * -> *) where pure :: a -> f a (<*>) :: f (a -> b) -> f a -> f b (*>) :: f a -> f b -> f b -- has default definition (<*) :: f a -> f b -> f a -- has default definition class Applicative f => Alternative (f :: * -> *) where empty :: f a (<|>) :: f a -> f a -> f a
the Creative Commons Attribution 4.0 International License. To view a copy of this license, visit http://creativecommons.org/licenses/by/4.0/. Slides https://github.com/frasertweedale/talks/ Email firstname.lastname@example.org Twitter @hackuador