{-# LANGUAGE ConstraintKinds #-}
module Data.Version.Extra(
module Data.Version,
readVersion
) where
import Partial
import Data.Version
import Data.List.Extra
import Text.ParserCombinators.ReadP
readVersion :: Partial => String -> Version
readVersion :: Partial => String -> Version
readVersion String
s =
case [ Version
x | (Version
x,String
"") <- forall a. ReadP a -> ReadS a
readP_to_S ReadP Version
parseVersion forall a b. (a -> b) -> a -> b
$ String -> String
trimEnd String
s] of
[Version
x] -> Version
x
[] -> forall a. Partial => String -> a
error String
"Data.Version.Extra.readVersion: no parse"
[Version]
_ -> forall a. Partial => String -> a
error String
"Data.Version.Extra.readVersion: ambiguous parse"