If there are no arguments, then :info prints a list of all the files that are currently loaded into the interpreter.
Prelude> :info Hugs session for: /Hugs/lib/Prelude.hs Demo.hs Prelude>If there are arguments, then Hugs treats each one as a name, and displays information about any corresponding type constructor, class, or function. The following examples show the the kind of output that you can expect:
Prelude> :info Either -- type constructor data Either a b -- constructors: Left :: a -> Either a b Right :: b -> Either a b -- instances: instance (Eq b, Eq a) => Eq (Either a b) instance (Ord b, Ord a) => Ord (Either a b) instance (Read b, Read a) => Read (Either a b) instance (Show b, Show a) => Show (Either a b) instance Eval (Either a b) Prelude>Newtypes are dealt with in exactly the same way. For a simple example of a datatype with selectors, the output produced for a Time datatype:
data Time = MkTime { hours, mins, secs :: Int }is as follows:
Time> :info Time -- type constructor data Time -- constructors: MkTime :: Int -> Int -> Int -> Time -- selectors: hours :: Time -> Int mins :: Time -> Int secs :: Time -> Int -- instances: instance Eval Time Time>
Prelude> :info String -- type constructor type String = [Char] Prelude>The expansion is not included in the output if the synonym is restricted.
Prelude> :info Num -- type class class (Eq a, Show a, Eval a) => Num a where (+) :: a -> a -> a (-) :: a -> a -> a (*) :: a -> a -> a negate :: a -> a abs :: a -> a signum :: a -> a fromInteger :: Integer -> a fromInt :: Int -> a -- instances: instance Num Int instance Num Integer instance Num Float instance Num Double instance Integral a => Num (Ratio a) Prelude>
Time> :info . : hours min (.) :: (a -> b) -> (c -> a) -> c -> b (:) :: a -> [a] -> [a] -- data constructor hours :: Time -> Int -- selector function min :: Ord a => a -> a -> a -- class member Time>
Prelude> :info (:) Unknown reference `(:)' Prelude>This illustrates that the arguments are treated as textual names for operators, not syntactic expressions (for example, identifiers). The type of the (:) operator can be obtained using the command :info : as above. There is no provision for including wildcard characters of any form in the arguments of :info commands.
If a particular argument can be interpreted as, for example, both a constructor function, and a type constructor, depending on context, then the output for both possibilities will be displayed.