remove prelude import

This commit is contained in:
Keagan McClelland
2021-09-29 13:17:42 -06:00
parent fab634698f
commit e364e55a26
2 changed files with 21 additions and 27 deletions

View File

@@ -19,7 +19,6 @@ import qualified Data.ByteString.Lazy as BS
import qualified Data.Conduit.List as CL
import qualified Data.HashMap.Strict as HM
import Data.List
import qualified Data.List.NonEmpty as NE
import Data.Semigroup
import Data.String.Interpolate.IsString
import qualified Data.Text as T

View File

@@ -36,25 +36,24 @@ module Lib.Types.Emver
, parseRange
) where
import Control.Applicative ( Alternative((<|>))
, liftA2
)
import Startlude hiding ( Any )
import Control.Monad.Fail ( fail )
import Data.Aeson
import qualified Data.Attoparsec.Text as Atto
import Data.Function
import Data.Functor ( ($>)
, (<&>)
)
import Data.String ( IsString(..) )
import qualified Data.Text as T
import Prelude
import Startlude ( Hashable )
import GHC.Base ( error )
import qualified GHC.Read as GHC
( readsPrec )
import qualified GHC.Show as GHC
( show )
-- | AppVersion is the core representation of the SemverQuad type.
newtype Version = Version { unVersion :: (Word, Word, Word, Word) } deriving (Eq, Ord, ToJSONKey, Hashable)
instance Show Version where
show (Version (x, y, z, q)) =
let postfix = if q == 0 then "" else '.' : show q in show x <> "." <> show y <> "." <> show z <> postfix
let postfix = if q == 0 then "" else '.' : GHC.show q
in GHC.show x <> "." <> GHC.show y <> "." <> GHC.show z <> postfix
instance IsString Version where
fromString s = either error id $ Atto.parseOnly parseVersion (T.pack s)
instance Read Version where
@@ -134,17 +133,17 @@ 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@(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 (Anchor ( Left EQ) v ) = '!' : '=' : GHC.show v
show (Anchor ( Right EQ) v ) = '=' : GHC.show v
show (Anchor ( Left LT) v ) = '>' : '=' : GHC.show v
show (Anchor ( Right LT) v ) = '<' : GHC.show v
show (Anchor ( Left GT) v ) = '<' : '=' : GHC.show v
show (Anchor ( Right GT) v ) = '>' : GHC.show v
show (Conj a@(Disj _ _) b@(Disj _ _)) = paren (GHC.show a) <> (' ' : paren (GHC.show b))
show (Conj a@(Disj _ _) b ) = paren (GHC.show a) <> (' ' : GHC.show b)
show (Conj a b@(Disj _ _)) = GHC.show a <> (' ' : paren (GHC.show b))
show (Conj a b ) = GHC.show a <> (' ' : GHC.show b)
show (Disj a b ) = GHC.show a <> " || " <> GHC.show b
show Any = "*"
show None = "!"
instance Read VersionRange where
@@ -183,10 +182,6 @@ satisfies _ None = False
(||>) = flip satisfies
{-# INLINE (||>) #-}
(<<$>>) :: (Functor f, Functor g) => (a -> b) -> f (g a) -> f (g b)
(<<$>>) = fmap . fmap
{-# INLINE (<<$>>) #-}
parseOperator :: Atto.Parser Operator
parseOperator =
(Atto.char '=' $> Right EQ)