better error diagnostics
pretty printing for typed representation