@@ -429,15 +429,16 @@ object exp = [|Encoding|] `appE` ([|E.char7 '{'|] <^> exp <^> [|E.char7 '}'|])
429sumToEncoding :: Options -> Bool -> Name -> Q Exp -> Q Exp
429sumToEncoding :: Options -> Bool -> Name -> Q Exp -> Q Exp
430sumToEncoding opts multiCons conName exp
430sumToEncoding opts multiCons conName exp
431 | multiCons =
431 | multiCons =
432+ let fexp = [|fromEncoding|] `appE` exp in
432 case sumEncoding opts of
433 case sumEncoding opts of
433 TwoElemArray ->
434 TwoElemArray ->
434− array (encStr opts conName <%> exp)
435+ array (encStr opts conName <%> fexp)
435 TaggedObject{tagFieldName, contentsFieldName} ->
436 TaggedObject{tagFieldName, contentsFieldName} ->
437 ([|E.builder tagFieldName|] <:> encStr opts conName) <%>
438 ([|E.builder tagFieldName|] <:> encStr opts conName) <%>
438− ([|E.builder contentsFieldName|] <:> [|fromEncoding|] `appE` exp)
439+ ([|E.builder contentsFieldName|] <:> fexp)
439 ObjectWithSingleField ->
440 ObjectWithSingleField ->
440− object (conTxt opts conName <:> [|fromEncoding|] `appE` exp)
441+ object (conTxt opts conName <:> fexp)
442 | otherwise = exp
443 | otherwise = exp