about summary refs log tree commit diff
path: root/src/Xanthous/Resource.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Xanthous/Resource.hs')
-rw-r--r--src/Xanthous/Resource.hs35
1 files changed, 21 insertions, 14 deletions
diff --git a/src/Xanthous/Resource.hs b/src/Xanthous/Resource.hs
index 5350e7646e38..cc2fc97a1464 100644
--- a/src/Xanthous/Resource.hs
+++ b/src/Xanthous/Resource.hs
@@ -1,24 +1,31 @@
 --------------------------------------------------------------------------------
 module Xanthous.Resource
-  ( Name(..)
+  ( Panel(..)
+  , Name(..)
   ) where
 --------------------------------------------------------------------------------
 import Xanthous.Prelude
 --------------------------------------------------------------------------------
 import Test.QuickCheck
-import Test.QuickCheck.Arbitrary.Generic
+import Data.Aeson (ToJSON, FromJSON)
+--------------------------------------------------------------------------------
+import Xanthous.Util.QuickCheck
 --------------------------------------------------------------------------------
 
-data Name = MapViewport
-            -- ^ The main viewport where we display the game content
-          | Character
-            -- ^ The character
-          | MessageBox
-            -- ^ The box where we display messages to the user
-          | Prompt
-            -- ^ The game's prompt
-  deriving stock (Show, Eq, Ord, Generic)
-  deriving anyclass (NFData, CoArbitrary, Function)
+-- | Enum for "panels" displayed in the game's UI.
+data Panel
+  = InventoryPanel -- ^ A panel displaying the character's inventory
+  deriving stock (Show, Eq, Ord, Generic, Enum, Bounded)
+  deriving anyclass (NFData, CoArbitrary, Function, ToJSON, FromJSON)
+  deriving Arbitrary via GenericArbitrary Panel
 
-instance Arbitrary Name where
-  arbitrary = genericArbitrary
+
+data Name
+  = MapViewport -- ^ The main viewport where we display the game content
+  | Character   -- ^ The character
+  | MessageBox  -- ^ The box where we display messages to the user
+  | Prompt      -- ^ The game's prompt
+  | Panel Panel -- ^ A panel in the game
+  deriving stock (Show, Eq, Ord, Generic)
+  deriving anyclass (NFData, CoArbitrary, Function, ToJSON, FromJSON)
+  deriving Arbitrary via GenericArbitrary Name