<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">I agree with Iavor that :type should report the real type. I see this only stymieing and frustrating efforts to teach the language.<div class=""><br class=""></div><div class="">I do like the :inst idea.</div><div class=""><br class=""><div class=""><div><blockquote type="cite" class=""><div class="">On Apr 27, 2016, at 12:22 PM, Iavor Diatchki <<a href="mailto:iavor.diatchki@gmail.com" class="">iavor.diatchki@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">Hello Richard,<div class=""><br class=""></div><div class="">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.</div><div class=""><br class=""></div><div class="">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:</div><div class=""><br class=""></div><div class="">:inst length</div><div class="">length :: [a] -> Int</div><div class="">length :: Maybe a -> Int</div><div class="">length :: Either a b -> Int</div><div class="">length :: (a,b) -> Int</div><div class=""><br class=""></div><div class="">:inst (==)</div><div class="">(==) :: Integer -> Integer -> Bool</div><div class="">(==) :: Word -> Word -> Bool</div><div class="">...</div><div class="">(==) :: Eq a => [a] -> [a] -> Bool    -- Note that we only instantiate the outer class</div><div class="">...</div><div class="">(==) :: (Eq a, Eq b, Eq c) => (a,b,c) -> (a,b,c) -> Bool  -- ditto</div><div class=""><br class=""></div><div class="">:inst mapM</div><div class="">mapM :: Monad m => (a -> m b) -> [a] -> m [b]</div><div class="">mapM :: Monad m => (a -> m b) -> Maybe a -> m (Maybe b)</div><div class="">mapM :: Monad m => (a -> m b) -> Either e a -> m (Either e b)</div><div class="">mapM :: Monad m => (a -> m b) -> (e,a) -> m (e,b)</div><div class=""><br class=""></div><div class="">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:</div><div class=""><br class=""></div><div class="">:inst 1</div><div class="">1 :: Word</div><div class="">1 :: Integer</div><div class="">1 :: Int</div><div class="">1 :: Float</div><div class="">1 :: Double</div><div class=""><br class=""></div><div class="">Anyway, just some ideas.</div><div class=""><br class=""></div><div class="">-Iavor</div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div></div><div class="gmail_extra"><br class=""><div class="gmail_quote">On Wed, Apr 27, 2016 at 8:16 AM, Manuel Gómez <span dir="ltr" class=""><<a href="mailto:targen@gmail.com" target="_blank" class="">targen@gmail.com</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On Wed, Apr 27, 2016 at 10:15 AM, John Leo <<a href="mailto:leo@halfaya.org" class="">leo@halfaya.org</a>> wrote:<br class="">
> Speaking as someone teaching his coworkers Haskell now, Eric's is the best<br class="">
> suggestion I've seen so far.<br class="">
><br class="">
> What I like about it:<br class="">
> * The original meaning of :type is unchanged.<br class="">
> * No new command is added (I prefer adding a flag to adding another<br class="">
> command).<br class="">
> * With the flag on, the full type is shown along with the possible<br class="">
> specializations (and good to note the list might not be exhaustive).  This<br class="">
> way, beginners can still see what the type should look like even if they<br class="">
> want to ignore it for now.  This is similar to learning to read Japanese by<br class="">
> using furigana.  It may be a bit confusing for beginners at first, but I<br class="">
> expect they'll quickly learn to ignore it until they need it, and I agree it<br class="">
> will be useful for experienced Haskellers.<br class="">
<br class="">
</span>Perhaps a pleasant solution would be to borrow a convention from the<br class="">
PostgreSQL community's interactive console psql and its meta-commands:<br class="">
<a href="http://www.postgresql.org/docs/current/static/app-psql.html#APP-PSQL-META-COMMANDS" rel="noreferrer" target="_blank" class="">http://www.postgresql.org/docs/current/static/app-psql.html#APP-PSQL-META-COMMANDS</a><br class="">
<br class="">
For example:<br class="">
<br class="">
> \d[S+] [ pattern ]<br class="">
><br class="">
> For each [object] matching the pattern, show all columns, their types, the tablespace (if not the default) and any special attributes such as NOT NULL or defaults. […]  The command form \d+ is identical, except that more information is displayed: any comments associated with the columns of the table are shown, as is the presence of OIDs in the table, the view definition if the relation is a view, a non-default replica identitysetting.<br class="">
<br class="">
Many psql commands use this convention: add a + to the end of the<br class="">
command, and you get extra information.  It’s quite nmemonic.<br class="">
<div class="HOEnZb"><div class="h5">_______________________________________________<br class="">
ghc-devs mailing list<br class="">
<a href="mailto:ghc-devs@haskell.org" class="">ghc-devs@haskell.org</a><br class="">
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs" rel="noreferrer" target="_blank" class="">http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs</a><br class="">
</div></div></blockquote></div><br class=""></div>
_______________________________________________<br class="">ghc-devs mailing list<br class=""><a href="mailto:ghc-devs@haskell.org" class="">ghc-devs@haskell.org</a><br class="">http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs<br class=""></div></blockquote></div><br class=""></div></div></body></html>