Add Read instances

This commit is contained in:
2022-07-22 01:06:35 +01:00
parent d4e5b02874
commit 4c5218c633
44 changed files with 209 additions and 126 deletions
+5 -4
View File
@@ -1,9 +1,11 @@
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TemplateHaskell #-}
module Picture.Data
where
import Geometry.Data
import GHC.Generics
import Control.Lens
import Streaming
data Verx = Verx
@@ -13,8 +15,7 @@ data Verx = Verx
, _vxLayer :: !Layer
, _vxShadNum :: !ShadNum
}
deriving (Eq,Ord,Show)
--newtype LayNum = LayNum { _unLayNum :: Int }
deriving (Eq,Ord,Show,Generic,Read)
data Layer
= BottomLayer
@@ -23,7 +24,7 @@ data Layer
| BloomNoZWrite
| DebugLayer
| FixedCoordLayer
deriving (Eq,Ord,Enum,Bounded,Show)
deriving (Eq,Ord,Enum,Bounded,Show,Generic,Read)
layerNum :: Layer -> Int
layerNum = fromEnum
@@ -31,7 +32,7 @@ numLayers :: Int
numLayers = length [minBound::Layer .. maxBound]
--TODO use synonyms for layer numbers
newtype ShadNum = ShadNum { _unShadNum :: Int }
deriving (Eq,Ord,Show)
deriving (Eq,Ord,Show,Generic,Read)
polyNum, polyzNum, bezNum, textNum, arcNum, ellNum :: ShadNum
{-# INLINE polyNum #-}
{-# INLINE polyzNum #-}