{-# LANGUAGE DeriveAnyClass #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE DerivingStrategies #-} {-# LANGUAGE GeneralisedNewtypeDeriving #-} {-# LANGUAGE StrictData #-} {-# LANGUAGE TemplateHaskell #-} {-# OPTIONS_GHC -Wno-missing-signatures #-} module Shape.Data where import Control.Lens import Data.Aeson import Data.Aeson.TH import Geometry.Data import LinearHelp () import Streaming {-# INLINE shVfromList #-} shVfromList = id {-# INLINE shEfromList #-} shEfromList = id newtype ShapeType = TopPrism Int deriving newtype (Eq, Ord, Show, Read) --deriving stock Generic --deriving anyclass Flat data ShapeObj = ShapeObj { _shType :: ShapeType , _shVs :: [ShapeV] } 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) pairToSV :: (Point3, Point4) -> ShapeV {-# INLINE pairToSV #-} pairToSV = uncurry ShapeV makeLenses ''ShapeV makeLenses ''ShapeObj type Shape' = Stream (Of ShapeObj) IO () type Shape = [ShapeObj] deriveJSON defaultOptions ''ShapeObj deriveJSON defaultOptions ''ShapeType deriveJSON defaultOptions ''ShapeV