SCL Types
Basic types
SCL is statically typed language which means that types of the possible values of all variables are known already at compile time. The following types have builtin support:
- Boolean
- Byte, Short, Integer, Long
- Float, Double
- String
- BooleanArray, ByteArray, ShortArray, IntegerArray, LongArray, FloatArray, DoubleArray
- []
- (), (,), (,,), ...
- (->)
- Maybe
- Array
Other types are either imported from the host language or defined in SCL modules.
Some types are parametric (compare to generics in Java or templates in C++). For example, the list type [] is has one parameter: the type of the list elements. Thus [Integer] is the type of the integer lists and [String] is the type of string lists. Integer is the type of the lists of integer lists. Usually parameters are written after the type that is being parametrized: for example Maybe String or Array Integer, but some of the builtin types can be written in a special way in order to make the type expressions more readable:
[a] = [] a (a,b) = (,) a b (a,b,c) = (,,) a b c ... a -> b = (->) a b
When multiple arrows are written in sequence, they are associated right, i.e
a -> b -> c = a -> (b -> c)