Thank you David, That is very helpful information and maybe good to add to the Debugger tutorial to help others. If I explicitly add type information to variables the debugger works.
On Sat, Nov 10, 2018 at 4:00 AM <polyml-request at inf.ed.ac.uk> wrote:
Send polyml mailing list submissions to polyml at inf.ed.ac.uk
To subscribe or unsubscribe via the World Wide Web, visit http://lists.inf.ed.ac.uk/mailman/listinfo/polyml or, via email, send a message with subject or body 'help' to polyml-request at inf.ed.ac.uk
You can reach the person managing the list at polyml-owner at inf.ed.ac.uk
When replying, please edit your Subject line so it is more specific than "Re: Contents of polyml digest..."
Today's Topics:
- Re: Debugger (David Matthews)
Message: 1 Date: Fri, 9 Nov 2018 13:13:17 +0000 From: David Matthews <David.Matthews at prolingua.co.uk> To: polyml at inf.ed.ac.uk Subject: Re: [polyml] Debugger Message-ID: <ab525449-d652-c995-211a-675dc359063b at prolingua.co.uk> Content-Type: text/plain; charset=utf-8; format=flowed
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
Subject: Digest Footer
polyml mailing list polyml at inf.ed.ac.uk http://lists.inf.ed.ac.uk/mailman/listinfo/polyml
End of polyml Digest, Vol 152, Issue 3
-- The University of Edinburgh is a charitable body, registered in Scotland, with registration number SC005336.
--
-Dave