Kind1 icon indicating copy to clipboard operation
Kind1 copied to clipboard

Type checker is not infering forall type correctly

Open o-santi opened this issue 2 years ago • 0 comments

The following code

#derive[match]
record Surreal {
  left : List Surreal
  right : List Surreal
}

Surreal.add (x: Surreal) (y: Surreal) : Surreal
Surreal.add (Surreal.new xl xr) (Surreal.new yl yr) =
  let x = (Surreal.new xl xr)
  let y = (Surreal.new yl yr)
  let add = (list: List Surreal) => (n: Surreal) => (List.map ((y: Surreal) => Surreal.add n y) list)
  (Surreal.new (List.concat (add xl y) (add yl x)) (List.concat (add xr y) (add yr x)))

fails with

Cannot call this "(add xl y)"

which seems to be an issue with infering lambda types.

o-santi avatar Jan 03 '23 20:01 o-santi