Completed conversion to snap.

[?]
Dec 21, 2014, 8:05 PM
TCOAKCGGHOIRJCTZYEZQ3K6KCGL2LGAYGYFRGSPCHBTJJY2V6AXAC

Dependencies

Change contents

  • edit in quixotic.cabal at line 19
    [3.585]
    [3.585]
    Quixotic.Auction
  • replacement in quixotic.cabal at line 70
    [3.209][3.209:222]()
    , sqlite
    [3.209]
    [3.222]
    , lens
    , sqlite-simple
  • edit in quixotic.cabal at line 74
    [3.244]
    [3.244]
    , transformers
  • edit in server/Main.hs at line 2
    [3.1459]
    [3.5255]
    {-# LANGUAGE RecordWildCards #-}
  • replacement in server/Main.hs at line 4
    [3.5256][3.1315:1340]()
    module Main (main) where
    [3.5256]
    [3.1460]
    module Main where
  • replacement in server/Main.hs at line 6
    [3.1461][3.1461:1482]()
    import ClassyPrelude
    [3.1461]
    [3.5259]
    import ClassyPrelude
  • replacement in server/Main.hs at line 8
    [3.5260][3.84:111](),[3.111][3.2336:2406](),[3.2336][3.2336:2406]()
    import Control.Applicative
    import Control.Monad.Trans (liftIO)
    import Control.Monad.Trans.Either
    [3.5260]
    [3.2406]
    import Control.Lens
    import Control.Monad.Trans.Reader
  • replacement in server/Main.hs at line 14
    [3.122][3.122:160](),[3.160][3.2455:2478](),[3.2455][3.2455:2478](),[3.2478][3.161:184]()
    import qualified Data.Text.Lazy as LT
    import Data.Time.Clock
    import Database.SQLite
    [3.122]
    [3.2502]
    import Database.SQLite.Simple
  • edit in server/Main.hs at line 20
    [3.1582][3.1582:1609]()
    import Snap.Util.FileServe
  • replacement in server/Main.hs at line 25
    [3.189][3.6250:6287](),[3.6287][2.184:206](),[2.206][3.6288:6332](),[3.288][3.6288:6332]()
    db <- openConnection $ dbName cfg
    adb <- sqliteQDB db
    quickHttpServe $ runReaderT (site adb) db
    [3.189]
    [3.2594]
    db <- open $ dbName cfg
    quickHttpServe $ runReaderT (site sqliteQDB) db
  • replacement in server/Main.hs at line 29
    [2.245][3.6371:6540](),[3.6371][3.6371:6540]()
    site adb = route
    [ ("logStart/:btcAddr", handleLogRequest adb StartWork)
    , ("logEnd/:btcAddr", handleLogRequest adb StopWork)
    , ("payouts", currentPayouts adb)
    [2.245]
    [3.6540]
    site qdb = route
    [ ("logStart/:btcAddr", handleLogRequest qdb StartWork)
    , ("logEnd/:btcAddr", handleLogRequest qdb StopWork)
    , ("payouts", currentPayouts qdb)
  • replacement in server/Main.hs at line 42
    [3.379][3.379:416]()
    cfg <- C.load [C.Required cfgFile]
    [3.379]
    [3.416]
    cfg <- C.load [C.Required (fpToString cfgFile)]
  • replacement in server/Main.hs at line 45
    [3.5696][2.246:322](),[2.322][3.587:620](),[3.2027][3.587:620](),[3.6622][3.587:620](),[3.587][3.587:620]()
    handleLogRequest :: QDB IO a -> (UTCTime -> WorkEvent) -> ReaderT a Snap ()
    handleLogRequest db adb ev = do
    [3.5696]
    [3.6623]
    handleLogRequest :: QDB IO a -> EventType -> ReaderT a Snap ()
    handleLogRequest qdb ev = do
    let QDB{..} = qdb
  • replacement in server/Main.hs at line 49
    [3.6664][3.2062:2115](),[3.2062][3.2062:2115](),[3.2115][3.2943:2980](),[3.2943][3.2943:2980](),[3.2980][3.621:682]()
    let addr = fmap T.pack addrBytes >>= parseBtcAddr
    timestamp <- liftIO getCurrentTime
    liftIO $ recordEvent adb db $ LogEntry addr (ev timestamp)
    [3.6664]
    [3.6062]
    timestamp <- lift $ liftIO getCurrentTime
    maybe
    (lift $ snapError 400 "")
    (\a -> mapReaderT liftIO $ recordEvent (LogEntry a (WorkEvent ev timestamp)))
    (fmap decodeUtf8 addrBytes >>= parseBtcAddr)
  • replacement in server/Main.hs at line 56
    [2.371][3.729:757](),[3.2159][3.729:757](),[3.6713][3.729:757](),[3.729][3.729:757](),[3.757][3.3100:3188](),[3.3100][3.3100:3188]()
    currentPayouts db adb = do
    ptime <- liftIO getCurrentTime
    let dep = linearDepreciation (Months 6) (Months 60)
    [2.371]
    [3.758]
    currentPayouts qdb = do
    let QDB{..} = qdb
    dep = linearDepreciation (Months 6) (Months 60)
  • replacement in server/Main.hs at line 60
    [3.759][3.2160:2211](),[3.2211][3.1483:1579](),[3.895][3.6168:6169](),[3.1579][3.6168:6169](),[3.2086][3.6168:6169](),[3.2305][3.6168:6169](),[3.3259][3.6168:6169](),[3.6168][3.6168:6169](),[3.6169][3.2306:2359](),[3.2359][3.952:1016](),[3.952][3.952:1016]()
    buildPayoutsResponse :: WorkIndex -> Snap ()
    buildPayoutsResponse widx = writeBS . A.encode . PayoutsResponse $ payouts dep ptime widx
    payoutsAction :: EitherT T.Text Snap WorkIndex
    payoutsAction = mapEitherT liftIO $ readWorkIndex adb db
    [3.759]
    [3.1016]
    ptime <- lift . liftIO $ getCurrentTime
    widx <- mapReaderT liftIO $ readWorkIndex
    lift . writeLBS . A.encode . PayoutsResponse $ payouts dep ptime widx
  • replacement in server/Main.hs at line 64
    [3.1017][3.6714:6790]()
    lift $ eitherT (raise . LT.fromStrict) buildPayoutsResponse payoutsAction
    [3.1017]
    [3.8456]
    snapError :: Int -> Text -> Snap ()
    snapError c t = do
    modifyResponse $ setResponseStatus c $ encodeUtf8 t
    writeText $ ((tshow c) <> " - " <> t)
    r <- getResponse
    finishWith r
  • replacement in server/Main.hs at line 76
    [3.645][3.645:691]()
    m = fmap fromRational (mapKeys address p)
    [3.645]
    m = fmap fromRational $ mapKeys (^. address) p