Implemented the typing rules for STLC using scala typeclass encoding.