about summary refs log tree commit diff
path: root/users/grfn/xanthous/src/Xanthous/Game/State.hs
diff options
context:
space:
mode:
Diffstat (limited to 'users/grfn/xanthous/src/Xanthous/Game/State.hs')
-rw-r--r--users/grfn/xanthous/src/Xanthous/Game/State.hs6
1 files changed, 6 insertions, 0 deletions
diff --git a/users/grfn/xanthous/src/Xanthous/Game/State.hs b/users/grfn/xanthous/src/Xanthous/Game/State.hs
index cdaf23edcd..6f51683d14 100644
--- a/users/grfn/xanthous/src/Xanthous/Game/State.hs
+++ b/users/grfn/xanthous/src/Xanthous/Game/State.hs
@@ -56,6 +56,8 @@ module Xanthous.Game.State
   , downcastEntity
   , _SomeEntity
   , entityIs
+  , entityTypeName
+
     -- ** Vias
   , Color(..)
   , DrawNothing(..)
@@ -394,6 +396,10 @@ entityIs = isJust . downcastEntity @a
 _SomeEntity :: forall a. (Entity a, Typeable a) => Prism' SomeEntity a
 _SomeEntity = prism' SomeEntity downcastEntity
 
+-- | Get the name of the type of 'SomeEntity' as a string
+entityTypeName :: SomeEntity -> Text
+entityTypeName (SomeEntity e) = pack . tyConName . typeRepTyCon $ typeOf e
+
 newtype DeriveEntity
   (blocksVision :: Bool)
   (description :: Symbol)