liveBook · Manning

Opaque type

An opaque type is a type whose representation and implementation details are hidden from code outside its defining abstraction boundary.

How 4 Manning books explain it

Modern C, Third Edition

An opaque data type is a type whose representation and implementation details are hidden from code that uses it.

How it is used
Uses hidden representations behind functional interfaces for streams and nonlocal control-flow state.
How deep it goes
Explains interface discipline and C typedef mechanics, but stops short of specifying either hidden representation.
Examples
Uses FILE* with fputc and fputs, and jmp_buf with setjmp and longjmp.
What you can do after
Evaluate/understand C interfaces without relying on opaque representation details or copying unsuitable typedef techniques.

Read how Modern C, Third Edition explains opaque type →

Functional Design and Architecture: Examples in Haskell

An opaque data type is a data type whose representation is hidden from client code behind an abstraction boundary.

How it is used
Separates unstable private implementations from stable public interfaces in imperative modules and prevents invalid states in domain models.
How deep it goes
Explains representation hiding through C declarations and typed constructors, then addresses testing access and internal stability trade-offs.
Examples
Uses C opaque pointers, device definitions, invalid component construction, smart constructors, and internal modules.
What you can do after
Apply via module interfaces and smart constructors that hide representation, preserve invariants, and permit controlled implementation changes.

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

Modern C

An opaque data type is a type whose internal representation or purpose is hidden from the code that manipulates it.

How it is used
Uses hidden representations to explain C library streams, pointers, and thread identifiers through permitted operations.
How deep it goes
Defines interface-based abstraction and warns against representation dependence, but defers pointer internals and memory purpose.
Examples
Uses FILE* with fputc and fputs, manually reimplements puts, and identifies threads with thrd_t.
What you can do after
Apply it via C library interfaces while avoiding assumptions about hidden representations.

Read how Modern C explains opaque type →

Functional Programming in Scala, Second Edition

An opaque type is a Scala type whose representation is equivalent to an underlying type within its defining scope but abstract outside that scope.

How it is used
Encapsulates state actions while preserving function-based representations for pure stateful APIs.
How deep it goes
Defines scope behavior, conversions, and runtime tradeoffs, but defers detailed language specification.
Examples
Uses State[S, A] as S => (A, S) and Rand[A] as a specialized state alias.
What you can do after
Build it from scratch by defining State with apply and run while retaining encapsulation without wrapper overhead.

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

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.