Copyright | disco team and contributors |
---|---|
Maintainer | byorgey@gmail.com |
Safe Haskell | None |
Language | Haskell2010 |
Type qualifiers and sorts.
Documentation
A "qualifier" is kind of like a type class in Haskell; but unlike
Haskell, disco users cannot define their own. Rather, there is a
finite fixed list of qualifiers supported by disco. For example,
QSub
denotes types which support a subtraction operation. Each
qualifier corresponds to a set of types which satisfy it (see
hasQual
and qualRules
).
These qualifiers generally arise from uses of various operations.
For example, the expression \x y. x - y
would be inferred to
have a type a -> a -> a [subtractive a]
, that is, a function of
type a -> a -> a
where a
is any type that supports
subtraction.
These qualifiers can appear in a CQual
constraint; see
Disco.Typecheck.Constraint.
QNum | Numeric, i.e. a semiring supporting + and * |
QSub | Subtractive, i.e. supports - |
QDiv | Divisive, i.e. supports / |
QCmp | Comparable, i.e. supports decidable ordering/comparison (see Note [QCmp]) |
QEnum | Enumerable, i.e. supports ellipsis notation [x .. y] |
QBool | Boolean, i.e. supports and, or, not (Bool or Prop) |
QBasic | Things that do not involve Prop. |
QSimple | Things for which we can derive a *Haskell* Ord instance |
Instances
decidable* (terminating) comparison.
bopQual :: BOp -> Qualifier Source #
A helper function that returns the appropriate qualifier for a binary arithmetic operation.