@@ -217,6 +217,7 @@ mkDeserializeExpr True False headTy tyOfTy =
217217mkDeserializeExpr False False headTy tyOfTy =
218218 case tyOfTy of
219219 -- Unit constructor
220+ -- XXX Should we peek and check if the byte value is 0?
220221 UnitType cname ->
221222 [|pure ($(varE _initialOffset) + 1, $(conE cname))|]
222223 -- Product type
@@ -341,7 +342,8 @@ mkSerializeExpr True False tyOfTy =
341342mkSerializeExpr False False tyOfTy =
342343 case tyOfTy of
343344 -- Unit type
344− UnitType _ -> [|pure ($(varE _initialOffset) + 1)|]
345+ UnitType _ ->
346+ [|serializeAt $(varE _initialOffset) $(varE _arr) (0 :: Word8)|]
345347 -- Product type
346348 (TheType (SimpleDataCon cname fields)) ->
347349 letE
@@ -395,7 +397,7 @@ mkSerializeDec (SerializeConfig {..}) headTy cons = do
395397 'serializeAt
396398 [ Clause
397399 (if isUnitType cons && not cfgConstructorTagAsString
398− then [VarP _initialOffset, WildP, WildP]
400+ then [VarP _initialOffset, VarP _arr, WildP]
399401 else [VarP _initialOffset, VarP _arr, VarP _val])
400402 (NormalB pokeMethod)
401403 []