[Haskell-beginners] why is the :type different in ghci?

Ovidiu Deac ovidiudeac at gmail.com
Tue Aug 23 05:26:52 CEST 2011


Can somebody explain the following situation?

$ ghci
GHCi, version 7.0.3: http://www.haskell.org/ghc/  :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Prelude> :type map show
map show :: Show a => [a] -> [String]
Prelude> map show [1,2,3]
["1","2","3"]
Prelude> let f = map show
Prelude> :type f
f :: [()] -> [String]
Prelude> f [1,2,3]

<interactive>:1:8:
    No instance for (Num ())
      arising from the literal `3'
    Possible fix: add an instance declaration for (Num ())
    In the expression: 3
    In the first argument of `f', namely `[1, 2, 3]'
    In the expression: f [1, 2, 3]



More information about the Beginners mailing list