diff options
author | Gregor Kleen <gkleen@yggdrasil.li> | 2016-02-26 22:57:30 +0000 |
---|---|---|
committer | Gregor Kleen <gkleen@yggdrasil.li> | 2016-02-26 22:57:30 +0000 |
commit | f64e26726ce5468069093aa86fe973ad4be4816c (patch) | |
tree | 28a982cf177434c798c49a23142f8502521e03d2 /server/src/Thermoprint/Server | |
parent | 022a5a69dfcfc7b62a940d9c3070e6ae37cc993e (diff) | |
download | thermoprint-f64e26726ce5468069093aa86fe973ad4be4816c.tar thermoprint-f64e26726ce5468069093aa86fe973ad4be4816c.tar.gz thermoprint-f64e26726ce5468069093aa86fe973ad4be4816c.tar.bz2 thermoprint-f64e26726ce5468069093aa86fe973ad4be4816c.tar.xz thermoprint-f64e26726ce5468069093aa86fe973ad4be4816c.zip |
Split QMConfig into own module
Diffstat (limited to 'server/src/Thermoprint/Server')
-rw-r--r-- | server/src/Thermoprint/Server/QMConfig.hs | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/server/src/Thermoprint/Server/QMConfig.hs b/server/src/Thermoprint/Server/QMConfig.hs new file mode 100644 index 0000000..0cf7beb --- /dev/null +++ b/server/src/Thermoprint/Server/QMConfig.hs | |||
@@ -0,0 +1,42 @@ | |||
1 | {-# LANGUAGE GADTs #-} | ||
2 | {-# LANGUAGE FlexibleContexts #-} | ||
3 | {-# LANGUAGE ImpredicativeTypes #-} | ||
4 | {-# LANGUAGE TypeOperators #-} | ||
5 | |||
6 | module Thermoprint.Server.QMConfig | ||
7 | ( QMConfig(..) | ||
8 | ) where | ||
9 | |||
10 | import Control.Monad.Trans.Resource | ||
11 | import Control.Monad.Trans.Control | ||
12 | import Control.Monad.Trans.Identity | ||
13 | import Control.Monad.Logger | ||
14 | import Control.Monad.Reader | ||
15 | import Control.Monad.IO.Class | ||
16 | import Control.Monad.Morph | ||
17 | import Control.Category | ||
18 | import Prelude hiding (id, (.)) | ||
19 | import Servant.Server.Internal.Enter (enter, (:~>)(..)) | ||
20 | |||
21 | import Data.Default.Class | ||
22 | |||
23 | import Control.Concurrent.STM | ||
24 | |||
25 | import Thermoprint.Server.Queue | ||
26 | |||
27 | data QMConfig m where | ||
28 | QMConfig :: ( MonadTrans t | ||
29 | , MFunctor t | ||
30 | , Monad (t STM) | ||
31 | , MonadIO (t IO) | ||
32 | ) => QueueManager t -> (t IO) :~> m -> QMConfig m | ||
33 | QMConfig' :: ( MonadIO m | ||
34 | ) => ( forall t. ( MonadTrans t | ||
35 | , MFunctor t | ||
36 | , Monad (t STM) | ||
37 | , MonadIO (t IO) | ||
38 | ) => QueueManager t | ||
39 | ) -> QMConfig m | ||
40 | |||
41 | instance MonadIO m => Default (QMConfig m) where | ||
42 | def = QMConfig idQM $ Nat (liftIO . runIdentityT) | ||