functional programming in scala type pdf