A type whose values are described by named data constructors with specified fields. For example,
data Tree a = One a | Two (Tree a) (Tree a) describes a leaf-labelled binary tree. Its two alternatives are distinguished by pattern matching; the recursive fields give a recursive type.A data type whose values belong to one of several alternatives, with a logical tag distinguishing the chosen alternative. If
Number n and Operator op are its constructors, pattern matching can distinguish the variants even if their payloads use similar representations. The tag need not occupy a separate physical memory field in every implementation.A named way to construct one alternative of an algebraic data type. In
data Tree a = One a | Two (Tree a) (Tree a), One has type signature a -> Tree a and Two has type signature Tree a -> Tree a -> Tree a. They construct values; the type constructor Tree instead constructs types from a type argument. Articles by others on the same topic
There are currently no matching articles.