------------------------------------------------------------------------ -- | -- Module : ALife.Creatur -- Copyright : (c) 2012-2021 Amy de Buitléir -- License : BSD-style -- Maintainer : amy@nualeargais.ie -- Stability : experimental -- Portability : portable -- -- Definitions used throughout the Créatúr framework. -- ------------------------------------------------------------------------ {-# LANGUAGE TypeFamilies, FlexibleInstances, FlexibleContexts #-} module ALife.Creatur ( Agent(..), AgentId, Time, programVersion ) where import ALife.Creatur.Database (Record, key) import Data.Version (showVersion) import Paths_creatur (version) -- | The internal clock used by Créatúr is a simple counter. type Time = Int -- | A unique ID associated with an agent. type AgentId = String -- | An artificial life species. -- All species used in Créatúr must be an instance of this class. class (Record a) => Agent a where -- | Returns the agent ID. agentId :: a -> AgentId agentId = a -> AgentId forall r. Record r => r -> AgentId key -- | Returns True if the agent is alive, false otherwise. isAlive :: a -> Bool programVersion :: String programVersion :: AgentId programVersion = AgentId "creatur-" AgentId -> AgentId -> AgentId forall a. [a] -> [a] -> [a] ++ Version -> AgentId showVersion Version version