Negative doubles or floats in Haskell (macports)

前端 未结 4 714
感情败类
感情败类 2020-12-21 01:28

Why do I get a segmentation fault when I try to show a negative double or float? There is no problem for negative integers.

Prelude> let a = 4
Prelude>         


        
4条回答
  •  太阳男子
    2020-12-21 02:08

    The most important thing you should realise is that segmentation faults should never occur in Haskell. Its type system ensures that nothing like that "goes wrong" at runtime. If you do see a segmentation fault then either there is a bug in your Haskell compiler or you're interfacing to C code with the Haskell FFI and something has gone wrong with your C code. In pure Haskell code, however, you should never see this.

提交回复
热议问题