1
1
mirror of https://github.com/github/semantic.git synced 2024-12-21 05:41:54 +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
liftEncodeMessage encodeMessage num = foldMap (Encode.embedded num . encodeMessage (fieldNumber 1))
-- liftDecodeMessage decodeMessage = fmap toList (Decode.repeated (Decode.embedded' oneMsg))
-- where
-- oneMsg = decodeMessage (fieldNumber 1)
-- liftDotProto (_ :: Proxy [a]) = messageField (NestedRepeated (Named (Single (nameOf (Proxy @a))))) Nothing
liftDecodeMessage decodeMessage num = fmap toList ((Decode.repeated (Decode.embedded' oneMsg)) `Decode.at` num)
where
oneMsg = decodeMessage (fieldNumber 1)
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))))