Attempt to make CWorld correct instance of Store

This commit is contained in:
2022-08-20 15:53:37 +01:00
parent e1a555ea02
commit 8571ab9254
89 changed files with 570 additions and 19 deletions
+10 -8
View File
@@ -3,6 +3,9 @@
module Sound.Data where
import TH.Derive
import Data.Store
import LinearHelp
import Control.Lens
import Data.Aeson
import Data.Aeson.TH
@@ -18,8 +21,6 @@ data SoundStatus = SoundStatus
}
deriving (Eq, Ord, Show)
-- TODO make this more sensible (use product rather than union in some cases)
data PlayStatus
= JustStartedPlaying
@@ -29,13 +30,9 @@ data PlayStatus
| ToStop
deriving (Eq, Ord, Show)
newtype SoundID = SoundID {_getSoundID :: Int}
deriving (Eq, Ord, Show, Read)
newtype SoundData = SoundData
{ _loadedChunks :: IM.IntMap Mix.Chunk
}
@@ -50,8 +47,6 @@ data ToPlaySound = ToPlaySound
}
deriving (Eq, Show)
data Sound = Sound
{ _soundTime :: Maybe Int
, _soundStatus :: SoundStatus
@@ -72,3 +67,10 @@ deriveJSON defaultOptions ''SoundStatus
deriveJSON defaultOptions ''PlayStatus
deriveJSON defaultOptions ''SoundID
deriveJSON defaultOptions ''ToPlaySound
{- FOURMOLU_DISABLE -}
$($(derive [d| instance Deriving (Store SoundStatus) |]))
$($(derive [d| instance Deriving (Store PlayStatus) |]))
$($(derive [d| instance Deriving (Store SoundID) |]))
$($(derive [d| instance Deriving (Store ToPlaySound) |]))
{- FOURMOLU_ENABLE -}