product-mix-auction-0.1.0.0: A single-round sealed-bid auction for multiple goods

Safe HaskellNone
LanguageHaskell2010

ProductMixAuction.Types

Contents

Synopsis

Basic types

newtype Units Source #

Constructors

Units 

Fields

Instances

Enum Units Source # 
Eq Units Source # 

Methods

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

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

Floating Units Source # 
Fractional Units Source # 
Num Units Source # 
Ord Units Source # 

Methods

compare :: Units -> Units -> Ordering #

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

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

(>) :: Units -> Units -> Bool #

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

max :: Units -> Units -> Units #

min :: Units -> Units -> Units #

Read Units Source # 
Real Units Source # 

Methods

toRational :: Units -> Rational #

RealFloat Units Source # 
RealFrac Units Source # 

Methods

properFraction :: Integral b => Units -> (b, Units) #

truncate :: Integral b => Units -> b #

round :: Integral b => Units -> b #

ceiling :: Integral b => Units -> b #

floor :: Integral b => Units -> b #

Show Units Source # 

Methods

showsPrec :: Int -> Units -> ShowS #

show :: Units -> String #

showList :: [Units] -> ShowS #

Generic Units Source # 

Associated Types

type Rep Units :: * -> * #

Methods

from :: Units -> Rep Units x #

to :: Rep Units x -> Units #

ToJSON Units Source # 

Methods

toJSON :: Units -> Value

toEncoding :: Units -> Encoding

toJSONList :: [Units] -> Value

toEncodingList :: [Units] -> Encoding

FromJSON Units Source # 

Methods

parseJSON :: Value -> Parser Units

parseJSONList :: Value -> Parser [Units]

ToField Units Source # 

Methods

toField :: Units -> Field

FromField Units Source #

Parse empty cells as quantity 0.

Methods

parseField :: Field -> Parser Units

Default Units Source # 

Methods

def :: Units

Random Units Source # 

Methods

randomR :: RandomGen g => (Units, Units) -> g -> (Units, g)

random :: RandomGen g => g -> (Units, g)

randomRs :: RandomGen g => (Units, Units) -> g -> [Units]

randoms :: RandomGen g => g -> [Units]

randomRIO :: (Units, Units) -> IO Units

randomIO :: IO Units

Arbitrary Units Source # 

Methods

arbitrary :: Gen Units

shrink :: Units -> [Units]

type Rep Units Source # 
type Rep Units = D1 (MetaData "Units" "ProductMixAuction.Types" "product-mix-auction-0.1.0.0-inplace" True) (C1 (MetaCons "Units" PrefixI True) (S1 (MetaSel (Just Symbol "_Units") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Double)))

newtype Price Source #

Represents a price supplied by or presented to the user, which will always be an integer.

Constructors

Price 

Fields

Instances

Bounded Price Source # 
Enum Price Source # 
Eq Price Source # 

Methods

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

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

Integral Price Source # 
Num Price Source # 
Ord Price Source # 

Methods

compare :: Price -> Price -> Ordering #

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

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

(>) :: Price -> Price -> Bool #

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

max :: Price -> Price -> Price #

min :: Price -> Price -> Price #

Read Price Source # 
Real Price Source # 

Methods

toRational :: Price -> Rational #

Show Price Source # 

Methods

showsPrec :: Int -> Price -> ShowS #

show :: Price -> String #

showList :: [Price] -> ShowS #

Generic Price Source # 

Associated Types

type Rep Price :: * -> * #

Methods

from :: Price -> Rep Price x #

to :: Rep Price x -> Price #

ToJSON Price Source # 

Methods

toJSON :: Price -> Value

toEncoding :: Price -> Encoding

toJSONList :: [Price] -> Value

toEncodingList :: [Price] -> Encoding

FromJSON Price Source # 

Methods

parseJSON :: Value -> Parser Price

parseJSONList :: Value -> Parser [Price]

ToField Price Source # 

Methods

toField :: Price -> Field

FromRecord Price Source # 

Methods

parseRecord :: Record -> Parser Price

FromField Price Source # 

Methods

parseField :: Field -> Parser Price

Default Price Source # 

Methods

def :: Price

Random Price Source # 

Methods

randomR :: RandomGen g => (Price, Price) -> g -> (Price, g)

random :: RandomGen g => g -> (Price, g)

randomRs :: RandomGen g => (Price, Price) -> g -> [Price]

randoms :: RandomGen g => g -> [Price]

randomRIO :: (Price, Price) -> IO Price

randomIO :: IO Price

Arbitrary Price Source # 

Methods

arbitrary :: Gen Price

shrink :: Price -> [Price]

type Rep Price Source # 
type Rep Price = D1 (MetaData "Price" "ProductMixAuction.Types" "product-mix-auction-0.1.0.0-inplace" True) (C1 (MetaCons "Price" PrefixI True) (S1 (MetaSel (Just Symbol "_Price") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Int)))

newtype TweakedPrice Source #

Represents a price used internally, which may be incremented by a small fraction from the original integer price.

Constructors

TweakedPrice 

Instances

Enum TweakedPrice Source # 
Eq TweakedPrice Source # 
Fractional TweakedPrice Source # 
Num TweakedPrice Source # 
Ord TweakedPrice Source # 
Read TweakedPrice Source # 
Real TweakedPrice Source # 
RealFrac TweakedPrice Source # 
Show TweakedPrice Source # 
Generic TweakedPrice Source # 

Associated Types

type Rep TweakedPrice :: * -> * #

ToJSON TweakedPrice Source # 

Methods

toJSON :: TweakedPrice -> Value

toEncoding :: TweakedPrice -> Encoding

toJSONList :: [TweakedPrice] -> Value

toEncodingList :: [TweakedPrice] -> Encoding

FromJSON TweakedPrice Source # 

Methods

parseJSON :: Value -> Parser TweakedPrice

parseJSONList :: Value -> Parser [TweakedPrice]

Default TweakedPrice Source # 

Methods

def :: TweakedPrice

type Rep TweakedPrice Source # 
type Rep TweakedPrice = D1 (MetaData "TweakedPrice" "ProductMixAuction.Types" "product-mix-auction-0.1.0.0-inplace" True) (C1 (MetaCons "TweakedPrice" PrefixI True) (S1 (MetaSel (Just Symbol "_TweakedPrice") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Double)))

newtype TradeOff Source #

A trade-off coefficient for use representing asymmetric bids.

Constructors

TradeOff 

Fields

Instances

Enum TradeOff Source # 
Eq TradeOff Source # 
Num TradeOff Source # 
Ord TradeOff Source # 
Read TradeOff Source # 
Show TradeOff Source # 
Generic TradeOff Source # 

Associated Types

type Rep TradeOff :: * -> * #

Methods

from :: TradeOff -> Rep TradeOff x #

to :: Rep TradeOff x -> TradeOff #

ToJSON TradeOff Source # 

Methods

toJSON :: TradeOff -> Value

toEncoding :: TradeOff -> Encoding

toJSONList :: [TradeOff] -> Value

toEncodingList :: [TradeOff] -> Encoding

FromJSON TradeOff Source # 

Methods

parseJSON :: Value -> Parser TradeOff

parseJSONList :: Value -> Parser [TradeOff]

ToField TradeOff Source # 

Methods

toField :: TradeOff -> Field

FromField TradeOff Source #

Parse empty cells as trade-off 1 (symmetric).

Methods

parseField :: Field -> Parser TradeOff

Default TradeOff Source # 

Methods

def :: TradeOff

type Rep TradeOff Source # 
type Rep TradeOff = D1 (MetaData "TradeOff" "ProductMixAuction.Types" "product-mix-auction-0.1.0.0-inplace" True) (C1 (MetaCons "TradeOff" PrefixI True) (S1 (MetaSel (Just Symbol "_TradeOff") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Double)))

newtype Ratio Source #

A number between 0 and 1.

Constructors

Ratio 

Fields

Instances

Enum Ratio Source # 
Eq Ratio Source # 

Methods

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

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

Fractional Ratio Source # 
Num Ratio Source # 
Ord Ratio Source # 

Methods

compare :: Ratio -> Ratio -> Ordering #

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

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

(>) :: Ratio -> Ratio -> Bool #

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

max :: Ratio -> Ratio -> Ratio #

min :: Ratio -> Ratio -> Ratio #

Read Ratio Source # 
Show Ratio Source # 

Methods

showsPrec :: Int -> Ratio -> ShowS #

show :: Ratio -> String #

showList :: [Ratio] -> ShowS #

Generic Ratio Source # 

Associated Types

type Rep Ratio :: * -> * #

Methods

from :: Ratio -> Rep Ratio x #

to :: Rep Ratio x -> Ratio #

ToJSON Ratio Source # 

Methods

toJSON :: Ratio -> Value

toEncoding :: Ratio -> Encoding

toJSONList :: [Ratio] -> Value

toEncodingList :: [Ratio] -> Encoding

FromJSON Ratio Source # 

Methods

parseJSON :: Value -> Parser Ratio

parseJSONList :: Value -> Parser [Ratio]

Default Ratio Source # 

Methods

def :: Ratio

Arbitrary Ratio Source # 

Methods

arbitrary :: Gen Ratio

shrink :: Ratio -> [Ratio]

type Rep Ratio Source # 
type Rep Ratio = D1 (MetaData "Ratio" "ProductMixAuction.Types" "product-mix-auction-0.1.0.0-inplace" True) (C1 (MetaCons "Ratio" PrefixI True) (S1 (MetaSel (Just Symbol "_Ratio") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Double)))

Labels

type Good = G Source #

newtype B Source #

Constructors

B 

Fields

Instances

Enum B Source # 

Methods

succ :: B -> B #

pred :: B -> B #

toEnum :: Int -> B #

fromEnum :: B -> Int #

enumFrom :: B -> [B] #

enumFromThen :: B -> B -> [B] #

enumFromTo :: B -> B -> [B] #

enumFromThenTo :: B -> B -> B -> [B] #

Eq B Source # 

Methods

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

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

Ord B Source # 

Methods

compare :: B -> B -> Ordering #

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

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

(>) :: B -> B -> Bool #

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

max :: B -> B -> B #

min :: B -> B -> B #

Read B Source # 
Show B Source # 

Methods

showsPrec :: Int -> B -> ShowS #

show :: B -> String #

showList :: [B] -> ShowS #

Generic B Source # 

Associated Types

type Rep B :: * -> * #

Methods

from :: B -> Rep B x #

to :: Rep B x -> B #

ToJSONKey B Source # 

Methods

toJSONKey :: ToJSONKeyFunction B

toJSONKeyList :: ToJSONKeyFunction [B]

ToJSON B Source # 

Methods

toJSON :: B -> Value

toEncoding :: B -> Encoding

toJSONList :: [B] -> Value

toEncodingList :: [B] -> Encoding

FromJSONKey B Source # 

Methods

fromJSONKey :: FromJSONKeyFunction B

fromJSONKeyList :: FromJSONKeyFunction [B]

FromJSON B Source # 

Methods

parseJSON :: Value -> Parser B

parseJSONList :: Value -> Parser [B]

ToField B Source # 

Methods

toField :: B -> Field

FromField B Source # 

Methods

parseField :: Field -> Parser B

Default B Source # 

Methods

def :: B

Arbitrary B Source # 

Methods

arbitrary :: Gen B

shrink :: B -> [B]

type Rep B Source # 
type Rep B = D1 (MetaData "B" "ProductMixAuction.Types" "product-mix-auction-0.1.0.0-inplace" True) (C1 (MetaCons "B" PrefixI True) (S1 (MetaSel (Just Symbol "_bid_index") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Int)))

newtype G Source #

Constructors

G 

Fields

Instances

Enum G Source # 

Methods

succ :: G -> G #

pred :: G -> G #

toEnum :: Int -> G #

fromEnum :: G -> Int #

enumFrom :: G -> [G] #

enumFromThen :: G -> G -> [G] #

enumFromTo :: G -> G -> [G] #

enumFromThenTo :: G -> G -> G -> [G] #

Eq G Source # 

Methods

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

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

Ord G Source # 

Methods

compare :: G -> G -> Ordering #

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

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

(>) :: G -> G -> Bool #

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

max :: G -> G -> G #

min :: G -> G -> G #

Read G Source # 
Show G Source # 

Methods

showsPrec :: Int -> G -> ShowS #

show :: G -> String #

showList :: [G] -> ShowS #

Generic G Source # 

Associated Types

type Rep G :: * -> * #

Methods

from :: G -> Rep G x #

to :: Rep G x -> G #

ToJSONKey G Source # 

Methods

toJSONKey :: ToJSONKeyFunction G

toJSONKeyList :: ToJSONKeyFunction [G]

ToJSON G Source # 

Methods

toJSON :: G -> Value

toEncoding :: G -> Encoding

toJSONList :: [G] -> Value

toEncodingList :: [G] -> Encoding

FromJSONKey G Source # 

Methods

fromJSONKey :: FromJSONKeyFunction G

fromJSONKeyList :: FromJSONKeyFunction [G]

FromJSON G Source # 

Methods

parseJSON :: Value -> Parser G

parseJSONList :: Value -> Parser [G]

ToField G Source # 

Methods

toField :: G -> Field

Default G Source # 

Methods

def :: G

Arbitrary G Source # 

Methods

arbitrary :: Gen G

shrink :: G -> [G]

type Rep G Source # 
type Rep G = D1 (MetaData "G" "ProductMixAuction.Types" "product-mix-auction-0.1.0.0-inplace" True) (C1 (MetaCons "G" PrefixI True) (S1 (MetaSel (Just Symbol "_good_index") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Int)))

newtype BidderName Source #

An identifying name for a bidder. This must be unique.

Constructors

BidderName 

Fields

Instances

Eq BidderName Source # 
Ord BidderName Source # 
Read BidderName Source # 
Show BidderName Source # 
Generic BidderName Source # 

Associated Types

type Rep BidderName :: * -> * #

ToJSONKey BidderName Source # 

Methods

toJSONKey :: ToJSONKeyFunction BidderName

toJSONKeyList :: ToJSONKeyFunction [BidderName]

ToJSON BidderName Source # 

Methods

toJSON :: BidderName -> Value

toEncoding :: BidderName -> Encoding

toJSONList :: [BidderName] -> Value

toEncodingList :: [BidderName] -> Encoding

FromJSONKey BidderName Source # 

Methods

fromJSONKey :: FromJSONKeyFunction BidderName

fromJSONKeyList :: FromJSONKeyFunction [BidderName]

FromJSON BidderName Source # 

Methods

parseJSON :: Value -> Parser BidderName

parseJSONList :: Value -> Parser [BidderName]

ToField BidderName Source # 

Methods

toField :: BidderName -> Field

FromField BidderName Source # 

Methods

parseField :: Field -> Parser BidderName

Arbitrary BidderName Source # 
type Rep BidderName Source # 
type Rep BidderName = D1 (MetaData "BidderName" "ProductMixAuction.Types" "product-mix-auction-0.1.0.0-inplace" True) (C1 (MetaCons "BidderName" PrefixI True) (S1 (MetaSel (Just Symbol "_BidderName") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Text)))

mkBidderName :: Int -> BidderName Source #

Construct a bidder name for a bidder identified only by their position in a list.

Rounding

newtype ScaleFactor Source #

A scale factor represents the precision with which quantities should be expressed as a number of decimal places.

Constructors

ScaleFactor 

Fields

Instances

Eq ScaleFactor Source # 
Num ScaleFactor Source # 
Read ScaleFactor Source # 
Show ScaleFactor Source # 
Generic ScaleFactor Source # 

Associated Types

type Rep ScaleFactor :: * -> * #

ToJSON ScaleFactor Source # 

Methods

toJSON :: ScaleFactor -> Value

toEncoding :: ScaleFactor -> Encoding

toJSONList :: [ScaleFactor] -> Value

toEncodingList :: [ScaleFactor] -> Encoding

FromJSON ScaleFactor Source # 

Methods

parseJSON :: Value -> Parser ScaleFactor

parseJSONList :: Value -> Parser [ScaleFactor]

Default ScaleFactor Source # 

Methods

def :: ScaleFactor

type Rep ScaleFactor Source # 
type Rep ScaleFactor = D1 (MetaData "ScaleFactor" "ProductMixAuction.Types" "product-mix-auction-0.1.0.0-inplace" True) (C1 (MetaCons "ScaleFactor" PrefixI True) (S1 (MetaSel (Just Symbol "_ScaleFactor") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Int)))

roundToScale :: RealFrac a => ScaleFactor -> a -> a Source #

Round to given number of decimal places.

TODO: can this return a fixed-precision type, rather than abusing floating-point like this?

floorToScale :: RealFrac a => ScaleFactor -> a -> a Source #

Round down to the given number of decimal places.

ceilingToScale :: RealFrac a => ScaleFactor -> a -> a Source #

Round up to the given number of decimal places.

scaleDistance :: ScaleFactor -> Double Source #

The distance between two successive points to which values will be rounded.

showUnits :: ScaleFactor -> Units -> String Source #

Show a quantity with the number of digits controlled by the precision of the auction.

Generators

Settings

jsonOptions :: String -> Options Source #

Debugging

data Verbosity Source #

Controls how much debug output is generated by library.

Constructors

Silent

No extra output

Debug

Very chatty, for debugging

Instances

Bounded Verbosity Source # 
Enum Verbosity Source # 
Eq Verbosity Source # 
Ord Verbosity Source # 
Show Verbosity Source # 
Generic Verbosity Source # 

Associated Types

type Rep Verbosity :: * -> * #

ToJSON Verbosity Source # 

Methods

toJSON :: Verbosity -> Value

toEncoding :: Verbosity -> Encoding

toJSONList :: [Verbosity] -> Value

toEncodingList :: [Verbosity] -> Encoding

FromJSON Verbosity Source # 

Methods

parseJSON :: Value -> Parser Verbosity

parseJSONList :: Value -> Parser [Verbosity]

Default Verbosity Source # 

Methods

def :: Verbosity

Arbitrary Verbosity Source # 
type Rep Verbosity Source # 
type Rep Verbosity = D1 (MetaData "Verbosity" "ProductMixAuction.Types" "product-mix-auction-0.1.0.0-inplace" False) ((:+:) (C1 (MetaCons "Silent" PrefixI False) U1) (C1 (MetaCons "Debug" PrefixI False) U1))

ifDebug :: Verbosity -> IO () -> IO () Source #

Execute an IO action, if debug output is enabled.

debugPutStrLn :: Verbosity -> String -> String -> IO () Source #

Write out a key-value pair, if debug output is enabled.

debugPrint :: Show a => Verbosity -> String -> a -> IO () Source #

Write out a key and the result of showing the value, if debug output is enabled.