update Semantic.AST definition
use `when` instead of `if`
rename type predicates and add Eq instance for Semantic.Type
type checking expressions