Safe Haskell | None |
---|---|
Language | Haskell2010 |
ProductMixAuction.Types
- newtype Units = Units {}
- newtype Price = Price {}
- newtype TweakedPrice = TweakedPrice {}
- newtype TradeOff = TradeOff {}
- newtype Ratio = Ratio {}
- unitsToDouble :: Units -> Double
- tweakedPriceToDouble :: TweakedPrice -> Double
- tradeOffToDouble :: TradeOff -> Double
- doubleToUnits :: Double -> Units
- type Good = G
- newtype B = B {
- _bid_index :: Int
- newtype G = G {
- _good_index :: Int
- newtype BidderName = BidderName {
- _BidderName :: Text
- mkBidderName :: Int -> BidderName
- newtype ScaleFactor = ScaleFactor {
- _ScaleFactor :: Int
- roundToScale :: RealFrac a => ScaleFactor -> a -> a
- floorToScale :: RealFrac a => ScaleFactor -> a -> a
- ceilingToScale :: RealFrac a => ScaleFactor -> a -> a
- scaleDistance :: ScaleFactor -> Double
- showUnits :: ScaleFactor -> Units -> String
- arbitraryUnits :: Int -> Int -> Gen Units
- jsonOptions :: String -> Options
- dropPrefix :: String -> String -> String
- data Verbosity
- ifDebug :: Verbosity -> IO () -> IO ()
- debugPutStrLn :: Verbosity -> String -> String -> IO ()
- debugPrint :: Show a => Verbosity -> String -> a -> IO ()
Basic types
Instances
Enum Units Source # | |
Eq Units Source # | |
Floating Units Source # | |
Fractional Units Source # | |
Num Units Source # | |
Ord Units Source # | |
Read Units Source # | |
Real Units Source # | |
RealFloat Units Source # | |
RealFrac Units Source # | |
Show Units Source # | |
Generic Units Source # | |
ToJSON Units Source # | |
FromJSON Units Source # | |
ToField Units Source # | |
FromField Units Source # | Parse empty cells as quantity 0. |
Default Units Source # | |
Random Units Source # | |
Arbitrary Units Source # | |
type Rep Units Source # | |
Represents a price supplied by or presented to the user, which will always be an integer.
Instances
Bounded Price Source # | |
Enum Price Source # | |
Eq Price Source # | |
Integral Price Source # | |
Num Price Source # | |
Ord Price Source # | |
Read Price Source # | |
Real Price Source # | |
Show Price Source # | |
Generic Price Source # | |
ToJSON Price Source # | |
FromJSON Price Source # | |
ToField Price Source # | |
FromRecord Price Source # | |
FromField Price Source # | |
Default Price Source # | |
Random Price Source # | |
Arbitrary Price Source # | |
type Rep Price Source # | |
newtype TweakedPrice Source #
Represents a price used internally, which may be incremented by a small fraction from the original integer price.
Constructors
TweakedPrice | |
Fields |
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 # | |
ToJSON TweakedPrice Source # | |
FromJSON TweakedPrice Source # | |
Default TweakedPrice Source # | |
type Rep TweakedPrice Source # | |
A trade-off coefficient for use representing asymmetric bids.
Instances
Enum TradeOff Source # | |
Eq TradeOff Source # | |
Num TradeOff Source # | |
Ord TradeOff Source # | |
Read TradeOff Source # | |
Show TradeOff Source # | |
Generic TradeOff Source # | |
ToJSON TradeOff Source # | |
FromJSON TradeOff Source # | |
ToField TradeOff Source # | |
FromField TradeOff Source # | Parse empty cells as trade-off 1 (symmetric). |
Default TradeOff Source # | |
type Rep TradeOff Source # | |
A number between 0 and 1.
unitsToDouble :: Units -> Double Source #
tradeOffToDouble :: TradeOff -> Double Source #
doubleToUnits :: Double -> Units Source #
Labels
Constructors
B | |
Fields
|
Constructors
G | |
Fields
|
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 # | |
ToJSONKey BidderName Source # | |
ToJSON BidderName Source # | |
FromJSONKey BidderName Source # | |
FromJSON BidderName Source # | |
ToField BidderName Source # | |
FromField BidderName Source # | |
Arbitrary BidderName Source # | |
type Rep BidderName Source # | |
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 # | |
ToJSON ScaleFactor Source # | |
FromJSON ScaleFactor Source # | |
Default ScaleFactor Source # | |
type Rep ScaleFactor Source # | |
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
Controls how much debug output is generated by library.