Re: How to use Read for Data.Version

chessai <[email protected]> Sat, 14 Aug 2021 12:06:54 -0500
Newsgroups gmane.comp.lang.haskell.libraries
Message-ID <CAD34_kK_F7JbpE4e4vZkQ73SHzLB9RURJzu=SZapd1TkYk3wrg@mail.gmail.com>
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

On Sat, Aug 14, 2021, 11:55 Andreas Abel <[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]
> _______________________________________________
> Libraries mailing list
> [email protected]
> http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
>

_______________________________________________
Libraries mailing list
[email protected]
http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries