Reserved Words and Symbols
Most programming languages have reserved words (keywords) and symbols that cannot be used as variable or function names or as the names of operators. They are part of the language's syntax. Haskell has a few of those, too.
Reserved words are case
, of
, if
, then
, else
, module
, where
,
import
, as
, qualified
, data
, newtype
, type
, let
, in
, class
,
do
, instance
, and deriving
. I may be forgetting some, but there aren't
many.
Symbols with special meaning that cannot be used as the names of operators are
|
, {
, }
, (
, )
, [
, ]
, ,
, ;
, ::
, ..
, =>
, ->
, <-
, @
,
_
, '
, "
, =
. Again, I may be forgetting a few.
In addition, whole-line comments start with two dashes, --
. C-style comments
are enclosed in {- ... -}
. So --
, {-
, and -}
also cannot be used as
operator names. in fact, any character combination that starts with --
is
not allowed as an operator name because Haskell would parse the first two
dashes as the beginning of a comment and then ignore the rest of the line.