diff options
-rw-r--r-- | type.lua | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/type.lua b/type.lua index cf24d0c..6dbf313 100644 --- a/type.lua +++ b/type.lua | |||
@@ -266,7 +266,9 @@ end | |||
266 | 266 | ||
267 | -- type assertion | 267 | -- type assertion |
268 | function m.assert_type (x, t) | 268 | function m.assert_type (x, t) |
269 | if not m.isp(x, t) then | 269 | local pred = function (a) return m.isp(a, t) end |
270 | if t == "list" then pred = m.listp end | ||
271 | if not pred(x) then | ||
270 | error("wrong type", m.lamtype(x), t) | 272 | error("wrong type", m.lamtype(x), t) |
271 | end | 273 | end |
272 | end | 274 | end |