Safe Haskell | None |
---|
This module containt the type definitions necessary to build a Nomic rule.
- type PlayerNumber = Int
- type PlayerName = String
- type RuleNumber = Int
- type RuleName = String
- type RuleDesc = String
- type RuleText = String
- type RuleCode = String
- type EventNumber = Int
- type EventName = String
- type VarName = String
- type GameName = String
- type Code = String
- type OutputNumber = Int
- data Nomex a where
- NewVar :: (Typeable a, Show a, Eq a) => VarName -> a -> Nomex (Maybe (V a))
- ReadVar :: (Typeable a, Show a, Eq a) => V a -> Nomex (Maybe a)
- WriteVar :: (Typeable a, Show a, Eq a) => V a -> a -> Nomex Bool
- DelVar :: V a -> Nomex Bool
- OnEvent :: (Typeable e, Show e, Eq e) => Event e -> ((EventNumber, EventData e) -> Nomex ()) -> Nomex EventNumber
- DelEvent :: EventNumber -> Nomex Bool
- DelAllEvents :: (Typeable e, Show e, Eq e) => Event e -> Nomex ()
- SendMessage :: (Typeable a, Show a, Eq a) => Event (Message a) -> a -> Nomex ()
- ProposeRule :: Rule -> Nomex Bool
- ActivateRule :: RuleNumber -> Nomex Bool
- RejectRule :: RuleNumber -> Nomex Bool
- AddRule :: Rule -> Nomex Bool
- ModifyRule :: RuleNumber -> Rule -> Nomex Bool
- GetRules :: Nomex [Rule]
- GetPlayers :: Nomex [PlayerInfo]
- SetPlayerName :: PlayerNumber -> PlayerName -> Nomex Bool
- DelPlayer :: PlayerNumber -> Nomex Bool
- NewOutput :: PlayerNumber -> String -> Nomex OutputNumber
- UpdateOutput :: OutputNumber -> String -> Nomex Bool
- DelOutput :: OutputNumber -> Nomex Bool
- SetVictory :: [PlayerNumber] -> Nomex ()
- CurrentTime :: Nomex UTCTime
- SelfRuleNumber :: Nomex RuleNumber
- Return :: a -> Nomex a
- Bind :: Nomex a -> (a -> Nomex b) -> Nomex b
- ThrowError :: String -> Nomex a
- CatchError :: Nomex a -> (String -> Nomex a) -> Nomex a
- data V a = V {}
- data Var = forall a . (Typeable a, Show a, Eq a) => Var {
- _vRuleNumber :: RuleNumber
- _vName :: String
- vData :: a
- data Player
- data RuleEvent
- data Time
- data EvRule
- data Message m
- data Victory
- data Input a = Input PlayerNumber String (InputForm a)
- data InputForm a
- data Event a where
- data InputData a
- = RadioData a
- | CheckboxData [a]
- | TextData String
- | TextAreaData String
- | ButtonData
- data UInputData
- = URadioData Int
- | UCheckboxData [Int]
- | UTextData String
- | UTextAreaData String
- | UButtonData
- data EventData a where
- PlayerData :: { } -> EventData Player
- RuleData :: { } -> EventData RuleEvent
- TimeData :: { } -> EventData Time
- MessageData :: Show m => {
- messageData :: m
- InputData :: Show a => { } -> EventData (Input a)
- VictoryData :: {
- victoryData :: [PlayerInfo]
- data Status
- data EventHandler where
- EH :: (Typeable e, Show e, Eq e) => {
- _eventNumber :: EventNumber
- _ruleNumber :: RuleNumber
- event :: Event e
- handler :: (EventNumber, EventData e) -> Nomex ()
- _evStatus :: Status
- EH :: (Typeable e, Show e, Eq e) => {
- type Msg a = Event (Message a)
- type MsgData a = EventData (Message a)
- data Output = Output {}
- data Log = Log {}
- type RuleFunc = Nomex RuleResp
- data RuleResp
- data BoolResp
- data Rule = Rule {}
- data RuleStatus
- data SubmitRule = SubmitRule RuleName RuleDesc RuleCode
- data PlayerInfo = PlayerInfo {}
- data Game = Game {
- _gameName :: GameName
- _gameDesc :: GameDesc
- _rules :: [Rule]
- _players :: [PlayerInfo]
- _variables :: [Var]
- _events :: [EventHandler]
- _outputs :: [Output]
- _victory :: [PlayerNumber]
- _logs :: [Log]
- _currentTime :: UTCTime
- data GameDesc = GameDesc {}
- displayGame :: Game -> String
- oStatus :: Lens Output Status
- output :: Lens Output String
- oPlayerNumber :: Lens Output PlayerNumber
- oRuleNumber :: Lens Output PlayerNumber
- outputNumber :: Lens Output OutputNumber
- vName :: Lens Var String
- vRuleNumber :: Lens Var RuleNumber
- evStatus :: Lens EventHandler Status
- ruleNumber :: Lens EventHandler RuleNumber
- eventNumber :: Lens EventHandler EventNumber
- playerName :: Lens PlayerInfo String
- playerNumber :: Lens PlayerInfo PlayerNumber
- rAssessedBy :: Lens Rule (Maybe RuleNumber)
- rStatus :: Lens Rule RuleStatus
- rRuleFunc :: Lens Rule RuleFunc
- rRuleCode :: Lens Rule Code
- rProposedBy :: Lens Rule PlayerNumber
- rDescription :: Lens Rule String
- rName :: Lens Rule RuleName
- rNumber :: Lens Rule RuleNumber
- agora :: Lens GameDesc String
- desc :: Lens GameDesc String
- currentTime :: Lens Game UTCTime
- logs :: Lens Game [Log]
- victory :: Lens Game [PlayerNumber]
- outputs :: Lens Game [Output]
- events :: Lens Game [EventHandler]
- variables :: Lens Game [Var]
- players :: Lens Game [PlayerInfo]
- rules :: Lens Game [Rule]
- gameDesc :: Lens Game GameDesc
- gameName :: Lens Game GameName
Documentation
type PlayerNumber = IntSource
type PlayerName = StringSource
type RuleNumber = IntSource
type EventNumber = IntSource
type OutputNumber = IntSource
Nomyx Expression
A Nomex (Nomyx Expression) allows the players to write rules. | within the rules, you can access and modify the state of the game. | It is a compositional algebra defined with a GADT.
Variables
stores the variable's data
forall a . (Typeable a, Show a, Eq a) => Var | |
|
Events
events names
data UInputData Source
data associated with each events
PlayerData :: PlayerInfo -> EventData Player | |
RuleData :: Rule -> EventData RuleEvent | |
TimeData :: UTCTime -> EventData Time | |
MessageData :: Show m => m -> EventData (Message m) | |
| |
InputData :: Show a => InputData a -> EventData (Input a) | |
VictoryData :: [PlayerInfo] -> EventData Victory | |
|
data EventHandler whereSource
EH :: (Typeable e, Show e, Eq e) => EventNumber -> RuleNumber -> Event e -> ((EventNumber, EventData e) -> Nomex ()) -> Status -> EventHandler | |
|
Outputs
Logs
Rule
Return type of a rule function. it can be either nothing or another rule.
An informationnal structure about a rule
Rule | |
|
data RuleStatus Source
the status of a rule.
data SubmitRule Source
Player
data PlayerInfo Source
informations on players
Game
The state of the game:
Game | |
|
displayGame :: Game -> StringSource
events :: Lens Game [EventHandler]Source
players :: Lens Game [PlayerInfo]Source