aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--spec/src/Thermoprint/API.hs5
-rw-r--r--spec/src/Thermoprint/Identifiers.hs10
2 files changed, 10 insertions, 5 deletions
diff --git a/spec/src/Thermoprint/API.hs b/spec/src/Thermoprint/API.hs
index 00115f3..e3d4b61 100644
--- a/spec/src/Thermoprint/API.hs
+++ b/spec/src/Thermoprint/API.hs
@@ -30,12 +30,13 @@ import qualified Data.IntMap.Strict as IntMap (foldMapWithKey, singleton)
30 30
31import Data.Text (Text) 31import Data.Text (Text)
32 32
33import Data.Typeable (Typeable)
33import GHC.Generics (Generic) 34import GHC.Generics (Generic)
35import Control.DeepSeq (NFData)
34 36
35import Data.Proxy (Proxy(..)) 37import Data.Proxy (Proxy(..))
36 38
37import Control.Exception (Exception) 39import Control.Exception (Exception)
38import Data.Typeable (Typeable)
39 40
40instance (Integral k, Ord k, ToJSON v) => ToJSON (Map k v) where 41instance (Integral k, Ord k, ToJSON v) => ToJSON (Map k v) where
41 toJSON = toJSON . Map.foldMapWithKey (IntMap.singleton . castId) 42 toJSON = toJSON . Map.foldMapWithKey (IntMap.singleton . castId)
@@ -55,7 +56,7 @@ data JobStatus = Queued PrinterId
55 deriving (Generic, Show, Read, FromJSON, ToJSON) 56 deriving (Generic, Show, Read, FromJSON, ToJSON)
56 57
57data PrintingError = UnknownError 58data PrintingError = UnknownError
58 deriving (Typeable, Generic, Show, Read, FromJSON, ToJSON, Exception) 59 deriving (Typeable, Generic, NFData, Show, Read, FromJSON, ToJSON, Exception)
59 60
60type DraftTitle = Text 61type DraftTitle = Text
61 62
diff --git a/spec/src/Thermoprint/Identifiers.hs b/spec/src/Thermoprint/Identifiers.hs
index ee35e24..0d6f56a 100644
--- a/spec/src/Thermoprint/Identifiers.hs
+++ b/spec/src/Thermoprint/Identifiers.hs
@@ -8,17 +8,21 @@ module Thermoprint.Identifiers
8 , castId 8 , castId
9 ) where 9 ) where
10 10
11import Data.Typeable (Typeable)
12import GHC.Generics (Generic)
13import Control.DeepSeq (NFData)
14
11import Servant.API (ToText, FromText) 15import Servant.API (ToText, FromText)
12import Data.Aeson (FromJSON, ToJSON) 16import Data.Aeson (FromJSON, ToJSON)
13 17
14newtype PrinterId = PrinterId Integer 18newtype PrinterId = PrinterId Integer
15 deriving (Show, Read, Eq, Ord, Num, Real, Integral, Enum, FromText, ToText, FromJSON, ToJSON) 19 deriving (Show, Read, Eq, Ord, Num, Real, Integral, Enum, FromText, ToText, FromJSON, ToJSON, Typeable, Generic, NFData)
16 20
17newtype JobId = JobId Integer 21newtype JobId = JobId Integer
18 deriving (Show, Read, Eq, Ord, Num, Real, Integral, Enum, FromText, ToText, FromJSON, ToJSON) 22 deriving (Show, Read, Eq, Ord, Num, Real, Integral, Enum, FromText, ToText, FromJSON, ToJSON, Typeable, Generic, NFData)
19 23
20newtype DraftId = DraftId Integer 24newtype DraftId = DraftId Integer
21 deriving (Show, Read, Eq, Ord, Num, Real, Integral, Enum, FromText, ToText, FromJSON, ToJSON) 25 deriving (Show, Read, Eq, Ord, Num, Real, Integral, Enum, FromText, ToText, FromJSON, ToJSON, Typeable, Generic, NFData)
22 26
23castId :: (Integral a, Enum b) => a -> b 27castId :: (Integral a, Enum b) => a -> b
24castId = toEnum . fromInteger . toInteger 28castId = toEnum . fromInteger . toInteger