diff --git a/joy/utils/polytypes.py b/joy/utils/polytypes.py index 45d2e73..acba4b8 100644 --- a/joy/utils/polytypes.py +++ b/joy/utils/polytypes.py @@ -355,6 +355,8 @@ def type_check(name, stack): except KeyError: return # None, indicating unknown + stack = _foo_stack(stack) + for fi, fo in infer(func): try: U = unify(fi, stack) @@ -369,6 +371,16 @@ def type_check(name, stack): return False +def _foo_stack(stack, s=None): + if s is None: + s = (StackJoyType(n) for n in xrange(23, 100)) + if stack == (): + return next(s) + if isinstance(stack, tuple): + return tuple(_foo_stack(inner, s) for inner in stack) + return stack + + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9 = A b0, b1, b2, b3, b4, b5, b6, b7, b8, b9 = B n0, n1, n2, n3, n4, n5, n6, n7, n8, n9 = N