{-# options_haddock prune #-}
module Helic.Effect.Agent where
import Helic.Data.AgentId (AgentId (AgentId))
import Helic.Data.Event (Event)
data AgentTag =
AgentTag Symbol
data Agent :: Effect where
Update :: Event -> Agent m ()
makeSem ''Agent
type AgentTmux =
'AgentTag "tmux"
type AgentX =
'AgentTag "x"
type AgentNet =
'AgentTag "net"
type Agents =
[
Agent @@ AgentTmux,
Agent @@ AgentX,
Agent @@ AgentNet
]
class AgentName (tag :: AgentTag) where
agentName :: Text
instance (
KnownSymbol s
) => AgentName ('AgentTag s) where
agentName :: Text
agentName =
forall a. ToText a => a -> Text
toText (forall (n :: Symbol) (proxy :: Symbol -> *).
KnownSymbol n =>
proxy n -> String
symbolVal (forall {k} (t :: k). Proxy t
Proxy @s))
agentIdTmux :: AgentId
agentIdTmux :: AgentId
agentIdTmux =
Text -> AgentId
AgentId Text
"tmux"
agentIdX :: AgentId
agentIdX :: AgentId
agentIdX =
Text -> AgentId
AgentId Text
"x"
agentIdNet :: AgentId
agentIdNet :: AgentId
agentIdNet =
Text -> AgentId
AgentId Text
"net"