Help needed with Data.Version
Krasimir Angelov
kr.angelov at gmail.com
Wed Mar 23 11:53:25 EST 2005
Yes. I found it with a litle bit help from Ross.
Cheers,
Krasimir
On Wed, 23 Mar 2005 16:52:00 -0000, Simon Marlow <simonmar at microsoft.com> wrote:
> This is the right behaviour: the parser isn't greedy. You just need to
> take a parse in which the remainder is empty.
>
> See for example Distribution.ParseUtils.runP.
>
> Cheers,
> Simon
>
> On 23 March 2005 15:19, Krasimir Angelov wrote:
>
> > What I need is to have simple function of type (String -> Version).
> > How I can do that with the current implementataion?
> >
> >
> > On Wed, 23 Mar 2005 15:16:09 +0000, Ross Paterson
> > <ross at soi.city.ac.uk> wrote:
> >> On Wed, Mar 23, 2005 at 02:55:47PM +0000, Krasimir Angelov wrote:
> >>> I have found a bug in Data.Version. The expression:
> >>>
> >>> readP_to_S parseVersion "1.0"
> >>>
> >>> produces:
> >>>
> >>> [(Version {versionBranch = [1], versionTags = []},".0"),(Version
> >>> {versionBranch= [1,0], versionTags = []},"")]
> >>>
> >>> With other words the parser is ambiguous.
> >>
> >> It's no more ambiguous than
> >>
> >> readP_to_S (many1 (satisfy isDigit)) "1234"
> >> [("1","234"),("12","34"),("123","4"),("1234","")]
> >>
> >> It just needs to be used in context.
> >>
> > _______________________________________________
> > Libraries mailing list
> > Libraries at haskell.org
> > http://www.haskell.org/mailman/listinfo/libraries
>
>
More information about the Libraries
mailing list