Re: How to use Read for Data.Version
Andreas Abel <[email protected]> Sat, 14 Aug 2021 19:09:16 +0200
| Newsgroups | gmane.comp.lang.haskell.libraries |
|---|---|
| Message-ID | <[email protected]> |
Thanks for the quick answer. Indeed, I confused Read and ReadP! --Andreas On 2021-08-14 19:06, chessai wrote: > Looking at the source code [1], Read is derived, and not using > parseVersion (which has the behaviour I think you expect). > > You may want to use parseVersion directly. > > [1]: > https://hackage.haskell.org/package/base-4.15.0.0/docs/src/Data-Version.html > <https://hackage.haskell.org/package/base-4.15.0.0/docs/src/Data-Version.html> > > On Sat, Aug 14, 2021, 11:55 Andreas Abel <[email protected] > <mailto:[email protected]>> wrote: > > How is the parser for Data.Version supposed to work? > > ```haskell > import Data.Version > > readVersion :: String -> Version > readVersion = read > > main :: IO () > main = print $ readVersion "8.10.5" > > -- *** Exception: Prelude.read: no parse > ``` > > P.S.: Maintainer [email protected] <mailto:[email protected]> > _______________________________________________ > Libraries mailing list > [email protected] <mailto:[email protected]> > http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries > <http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries> > _______________________________________________ Libraries mailing list [email protected] http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries