diff options
author | Gregor Kleen <gkleen@yggdrasil.li> | 2016-02-14 21:41:53 +0000 |
---|---|---|
committer | Gregor Kleen <gkleen@yggdrasil.li> | 2016-02-14 21:41:53 +0000 |
commit | 575a06949d7271734db4d52fe512981d6c0e139d (patch) | |
tree | d05f9e7d4a5089fede05ea3e1b490482b91c8e61 /server/src/Thermoprint/Server | |
parent | f4aa09d615a9cb77f1d13cbbc516be23a2d3cc69 (diff) | |
download | thermoprint-575a06949d7271734db4d52fe512981d6c0e139d.tar thermoprint-575a06949d7271734db4d52fe512981d6c0e139d.tar.gz thermoprint-575a06949d7271734db4d52fe512981d6c0e139d.tar.bz2 thermoprint-575a06949d7271734db4d52fe512981d6c0e139d.tar.xz thermoprint-575a06949d7271734db4d52fe512981d6c0e139d.zip |
Support for exception masking in PrinterMethods
Diffstat (limited to 'server/src/Thermoprint/Server')
-rw-r--r-- | server/src/Thermoprint/Server/Printer.hs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/server/src/Thermoprint/Server/Printer.hs b/server/src/Thermoprint/Server/Printer.hs index d9cea9d..d0dc37b 100644 --- a/server/src/Thermoprint/Server/Printer.hs +++ b/server/src/Thermoprint/Server/Printer.hs | |||
@@ -40,6 +40,7 @@ import Control.Monad.Trans.Resource | |||
40 | import Control.Monad.IO.Class | 40 | import Control.Monad.IO.Class |
41 | import Control.Monad.Logger | 41 | import Control.Monad.Logger |
42 | import Control.Monad.Reader | 42 | import Control.Monad.Reader |
43 | import Control.Monad.Catch (MonadMask) | ||
43 | 44 | ||
44 | import Control.Monad (forever) | 45 | import Control.Monad (forever) |
45 | 46 | ||
@@ -49,7 +50,7 @@ import Data.Time.Clock | |||
49 | 50 | ||
50 | import Thermoprint.Server.Queue | 51 | import Thermoprint.Server.Queue |
51 | 52 | ||
52 | newtype PrinterMethod = PM { unPM :: forall m. (MonadResource m, MonadLogger m) => Printout -> m (Maybe PrintingError) } | 53 | newtype PrinterMethod = PM { unPM :: forall m. (MonadResource m, MonadLogger m, MonadMask m) => Printout -> m (Maybe PrintingError) } |
53 | 54 | ||
54 | data Printer = Printer | 55 | data Printer = Printer |
55 | { print :: PrinterMethod | 56 | { print :: PrinterMethod |
@@ -69,6 +70,7 @@ runPrinter :: ( MonadReader ConnectionPool m | |||
69 | , MonadLogger m | 70 | , MonadLogger m |
70 | , MonadBaseControl IO m | 71 | , MonadBaseControl IO m |
71 | , MonadResource m | 72 | , MonadResource m |
73 | , MonadMask m | ||
72 | ) => Printer -> m () | 74 | ) => Printer -> m () |
73 | -- ^ Loop 'forever' pushing entries from the 'Queue' associated to a 'Printer' into its 'print'-method | 75 | -- ^ Loop 'forever' pushing entries from the 'Queue' associated to a 'Printer' into its 'print'-method |
74 | runPrinter Printer{..} = forever $ do | 76 | runPrinter Printer{..} = forever $ do |