liveBook · Manning

Option

An option type is a type that explicitly represents either a value of a specified type or the absence of a value.

How 9 Manning books explain it

Functional Programming in Scala, Second Edition

Option is a Scala standard-library type representing either the presence of a value with Some or its absence with None.

How it is used
Models expected absent or undefined results as values instead of exceptions or sentinel values.
How deep it goes
Defines Option’s cases and operations, then develops lifting, combination, traversal, and its Applicative-versus-Monad distinction.
Examples
Uses empty-sequence mean and variance, employee lookup, integer parsing, insurance quotes, and dependent Map lookups.
What you can do after
Apply it via Scala Option operations to compose missing-value computations, combine inputs, and wrap parsing failures.

Read how Functional Programming in Scala, Second Edition explains option →

F# in Action: A Revised Edition of Get Programming with F#

An option is an F# generic discriminated union representing either the presence of a value with Some or its absence with None.

How it is used
Models expected absence of domain data while requiring callers to account for missing values.
How deep it goes
Defines the discriminated-union cases, safe pattern matching, mapping pipelines, collection operations, and .NET conversion boundaries.
Examples
Uses optional integers, database-loaded customers and ages, collection searches, null conversion, and a TryParse wrapper.
What you can do after
Apply it via Option.map, pattern matching, collection try functions, and .NET conversion helpers to represent missing data safely.

Read how F# in Action: A Revised Edition of Get Programming with F# explains option →

Functional Programming in JavaScript

A monadic type that represents an optional value, distinguishing presence from absence without using null directly.

How it is used
Consolidates null-check logic and supports compositional functional error handling without direct null or undefined branching.
How deep it goes
Defines Just and Nothing, demonstrates mapping and defaults, and stops short of detailing the complete monad API.
Examples
Uses nullable student lookups, nested school addresses, DOM-style defaults, and database records wrapped as Just or Nothing.
What you can do after
Apply it via mapping and getOrElse to compose nullable lookups and provide explicit fallback values.

Read how Functional Programming in JavaScript explains option →

Rust Servers, Services, and Apps

Option is a Rust standard-library generic type representing either a value or its absence.

How it is used
Models fields that may be absent across API payloads and database records with different requiredness.
How deep it goes
Explains optional struct fields and nullable database columns, but does not develop Option’s broader API or internals.
Examples
Uses Course, CreateCourse, UpdateCourse, and nullable course-table columns to demonstrate optional values.
What you can do after
Apply it via Rust data models that distinguish required fields from values accepted as absent.

Read how Rust Servers, Services, and Apps explains option →

Learn Rust in a Month of Lunches

How it is used
Represents a value that might be absent without treating absence as an error.
How deep it goes
Explains enum variants, checked returns, pattern matching, unwrap panics, and chained optional operations.
Examples
Uses a fifth-item vector lookup and an array lookup followed by number parsing and character conversion.
What you can do after
Build it from scratch: return `Option<i32>` for a checked lookup and handle `Some` and `None` with `match`.

Read how Learn Rust in a Month of Lunches explains option →

Server-Side WebAssembly

Option is Rust's enum type for representing either a present value or the absence of a value.

How it is used
Models possibly missing key-value lookups across Rust host and JavaScript guest component boundaries.
How deep it goes
Works through a HashMap lookup, WIT signature, generated TypeScript mapping, and the runtime failure risk of assuming presence.
Examples
Uses a SmartCMS kvstore get operation, a guest-hello value, Rust Option<String>, and a generated string | undefined declaration.
What you can do after
Apply it via WIT by declaring option<string> and returning a Rust HashMap lookup without unwrap.

Read how Server-Side WebAssembly explains option →

Functional Design and Architecture: Examples in Haskell

The Maybe type is an algebraic data type representing either an optional value or the absence of a value.

How it is used
Models optional and potentially failing results while composing functional operations over lists, lookups, and extracted values.
How deep it goes
Defines Just and Nothing, demonstrates fmap over nested structures, and refactors nested pattern matching with monadic do notation.
Examples
Uses optional names, nested fmap, database user lookup, name extraction, and initial-letter construction.
What you can do after
Apply via fmap and do notation to transform and sequence computations that may produce Nothing.

Read how Functional Design and Architecture: Examples in Haskell explains option →

Code Like a Pro in Rust

How it is used
Represents possibly absent boxed data and marks the end of a linked-list chain.
How deep it goes
Defines Some and None through linked-list access, while leaving heap-allocation failure handling outside scope.
Examples
Uses None for a new node’s next link and Some to traverse to the next node.
What you can do after
Apply Rust’s Option to represent absent data without relying on unsafe null pointers.

Read how Code Like a Pro in Rust explains option →

100 Java Mistakes and How to Avoid Them

Optional is a Java standard-library container type representing either a present non-null value or an empty state.

How it is used
Uses Optional to signal possibly absent return values and reduce NullPointerException risk.
How deep it goes
Defines empty and non-empty states, factory methods, fluent transformation, and parameter guidance, but does not detail implementation internals.
Examples
Uses a user-search result, Optional.empty(), Optional.of(), Optional.ofNullable(), map(), and orElse().
What you can do after
Apply Optional through its factory and transformation methods when absence belongs in a return value.

Read how 100 Java Mistakes and How to Avoid Them explains option →

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.