{-# LANGUAGE CPP, ConstraintKinds #-}
{-# OPTIONS_GHC -fno-warn-duplicate-exports #-}
module Data.Version.Extra(
module Data.Version,
makeVersion, readVersion
) where
import Partial
import Data.Version
import Data.List.Extra
import Text.ParserCombinators.ReadP
#if __GLASGOW_HASKELL__ < 710
makeVersion :: [Int] -> Version
makeVersion b = Version b []
#endif
readVersion :: Partial => String -> Version
readVersion s =
case [ x | (x,"") <- readP_to_S parseVersion $ trimEnd s] of
[x] -> x
[] -> error "Data.Version.Extra.readVersion: no parse"
_ -> error "Data.Version.Extra.readVersion: ambiguous parse"