1
1
mirror of https://github.com/github/semantic.git synced 2024-12-30 10:27:45 +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 instance Primitive Name where
encodePrimitive num (Name text) = Encode.text num (LT.fromStrict text) encodePrimitive num (Name text) = Encode.text num (LT.fromStrict text)
encodePrimitive _ (I _) = error "We should never be encoding I :: Name constructors" encodePrimitive num (I index) = Encode.int num index
decodePrimitive = Name . LT.toStrict <$> Decode.text decodePrimitive = Name . LT.toStrict <$> Decode.text <|> I <$> Decode.int
primType _ = Bytes primType _ = Bytes
-- | Construct a 'Name' from a 'Text'. -- | Construct a 'Name' from a 'Text'.