-
Type: A context that describes some value.
-
Sum type: A kind of user-defined type that is a boolean XOR of possible types, where only one is chosen for a given instantiation. Also called a disjoint union, a sum type is an example of a type with limited polymorphism, where each of the possible instantiations of the type is explicitly defined.
-
Product type: A kind of user-defined type that is a boolean AND of types.
-
Algebraic Data Type (ADT): A composition of sum types, product types, and/or primitive types, with potentially multiple varied data-type-constructors which, when called, return concrete instances of an algebraic data type.
-
data: A definition for an algebraic data type. The data type may be instantiated by calling a data-type-constructor with appropriate arguments.
-
class: A set of abstract behaviors, a contract/interface specification. Any implementation of a given type-class must implement the set of behaviors defined by the class.
-
instance: A concrete behavioral definition. A type class may consist of multiple behaviors. Implementers of a class must provide definitions for all of the behaviors defined by the class.
-
type: A synonym for a type, given a different name. Contains no constructor definition.
-
newtype: Exactly one type constructor with one argument. A re-definition of an existing type that gives the type a new name.
-
derive: "To obtain actually or theoretically from a parent substance"; To auto-create an instance of a supported type class, based on a set of supported type classes, which include: Eq, Ord, Functor, Newtype, and Generic.Rep. Typically used with "instance".
There is no direct link between an algebraic data type and a type class, which defines abstract behaviors. A class instance is the mapping between a data type and a type class. The class instance defines an instantiation of a type class, a defined set of behaviors for a given data type, which act upon the data type. Modules often define a data-type and a type-class together, then provide instances of the class, creating the associations between data and class within the Module definition.