Disuse ScopedTypeVariables

The usage of that extension here can be replaced by
asTypeOf and undefined with Haskell 98 type signatures.
Prepare to rewrite overlapping instances

This uses the technique that is used in the Show class
to make show for String use quotes instead of brackets.

This prepares to remove the overlap in Val [a] and Val (Maybe a).

Move val and cast' in Val [a] to valList and cast'List in Val a.

Move val and cast' in Val (Maybe a) to valMaybe and cast'Maybe in Val a.
Rewrite instance Val String

This removes the overlap between Val [a] and Val [Char].

The val in Val Char returns a one-character string
that consists of the character itself.

The cast' in Val Char takes the first character of the input
if it is a non-empty string.
Rewrite instance Val Document

This removes the overlap between Val [a] and Val [Field].

The val in Val Field returns a one-field document
that consists of the field itself.

The cast' in Val Field always produces Nothing
since cast' cannot generally give a sensible field label.
Rewrite instance Val Value

This removes the overlap between Val [Value] and Val [a]
and between Val (Maybe Value) and Val (Maybe a).

The val in Val Value returns the input.
It is an identity function.

The cast' in Val Value returns Just the input.
Disuse instance extensions