Safe Haskell | None |
---|---|
Language | Haskell2010 |
Memory units.
- class Integral unit => MemoryUnit unit where
- data Byte
- data Kilobyte
- data Megabyte
- data Gigabyte
- data Terabyte
- unitBuilder :: MemoryUnit unit => unit -> Builder
- memory :: MemoryUnit unit => Format r (unit -> r)
- toBytes :: forall unit. MemoryUnit unit => unit -> Integer
- fromBytes :: forall unit. MemoryUnit unit => Integer -> unit
- convertUnit :: (MemoryUnit a, MemoryUnit b) => a -> b
Documentation
Type class
class Integral unit => MemoryUnit unit where Source #
bytesMultiplier :: Proxy unit -> Integer Source #
This value is n iff (1 :: unit) is n bytes.
Concrete types
Pretty printing
unitBuilder :: MemoryUnit unit => unit -> Builder Source #
Construct Text Builder.
memory :: MemoryUnit unit => Format r (unit -> r) Source #
Formatter for formatting
library.
Helpers
toBytes :: forall unit. MemoryUnit unit => unit -> Integer Source #
Convert given memory unit into integer representing bytes.
fromBytes :: forall unit. MemoryUnit unit => Integer -> unit Source #
Convert given number of bytes into memory unit, flooring value if necessary.
convertUnit :: (MemoryUnit a, MemoryUnit b) => a -> b Source #
Conversion between memory units.