Rewrite BType to a type hierarchy.

This makes BTypes more type safe.

It fixes at least one bug: the old BTypes are not actually
hash-consed. This worked because the equals method used to have a
fallback that would compare the represented string
character-by-character.