How to use Read for Data.Version

chessai chessai1996 at gmail.com
Sat Aug 14 17:06:54 UTC 2021


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 <andreas.abel at ifi.lmu.de> 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        libraries at haskell.org
> _______________________________________________
> Libraries mailing list
> Libraries at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/libraries/attachments/20210814/973102d8/attachment.html>


More information about the Libraries mailing list