More progression toward lenses.
[?]
Dec 9, 2014, 8:59 PM
75N3UJ4JK56KXF56GASGPAWLFYGJDETVJNYTF4KXFCQM767JUU5ACDependencies
- [2]
WO2MINIFAuctions now compile! - [3]
TZQJVHBAAdd auction functions to ADB. - [4]
GKGVYBZGAdded JSON serialization to TimeLog - [5]
64C6AWH6Rename Ananke -> Quixotic, project reboot. - [6]
64VI73NPServer now compiles using abstracted SQLite - [7]
EMVTF2IWWIP moving back to snap. - [8]
LAROLAYUWIP - [9]
NVOCQVASInitial failing tests. - [10]
5W5M56VJMove library code to 'lib' - [11]
7DBNV3GVInitial, stack-based impl of time log event reduction. - [12]
Y35QCWYWMinor improvement in WorkIndex type to eliminate duplicated information. - [13]
WFZDMVUXRename ADB -> QDB - [*]
FRPWIKCNAdded log event parsing to Quixotic.Database.SQLite
Change contents
- replacement in lib/Quixotic/Auction.hs at line 1
{-# LANGUAGE ScopedTypeVariables, OverloadedStrings, NoImplicitPrelude #-}{-# LANGUAGE ScopedTypeVariables, OverloadedStrings, NoImplicitPrelude, TemplateHaskell #-} - edit in lib/Quixotic/Auction.hs at line 6
import Control.Lens - replacement in lib/Quixotic/Auction.hs at line 15
{ raiseAmount :: BTC, endsAt :: UTCTime{ _raiseAmount :: BTC, _endsAt :: UTCTime - edit in lib/Quixotic/Auction.hs at line 19
makeLenses ''Auction - replacement in lib/Quixotic/Auction.hs at line 22[4.5339]→[4.5339:5360](∅→∅),[4.5360]→[2.82:105](∅→∅),[2.105]→[4.5379:5400](∅→∅),[4.5379]→[4.5379:5400](∅→∅)
{ userId :: UserId, seconds :: Seconds, btcAmount :: BTC{ _userId :: UserId, _seconds :: Seconds, _btcAmount :: BTC - edit in lib/Quixotic/Auction.hs at line 27
makeLenses ''Bid - replacement in lib/Quixotic/Auction.hs at line 32
where costRatio bid = (toRational . seconds $ bid) / (toRational . runBTC . btcAmount $ bid)wherebidSeconds bid = toRational $ bid ^. secondsbidAmount bid = toRational $ bid ^. (btcAmount . btc)costRatio bid = bidSeconds bid / bidAmount bid - replacement in lib/Quixotic/Auction.hs at line 43
| total ++ btcAmount x < raiseAmount auction =x : (takeWinningBids (total ++ btcAmount x) xs)| (total ++ x ^. btcAmount) < (auction ^. raiseAmount) =x : (takeWinningBids (total ++ x ^. btcAmount) xs) - replacement in lib/Quixotic/Auction.hs at line 47
| total < raiseAmount auction =let remainder = raiseAmount auction <> invert totalwinFraction = (toRational . runBTC $ remainder) / (toRational . runBTC $ btcAmount x)remainderSeconds = Seconds . round $ winFraction * (toRational . seconds $ x)in [Bid (userId x) remainderSeconds remainder]| total < auction ^. raiseAmount =let remainder = (auction ^. raiseAmount) ++ invert totalwinFraction :: RationalwinFraction = (toRational $ remainder ^. btc) / (toRational $ x ^. (btcAmount . btc))remainderSeconds = Seconds . round $ winFraction * (toRational $ x ^. seconds)in [x & seconds .~ remainderSeconds & btcAmount .~ remainder] - edit in lib/Quixotic/Database/SQLite.hs at line 6
import Control.Lens - edit in lib/Quixotic/Database/SQLite.hs at line 8
import Data.Text.Lens - edit in lib/Quixotic/Database/SQLite.hs at line 12
import Quixotic.Auction - edit in lib/Quixotic/Database/SQLite.hs at line 15
import Quixotic.Users - replacement in lib/Quixotic/Database/SQLite.hs at line 23
, newAuction = undefined, readAuction = undefined, recordBid = undefined, readBids = undefined, createUser = undefined, newAuction = newAuction', readAuction = readAuction', recordBid = recordBid', readBids = readBids', createUser = createUser' - replacement in lib/Quixotic/Database/SQLite.hs at line 34
[ ("btcAddr", unpack (address ba))[ ("btcAddr", ba ^. address ^. from packed) - edit in lib/Quixotic/Database/SQLite.hs at line 44[15.96][4.4555]
newAuction' :: Auction -> ReaderT a (EitherT Text IO) AuctionIdnewAuction' = undefinedreadAuction' :: AuctionId -> ReaderT a (EitherT Text IO) AuctionreadAuction' = undefinedrecordBid' :: UTCTime -> Bid -> ReaderT a (EitherT Text IO) ()recordBid' = undefinedreadBids' :: AuctionId -> ReaderT a (EitherT Text IO) [(UTCTime, Bid)]readBids' = undefinedcreateUser' :: User -> ReaderT a (EitherT Text IO) UserIdcreateUser' = undefined - replacement in lib/Quixotic.hs at line 1
{-# LANGUAGE NoImplicitPrelude #-}{-# LANGUAGE NoImplicitPrelude, TemplateHaskell #-} - replacement in lib/Quixotic.hs at line 3[4.1127]→[4.5553:5569](∅→∅),[4.2457]→[4.5553:5569](∅→∅),[4.5569]→[4.2472:2493](∅→∅),[4.2472]→[4.2472:2493](∅→∅),[4.2493]→[4.1107:1124](∅→∅),[4.1124]→[2.1257:1269](∅→∅),[4.1124]→[4.2505:2515](∅→∅),[2.1269]→[4.2505:2515](∅→∅),[4.2505]→[4.2505:2515](∅→∅)
module Quixotic( BtcAddr(address), parseBtcAddr, BTC(..)) wheremodule Quixotic where - replacement in lib/Quixotic.hs at line 6
import qualified Data.Text as Timport Control.Lens - replacement in lib/Quixotic.hs at line 11
newtype BtcAddr = BtcAddr { address :: T.Text } deriving (Show, Eq, Ord)newtype BtcAddr = BtcAddr { _address :: Text } deriving (Show, Eq, Ord)makeLenses ''BtcAddr - replacement in lib/Quixotic.hs at line 14
newtype BTC = BTC { runBTC :: Integer } deriving (Show, Eq, Ord)newtype BTC = BTC { _btc :: Integer } deriving (Show, Eq, Ord)makeLenses ''BTC - replacement in lib/Quixotic.hs at line 18
(<>) b1 b2 = BTC $ runBTC b1 + runBTC b2(<>) b1 b2 = BTC $ _btc b1 + _btc b2 - replacement in lib/Quixotic.hs at line 25
invert b = BTC . negate . runBTC $ binvert b = BTC . negate . _btc $ b - replacement in lib/Quixotic.hs at line 29
parseBtcAddr :: T.Text -> Maybe BtcAddrparseBtcAddr :: Text -> Maybe BtcAddr