Add Store instances

This commit is contained in:
2022-08-21 12:21:05 +01:00
parent 1ce7d4a72d
commit dd62e30026
92 changed files with 465 additions and 255 deletions
+5 -3
View File
@@ -5,6 +5,8 @@
module Picture.Data where
import TH.Derive
import Data.Store
import Data.Binary
import Flat
import LinearHelp ()
@@ -22,7 +24,6 @@ data Verx = Verx
, _vxShadNum :: !ShadNum
}
deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary Verx
data Layer
= BottomLayer
@@ -32,7 +33,6 @@ data Layer
| DebugLayer
| FixedCoordLayer
deriving (Eq, Ord, Enum, Bounded, Show, Read, Generic, Flat)
instance Binary Layer
layerNum :: Layer -> Int
layerNum = fromEnum
@@ -42,7 +42,7 @@ numLayers = length [minBound :: Layer .. maxBound]
newtype ShadNum = ShadNum {_unShadNum :: Int}
deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary ShadNum
$($(derive [d| instance Deriving (Store ShadNum) |]))
polyNum, polyzNum, bezNum, textNum, arcNum, ellNum :: ShadNum
{-# INLINE polyNum #-}
@@ -96,3 +96,5 @@ makeLenses ''Verx
deriveJSON defaultOptions ''Verx
deriveJSON defaultOptions ''Layer
deriveJSON defaultOptions ''ShadNum
$($(derive [d| instance Deriving (Store Verx ) |]))
$($(derive [d| instance Deriving (Store Layer) |]))