Remove generic and flat instances

This commit is contained in:
2022-08-21 22:38:40 +01:00
parent 36c8befa9f
commit 7181046aa3
94 changed files with 312 additions and 423 deletions
+8 -21
View File
@@ -10,7 +10,7 @@ module Shape.Data where
import Control.Lens
import Data.Aeson
import Flat
import Data.Aeson.TH
import Geometry.Data
import LinearHelp ()
import Streaming
@@ -23,38 +23,22 @@ shVfromList = id
shEfromList = id
newtype ShapeType = TopPrism Int
deriving newtype (Eq, Ord, Show, Read)
deriving stock Generic
deriving anyclass Flat
--deriving stock Generic
--deriving anyclass Flat
data ShapeObj = ShapeObj
{ _shType :: ShapeType
, _shVs :: [ShapeV]
}
deriving (Eq, Ord, Show, Read, Generic, Flat)
instance ToJSON ShapeObj where
toEncoding = genericToEncoding defaultOptions
instance FromJSON ShapeObj
instance ToJSON ShapeType where
toEncoding = genericToEncoding defaultOptions
instance FromJSON ShapeType
deriving (Eq, Ord, Show, Read) --Generic, Flat)
-- edges are given by four consecutive points
data ShapeV = ShapeV
{ _svPos :: Point3
, _svCol :: Point4
}
deriving (Eq, Ord, Show, Read, Generic, Flat)
instance ToJSON ShapeV where
toEncoding = genericToEncoding defaultOptions
instance FromJSON ShapeV
deriving (Eq, Ord, Show, Read) --Generic, Flat)
pairToSV :: (Point3, Point4) -> ShapeV
{-# INLINE pairToSV #-}
@@ -66,3 +50,6 @@ type Shape' = Stream (Of ShapeObj) IO ()
type Shape = [ShapeObj]
deriveJSON defaultOptions ''ShapeObj
deriveJSON defaultOptions ''ShapeType
deriveJSON defaultOptions ''ShapeV