get rid of (completely safe) uses of Char8

Char8 often indicates an encoding bug. It didn't here, but I can avoid it
and not worry about it.
This commit is contained in:
Joey Hess 2014-05-27 20:23:53 -04:00
parent 34f2c82886
commit b197ec8917
2 changed files with 5 additions and 4 deletions

View file

@ -12,13 +12,13 @@ import Assistant.Pairing
import Git.Types
import qualified Data.Text as T
import qualified Data.Text.Encoding as T
import qualified Data.Set as S
import qualified Data.Map as M
import qualified Data.DList as D
import Control.Concurrent.STM
import Control.Concurrent.MSampleVar
import Data.ByteString (ByteString)
import qualified Data.ByteString.Char8 as B8
import Data.Text (Text)
{- Messages that can be sent out of band by a network messager. -}
@ -85,7 +85,7 @@ logNetMessage (Pushing c stage) = show $ Pushing (logClientID c) $
SendPackOutput n _ -> SendPackOutput n elided
s -> s
where
elided = B8.pack "<elided>"
elided = T.encodeUtf8 $ T.pack "<elided>"
logNetMessage (PairingNotification stage c uuid) =
show $ PairingNotification stage (logClientID c) uuid
logNetMessage m = show m

View file

@ -18,7 +18,8 @@ module Utility.Hash (
) where
import qualified Data.ByteString.Lazy as L
import qualified Data.ByteString.Char8 as C8
import qualified Data.Text as T
import qualified Data.Text.Encoding as T
#ifndef WITH_CRYPTOHASH
import Data.Digest.Pure.SHA
@ -66,4 +67,4 @@ prop_hashes_stable = all (\(hasher, result) -> hasher foo == result)
#endif
]
where
foo = L.fromChunks [C8.pack "foo"]
foo = L.fromStrict $ T.encodeUtf8 $ T.pack "foo"