Add test demonstrating use of codec.as with a coproduct type