refactor: upgrade versions library usage

This commit is contained in:
Colin Woodbury
2023-10-13 17:09:35 +09:00
committed by Julian Ospald
parent fbb648d984
commit 15c6ed2b8d
16 changed files with 135 additions and 234 deletions

View File

@@ -10,6 +10,8 @@ import Test.Tasty
import Test.Tasty.HUnit
import Control.Monad.IO.Class
import qualified Data.Text as T
import Language.Haskell.TH (Exp, Q)
import Language.Haskell.TH.Syntax (lift)
parseWith :: [String] -> IO Command
parseWith args =
@@ -23,13 +25,12 @@ padLeft desiredLength s = padding ++ s
mapSecond :: (b -> c) -> [(a,b)] -> [(a,c)]
mapSecond = map . second
mkVersion :: NonEmpty VChunk -> Version
mkVersion chunks = Version Nothing chunks [] Nothing
mkVersion' :: T.Text -> Version
mkVersion' txt =
let Right ver = version txt
in ver
-- | Parse a `Version` at compile time.
verQ :: T.Text -> Q Exp
verQ nm =
case version nm of
Left err -> fail (errorBundlePretty err)
Right v -> lift v
buildTestTree
:: (Eq a, Show a)