Skip to content

Instantly share code, notes, and snippets.

View tgrospic's full-sized avatar

Tomislav Grospić tgrospic

View GitHub Profile
@tgrospic
tgrospic / Parsec.hs
Created January 4, 2019 09:22
Parsec tutorial
module Parser where
-- won't work because type class instances must not be type synonyms
-- type Parsera res = String -> (Either String res, String)
-- data Parser res = Parser (String -> (Either String res, String))
-- parse (Parser p) = p
-- or with `newtype`
newtype Parser res = Parser { parse :: String -> (Either String res, String) }