Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
Here is a quick example:
ByteValue (1024 * 1024 * 3) Bytes -- the above will evaluate to: ByteValue 3145728.0 Bytes
getShortHand . getAppropriateUnits $ ByteValue (1024 * 1024 * 3) Bytes -- the above will evaluate to: "3.00 MB"
Documentation
Instances
Eq ByteValue Source # | |
Ord ByteValue Source # | Also allows comparing sizes, but because it uses float - it might not be 100% accurate
|
Defined in Data.ByteUnits | |
Show ByteValue Source # | |
convertByteUnit :: ByteValue -> ByteUnit -> ByteValue Source #
Converts the ByteValue to an ByteValue with the specified ByteUnit
>>>
convertByteUnit (ByteValue 500 GigaBytes) MegaBytes
ByteValue 512000.0 MegaBytes
getAppropriateUnits :: ByteValue -> ByteValue Source #
Converts to the largest unit size provided the float value is > 1
>>>
getAppropriateUnits (ByteValue 1024 Bytes)
ByteValue 1 KiloBytes
>>>
getAppropriateUnits (ByteValue (3.5 * 1024* 1024) Bytes)
ByteValue 3.5 MegaBytes
getShortHand :: ByteValue -> String Source #
Converts to a short string representation
>>>
getShortHand $ ByteValue 100 MegaBytes
"100.00 MB"