[Hugs-users] :t / :f inconsistencies

Neil Mitchell ndmitchell at gmail.com
Sun Feb 5 09:09:39 EST 2006


Hi,

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.

Thanks

Neil


More information about the Hugs-Users mailing list