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.Conduit.List as CL
import qualified Data.HashMap.Strict as HM import qualified Data.HashMap.Strict as HM
import Data.List import Data.List
import qualified Data.List.NonEmpty as NE
import Data.Semigroup import Data.Semigroup
import Data.String.Interpolate.IsString import Data.String.Interpolate.IsString
import qualified Data.Text as T import qualified Data.Text as T

View File

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