我在哪里可以找到这个fromRealFrac功能?根据温和的介绍功能应该存在,并从谷歌搜索周围,我收集它应该在Prelude - 但ghci抱怨它不在范围内.
我正在fromRational . toRational暂时使用,因为根据温和的介绍,这是如何fromRealFrac定义的.
Don*_*art 19
以前称为"fromRealFrac"的函数在Haskell 98报告中被重命名为"realToFrac".
在Haskell 1.4 Prelude中我们发现
fromRealFrac :: (RealFrac a, Fractional b) => a -> b
fromRealFrac = fromRational . toRational
Run Code Online (Sandbox Code Playgroud)
然而,通过Haskell 98,它被称为
realToFrac :: (Real a, Fractional b) => a -> b
realToFrac = fromRational . toRational
Run Code Online (Sandbox Code Playgroud)
此更改列在Haskell 98报告勘误表中:
[Apr 2001] Page 84, Section 6.4, Fig 7; and bottom of page 86, Section 6.4.6.
fromRealFrac :: (RealFrac a, Fractional b) => a -> b
should be replaced by
realToFrac :: (Real a, Fractional b) => a -> b
Run Code Online (Sandbox Code Playgroud)
最近提交我能找到的这个报告回购.
| 归档时间: |
|
| 查看次数: |
649 次 |
| 最近记录: |