[Haskell-beginners] Parse string with optional entries [Parsec]

Antoine Latter aslatter at gmail.com
Mon Aug 8 13:44:21 CEST 2011


On Mon, Aug 8, 2011 at 6:39 AM,  <Stefan.Lukasser-EE at infineon.com> wrote:
> Hi all,
>
> I'm trying to parse a string in one of the following forms using Parsec:
>
> "1\t1\t123\t456" -> desired output: [Just 1, Just 1, Just 123, Just 456]
>
> or
>
> "1\t\1\t\t456"  -> desired output: [Just 1, Just 1, Nothing, Just 456]
>
> i.e., the input is a list of numbers, separated by '\t' characters, with the possibility of missing entries.
> I'm having troubles with the backtracking in case of missing numbers. Can anybody give me a hint?
>

What do you have so far?

> Thanks in advance,
> Stefan
>
> _______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://www.haskell.org/mailman/listinfo/beginners
>



More information about the Beginners mailing list