Because b
is basically a function from Num a
dictionary to [a]
for some a
. If this were a concrete type then it would be as you expected:
let a Prelude> let a = [1..4] :: [Int]
Prelude> let b = map (*8) a
Prelude> :sprint b
b = _
Prelude> b
[8,16,24,32]
Prelude> :sprint b
b = [8,16,24,32]
EDIT
Side by side it will hopefully be even more apparent:
Prelude> let a = [1..4]
Prelude> :t a
a :: (Num a, Enum a) => [a]
Prelude> let poly_b = map (*8) a
Prelude> let concrete_b = map (* (8 ::Int)) a
Prelude> :sprint poly_b
poly_b = _
Prelude> :sprint concrete_b
concrete_b = _
Prelude> poly_b
[8,16,24,32]
Prelude> concrete_b
[8,16,24,32]
Prelude> :sprint poly_b
poly_b = _
Prelude> :sprint concrete_b
concrete_b = [8,16,24,32]
EDIT 2: It occurs to me that the monomorphism restriction, or lack thereof in the REPL, could be causing some confusion. In compiled code the value in a let statement would take on a single concrete type and not be polymorphic, thus not have this "problem" at all:
Prelude> :set -XMonomorphismRestriction
Prelude> let a = [1..4]
Prelude> let b = map (*8) a
Prelude> :sprint b
b = _
Prelude> b
[8,16,24,32]
Prelude> :sprint b
b = [8,16,24,32]