Data.UInt64
- Package
- purescript-int64
- Repository
- purescript-contrib/purescript-int64
Unsigned 64-bit integers and operations.
All of the usual arithmetic operations are supplied by typeclass instances.
Usage
import Prelude
import Data.UInt64 as UInt64
let
hundred = UInt64.unsafeFromInt 100
billion = UInt64.unsafeFromInt 1000000000
> hundred * billion
100000000000ul
> billion / hundred
10000000ul
> hundred + one
101ul
> hundred * zero
0ul
#unsafeFromInt Source
unsafeFromInt :: Int -> UInt64
Creates a UInt64
from an Int
value.
If the Int
is negative, the result is undefined.
#fromLowHighBits Source
fromLowHighBits :: Int -> Int -> UInt64
Creates a UInt64
from low and high bits represented as Int
.
#fromNumber Source
fromNumber :: Number -> Maybe UInt64
Creates a UInt64
from a Number
value. The number must already be an
integer and fall within the valid range of values for the UInt64
type
otherwise Nothing
is returned.
#fromString Source
fromString :: String -> Maybe UInt64
Reads a UInt64
from a String
value. The number must parse as an integer
and fall within the valid range of values for the UInt64
type, otherwise
Nothing
is returned.
#fromStringAs Source
fromStringAs :: Radix -> String -> Maybe UInt64
Like fromString
, but the integer can be specified in a different base.
#toStringAs Source
toStringAs :: Radix -> UInt64 -> String
Like toString
, but the integer can be specified in a different base.
#complement Source
complement :: UInt64 -> UInt64
Bitwise NOT.
The
Show
instance will suffix a lowercase ‘ul’ for “unsigned long”. (SeetoString
.)