From 5b9784507ca7404cac7f0f638db0cf75283df038 Mon Sep 17 00:00:00 2001 From: Joshua Simmons Date: Mon, 16 Nov 2015 16:44:07 -0700 Subject: [PATCH] use Text instead of ByteString for Version issue #1337 --- src/Stack/Types/Version.hs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/Stack/Types/Version.hs b/src/Stack/Types/Version.hs index bc84e4f515..68940e32b5 100644 --- a/src/Stack/Types/Version.hs +++ b/src/Stack/Types/Version.hs @@ -32,10 +32,8 @@ import Control.Applicative import Control.DeepSeq import Control.Monad.Catch import Data.Aeson.Extended -import Data.Attoparsec.ByteString.Char8 +import Data.Attoparsec.Text import Data.Binary.VersionTagged (Binary, HasStructuralInfo) -import Data.ByteString (ByteString) -import qualified Data.ByteString.Char8 as S8 import Data.Data import Data.Hashable import Data.List @@ -57,7 +55,7 @@ import Text.PrettyPrint (render) -- | A parse fail. data VersionParseFail = - VersionParseFail ByteString + VersionParseFail Text deriving (Typeable) instance Exception VersionParseFail instance Show VersionParseFail where @@ -113,7 +111,7 @@ versionParser = point = satisfy (== '.') -- | Convenient way to parse a package version from a bytestring. -parseVersion :: MonadThrow m => ByteString -> m Version +parseVersion :: MonadThrow m => Text -> m Version parseVersion x = go x where go = either (const (throwM (VersionParseFail x))) return . @@ -122,7 +120,7 @@ parseVersion x = go x -- | Migration function. parseVersionFromString :: MonadThrow m => String -> m Version parseVersionFromString = - parseVersion . S8.pack + parseVersion . T.pack -- | Get a string representation of a package version. versionString :: Version -> String