An Effect System for Algebraic Effects and Handlers