diff: typeclasses (round 2) [3/4]
David Glen JEFFERY
dgj at cs.mu.oz.au
Thu Dec 18 19:02:07 AEDT 1997
Here's the changes to the library.
------------------------------------------------------------------------------
diff -u -r library/mercury_builtin.m /home/pgrad/dgj/mer/work/mercury/library/mercury_builtin.m
--- library/mercury_builtin.m Thu Dec 18 14:55:48 1997
+++ /home/pgrad/dgj/mer/work/mercury/library/mercury_builtin.m Wed Dec 17 14:31:04 1997
@@ -244,9 +244,18 @@
:- type typeclass_info ---> typeclass_info(base_typeclass_info /*, ... */).
:- type base_typeclass_info ---> typeclass_info(int /*, ... */).
+ % type_info_from_typeclass_info(TypeClassInfo, Index, TypeInfo)
+ % extracts TypeInfo from TypeClassInfo, where TypeInfo is the Indexth
+ % type_info in the typeclass_info
+ %
+ % Note: Index must be equal to the number of the desired type_info
+ % plus the number of superclasses for this class.
:- pred type_info_from_typeclass_info(typeclass_info, int, type_info(T)).
:- mode type_info_from_typeclass_info(in, in, out) is det.
+ % superclass_from_typeclass_info(TypeClassInfo, Index, SuperClass)
+ % extracts SuperClass from TypeClassInfo where TypeInfo is the Indexth
+ % superclass of the class.
:- pred superclass_from_typeclass_info(typeclass_info, int, typeclass_info).
:- mode superclass_from_typeclass_info(in, in, out) is det.
@@ -270,16 +279,14 @@
% Many of the predicates defined in this module are builtin -
% the compiler generates code for them inline.
-:- pragma c_code(will_not_call_mercury,
- type_info_from_typeclass_info(TypeClassInfo::in, Index::in,
- TypeInfo::out),
+:- pragma c_code(type_info_from_typeclass_info(TypeClassInfo::in, Index::in,
+ TypeInfo::out), will_not_call_mercury,
"
TypeInfo = MR_typeclass_info_type_info(TypeClassInfo, Index);
").
-:- pragma c_code(will_not_call_mercury,
- superclass_from_typeclass_info(TypeClassInfo0::in, Index::in,
- TypeClassInfo::out),
+:- pragma c_code(superclass_from_typeclass_info(TypeClassInfo0::in, Index::in,
+ TypeClassInfo::out), will_not_call_mercury,
"
TypeClassInfo =
MR_typeclass_info_superclass_info(TypeClassInfo0, Index);
love and cuddles,
dgj
--
David Jeffery (dgj at cs.mu.oz.au) | Marge: Did you just call everyone "chicken"?
MEngSc student, | Homer: Noooo. I swear on this Bible!
Department of Computer Science | Marge: That's not a Bible; that's a book of
University of Melbourne | carpet samples!
Australia | Homer: Ooooh... Fuzzy.
More information about the developers
mailing list