Home

Coxtype

Coxtype is a theoretical construct in type theory and category theory used to denote the dual notion to algebraic data types. Whereas algebraic data types are defined by constructors that build values, co-types are characterized by destructors that observe or decompose values. In this dual view, a co-type emphasizes the observable structure of data rather than its construction.

A co-type is often associated with coalgebras and final coalgebras, and commonly features corecursive definitions. Instances

Example: a stream of values of type A can be treated as a co-type with destructors head

Usage and status: Co-type theory remains a topic of academic research within type theory and category theory.

See also: algebraic data type, cotype, coalgebra, codata, corecursion, final coalgebra.

are
described
by
how
they
can
be
observed
through
a
finite
set
of
destructors,
and
potentially
by
recursive
relationships
between
observations.
This
makes
co-types
well-suited
to
model
infinite
or
lazily
produced
data
such
as
streams
or
reactive
processes.
that
yields
the
next
element
and
tail
that
yields
the
remainder
stream.
In
a
language
supporting
codata,
such
destructors
are
the
primary
means
of
interacting
with
a
stream,
rather
than
constructing
a
particular
stream
upfront.
It
informs
discussions
of
corecursion,
bisimulation,
and
dualities
between
data
construction
and
observation.
It
is
not
a
standard
feature
in
mainstream
programming
languages,
though
related
ideas
appear
in
languages
that
support
codata,
copatterns,
or
lazy
coalgebraic
definitions.