On 13 August 2011 17:34, Patrick Browne <[email protected]> wrote:
> The :info command is a great help.
> Why does
>  :info g 4
> produce a parse error, while
>  :t g 4
> does not?

From :help in ghci:

:info [<name> ...]          display information about the given names

By "names", it's referring to existing definitions, either in imported
modules or defined within ghci using let, e.g.:

Prelude> let foo = "foo"
Prelude> :i foo
foo :: [Char]   -- Defined at <interactive>:1:5-7

So, ":info g" would work; as would ":info g T" (by getting the info of
both g and T _separately_)..  But ":info g 4" doesn't because of the
_4_, as it is a literal value, not a name of a value.  This also
happens with literal Strings, etc.

Doing ":t g 4" tells ghci to determine the type of the expression "(g
4)".  Note that even if you did ":info g T" it will _not_ give you the
info of the expression "(g T)".

-- 
Ivan Lazar Miljenovic
[email protected]
IvanMiljenovic.wordpress.com

_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to