Recursive Data Type - Theory

Theory

In type theory, a recursive type has the general form μα.T where the type variable α may appear in the type T and stands for the entire type itself.

For example, the natural number (see Peano arithmetic) may be defined by the Haskell datatype:

data Nat = Zero | Succ Nat

In type theory, we would say: where the two arms of the sum type represent the Zero and Succ data constructors. Zero takes no arguments (thus represented by the unit type) and Succ takes another Nat (thus another element of ).

There are two forms of recursive types: the so-called isorecursive types, and equirecursive types. The two forms differ in how terms of a recursive type are introduced and eliminated.

Read more about this topic:  Recursive Data Type

Famous quotes containing the word theory:

    Osteopath—One who argues that all human ills are caused by the pressure of hard bone upon soft tissue. The proof of his theory is to be found in the heads of those who believe it.
    —H.L. (Henry Lewis)

    ... the first reason for psychology’s failure to understand what people are and how they act, is that clinicians and psychiatrists, who are generally the theoreticians on these matters, have essentially made up myths without any evidence to support them; the second reason for psychology’s failure is that personality theory has looked for inner traits when it should have been looking for social context.
    Naomi Weisstein (b. 1939)

    Could Shakespeare give a theory of Shakespeare?
    Ralph Waldo Emerson (1803–1882)