Re: [Haskell-cafe] ReadP question

2006-08-31 Thread Udo Stenzel
Chris Kuklewicz wrote: I just tried to mimic regular expression matching with ReadP and got what seems like a non-terminating program. Is there another way to use ReadP to do this? -- Simulate (a?|b+|c*)*d regular expression test = star (choice [quest (c 'a') ,plus

Re: [Haskell-cafe] ReadP question

2006-08-31 Thread Chris Kuklewicz
Tom Phoenix wrote: On 8/30/06, Chris Kuklewicz [EMAIL PROTECTED] wrote: -- Simulate (a?|b+|c*)*d regular expression But 'go' seems to not terminate with the leading 'star' Unless I'm missing something... The part of the pattern inside the parentheses should successfully match at least

[Haskell-cafe] ReadP question

2006-08-30 Thread Chris Kuklewicz
Udo Stenzel wrote: Chris Kuklewicz wrote: Again, Parsec requires you to put try where you need it I'm pretty sure it does, although this Udo Stenzel wrote: countBetween 0 n p = p : countBetween 0 (n-1) p | return [] is a place where it's not needed in general. You should know what

Re: [Haskell-cafe] ReadP question

2006-08-30 Thread Tom Phoenix
On 8/30/06, Chris Kuklewicz [EMAIL PROTECTED] wrote: -- Simulate (a?|b+|c*)*d regular expression But 'go' seems to not terminate with the leading 'star' Unless I'm missing something... The part of the pattern inside the parentheses should successfully match at least the empty string at