Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 32 lines (24 sloc) 0.96 kb
3e00ef3 @rhz first commit
authored
1 module Agent( KP.SiteName, SiteId, KP.InternalState, InternalStateId, BindingState(..), Site, Interface
2 , AgentId, AgentNameId, Agent(..), KP.AgentName, nameId, interface, foldInterface
3 ) where
4
5 import qualified KappaParser as KP
6 import qualified Data.Map as Map
7 import qualified Data.Vector as Vec
8
9 {- Basic types regarding Kappa agents and some accessor functions.
10 -}
11
12 -- Sites
13 type SiteId = Int
14 type InternalStateId = Int
15 data BindingState = Free | SemiLink | Bound | Unspecified -- WLD = Unspecified
16 deriving (Show, Eq)
17 type Site = (Maybe InternalStateId, BindingState)
18 type Interface = Map.Map SiteId Site
19
20 -- Agents
21 type AgentId = Int
22 type AgentNameId = Int
23 data Agent = Agent AgentNameId Interface
24 deriving (Show, Eq)
25
26 nameId (Agent agentNameId _) = agentNameId
27 interface (Agent _ intf) = intf
28
29 foldInterface :: (SiteId -> Site -> a -> a) -> a -> Agent -> a
30 foldInterface f acc (Agent _ intf) = Map.foldrWithKey f acc intf
31
Something went wrong with that request. Please try again.