diff: polymorphic abstract exported eqv types error
Fergus Henderson
fjh at cs.mu.OZ.AU
Wed Jan 28 02:24:43 AEDT 1998
On 28-Jan-1998, Fergus Henderson <fjh at cs.mu.OZ.AU> wrote:
> Estimated hours taken: 1
>
> compiler/make_hlds.m:
> Print out a "Sorry, not implemented" message for
> abstract exported polymorphic equivalence types
> whose bodies have fewer type variables than their
> heads. (Previously the compiler allow this,
> but generated code that dumped core.)
Amazing how a little bit of testing helps...
Estimated hours taken: 0.25
library/graph.m:
Modify the code to avoid a (spurious in this case, as it happens)
"Sorry, not implemented" message for abstract exported polymorphic
equivalence types whose bodies have fewer type variables than their
heads.
Index: graph.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/graph.m,v
retrieving revision 1.17
diff -u -u -r1.17 graph.m
--- graph.m 1998/01/23 12:33:18 1.17
+++ graph.m 1998/01/27 15:19:40
@@ -167,9 +167,9 @@
:- type graph__arc_supply == int.
-:- type node(N) == int.
+:- type node(N) ---> node(int).
-:- type arc(A) == int.
+:- type arc(A) ---> arc(int).
:- type arc_info(N, A) ---> arc_info(node(N), node(N), A).
@@ -183,19 +183,19 @@
%------------------------------------------------------------------------------%
-graph__set_node(G0, NInfo, N, G) :-
+graph__set_node(G0, NInfo, node(N), G) :-
graph__get_node_supply(G0, NS0),
NS is NS0 + 1,
N = NS,
graph__set_node_supply(G0, NS, G1),
graph__get_nodes(G1, Nodes0),
- map__set(Nodes0, N, NInfo, Nodes),
+ map__set(Nodes0, node(N), NInfo, Nodes),
graph__set_nodes(G1, Nodes, G2),
graph__get_edges(G2, Edges0),
map__init(EdgeMap),
- map__set(Edges0, N, EdgeMap, Edges),
+ map__set(Edges0, node(N), EdgeMap, Edges),
graph__set_edges(G2, Edges, G).
graph__det_insert_node(G0, NInfo, N, G) :-
@@ -208,7 +208,7 @@
error("graph__det_insert_node: node already exists.")
).
-graph__insert_node(G0, NInfo, N, G) :-
+graph__insert_node(G0, NInfo, node(N), G) :-
% Make sure that the graph doesn't contain
% NInfo already.
graph__get_nodes(G0, Nodes0),
@@ -220,12 +220,12 @@
graph__set_node_supply(G0, NS, G1),
graph__get_nodes(G1, Nodes1),
- map__set(Nodes1, N, NInfo, Nodes),
+ map__set(Nodes1, node(N), NInfo, Nodes),
graph__set_nodes(G1, Nodes, G2),
graph__get_edges(G2, Edges0),
map__init(EdgeSet),
- map__set(Edges0, N, EdgeSet, Edges),
+ map__set(Edges0, node(N), EdgeSet, Edges),
graph__set_edges(G2, Edges, G).
%------------------------------------------------------------------------------%
@@ -276,7 +276,7 @@
graph__set_edge(G0, Start, End, Info, Arc, G) :-
graph__get_arc_supply(G0, AS0),
AS is AS0 + 1,
- Arc = AS,
+ Arc = arc(AS),
graph__set_arc_supply(G0, AS, G1),
graph__get_arcs(G1, Arcs0),
@@ -304,7 +304,7 @@
graph__insert_edge(G0, Start, End, Info, Arc, G) :-
graph__get_arc_supply(G0, AS0),
AS is AS0 + 1,
- Arc = AS,
+ Arc = arc(AS),
graph__set_arc_supply(G0, AS, G1),
graph__get_arcs(G1, Arcs0),
--
Fergus Henderson <fjh at cs.mu.oz.au> | "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh> | of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3 | -- the last words of T. S. Garp.
More information about the developers
mailing list