Function type
A function type specifies the types of inputs and result that a callable value accepts and produces.
Kotlin in Action, 2E
A function type describes the parameter types and return type of callable values.
- How it is used
- Enables higher-order functions that receive, store, and return behavior as lambda or function-reference values.
- How deep it goes
- Explains syntax, invocation, nullability placement, named parameters, returned functions, and predicate-based reuse; defers lambda performance to inline functions.
- Examples
- Uses arithmetic operations, a String filter, shipping-cost selection, contact filtering, and site-visit duration queries.
- What you can do after
- Build it from scratch by declaring function-typed variables, parameters, and returns, then passing or invoking lambdas.
Type-Driven Development with Idris
A function type specifies the types of a function's inputs and result.
- How it is used
- Uses function types to declare function inputs and results and to identify checks needed when handling external input.
- How deep it goes
- Defines input-to-output signatures and works through a simple function and a dependent vector signature.
- Examples
- Uses `double : Int -> Int`, REPL evaluations, and `zip` over equal-length vectors.
- What you can do after
- Build an Idris function from an input-to-result signature and test its evaluations in the REPL.
Read how Type-Driven Development with Idris explains function type →
Learn Haskell by Example
A function type specifies the input and output types of a function value.
- How it is used
- Uses function types to document definitions, check operator compatibility, and shape practical encryption and synthesizer components.
- How deep it goes
- Explains unary and curried function types, lambda notation, syntactic sugar, and operator-driven type errors without covering deeper type-system internals.
- Examples
- Uses square and add definitions, mixed Int and Double multiplication, character rotation, and Event-to-Signal oscillators.
- What you can do after
- Evaluate and write Haskell signatures for unary, multi-argument, and function-valued definitions while diagnosing simple type mismatches.
Geometry for Programmers
A function type specifies the kinds of inputs and outputs a function accepts, including its domain and codomain.
- How it is used
- Frames geometric modeling functions by matching mathematical domains and codomains with programming input and output types.
- How deep it goes
- Defines domains and codomains, then distinguishes transformations and vector fields, without developing their later chapters’ mechanics.
- Examples
- Uses translation of a square in ℝ² and vector-field illustrations to ground abstract function types.
- What you can do after
- Evaluate/understand geometric functions by identifying their input spaces, output spaces, and per-input values.
100 Go Mistakes and How to Avoid Them
A function type is a Go type whose values are functions with a specified parameter and result signature.
- How it is used
- Uses function types to inject time dependencies and make unit tests deterministic.
- How deep it goes
- Defines a named function type, wires production and test implementations, and contrasts function injection with global state and explicit arguments.
- Examples
- Uses Cache, time.Now, TrimOlderThan, fixed timestamps, and a fake func() time.Time implementation.
- What you can do after
- Build deterministic time-dependent tests by injecting a function that returns a controlled timestamp.
Read how 100 Go Mistakes and How to Avoid Them explains function type →
Also covered in
What to know first
- type inferenceType inference is the automatic deduction of program types from expressions, values, declarations, usage, or contextual constraints without requiring every type to be specified explicitly.
- lambdaA lambda is an expression that defines an unnamed function, specifying its parameters and body and producing a callable value.
- functionA function is a callable unit of program code that performs a computation or operation, can accept inputs, and may produce a result or side effect.
Related concepts
- data typekind of · A data type classifies values by their permitted forms or representations and the operations or interpretations applicable to them.
- Kotlinused by · Kotlin is a statically typed general-purpose programming language that targets the JVM and other platforms and interoperates with Java.
- atomic typekind of · An atomic type is a type whose supported accesses and operations are indivisible with respect to concurrent execution and provide defined synchronization semantics.
- variable in typehas part · A variable in a type expression may stand for a type or, in dependent types, a value.
- code duplicationaddresses · Code duplication is the presence of the same or substantially similar implementation logic in multiple locations within a software system.
- extension function typecontrasts with · An extension function type is a Kotlin function type that specifies a receiver type before the parameter types, allowing values of that type to invoke the callable using extension-function syntax.
Questions about function type
What is function type?
A function type specifies the types of inputs and result that a callable value accepts and produces.
Which Manning books explain function type?
Kotlin in Action, 2E, Type-Driven Development with Idris, Learn Haskell by Example, Geometry for Programmers and 100 Go Mistakes and How to Avoid Them.
What should I know before learning function type?
Manning books that teach function type usually introduce type inference, lambda and function first.
What is the difference between function type and extension function type?
A function type specifies the types of inputs and result that a callable value accepts and produces. An extension function type is a Kotlin function type that specifies a receiver type before the parameter types, allowing values of that type to invoke the callable using extension-function syntax.
What is function type a kind of?
Function type is a kind of data type. A data type classifies values by their permitted forms or representations and the operations or interpretations applicable to them.
What are the parts of function type?
Function type includes variable in type.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.




