--*-M2-*-

-- develop this a bit further and install:

TypedList = new Type of List;
intersect TypedList := x -> (
     if #x === 0 and null =!= lookup(class,class x)
     then ideal lookup(ring,lookup(class,class x))
     else intersect toSequence x);
TypedListType = new Type of Type
net TypedListType := X -> "List of " | net lookup(class,X);
RingedIdealType = new Type of Type
net RingedIdealType := X -> "Ideal of " | net lookup(ring,X);
listOfIdealOf = (cacheValue listOfIdealOf) (
     R -> new TypedListType of TypedList from hashTable {
	  class => new RingedIdealType of Ideal from hashTable { ring => R }
	  }
     );
oldmethod := lookup(decompose, Ideal);
decompose Ideal := I -> new listOfIdealOf ring I from oldmethod I;
R = QQ[x,y,z];
decompose ideal (x*y)
intersect oo
decompose ideal 1_R
intersect oo
