I'm trying to parse URLs of the form
/123/456/789
using the following code:
{-# LANGUAGE OverloadedStrings, TemplateHaskell, TypeOperators #-}
import Prelude hiding ((.), id)
import Control.Category ((.), id)
import Text.Boomerang.TH (derivePrinterParsers)
import Web.Routes.Boomerang
data Indices = Indices [Integer]
$(derivePrinterParsers ''Indices)
sitemap :: Router () (Sitemap :- ())
sitemap = rIndices . rList (integer . eos)
Unfortunately, trying to run this parser with
> parse sitemap ["0", "1"]
causes an infinite loop.
Is there any simple way to parse a list of slash-separated integers?