08Software Engineering7 of 44 runs pass

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.

#ModelRolloutsPass@1ScoreTime
1Claude Opus 5.5 max3/475.02.6h
2GPT-6 Astra xhigh2/450.03.1h
3GPT-6.1 Sol max2/450.03.6h
4GPT-5.6 Sol max0/402.0h
5Gemini 3.8 Flash high0/402.0h
6Qwen3.8 Max xhigh0/403.3h
7GLM 5.3 Flash max0/404.0h
8Muse Spark 1.3 max0/403.8h
9Kimi K3 max0/403.0h
10Grok 4.7 xhigh0/401.7h
11Claude Sonnet 5.5 max0/402.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
All tasks