module Cryptsy.API.Public
( module Cryptsy.API.Public.Types
, module Cryptsy.API.Public.MarketData.Old
, module Cryptsy.API.Public.MarketData.New
, module Cryptsy.API.Public.Market
, module Cryptsy.API.Public.OrderData
, module Cryptsy.API.Public.OrderBook
, defaultEvalPubCryptsy
, defaultRunPubCryptsy
)
where
import Data.Maybe (fromMaybe)
import Data.Monoid (mempty)
import Control.Monad.Trans.Either (runEitherT)
import Network.HTTP.Client (CookieJar, withManager)
import Network.HTTP.Client.TLS (tlsManagerSettings)
import Control.Monad.Trans.Reader (runReaderT)
import Control.Monad.Trans.State (runStateT)
import Cryptsy.API.Public.Market
import Cryptsy.API.Public.MarketData.New
import Cryptsy.API.Public.MarketData.Old
import Cryptsy.API.Public.OrderBook
import Cryptsy.API.Public.OrderData
import Cryptsy.API.Public.Types
defaultEvalPubCryptsy :: PubCryptsy a -> IO (Either CryptsyError a)
defaultEvalPubCryptsy = fmap fst . defaultRunPubCryptsy
defaultRunPubCryptsy :: PubCryptsy a -> IO (Either CryptsyError a, CookieJar)
defaultRunPubCryptsy = withManager tlsManagerSettings
. (defaultRunInReader .) . runReaderT
where
defaultRunInReader = fmap (msnd (fromMaybe mempty)) . ($ Just mempty)
. runStateT . runEitherT
msnd f (x, y) = (x, f y)