当我尝试显示负double或float时,为什么会出现分段错误?对于负整数没有问题。
Prelude> let a = 4
Prelude> :t a
a :: Integer
Prelude> let b = -4
Prelude> b
-4
Prelude> :t b
b :: Integer
Prelude> let c = 5.6
Prelude> :t c
c :: Double
Prelude> let d = -5.6
Prelude> :t d
d :: Double
Prelude> show d
"-Segmentation fault
我尝试了多种方式,似乎数字被正确理解但未显示。版本信息:
ghci --version
The Glorious Glasgow Haskell Compilation System, version 6.10.4
:t
显示一般类型而不是默认类型(即我得到Num t => t
和Fractional t => t
作为类型)。 - sepp2k