
Sun, 11 Feb 2001 22:27:53 -0500, Dylan Thurston
Reading this, it occurred to me that you could explictly declare an instance of Powerful Integer Integer and have everything else work.
No, because it overlaps with Powerful a Integer (the constraint on a doesn't matter for determining if it overlaps).
Then the second argument of (^) is always arbitrary RealIntegral,
Nit: the second argument should be an Integer, not an arbitrary RealIntegral.
Of course not. (2 :: Integer) ^ (i :: Int) makes perfect sense.
You forgot toInteger.
Oh, right. I actually had it and then deleted it. On the one hand, it feels very implementation-specific to me, comparable to the decodeFloat routines
It is needed for conversions (fromIntegral in particular).
class Convertible a b where convert :: a -> b maybe with another class like class (Convertible a Integer) => ConvertibleToInteger a where toInteger :: a -> Integer toInteger = convert
This requires to write a Convertible instance in addition to ConvertibleToInteger, where currently mere toInteger in Integral suffices. Since Convertible must be defined separately for each pair of types (otherwise instances would easily overlap), it's not very useful for numeric conversions. Remember that there are a lot of numeric types in the FFI: Int8, Word16, CLong, CSize. It does not provide anything in this area so should not be required to define instances there. After a proposal is developed, please check how many instances one has to define to make a type the same powerful as Int, and is it required to define methods irrelevant to non-mathematical needs. basAlgPropos fails badly in this criterion.
Convertible a b should indicate that a can safely be converted to b without losing any information and maintaining relevant structure;
So fromInteger does not require Convertible, which is inconsistent with toInteger. Sorry, I am against Convertible in Prelude - tries to be too general, which makes it inappropriate. -- __("< Marcin Kowalczyk * qrczak@knm.org.pl http://qrczak.ids.net.pl/ \__/ ^^ SYGNATURA ZASTÊPCZA QRCZAK