Haskell中的负双打或浮动(macports) [英] Negative doubles or floats in Haskell (macports)

查看:95
本文介绍了Haskell中的负双打或浮动(macports)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么当我尝试显示负双或浮动时出现分段错误?负数整数没有问题。

  Prelude>让a = 4 
Prelude> :t a
a ::整数
前奏>让b = -4
前奏> b
-4
前奏> :t b
b :: Integer
Prelude>让c = 5.6
Prelude> :t c
c :: Double
Prelude>让d = -5.6
前奏> :t d
d :: Double
Prelude>显示d
- 分段错误

我尝试过不同的方法,版本信息:

  ghci --version 
Glorious Glasgow Haskell编译系统,版本6.10.4


解决方案

MacPorts上的GHC似乎被打破。请参阅 https://trac.macports.org/ticket/25265



请考虑从haskell.org安装Haskell Platform,其中包含GHC 6.12.3和一束Haskelly的好东西。


  • 信息: http://hackage.haskell.org/platform/

  • 链接:< a href =http://hackage.haskell.org/platform/mac.html> http://hackage.haskell.org/platform/mac.html

  • ul>

    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> :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
    

    I tried it various ways, it seems that the number is correctly understood but not shown. Version info:

    ghci --version
    The Glorious Glasgow Haskell Compilation System, version 6.10.4
    

    解决方案

    GHC on MacPorts seems to be broken. See https://trac.macports.org/ticket/25265

    Consider instead installing the Haskell Platform from haskell.org, which includes GHC 6.12.3 and a bundle of Haskelly goodies.

    这篇关于Haskell中的负双打或浮动(macports)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆