Add Binary instances

This commit is contained in:
2022-08-21 10:58:19 +01:00
parent 386a2b4732
commit 1ce7d4a72d
95 changed files with 345 additions and 3 deletions
+4
View File
@@ -5,6 +5,7 @@
module Picture.Data where
import Data.Binary
import Flat
import LinearHelp ()
import Control.Lens
@@ -21,6 +22,7 @@ data Verx = Verx
, _vxShadNum :: !ShadNum
}
deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary Verx
data Layer
= BottomLayer
@@ -30,6 +32,7 @@ data Layer
| DebugLayer
| FixedCoordLayer
deriving (Eq, Ord, Enum, Bounded, Show, Read, Generic, Flat)
instance Binary Layer
layerNum :: Layer -> Int
layerNum = fromEnum
@@ -39,6 +42,7 @@ numLayers = length [minBound :: Layer .. maxBound]
newtype ShadNum = ShadNum {_unShadNum :: Int}
deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary ShadNum
polyNum, polyzNum, bezNum, textNum, arcNum, ellNum :: ShadNum
{-# INLINE polyNum #-}