Sam: a constructor for optional field

[Sam.optional_field] is a private type and the only way to build a
value is through the [Sam.parse_optional_field] function, which is not
adequate when parsing BAM.

I added a constructor, trying my best to put all the necessary checks
and preserve all invariants of the specification. I mostly reused the
tests that were in [parse_optional_field] and, in order to avoid code
duplication, I removed those tests from the function and used the
constructor instead. I think this is the best thing to do, but I'm not
sure I've done it right.

@agarwal: could you review this patch and tell me if something seems wrong to you?