Fix const correctness issues
Move tagged union visitor to its own header