Typed Functional Programming with Rank 1 Types