Copyright | (c) 2012-2021 Amy de Buitléir |
---|---|
License | BSD-style |
Maintainer | amy@nualeargais.ie |
Stability | experimental |
Portability | portable |
Safe Haskell | None |
Language | Haskell2010 |
Provides tasks that you can use with a daemon. These tasks handle reading and writing agents, and various other housekeeping chores, which reduces the amount of code you need to write.
It’s also easy to write your own tasks, using these as a guide.)
Synopsis
- type AgentProgram u = Agent u -> StateT u IO (Agent u)
- type AgentsProgram u = [Agent u] -> StateT u IO [Agent u]
- withAgent :: (Universe u, Serialize (Agent u)) => AgentProgram u -> AgentId -> StateT u IO ()
- withAgents :: (Universe u, Serialize (Agent u)) => AgentsProgram u -> [AgentId] -> StateT u IO ()
- runNoninteractingAgents :: (Universe u, Serialize (Agent u)) => AgentProgram u -> StateT u IO () -> StateT u IO () -> StateT u IO ()
- runInteractingAgents :: (Universe u, Serialize (Agent u)) => AgentsProgram u -> StateT u IO () -> StateT u IO () -> StateT u IO ()
- simpleJob :: Universe u => Job u
- startupHandler :: Universe u => u -> IO u
- shutdownHandler :: Universe u => u -> IO ()
- doNothing :: Monad m => m ()
- exceptionHandler :: Universe u => u -> SomeException -> IO u
- checkPopSize :: Universe u => (Int, Int) -> StateT u IO ()
- requestShutdown :: Universe u => String -> StateT u IO ()
Documentation
type AgentProgram u = Agent u -> StateT u IO (Agent u) Source #
A program involving one agent. The input parameter is the agent. The program must return the agent (which may have been modified).
type AgentsProgram u = [Agent u] -> StateT u IO [Agent u] Source #
A program involving multiple agents. The input parameter is a list of agents. The program must return a list of agents that have been *modified*. The order of the output list is not important.
withAgent :: (Universe u, Serialize (Agent u)) => AgentProgram u -> AgentId -> StateT u IO () Source #
Run a program involving one agent
withAgents :: (Universe u, Serialize (Agent u)) => AgentsProgram u -> [AgentId] -> StateT u IO () Source #
runNoninteractingAgents :: (Universe u, Serialize (Agent u)) => AgentProgram u -> StateT u IO () -> StateT u IO () -> StateT u IO () Source #
runInteractingAgents :: (Universe u, Serialize (Agent u)) => AgentsProgram u -> StateT u IO () -> StateT u IO () -> StateT u IO () Source #
startupHandler :: Universe u => u -> IO u Source #
shutdownHandler :: Universe u => u -> IO () Source #
doNothing :: Monad m => m () Source #
Can be used as a startupHandler, shutdownHandler, startRoundProgram, or endRoundProgram
exceptionHandler :: Universe u => u -> SomeException -> IO u Source #