Marc Van Dongen 

writes about the need of  constant :: a -> b ->

and explains that it is needed, for example, to convert constant
to polynomial.
I consider this as kind of support for the  

  Domain conversion proposal  in  basAlgPropos, section 'dcon'.

It suggests                              class Convertible
which I would like to reformulate now as
 
              class Cast a b where cast :: CastMode -> a -> b -> a

Example:                               cast _ f 2 
makes a polynomial from  2 :: Integer,
if   instance (Pol ..) Integer  is defined.
f  serves as the sample that denotes the particular domain of 
polynomials. This may be, for example - in [x] or in [x,y]  -
different domains.
Of course, the eager usage of Cast would often cause the ambiguity
- compile-time report.
Still the thing is useful in practice. And mathematically, it is a
highly cultural approach - to cast between the domains.
It is on the user how wide and how wise to set the  Cast  instances
- the user knows that it is often hard for Haskell to solve such 
instances.
I tried this in practice with GHC, Hugs - a very useful thing.

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








Reply via email to