basic algebraic functions. Type classes