std.func 1.37 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
type Byte = 0..255
type Char = (Byte,Byte,Byte,Byte) # 32 bits
type List a = Cons a | Nil
type URL = URL List Char
type Maybe a = Just a | Nothing
type Tuple a b = Tuple a b

type Int = One | Inc Int # At least 64 bits accuracy
type Signed = Positive Int | Zero | Negative Int # At least 64 bits Two's Complement accuracy
type Real = Frac Signed Int # At least 64 bits floating point accuracy

type ByteArray = Slice List Byte  Maybe Int  Int

type Expression = Call List Char  List List Char | Let List Declaration  Expression | Match Expression   List Tuple  List List Char  Expression
type Type = Type List Char  List Type
type Declaration = Function List Char  Maybe Type  List List Char  Expression |
    Type List Char  List List Char   List Tuple  List Char Type |
    Import URL  Maybe List Char  List List Char  Maybe URL |
    Parser URL  List Char
Adrian Cochrane's avatar
Adrian Cochrane committed
20 21 22 23 24 25 26 27 28 29 30 31 32 33
type Program = Program List List Char  List Declaration # arguments: exports declarations

type Time = Time Real # Unix time
type Duration = Duration Real # In seconds
type Timeline a = Change Duration a Timeline a | Future Duration Timeline a | End

type MouseButton = Primary | Secondary | Middle
type Coord = Coord Real Real
type Mouse = Scroll Signed Signed |
    Press MouseButton | Release MouseButton |
    Move Coord
type Keyboard = Down Char | Up Char | Press Char
type Touch = Down Coord | Move Coord | Up Coord
type GameControl = # TODO