(,,)etc. to construct a tuple (type), i.e. you cannot write
(,) 3 4
as type constructor, i.e. you cannot write
x ::  Int
Either a b,
Either a b,
Eq(and not for other classes) can be derived for data types. These instances are needed to use overloaded functions, such as
IO, then the value is printed with a
showfunction. The show functions can print anything, e.g. functions are printed as
. Therefore, there is a difference between main = expression and main = show expression. In the latter case, the expression must be in the
3is of type
Float. A consequence is that you can never write
2 + 2.3, although in overloaded mode you may write both
2 + 3and
2.0 + 3.0.
(+2*3)is not allowed, this should be written as
(x:xs) ++ ys = ... (x:xs) = ...Helium rejects a definition if operator precedence is necessary to understand the left-hand side. See the end of Section 4.4 of the Haskell Report to see why we have done this.
Integeris simply a type synonym for
Int. This makes programs with the explicit type
Integercompile but, of course, this does not make them have arbitrary precision.
showMaybeis automatically created for the data type
Maybe. If the data type has parameters, then the show function gets the necessary additional arguments, e.g.
showMaybe showInt (Just 3).