Skip to content

Instantly share code, notes, and snippets.

@gseitz
Created April 4, 2012 23:20
Show Gist options
  • Save gseitz/2306504 to your computer and use it in GitHub Desktop.
Save gseitz/2306504 to your computer and use it in GitHub Desktop.
polyparse.scala
scala> val pair = for {
| _ <- token(char('{'))
| id <- token(ident)
| _ <- token(char(':'))
| v <- integer
| _ <- token(char('}'))
| } yield id -> v
obj: scalaz.parse.huttonmeijer.Parser[(List[Char], Int)] = scalaz.parse.huttonmeijer.Parser$$anon$2@234e7730
scala> pair("{ foo : 17 }".toList)
res3: List[((List[Char], Int), scalaz.parse.huttonmeijer.package.Tokens)] = List(((List(f, o, o),17),List()))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment