Algebrick types and pattern matching