什么函数或一系列函数可以将Int32转换为Haskell中的Int?我知道HashTable.hashString可以转换为Int32,但我需要一个可以转换其他方式的函数。Int32 to Int in Haskell
8
A
回答
12
ghci> import Data.Int
ghci> fromIntegral (5 :: Int32) :: Int
5
ghci> fromIntegral (5 :: Int) :: Int32
5
2
fromIntegral
将从Int32转换为Int或其他方式。
6
停止。 Hoogle time!...不幸的是,Hoogle这次没有很好地回答这个问题。跳绳的答案...
fromIntegral :: (Integral a, Num b) => a -> b
注fromIntegral
类型签名表示它会变成任何Integral
到任何Num
。由于Int32
具有Integral
的声明实例,并且Int
具有Num
的声明实例,因此fromIntegral
函数将执行此作业。
相关问题
- 1. Haskell int list to String
- 2. String to int cast in php
- 3. Ascii Bytes Array To Int32或Double
- 4. int32.Equals int的区别? == int?对于linq
- 5. LINQ to Entities不识别方法'Int32 Last [Int32]
- 6. LINQ to Entities不识别方法Int32 get_Item(Int32)
- 7. Haskell Int和Maybe Int
- 8. 将int32转换为int
- 9. int32不能转换为int
- 10. LINQ to Entities模拟SQL“IN”代理一个int []
- 11. PutText in haskell HUnit
- 12. Operator&in haskell?
- 13. Haskell List to Tuple
- 14. LINQ to SQL in and not in
- 15. IplImage in(com.googlecode.javacv.cpp.opencv_core.IplImage)to Mat in org.opencv.core.Mat
- 16. LINQ to SQL - How to“Where ... in ...”
- 17. Remaping [to {in vim
- 18. NSnumber in to NSstring
- 19. LINQ-to-SQL IN()
- 20. datatable to Excel in c#
- 21. Int32.TryParse(String,Int32)在失败时改变int参数吗?
- 22. SelectMany in Linq to entity
- 23. int pixels in bmp in java
- 24. always int int = float float in python
- 25. Haskell的类型不匹配INT和[INT]
- 26. Haskell:无法与Int类型[Int]匹配
- 27. Concat String to Int
- 28. Java byte to int
- 29. C#int to byte []
- 30. php,string to int
欢迎来到多态返回类型!当我第一次遇到哈斯克尔时,这些非常神秘。 – Daniel 2011-02-03 14:38:46