Closed lukaszcz closed 1 week ago
myCons@{elem := f elem; next := go f next};
desugars to
let var1 = f elem
var2 = go f next
in myCons var1 var2
Yes, termination fails also when explicitly desugared. Typechecking:
go {A B} (f : A -> B) : MyList A -> MyList B
| myNil := myNil
| myCons@{elem; next} :=
let var1 := f elem;
var2 := go f next;
in myCons var1 var2;
gives:
The following functions fail the termination checker:
• var2
• go
Even this fails:
go {A B} (f : A -> B) : MyList A -> MyList B
| myNil := myNil
| (myCons elem next) :=
let var1 := f elem;
var2 := go f next;
in myCons var1 var2;
So the problem is, weirdly, with the let
, not with record syntax as such.
I think this is the problem:
-- NOTE that we forget about the arguments of the hosting function
scanLetClause :: (Members '[State CallMap] r) => LetClause -> Sem r ()
Typechecking
gives the error
But the following type-checks:
Termination checking needs to be adapted to deal with record creation/update syntax (or whatever it is desugared to in Internal).