Hello Richard,
I think that `:type` should report the real type of an expressions (i.e., the fully generalized inferred type, just like it does now). Certainly I wouldn't want `:type` to show me some kind of (more or less) arbitrary specialization of the type.
It could be useful to have a ghci command that would show all instantiations of a class method (just 1 level deep) using the instances that are currently in scope. This would be essentially a combination of `:info` on a class and a method. For example, this is what it would look like on some of the methods in 7.10's Prelude:
:inst length
length :: [a] -> Int
length :: Maybe a -> Int
length :: Either a b -> Int
length :: (a,b) -> Int
:inst (==)
(==) :: Integer -> Integer -> Bool
(==) :: Word -> Word -> Bool
...
(==) :: Eq a => [a] -> [a] -> Bool -- Note that we only instantiate the outer class
...
(==) :: (Eq a, Eq b, Eq c) => (a,b,c) -> (a,b,c) -> Bool -- ditto
:inst mapM
mapM :: Monad m => (a -> m b) -> [a] -> m [b]
mapM :: Monad m => (a -> m b) -> Maybe a -> m (Maybe b)
mapM :: Monad m => (a -> m b) -> Either e a -> m (Either e b)
mapM :: Monad m => (a -> m b) -> (e,a) -> m (e,b)
This could be generalized to expressions, rather than just methods, but for expressions with multiple constraints one could get an explosion of possible instantiations. However, it would be quite cool to allow things like this:
:inst 1
1 :: Word
1 :: Integer
1 :: Int
1 :: Float
1 :: Double
Anyway, just some ideas.
-Iavor