2008/12/13 Nathan Bloomfield <nblo...@gmail.com>:
> I want to be able to parse a string of digits to a type level numeral as
> described in the Number parameterized types paper.

Hi, I'm at UA too (bsl04). Here's a quick try. Sorry if I'm not
getting what you're doing.

import Text.Parsec
import Text.Parsec.String

data PeanoNumber = Zero | Succ PeanoNumber
  deriving Show

parseP :: Parser PeanoNumber
parseP = do
  char '1'
  rest <- parseP
  return $ Succ rest
  <|> return Zero

test = parseTest parseP "111"
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to