I have a function to reconstruct a tree from 2 lists. I return a list on all branches, but I am getting an error that I don\'t understand. But I assume it has to do with the ret
Ionut gave a comprehensive explanation of how type unification works, so here is a hint:
[preoH, recon (preoLST@preoRST, inoLST@inoRST)]
The first element has type 'a and the second element has type 'a list.
[recon (preoLST, inoLST), preoH, recon (preoRST, inoRST)]
The second element has type 'a and the first and third element have type 'a list.
When you check lists for being empty, consider using null preoT
, or handle the case using pattern matching.