Glossary of terms for programming in Haskell
To effectively program in Haskell we need to master some
new skills. These words will help us describe these skills.
- Computation - A program fragment indicating a sequence of operations to be carried out by the computer. Some
program fragments do not describe computations.
- Value - A result of a computation. A piece of data that requires no further computation to be completed.
5 is a value, but (3 + 4) is not. It is also often is used to describe a computation that will not cause any side effects as it is computed.
Some times called a pure computation.
- Command - A computation that causes side effects. Examples include reading or writing to a file,
assigning a new value to mutable reference, interacting with the physical world.
- Syntax - the actual physical marks that make up the program on paper. Syntax is structured.
Not all marks make up a legal program.
- Variable - A primitive name for a computation. The name denotes the actual computation. Variables
arise from naming declarations and from formal arguments to functions. Variable always start with
a lower case letter.
- Expression - A structured name for a computation. Usually consisting of operators and control.
Operators in Haskell are infix operators (+) (-) and prefix functions (reverse). Control in Haskell
includes things like if, case, where etc. See the
Basic Haskell Program Structure for some example control expressions and
the Basic types and their operations for some example operators.
- Statement - A syntactic form denoting a Command, i.e. a non-pure computation. In Haskell
statements are formed using the do syntax.
- Type - A type is a way of classifying as similar a set of values. I.e. all integers, all strings, etc.
The set a type classifys can be infinite. In Haskell types always start with a capital letter.
See the note on types for some examples.
- Type constructor - A parameterized type. Examples include [Int], Tree Bool, and IO String
- Type Synonym - A shorthand for a type. Often used when the type is large or unwieldy, a synonym can
introduce a shorter name.
- Polymorphic type - A type some of whose components are unconstrained, that is these components can take on
any type. Polymorphic types always have type variables in them. A type variable always starts with
a lowercase letter. Examples include [a], and (Int,b).
- Class - A mechanism used in Haskell to introduce over loading. I.e. using the same name
for different sequences of computation steps. In Haskell over loading is always type based, i.e. the
particular sequence of computation steps chosen is determined by the type of the overloaded operator
or its arguments.
- Method - What Haskell calls overloaded operators
- Constraint - A predicate on types. examples include Show a, Eq b, and Ord x.
Constraints always start with a capital letter, and always appear before the => in a type.
For example the type of print is Show a => a -> IO ().
Back to the Daily Record.
Back to the class web-page.