liveBook · Manning

Type constructor

A type constructor is a type-level function that takes types as parameters and produces a parameterized type.

How 2 Manning books explain it

Functional Programming in Scala, Second Edition

A type constructor is a type-level function that takes one or more types as parameters and produces a new parameterized type.

How it is used
Abstracts over parameterized computational and data contexts to define shared interfaces such as Foldable, Functor, Monad, and Free.
How deep it goes
Defines unary constructors, then works through partial application and type lambdas for two-argument State before applying constructors in abstractions.
Examples
Uses List, Option, Gen, Parser, State, Par, Function0, Async, TailRec, and Free as concrete constructor examples.
What you can do after
Apply it via Scala type aliases and type lambdas to supply one-argument constructors required by Monad instances.

Read how Functional Programming in Scala, Second Edition explains type constructor →

Functional Programming in JavaScript

An operation or definition that creates values of a parameterized type.

How it is used
Creates the container form used before chaining, flattening, or handling missing values in monadic code.
How deep it goes
Defines the constructor role and names its place in the monad interface, but stops short of formal type-system detail.
Examples
Uses Wrapper.of, Maybe.of, and Maybe.fromNullable as concrete constructors for wrapped, present, or absent values.
What you can do after
Build it from scratch as the entry point for values that will be mapped, joined, or safely handled later.

Read how Functional Programming in JavaScript explains type constructor →

Related concepts

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.