Add alternative implementation of auction winner determination.
[?]
Mar 9, 2016, 4:57 AM
EKI57EJR65DA5FPILAHGHHAIU5ITVGHA6V3775OX7GV5XD67OWRQCDependencies
- [2]
NLZ3JXLOFix formatting with stylish-haskell. - [3]
LHJ2HFXVAdd property test for auction algorithm. - [4]
IZEVQF62Work in progress replacing sqlite with postgres. - [5]
ZP62WC47Begin conversion to build with stack. - [6]
WO2MINIFAuctions now compile! - [7]
75N3UJ4JMore progression toward lenses. - [8]
2XQD6KKKAdd invitation logic and clean up DBProg error handling. - [9]
M4KM76DGMerge branch 'stackify' - [10]
QMRKFEPGRefactor QDB to use a free monad algebra instead. - [11]
4U7F3CPITHE GREAT RENAMING OF THINGS! - [12]
Z7KS5XHHVery WIP. Wow. - [13]
KEP5WUFJConvert project to stack-based build. - [14]
LAROLAYUWIP - [15]
NEDDHXUKReformat via stylish-haskell - [*]
64C6AWH6Rename Ananke -> Quixotic, project reboot.
Change contents
- edit in aftok.cabal at line 53
, mtl - edit in lib/Aftok/Auction.hs at line 7
import Control.Monad.State - replacement in lib/Aftok/Auction.hs at line 13
import Aftokimport Aftok.Typesimport Aftok (UserId)import Aftok.Types (Satoshi(..)) - replacement in lib/Aftok/Auction.hs at line 20
{ _raiseAmount :: Satoshi, _auctionEnd :: C.UTCTime{ _raiseAmount :: Satoshi, _auctionEnd :: C.UTCTime - edit in lib/Aftok/Auction.hs at line 36
data Commitment = Commitment{ _baseBid :: Bid, _commitmentSeconds :: Seconds, _commitmentAmount :: Satoshi} - edit in lib/Aftok/Auction.hs at line 88[3.654]
bidCommitment :: Satoshi -> Bid -> State Satoshi (Maybe Commitment)bidCommitment raiseAmount' bid = doraised <- getcase raised of-- if the total is fully within the raise amountx | x + (bid ^. bidAmount) < raiseAmount' ->put (x + bid ^. bidAmount) >>(pure . Just $ Commitment bid (bid ^. bidSeconds) (bid ^. bidAmount))-- if the last bid will exceed the raise amount, reduce it to fitx | x < raiseAmount' ->let remainder = raiseAmount' - xwinFraction = toRational remainder / toRational (bid ^. bidAmount)remainderSeconds = Seconds . round $ winFraction * toRational (bid ^. bidSeconds)in put (x + remainder) >>(pure . Just $ Commitment bid (remainderSeconds) remainder)-- otherwise,_ -> pure Nothing - replacement in lib/Aftok/Database.hs at line 13
import Aftok.Auctionimport Aftok.Auction (Auction, AuctionId, Bid, BidId)