~/dev> ghci
GHCi, version 7.6.3: http://www.haskell.org/ghc/ :? for help
:Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... tlinking ... done.
Prelude>
Simply enter :type
followed by a name:
Prelude> :type map
map :: (a -> b) -> [a] -> [b]
You can also get the types of partially-applied functions:
Prelude> :type map show
map show :: Show a => [a] -> [String]
Use the :info
command:
Prelude> :info Num
class Num a where
(+) :: a -> a -> a
(*) :: a -> a -> a
(-) :: a -> a -> a
negate :: a -> a
abs :: a -> a
signum :: a -> a
fromInteger :: Integer -> a
-- Defined in `GHC.Num'
instance Num Integer -- Defined in `GHC.Num'
instance Num Int -- Defined in `GHC.Num'
instance Num Float -- Defined in `GHC.Float'
instance Num Double -- Defined in `GHC.Float'
Loading a file can be achieved using the :load
command. Path is relative to where you started GHCI.
Prelude> :l src/Cis194/Hw/Week1.hs
[1 of 1] Compiling Cis194.Hw.Week1 ( src/Cis194/Hw/Week1.hs, interpreted )
Ok, modules loaded: Cis194.Hw.Week1.
*Cis194.Hw.Week1>