Mercury Bugs - mercury
View Issue Details
0000055mercuryBugpublic2008-03-29 02:382008-06-02 15:06
Reporterobo 
Assigned To 
PrioritynormalSeveritymajorReproducibilityalways
StatusconfirmedResolutionopen 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version 
Summary0000055: typeclass instances for e.g. bag(T) no longer work
Descriptionwith rotd-2008-03-27, the attached file bug.m gives the following error:

bug.m:001: Warning: interface for module `bug' does not export anything.
bug.m:011: In instance declaration for `bug.fooable((bag.bag(V)))':
bug.m:011: the first arg contains a type variable which is used in another
bug.m:011: arg

with rotd-2007-08-13, the same code was compilable and worked as expected.


When I tried to avoid the type variable by instantiating the typeclass for eg. bag(string) specifically, the recent ROTD gives me this error:

testhugemap.m:047: In instance declaration for
testhugemap.m:047: `pickle.tc_picklable((bag.bag(string)))':
testhugemap.m:047: the first arg is a type whose first arg is not a variable

What is the correct way of instantiating such typeclasses?

Thanks, Ondrej.


TagsNo tags attached.
Attached Files? bug.m (206) 2008-03-29 02:38
https://bugs.mercurylang.org/file_download.php?file_id=47&type=bug

Notes
(0000096)
mark   
2008-03-29 12:00   
The basic problem is the following restriction from the
reference manual:

    "The types in an instance declaration must not be abstract
    types which are elsewhere defined as equivalence types."

bag/1 is an abstract type that happens to be defined as an
equivalence type.

The error message is just plain wrong, however.
(0000103)
juliensf   
2008-06-02 15:06   
I have changed the definition of bag/1 so that it can be used in type class instances --
the issue with the error message is still a bug though.

Issue History
2008-03-29 02:38oboNew Issue
2008-03-29 02:38oboFile Added: bug.m
2008-03-29 12:00markNote Added: 0000096
2008-03-29 12:02markStatusnew => confirmed
2008-06-02 15:06juliensfNote Added: 0000103