Maybe what I said is misleading, but I can do what I want now
(with an disadvantage):

-- plus.spad file starts here
)abbrev package PLSPKG PlusPackage

PlusPackage(A:SetCategory, B:AbelianSemiGroup) : Exports == Impl where
  Exports == with
     plus : ((A->B),(A->B))->(A->B)
  Impl == add
     plus(f,g) == x+->f(x)+g(x)

)abbrev package TEST1 TestPlusPackage

TestPlusPackage(A:Ring) : Exports == Impl where
  Exports == with
    double : A->A
    square : A->A
  Impl == add
    double x == x+x
    square x == x*x

)abbrev package MYPKG MyPackage

MyPackage(A:Ring) : Exports == Impl where
  Exports == with
    h : A->A
  Impl == add
    import PlusPackage(A,A)
    import TestPlusPackage(A)
    h x == plus(double,square) x
-- plus.spad file ends here


Now, in interpreter,

  )co plus
  -- success

(1) -> h 3

   (1)  15
                                                        Type: PositiveInteger
(2) -> h 3.1

   (2)  15.81
                                                                  Type: Float
(3) -> h x

         2
   (3)  x  + 2x
                                                    Type: Polynomial(Integer)

This is what I want, the only disadvantage is that this can not be
done in interpreter, but doing so in spad file is fine for me. And
there are not much typeing, the key here is 'import'.

Thanks for everyone's help!

-- 
You received this message because you are subscribed to the Google Groups 
"FriCAS - computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/fricas-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to