switch MetaValue to ByteString and MetaField to Text

MetaField was already limited to alphanumerics, so it makes sense to use
Text for it.

Note that technically a UUID can contain invalid UTF-8, and so
remoteMetaDataPrefix's use of T.pack . fromUUID could replace non-UTF8
values with '?' or whatever. In practice, a UUID is usually also text,
I only kept open the possibility of it containing invalid UTF-8 to avoid
breaking parsing of strange UUIDs in git-annex branch files. So, I
decided to let this edge case slip by.

Have not updated the rest of the code base yet for this change, as the
change took 2.5 hours longer than I expected to get working properly.
This commit is contained in:
Joey Hess 2019-01-07 14:18:24 -04:00
parent a80922a594
commit 16c798b5ef
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
3 changed files with 88 additions and 60 deletions

View file

@ -44,6 +44,9 @@ encode = Data.Aeson.encode . toJSON'
class ToJSON' a where
toJSON' :: a -> Value
instance ToJSON' T.Text where
toJSON' = toJSON
instance ToJSON' String where
toJSON' = toJSON . packString