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:
parent
a80922a594
commit
16c798b5ef
3 changed files with 88 additions and 60 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue