Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Planned syntax

Hello world

main : Out c => c ()
main = print "Hello world"

Top-level defs

-- Optional type annotations.
id x = x

const : a -> b -> a
const x y = x

ADTs

Point a = @data {
  x : a,
  y : a
}

List a = @data Cons a (List a)
             | Nil

-- Optional kind annotations.
Functor : * -> *
Functor f = @class
  { map : (a -> b) -> f a -> f b
  , _<*_ : a -> f b -> f a
  }

Comptime

-- The List example from before can be rewritten as:
List a = @data
  { Cons a $ List a
  | Nil
  }

-- At comptime, everything is values.
-- Here, $ treats types as values,
-- so the compiler infers it must be comptime.