From 2b9ceaead3f3cd80e973cccecb9a3eebc51154f7 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Sun, 17 Jul 2016 19:21:56 +0200 Subject: Fixes for GHC 8.0.1 --- server/src/Thermoprint/Server.hs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'server/src/Thermoprint/Server.hs') diff --git a/server/src/Thermoprint/Server.hs b/server/src/Thermoprint/Server.hs index 07462da..15fb651 100644 --- a/server/src/Thermoprint/Server.hs +++ b/server/src/Thermoprint/Server.hs @@ -13,7 +13,7 @@ module Thermoprint.Server , Config(..), QMConfig(..) , withPrinters , module Data.Default.Class - , module Servant.Server.Internal.Enter + , module Servant.Utils.Enter , module Thermoprint.Server.Printer , module Thermoprint.Server.Queue , module Thermoprint.Server.Queue.Utils @@ -62,7 +62,7 @@ import qualified Network.Wai.Handler.Warp as Warp import Network.Wai (Application) import Servant.Server (serve) -import Servant.Server.Internal.Enter (enter, (:~>)(..)) +import Servant.Utils.Enter (enter, (:~>)(..)) import Servant.API import Servant.Utils.Links import Network.URI @@ -137,16 +137,16 @@ thermoprintServer :: ( MonadLoggerIO m -> (m :~> IO) -- ^ 'dyre' controls the base of the monad-transformer-stack ('IO') but we let the user specify much of the rest of it (we handle 'ResourceT' ourselves, since we need it to fork properly). Therefore we require a specification of how to collapse the stack. -> ResourceT m (Config (ResourceT m)) -> IO () -- ^ Run the server -thermoprintServer dyre io = do +thermoprintServer dyre io cfg = do cfgDir <- lookupEnv "THERMOPRINT_CONFIG" cacheDir <- lookupEnv "THERMOPRINT_CACHE" - Dyre.wrapMain $ Dyre.defaultParams + flip Dyre.wrapMain cfg $ Dyre.defaultParams { Dyre.projectName = "thermoprint-server" , Dyre.realMain = realMain , Dyre.showError = flip (\msg -> fmap (\cfg -> cfg { dyreError = Just msg })) , Dyre.configCheck = dyre - , Dyre.configDir = cfgDir - , Dyre.cacheDir = cacheDir + , Dyre.configDir = return <$> cfgDir + , Dyre.cacheDir = return <$> cacheDir } where realMain cfg = unNat (io . Nat runResourceT) $ do @@ -164,6 +164,6 @@ thermoprintServer dyre io = do nChan <- liftIO $ newBroadcastTChanIO let printerUrl :: API.PrinterId -> URI - printerUrl = safeLink thermoprintAPI (Proxy :: Proxy ("jobs" :> QueryParam "printer" API.PrinterId :> Get '[JSON] (Seq (API.JobId, UTCTime, JobStatus)))) + printerUrl = safeLink thermoprintAPI (Proxy :: Proxy ("jobs" :> QueryParam "printer" API.PrinterId :> Get '[JSON] (Seq (API.JobId, UTCTime, JobStatus)))) . Just mapM_ (fork tMgr . uncurry (notifyOnChange nChan ((==) `on` fromZipper)) . bimap printerUrl queue) $ Map.toList printers liftIO . Warp.runSettings warpSettings . withPush nChan . serve thermoprintAPI . flip enter API.thermoprintServer =<< handlerNat printers nChan -- cgit v1.2.3