On Sun, Feb 05, 2012 at 03:02:35PM +0100, Ralf Hemmecke wrote:
>> But here is a small example:
>> the below package  DChar1  uses  dropWhile  and  span  of the package
>> DList1.
>> For  dropWhile,  the comiler insists on adding   $ DList1(Character)
>> (otherwise reports of a certain error).
>
> [snip]
>
>> )abbrev package DCHAR1 DChar1
>> DChar1() : with
>>     foo : List Character ->  Product(List Character, List Character)
>>   ==
>>    add
>>      foo(xs : List Character) :
>>                             Product(List Character, List Character) ==
>>
>>            xs0  := dropWhile(x +->  x = space, xs)   $ DList1(Character)
>>                                                  -- $ cannot be omitted
>>            span(x +->  not digit?(x), xs0)
>
> If you remove the line starting with xs0 and replace xs0 by xs in the  
> next line, the compiler also insists on adding $DList1(Character) for 
> span.
>
> Obviously, using $DList1(Character) for package calling dropWhile means  
> to import the functions from DList1(Character).
>
> So your function foo would also work if you introduce
>
>    import DList1(Character)
>
> just before the line "xs0 := ...".
>
> I'm not sure, however, whether I like that package calling should import  
> all other functions from that package. I tend to dislike it and consider  
> it a compiler bug.

Is there a way to import only a couple of chosen items from a package?
I Haskell, we write, for example, 
                                 import Foo (A(..), T(..), foo)   

to import from the _module_ Foo  a class (category) A, a data type T,
and a function  foo.  Only these three items will be imported
(+ all the class instances defined in Foo for the data type  T)
(I guess, a messy job to correctly implement all this in the compiler, 
even writing it in Haskell).

Generally, it would be natural to have a similar possibility in Spad
(I do not know, may be it has such).

Regards, 

------
Sergei
[email protected]

-- 
You received this message because you are subscribed to the Google Groups 
"FriCAS - computer algebra system" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/fricas-devel?hl=en.

Reply via email to