Symbol package:base
Haskell symbol, e.g. >>, :%
(Kind) This is the kind of type-level symbols.
Selects Unicode symbol characters, including mathematical and currency
symbols.
This function returns
True if its argument has one of the
following
GeneralCategorys, or
False otherwise:
These classes are defined in the
Unicode Character Database,
part of the Unicode standard. The same document defines what is and is
not a "Symbol".
Examples
Basic usage:
>>> isSymbol 'a'
False
>>> isSymbol '6'
False
>>> isSymbol '='
True
The definition of "math symbol" may be a little counter-intuitive
depending on one's background:
>>> isSymbol '+'
True
>>> isSymbol '-'
False
Concatenation of type-level symbols.
Comparison of type-level symbols, as a function.
Extending a type-level symbol with a type-level character
This class gives the string associated with a type-level symbol. There
are instances of the class for every concrete literal: "hello", etc.
A value-level witness for a type-level symbol. This is commonly
referred to as a
singleton type, as for each
s, there
is a single value that inhabits the type
SSymbol s
(aside from bottom).
The definition of
SSymbol is intentionally left abstract. To
obtain an
SSymbol value, use one of the following:
- The symbolSing method of KnownSymbol.
- The SSymbol pattern synonym.
- The withSomeSSymbol function, which creates an
SSymbol from a String.
A explicitly bidirectional pattern synonym relating an
SSymbol
to a
KnownSymbol constraint.
As an
expression: Constructs an explicit
SSymbol
s value from an implicit
KnownSymbol s
constraint:
SSymbol @s :: KnownSymbol s => SSymbol s
As a
pattern: Matches on an explicit
SSymbol s
value bringing an implicit
KnownSymbol s constraint
into scope:
f :: SSymbol s -> ..
f SSymbol = {- KnownSymbol s in scope -}
This type represents unknown type-level symbols.
This type family yields type-level
Just storing the first
character of a symbol and its tail if it is defined and
Nothing
otherwise.
Like
sameSymbol, but if the symbols aren't equal, this
additionally provides proof of LT or GT.
We either get evidence that this function was instantiated with the
same type-level symbols, or that the type-level symbols are distinct.
Return the String corresponding to
s in an
SSymbol
s value.