fixes version rendering

This commit is contained in:
Keagan McClelland
2020-11-03 20:10:29 -07:00
parent 2d54fd5f3e
commit d5106b62f5

View File

@@ -130,16 +130,19 @@ exactly :: Version -> VersionRange
exactly = Anchor (Right EQ)
instance Show VersionRange where
show (Anchor (Left EQ) v) = '!' : '=' : show v
show (Anchor (Right EQ) v) = '=' : show v
show (Anchor (Left LT) v) = '>' : '=' : show v
show (Anchor (Right LT) v) = '<' : show v
show (Anchor (Left GT) v) = '<' : '=' : show v
show (Anchor (Right GT) v) = '>' : show v
show (Conj a b) = paren $ show a <> (' ' : show b)
show (Disj a b) = paren $ show a <> " || " <> show b
show Any = "*"
show None = "!"
show (Anchor ( Left EQ) v ) = '!' : '=' : show v
show (Anchor ( Right EQ) v ) = '=' : show v
show (Anchor ( Left LT) v ) = '>' : '=' : show v
show (Anchor ( Right LT) v ) = '<' : show v
show (Anchor ( Left GT) v ) = '<' : '=' : show v
show (Anchor ( Right GT) v ) = '>' : show v
show (Conj a@(Disj _ _) b@(Disj _ _)) = paren (show a) <> (' ' : paren (show b))
show (Conj a@(Disj _ _) b ) = paren (show a) <> (' ' : show b)
show (Conj a b@(Disj _ _)) = show a <> (' ' : paren (show b))
show (Conj a b ) = show a <> (' ' : show b)
show (Disj a b ) = show a <> " || " <> show b
show Any = "*"
show None = "!"
instance Read VersionRange where
readsPrec _ s = case Atto.parseOnly parseRange (T.pack s) of
Left _ -> []