Juergen Pfitzenmaier <[EMAIL PROTECTED]>

writes on 9 Feb 2000 

> Maybe I understand why Sergey wants to use overlapping instances in his
> DoCon. 2 years ago I tried to the same thing in C++ (also while implementing
> a computer algebra system).  Overlapping instances *may* be useful, but
> in combination with parametrized containers for algebraic things they are
> likely to fail. Just one small example (sorry this is c++ -- I can't think
> haskell late in the evening -- but the idea holds the same in haskell):
> [..]
> mail me if someone wants more info or a haskell example; I'm about to write
> a paper about implementation strategies for containers of algebraic things.


I would hardly understand examples scripted in C++.
So, please, provide the example in Haskell.

If you need my experience in this, see first
             http://www.botik.ru/pub/local/Mechveliani/basAlgPropos/,
then         http://haskell.org/docon/2/

And, I do not know, maybe, it worths to move to the private
discussion - for a while.

Probably, people would consider the approach in  ..docon/2/
as too complex. But I cannot invent so far of any better way. 
The most nasty place is the domain constructors that take the 
parameters, and need to be dynamic, otherwise, a rather poor tool
appears. 
I wonder whether even the language can be extended so that it would
remain functional and support the above domain treating.
The overlapping instances, they cause much less problems.


> In the same way Sergey could handle the special algorithms in his examples
> to compute the determinant of a matrix. In this case the matrix container
> depends on only one type - the type of the elements - but the algorithms
> depend also on the structure of the matrix (dense, sparse, modular,...) and
> so we pack the algorithms together with a description of the structure of the
> matrix in a type argument for the matrix container.

I would rather formulate this as follows.
                    det mM  for  mM :: CommutativeRing a => Matrix a

is computed in a generic way for the case of `a' belonging to the 
category (class) CommutativeRing.
But `a' can also have structure, it may occur built from other 
domains with constructors. For example, for 
                                         a = UnivariatePolynomial k,  
                                         k  of FiniteField category.
Here, there are possible at least two methods for  det mM:
the generic (coming from CommutativeRing)
and the special - based on the particular construction of `a'.
The special one is cheaper to compute, and it has to override the 
generic.

------------------
Sergey Mechveliani
[EMAIL PROTECTED]







Reply via email to