David, David,
Using recent sources, the following caused an internal error as described in the comment. The problem persists when I update to the very latest (rev. 866).
fun present (eq : ('a * 'a) -> bool) (x: 'a) : 'a list -> bool = ( let fun test (h :: t) = eq(x,h) orelse test t | test [] = false in test end ); fun insert (eq:'a * 'a -> bool) (lst : 'a list) (what : 'a) = ( if present eq what lst then lst else (what :: lst) ); (* following cut down extract from a test script fails with: Exception- InternalError: Equality for function raised while compiling *) [ (insert (op =) []), (insert (op =) [1]) ];
Regards,
Rob.
Rob, Thanks for cutting that down into something manageable. I've now fixed it. I'd forgotten about the case of an overloaded type when generating equality functions. There doesn't appear to be any overloading in your example until you look very closely and realise that "1" is actually overloaded on both int and Int32.int. Regards, David
Rob Arthan wrote:
Using recent sources, the following caused an internal error as described in the comment. The problem persists when I update to the very latest (rev. 866).
fun present (eq : ('a * 'a) -> bool) (x: 'a) : 'a list -> bool = ( let fun test (h :: t) = eq(x,h) orelse test t | test [] = false in test end ); fun insert (eq:'a * 'a -> bool) (lst : 'a list) (what : 'a) = ( if present eq what lst then lst else (what :: lst) ); (* following cut down extract from a test script fails with: Exception- InternalError: Equality for function raised while compiling *) [ (insert (op =) []), (insert (op =) [1]) ];