You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Unannotated recursive local binding: Cannot unify 'Int -> Int' with 'Int -> Int' #680
A local binding that has no type signature and refers to itself inside a lambda passed to another function is rejected by Iris with a CannotUnify error between two identical types. purs 0.15.16 accepts the same code.
Repro
moduleMainwhereimportPreludecall::forallf. (Unit->f) ->f
call k = k unit
f::Int->Int
f = go
where
go = call \_ -> go
Iris 0.1.15
Error! · [CannotUnify] · src/Main.purs:11:3
│
• Cannot unify 'Int -> Int' with 'Int -> Int'
│
│ go = call \_ -> go
│ ╰─────────────────
purs 0.15.16 (via spago) builds the same module successfully.
What changes the result
Adding a signature to the local binding (go :: Int -> Int) makes Iris accept it.
The same binding at top level, without a signature, is accepted.
let inside do fails the same way as where.
Rank-N is not required: call :: forall f. (forall x. x -> f) -> f fails identically.
Where it shows up
The playwright package (registry package set) uses this pattern in three places, so any project depending on it fails to build with Iris. For example, in Playwright/Dialog.purs:
Fixed in aeedfce ([checking] Fix unannotated recursive local bindings).
An unannotated local binding with no arguments, such as go = call \_ -> go, could already have its placeholder type linked to the body's type by the time the body was inferred. The let-binding checker then solved that unification variable to itself, which the occurs check rejects, so Iris reported Cannot unify 'Int -> Int' with 'Int -> Int'. It now relates the two types with unify, which accepts identical types before solving, as upstream's unifyTypes does.
The regression fixture is tests-integration/fixtures/compiler/1794636859_unannotated_recursive_local_lambda. klntsky/purescript-playwright now builds with no errors; before the fix it failed in Playwright/Dialog.purs and Playwright.purs.
Activity
purefunctor commentedon Nov 14, 2026
Fixed in aeedfce ([checking] Fix unannotated recursive local bindings).
An unannotated local binding with no arguments, such as
go = call \_ -> go, could already have its placeholder type linked to the body's type by the time the body was inferred. The let-binding checker then solved that unification variable to itself, which the occurs check rejects, so Iris reportedCannot unify 'Int -> Int' with 'Int -> Int'. It now relates the two types withunify, which accepts identical types before solving, as upstream'sunifyTypesdoes.The regression fixture is
tests-integration/fixtures/compiler/1794636859_unannotated_recursive_local_lambda. klntsky/purescript-playwright now builds with no errors; before the fix it failed inPlaywright/Dialog.pursandPlaywright.purs.