OCaml Polymorphic Parameters
Implement polymorphic function parameters in the OCaml compiler: explicitly polymorphic parameter types checked and inferred through the type checker and backends.
Results
Each square represents one run. Score is the percentage of runs that pass: 0, 25, 50, 75, or 100 for four runs.
| # | Model | Rollouts | Pass@1 | Score | Time |
|---|---|---|---|---|---|
| 1 | Claude Opus 5.5 max | 3/4 | 2.6h | ||
| 2 | GPT-6 Astra xhigh | 2/4 | 3.1h | ||
| 3 | GPT-6.1 Sol max | 2/4 | 3.6h | ||
| 4 | GPT-5.6 Sol max | 0/4 | 2.0h | ||
| 5 | Gemini 3.8 Flash high | 0/4 | 2.0h | ||
| 6 | Qwen3.8 Max xhigh | 0/4 | 3.3h | ||
| 7 | GLM 5.3 Flash max | 0/4 | 4.0h | ||
| 8 | Muse Spark 1.3 max | 0/4 | 3.8h | ||
| 9 | Kimi K3 max | 0/4 | 3.0h | ||
| 10 | Grok 4.7 xhigh | 0/4 | 1.7h | ||
| 11 | Claude Sonnet 5.5 max | 0/4 | 2.6h |
Background
OCaml already supports higher-rank polymorphism in polymorphic record fields and methods, but a function parameter is always monomorphic inside the function body. A function that needs to use an argument at two different types has to take it wrapped in a record or object that every caller then builds. Jane Street's compiler has supported polymorphic parameters for a while, and the task brings the feature to the upstream compiler.
Task
The agent implements polymorphic function parameters: arrow types with a polymorphic parameter such as ('a. 'a -> 'a) -> int, annotated polymorphic parameters in every function form, and applications whose argument must be at least as general as the parameter. The new arrows take part in unification, instantiation, generalization, type equality, signature inclusion and coercions. A polymorphic type is never inferred, and every program accepted today must keep its current type and meaning.
Workspace
The offline sandbox (4 CPUs, 8 GB, 4 hours) holds the OCaml compiler repository at the starting commit.
Verification
The committed HEAD is rebuilt and bootstrapped in a clean checkout with the trusted test suite and bootstrap binaries restored. Hidden phrases in seven families are compared with pre-registered reference observations: whether each is accepted or rejected, the error messages, printed signatures, warnings including under -principal, and program output. The compiler's own test suite must pass with no regressions, and every family must reach 90%.
Environment
- Toolchain
- OCaml
- Compute
- 4 CPUs · 8 GB RAM
- Network
- Offline
- Time limit
- 4 hours