1
1
mirror of https://github.com/github/semantic.git synced 2024-12-21 05:41:54 +03:00

Fill in the Primitive instance of Name

This commit is contained in:
joshvera 2018-06-26 13:11:55 -04:00
parent 1c2abd36d0
commit 14e5b39afb

View File

@ -29,8 +29,8 @@ instance HasDefault Name where
instance Primitive Name where
encodePrimitive num (Name text) = Encode.text num (LT.fromStrict text)
encodePrimitive _ (I _) = error "We should never be encoding I :: Name constructors"
decodePrimitive = Name . LT.toStrict <$> Decode.text
encodePrimitive num (I index) = Encode.int num index
decodePrimitive = Name . LT.toStrict <$> Decode.text <|> I <$> Decode.int
primType _ = Bytes
-- | Construct a 'Name' from a 'Text'.