ohhecs-0.0.2: src/Games/ECS/Prototype/PrototypeID.hs
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE Trustworthy #-}
-- |
-- Module : Games.ECS.Prototype.PrototypeID
-- Description : Prototype definitions
-- Copyright : (C) 2020 Sophie Taylor
-- License : AGPL-3.0-or-later
-- Maintainer : Sophie Taylor <sophie@spacekitteh.moe>
-- Stability : experimental
-- Portability: GHC
--
-- Prototype IDs are essentially just strings.
module Games.ECS.Prototype.PrototypeID where
import Games.ECS.Serialisation
import Control.Lens
import Data.Interned.Text
import Data.Hashable
import GHC.Generics
import Data.String
-- | A prototype's ID is distinct from its entity reference in that it is stable, and in a unique namespace.
newtype PrototypeID = PrototypeID {_unPrototypeID :: InternedText}
deriving newtype (Eq, Ord, Show)
deriving newtype (XMLPickleAsAttribute)
deriving stock (Generic)
deriving newtype (Hashable)
deriving newtype IsString
makeClassy ''PrototypeID
instance {-# OVERLAPS #-} XMLPickler [Node] PrototypeID where
{-# INLINE xpickle #-}
xpickle =
xpWrap
PrototypeID
_unPrototypeID
xpickle