Vaguely, this is still a limitation of monomorphism in a game (or rather, its absence when in GHCi). Since GHCi has no restriction on monomorphism, your definitions of mi and ma do not become specialized for Int , as you think, they will be - instead, they remain generally like mi, ma :: Bounded a => a and the variables a are instantiated twice
- once as
() in fromIntegral $ length $ show ma (as you noticed, this is the default value) - once
Int in [mi,ma,le] :: [Int]
If you want mi and ma really be of type Int , annotate them as such directly
Prelude> :{ Prelude| let mi, ma :: Int Prelude| mi = minBound Prelude| ma = maxBound Prelude| le = fromIntegral $ length $ show ma Prelude| in [mi,ma,le] Prelude| :} [-9223372036854775808,9223372036854775807,19]
Or enable monomorphism restriction manually in GHCi
Prelude> :set -XMonomorphismRestriction Prelude> :{ Prelude| let mi = minBound Prelude| ma = maxBound Prelude| le = fromIntegral $ length $ show ma Prelude| in [mi,ma,le] :: [Int] Prelude| :} [-9223372036854775808,9223372036854775807,19]
source share