Re: :t / :f inconsistencies
Ross Paterson <[email protected]> Sun, 5 Feb 2006 14:35:03 +0000
| Newsgroups | gmane.comp.lang.haskell.hugs.user |
|---|---|
| Message-ID | <[email protected]> |
On Sun, Feb 05, 2006 at 02:09:39PM +0000, Neil Mitchell wrote: > I've always been confused when looking up symbols using :t and :f, > never knowing if it should have brackets or not. I have finally > figured out why I am confused: > > Hugs> :t (^) > (^) :: (Num a, Integral b) => a -> b -> a > Hugs> :t ^ > ERROR - Syntax error in expression (unexpected symbol "^") > Hugs> :f ^ > -- goes away and finds it > Hugs> :f (^) > ERROR - No current definition for name "(^)" > > Essentially, :t wants brackets, :f doesn't. > > I realise that in haskell ^ on its own is not a valid expression, and > therefore that is a reason for :t not working on it. Perhaps a symbol > on its own with no other stuff could be special cased for :t, since > its certainly a valid answer to the question the user was asking. > > I can't see any reason for :f not dropping brackets in all cases, > since :f (,) and :f () doesn't work anyway (because of the way tuples > are implicit in Hugs, it seems). > > With these two changes, all of the above examples would work > perfectly. I'm happy to have a go at hacking this up, provided its OK, > and I haven't missed anything in my interpretation. The current setup seems logical to me: :type <expr> :find <name> :info <name> I often use :t with more complex expressions, so it's no surprise. Changing it probably would do no harm, except for the extra complication; it just doesn't seem worth it to me.