liveBook · Manning

Type signature

As explained in Functional Programming in Scala, Second Edition

A type signature is a declaration of the types of a function's parameters and result, including any type parameters.

A type signature declares a function’s parameter types, result type, and any type parameters. It describes the shape of a computation before its implementation. section 2.5

For partial1, the signature says that a value of type A and a function from (A, B) to C produce a function from B to C. Reading the result type first determines that the implementation must return a function. section 2.5

Partial application

def partial1[A, B, C](a: A, f: (A, B) => C): B => C = (b: B) => f(a, b) The returned function accepts the remaining B value and applies f to the captured A value and b. section 2.5

How Functional Programming in Scala, Second Edition covers it

How deep it goes
Explains parameters, results, type parameters, and result-driven implementation through partial1, then stops short of formal type-system internals.
Examples
Uses partial1, with curry, uncurry, compose, and a function-composition expression as related signatures and examples.
What it assumes
Assumes familiarity with basic Scala functions while introducing anonymous functions, type parameters, and higher-order functions through concrete code.
What you can do after
Build it from scratch by reading a function’s signature and deriving the only implementation that compiles.
How it connects
Connects type signatures to higher-order functions, partial application, anonymous functions, and Scala’s type system.

Also explained in

Compare how 8 books explain type signature →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Functional Programming in Scala, Second Edition. The section links point to the parts of the book it draws on.