On Wed, 2010-06-02 at 14:01 +1200, Richard O'Keefe wrote: > For what applications is it "useful" to use the same symbol > for operations obeying (or in the case of floating point > operations, *approximating* operations obeying) distinct laws? > >
If the given operations do share something in common. For example * is
usually commutative. However you do use it with quaternions (Hamilton
product). You even write ij = k despite the fact that ji = -k.
I gave the code which might have work for both Integral and Fractional
but it is not possible to type it in Haskell. Although I wouldn't mind
something like:
class Num a => Divisable a where
(./.) :: a -> a -> a
class (Real a, Enum a, Divisable a) => Integral a where
div = (./.)
...
class Divisable a => Fractional a where
(/) = (./.)
...
(/ and div preserve their meaning, ./. is the generalized division)
Regards
signature.asc
Description: This is a digitally signed message part
_______________________________________________ Haskell-Cafe mailing list [email protected] http://www.haskell.org/mailman/listinfo/haskell-cafe
