The language implements a Hindley-Milner type system with:
- Parametric polymorphism
- Type inference
- Algebraic data types
The language provides these built-in types:
Int -- 64-bit signed integer
Float -- 64-bit floating point
Char -- Unicode character
String -- UTF-8 string
Bool -- Boolean true/false
Unit -- Single value type ()
type Person =
{ name : String
, age : Int
, email : Maybe String
}
type Maybe a =
| None
| Some a
type Result e a =
| Err e
| Ok a
type alias UserId = String
type alias Age = Int
type alias EmailAddress = String
Not sure if these will be supported and if so, to what extent.
Effects are tracked in the type system:
# Pure function type
let map : (a -> b) -> List a -> List b
# Function with sync effect
let read_file : String -> Eff (Result Error String)
# Function with async effect
let read_file : String -> Aff (Result Error String)
The type system implements bidirectional type inference:
- Expressions are analyzed to infer their type
- Type annotations can provide additional context
- Most general type is inferred when possible
Example:
# Inferred: a -> a
let identity = \x => x
# Inferred: Int -> Int -> Int
let add = \x y => x + y
# Annotated
let repeat : Int -> a -> List a = \n x => ...