serokell-util-0.4.1: General-purpose functions by Serokell

Safe HaskellNone
LanguageHaskell2010

Serokell.Data.Memory.Units

Description

Memory units.

Synopsis

Documentation

Type class

Concrete types

data Byte Source #

Instances

Enum Byte Source # 

Methods

succ :: Byte -> Byte #

pred :: Byte -> Byte #

toEnum :: Int -> Byte #

fromEnum :: Byte -> Int #

enumFrom :: Byte -> [Byte] #

enumFromThen :: Byte -> Byte -> [Byte] #

enumFromTo :: Byte -> Byte -> [Byte] #

enumFromThenTo :: Byte -> Byte -> Byte -> [Byte] #

Eq Byte Source # 

Methods

(==) :: Byte -> Byte -> Bool #

(/=) :: Byte -> Byte -> Bool #

Integral Byte Source # 

Methods

quot :: Byte -> Byte -> Byte #

rem :: Byte -> Byte -> Byte #

div :: Byte -> Byte -> Byte #

mod :: Byte -> Byte -> Byte #

quotRem :: Byte -> Byte -> (Byte, Byte) #

divMod :: Byte -> Byte -> (Byte, Byte) #

toInteger :: Byte -> Integer #

Num Byte Source # 

Methods

(+) :: Byte -> Byte -> Byte #

(-) :: Byte -> Byte -> Byte #

(*) :: Byte -> Byte -> Byte #

negate :: Byte -> Byte #

abs :: Byte -> Byte #

signum :: Byte -> Byte #

fromInteger :: Integer -> Byte #

Ord Byte Source # 

Methods

compare :: Byte -> Byte -> Ordering #

(<) :: Byte -> Byte -> Bool #

(<=) :: Byte -> Byte -> Bool #

(>) :: Byte -> Byte -> Bool #

(>=) :: Byte -> Byte -> Bool #

max :: Byte -> Byte -> Byte #

min :: Byte -> Byte -> Byte #

Real Byte Source # 

Methods

toRational :: Byte -> Rational #

Show Byte Source # 

Methods

showsPrec :: Int -> Byte -> ShowS #

show :: Byte -> String #

showList :: [Byte] -> ShowS #

Generic Byte Source # 

Associated Types

type Rep Byte :: * -> * #

Methods

from :: Byte -> Rep Byte x #

to :: Rep Byte x -> Byte #

Arbitrary Byte Source # 

Methods

arbitrary :: Gen Byte #

shrink :: Byte -> [Byte] #

NFData Byte Source # 

Methods

rnf :: Byte -> () #

MemoryUnit Byte Source # 
type Rep Byte Source # 
type Rep Byte = D1 (MetaData "Byte" "Serokell.Data.Memory.Units" "serokell-util-0.4.1-1io9BEQXew877evaPni4CC" True) (C1 (MetaCons "Byte" PrefixI False) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Integer)))

data Kilobyte Source #

Instances

Enum Kilobyte Source # 
Eq Kilobyte Source # 
Integral Kilobyte Source # 
Num Kilobyte Source # 
Ord Kilobyte Source # 
Real Kilobyte Source # 
Show Kilobyte Source # 
Generic Kilobyte Source # 

Associated Types

type Rep Kilobyte :: * -> * #

Methods

from :: Kilobyte -> Rep Kilobyte x #

to :: Rep Kilobyte x -> Kilobyte #

Arbitrary Kilobyte Source # 
NFData Kilobyte Source # 

Methods

rnf :: Kilobyte -> () #

MemoryUnit Kilobyte Source # 
type Rep Kilobyte Source # 
type Rep Kilobyte = D1 (MetaData "Kilobyte" "Serokell.Data.Memory.Units" "serokell-util-0.4.1-1io9BEQXew877evaPni4CC" True) (C1 (MetaCons "Kilobyte" PrefixI False) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Integer)))

data Megabyte Source #

Instances

Enum Megabyte Source # 
Eq Megabyte Source # 
Integral Megabyte Source # 
Num Megabyte Source # 
Ord Megabyte Source # 
Real Megabyte Source # 
Show Megabyte Source # 
Generic Megabyte Source # 

Associated Types

type Rep Megabyte :: * -> * #

Methods

from :: Megabyte -> Rep Megabyte x #

to :: Rep Megabyte x -> Megabyte #

Arbitrary Megabyte Source # 
NFData Megabyte Source # 

Methods

rnf :: Megabyte -> () #

MemoryUnit Megabyte Source # 
type Rep Megabyte Source # 
type Rep Megabyte = D1 (MetaData "Megabyte" "Serokell.Data.Memory.Units" "serokell-util-0.4.1-1io9BEQXew877evaPni4CC" True) (C1 (MetaCons "Megabyte" PrefixI False) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Integer)))

data Gigabyte Source #

Instances

Enum Gigabyte Source # 
Eq Gigabyte Source # 
Integral Gigabyte Source # 
Num Gigabyte Source # 
Ord Gigabyte Source # 
Real Gigabyte Source # 
Show Gigabyte Source # 
Generic Gigabyte Source # 

Associated Types

type Rep Gigabyte :: * -> * #

Methods

from :: Gigabyte -> Rep Gigabyte x #

to :: Rep Gigabyte x -> Gigabyte #

Arbitrary Gigabyte Source # 
NFData Gigabyte Source # 

Methods

rnf :: Gigabyte -> () #

MemoryUnit Gigabyte Source # 
type Rep Gigabyte Source # 
type Rep Gigabyte = D1 (MetaData "Gigabyte" "Serokell.Data.Memory.Units" "serokell-util-0.4.1-1io9BEQXew877evaPni4CC" True) (C1 (MetaCons "Gigabyte" PrefixI False) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Integer)))

data Terabyte Source #

Instances

Enum Terabyte Source # 
Eq Terabyte Source # 
Integral Terabyte Source # 
Num Terabyte Source # 
Ord Terabyte Source # 
Real Terabyte Source # 
Show Terabyte Source # 
Generic Terabyte Source # 

Associated Types

type Rep Terabyte :: * -> * #

Methods

from :: Terabyte -> Rep Terabyte x #

to :: Rep Terabyte x -> Terabyte #

Arbitrary Terabyte Source # 
NFData Terabyte Source # 

Methods

rnf :: Terabyte -> () #

MemoryUnit Terabyte Source # 
type Rep Terabyte Source # 
type Rep Terabyte = D1 (MetaData "Terabyte" "Serokell.Data.Memory.Units" "serokell-util-0.4.1-1io9BEQXew877evaPni4CC" True) (C1 (MetaCons "Terabyte" PrefixI False) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Integer)))

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.