From b5c583dbbb299a1fbb044584c33962954c42cdf6 Mon Sep 17 00:00:00 2001 From: joshvera Date: Mon, 25 Jun 2018 17:35:27 -0400 Subject: [PATCH] Add decoding to Message1 [] --- src/Data/Syntax.hs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/Data/Syntax.hs b/src/Data/Syntax.hs index 292558c23..61af378d9 100644 --- a/src/Data/Syntax.hs +++ b/src/Data/Syntax.hs @@ -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))))