Dave,
It seems to be a bug with printing the value of a polymorphic equality
type variable. "s" has type ''a and that upsets the debugger. It works
either if there is a type constraint to force the type of "s" to be int
list or if "member" is changed so that the equality function is passed
as an argument and the functions are fully polymorphic. I need to find
out why equality types cause problems.
David
On 09/11/2018 05:29, David Topham wrote:
I am trying to use the debugger in PolyML but always get errors. Here is
my code:
PolyML.Compiler.debug := true;
open PolyML.Debug;
fun member(x,[]) = false
| member(x,(y::ys)) = if x = y then true else member(x,(ys));
member(2,[2,3,4]); (* expect true *)
member(5,[2,3,4]); (* expect false *)
fun subset([],s) = true
| subset((x::xs),s) = member(x,s) andalso subset(xs,s);
fun equals(s1,s2) = subset(s1,s2) andalso subset(s2,s1);
breakIn "subset";
subset([],[1,2,3]); (* expect true *)
subset([2],[1,2,3]); (* expect true *)
It does break at the debug prompt, but when typing
dump();
it crashes with: Function subset:Exception- Cast "toAddress" raised
Do you have any suggestions?
I am using Debian 9 64-bit and installed using apt-get
"polyml is already the newest version (5.6-8)"
-Dave
_______________________________________________
polyml mailing list
polyml@inf.ed.ac.uk
http://lists.inf.ed.ac.uk/mailman/listinfo/polyml