Convert Haskell Int & # 8594; Word64

It should be pretty simple. I have an Int and I want to convert it to Word64. It can never be less than 0. I do not mind if it has error checking or not. It seems I can do the inverse transform using fromIntegral, but I cannot find the inverse function.

Thanks.

+4
source share
1 answer

well,

fromIntegral :: (Integral a, Num b) => a -> b 

should be ideally able to convert from Int to Word64 , since Int is an instance of Integral and Word64 is an instance of Num

+10
source

Source: https://habr.com/ru/post/1334679/


All Articles