1
1
mirror of https://github.com/github/semantic.git synced 2024-12-30 10:27:45 +03:00

Add decoding to Message1 []

This commit is contained in:
joshvera 2018-06-25 17:35:27 -04:00
parent 002cb36cb3
commit b5c583dbbb

View File

@ -143,10 +143,9 @@ instance Named1 [] where
instance Message1 [] where instance Message1 [] where
liftEncodeMessage encodeMessage num = foldMap (Encode.embedded num . encodeMessage (fieldNumber 1)) liftEncodeMessage encodeMessage num = foldMap (Encode.embedded num . encodeMessage (fieldNumber 1))
-- liftDecodeMessage decodeMessage = fmap toList (Decode.repeated (Decode.embedded' oneMsg)) liftDecodeMessage decodeMessage num = fmap toList ((Decode.repeated (Decode.embedded' oneMsg)) `Decode.at` num)
-- where where
-- oneMsg = decodeMessage (fieldNumber 1) oneMsg = decodeMessage (fieldNumber 1)
-- liftDotProto (_ :: Proxy [a]) = messageField (NestedRepeated (Named (Single (nameOf (Proxy @a))))) Nothing
liftDotProto (_ :: Proxy [a]) = [ Proto.DotProtoMessageField $ Proto.DotProtoField (fieldNumber 1) ty (Proto.Single "listContent") [] Nothing ] liftDotProto (_ :: Proxy [a]) = [ Proto.DotProtoMessageField $ Proto.DotProtoField (fieldNumber 1) ty (Proto.Single "listContent") [] Nothing ]
where ty = Proto.NestedRepeated (Proto.Named (Proto.Single (nameOf (Proxy @a)))) where ty = Proto.NestedRepeated (Proto.Named (Proto.Single (nameOf (Proxy @a))))