Move from store to flat

This commit is contained in:
2022-08-20 17:54:35 +01:00
parent 8571ab9254
commit ff9dbdf068
95 changed files with 793 additions and 748 deletions
+8 -14
View File
@@ -1,5 +1,8 @@
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE FlexibleInstances #-}
@@ -11,6 +14,7 @@ The warnings have been disabled.
-}
module Dodge.Data.PathGraph where
import Flat
import LinearHelp
import Control.Lens
import Data.Aeson
@@ -42,7 +46,7 @@ data PathEdge = PathEdge
, _peDist :: Float
, _peObstacles :: Set.Set EdgeObstacle
}
deriving (Eq, Ord, Show, Read, Generic)
deriving (Eq, Ord, Show, Read, Generic, Flat)
instance ToJSON PathEdge where
toEncoding = genericToEncoding defaultOptions
@@ -54,7 +58,7 @@ data EdgeObstacle
| DoorObstacle
| AutoDoorObstacle
| WallObstacle
deriving (Eq, Ord, Show, Read, Bounded, Enum, Generic)
deriving (Eq, Ord, Show, Read, Bounded, Enum, Generic, Flat)
instance ToJSON EdgeObstacle where
toEncoding = genericToEncoding defaultOptions
@@ -66,17 +70,7 @@ instance (ToJSON a, ToJSON b) => ToJSON (Gr a b) where
instance (FromJSON a, FromJSON b) => FromJSON (Gr a b)
deriving instance (Flat (Gr Point2 PathEdge))
makeLenses ''PathGraph
makeLenses ''PathEdge
{- FOURMOLU_DISABLE -}
$($(derive [d|
instance Deriving (Store EdgeObstacle)
|]))
$($(derive [d|
instance Deriving (Store PathEdge)
|]))
$($(derive [d|
instance Deriving (Store (Gr Point2 PathEdge))
|]))
{- FOURMOLU_ENABLE -}