about summary refs log tree commit diff stats
path: root/types.lua
blob: 042edcee86cade60289cd01894166f7b86b59a14 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
--- lam.types

local types = {}

function types.Type(x)
	if type(x) == "string" then
		-- Symbols are Lua strings
		return "Symbol"
	elseif type(x) == "number" then
		-- Numbers are Lua numbers
		return "Number"
	elseif x.__type then
		return x.__type
	elseif type(x) == "table" then
		-- Lists are Lua tables (non-adorned)
		return "List"
	else
		return type(x)
	end
end

types.Object = { __type = "Object" }
function types.Object:new(o)
	o = o or {}
	setmetatable(o, self)
	self.__index = self
	return o
end

--- Boxed types

-- Strings

-- Lists

---
return types