Verified interview challenge
Infer return types in a toy language
Match concrete arguments to generic function types and construct the resulting return type.
Unlock with Full AccessThe challenge
Work with a supplied object model for primitive types, nested tuples and generic function signatures. Format those types consistently, then infer a function's return type from the concrete arguments at a call site.
A generic can stand for an entire nested type and can appear more than once in a signature. The exercise tests structural matching and consistent substitution, with no parser to build.
What you'll practise
Recursive structure
Compare and format nested types without losing their shape.
Generic consistency
Carry bindings through repeated occurrences and construct the concrete output type.
# Your implementation goes here
# Run examples and inspect results
# Full starter code includedRun your code to see results.