Safe Haskell | None |
---|---|
Language | Haskell98 |
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 Code = String
- type OutputNumber = Int
- type InputNumber = Int
- data Eff
- type Effect = Effect
- type NoEffect = NoEffect
- type Nomex = Exp Effect
- type NomexNE = Exp NoEffect
- data Exp :: Eff -> * -> * where
- NewVar :: (Typeable a, Show a) => VarName -> a -> Nomex (Maybe (V a))
- ReadVar :: (Typeable a, Show a) => V a -> NomexNE (Maybe a)
- WriteVar :: (Typeable a, Show a) => V a -> a -> Nomex Bool
- DelVar :: V a -> Nomex Bool
- OnEvent :: (Typeable e, Show e) => Event e -> ((EventNumber, e) -> Nomex ()) -> Nomex EventNumber
- DelEvent :: EventNumber -> Nomex Bool
- GetEvents :: NomexNE [EventInfo]
- SendMessage :: (Typeable a, Show a) => Msg a -> a -> Nomex ()
- ProposeRule :: RuleInfo -> Nomex Bool
- ActivateRule :: RuleNumber -> Nomex Bool
- RejectRule :: RuleNumber -> Nomex Bool
- AddRule :: RuleInfo -> Nomex Bool
- ModifyRule :: RuleNumber -> RuleInfo -> Nomex Bool
- GetRules :: NomexNE [RuleInfo]
- GetPlayers :: NomexNE [PlayerInfo]
- SetPlayerName :: PlayerNumber -> PlayerName -> Nomex Bool
- DelPlayer :: PlayerNumber -> Nomex Bool
- NewOutput :: Maybe PlayerNumber -> NomexNE String -> Nomex OutputNumber
- GetOutput :: OutputNumber -> NomexNE (Maybe String)
- UpdateOutput :: OutputNumber -> NomexNE String -> Nomex Bool
- DelOutput :: OutputNumber -> Nomex Bool
- SetVictory :: NomexNE [PlayerNumber] -> Nomex ()
- CurrentTime :: NomexNE UTCTime
- SelfRuleNumber :: NomexNE RuleNumber
- Return :: a -> Exp e a
- Bind :: Exp e a -> (a -> Exp e b) -> Exp e b
- ThrowError :: String -> Exp Effect a
- CatchError :: Nomex a -> (String -> Nomex a) -> Nomex a
- LiftEffect :: NomexNE a -> Nomex a
- Simu :: Nomex a -> NomexNE Bool -> NomexNE Bool
- liftEffect :: NomexNE a -> Nomex a
- data V a = V {}
- data Event a where
- SumEvent :: Event a -> Event a -> Event a
- AppEvent :: Event (a -> b) -> Event a -> Event b
- PureEvent :: a -> Event a
- EmptyEvent :: Event a
- BindEvent :: Event a -> (a -> Event b) -> Event b
- ShortcutEvents :: [Event a] -> ([Maybe a] -> Bool) -> Event [Maybe a]
- BaseEvent :: Typeable a => Field a -> Event a
- LiftNomexNE :: NomexNE a -> Event a
- data Field a where
- data SomeField = forall a . Typeable a => SomeField (Field a)
- data SomeData = forall e . (Typeable e, Show e) => SomeData e
- data Player
- data RuleEvent
- data Msg m = Msg String
- data InputForm a where
- data EventInfo = forall e . (Typeable e, Show e) => EventInfo {
- _eventNumber :: EventNumber
- _ruleNumber :: RuleNumber
- event :: Event e
- handler :: EventHandler e
- _evStatus :: Status
- _env :: [FieldResult]
- data FieldAddressElem
- type FieldAddress = [FieldAddressElem]
- data FieldResult = forall e . (Typeable e, Show e) => FieldResult {
- field :: Field e
- fieldResult :: e
- _fieldAddress :: Maybe FieldAddress
- type EventHandler e = (EventNumber, e) -> Nomex ()
- data Status
- type Rule = Nomex ()
- data RuleInfo = RuleInfo {}
- data RuleStatus
- data PlayerInfo = PlayerInfo {}
- data VictoryInfo = VictoryInfo {}
- partial :: String -> Nomex (Maybe a) -> Nomex a
- concatMapM :: Monad m => (a -> m [b]) -> [a] -> m [b]
- fieldAddress :: Lens FieldResult (Maybe FieldAddress)
- env :: Lens EventInfo [FieldResult]
- evStatus :: Lens EventInfo Status
- ruleNumber :: Lens EventInfo RuleNumber
- eventNumber :: Lens EventInfo EventNumber
- playAs :: Lens PlayerInfo (Maybe PlayerNumber)
- playerName :: Lens PlayerInfo String
- playerNumber :: Lens PlayerInfo PlayerNumber
- rAssessedBy :: Lens RuleInfo (Maybe RuleNumber)
- rStatus :: Lens RuleInfo RuleStatus
- rRule :: Lens RuleInfo Rule
- rRuleCode :: Lens RuleInfo Code
- rProposedBy :: Lens RuleInfo PlayerNumber
- rDescription :: Lens RuleInfo String
- rName :: Lens RuleInfo RuleName
- rNumber :: Lens RuleInfo RuleNumber
Documentation
type PlayerNumber = Int Source
type PlayerName = String Source
type RuleNumber = Int Source
type EventNumber = Int Source
type OutputNumber = Int Source
type InputNumber = Int Source
Nomyx Expression
type Nomex = Exp Effect Source
A Nomex (Nomyx Expression) allows the players to write rules. within the rules, you can access and modify the state of the game.
type NomexNE = Exp NoEffect Source
A NomexNE (Nomyx Expression No Effect) is a specialisation of the type that guaranties that the instructions will have no effects.
data Exp :: Eff -> * -> * where Source
liftEffect :: NomexNE a -> Nomex a Source
Variables
Events
Composable events
SumEvent :: Event a -> Event a -> Event a | |
AppEvent :: Event (a -> b) -> Event a -> Event b | |
PureEvent :: a -> Event a | |
EmptyEvent :: Event a | |
BindEvent :: Event a -> (a -> Event b) -> Event b | |
ShortcutEvents :: [Event a] -> ([Maybe a] -> Bool) -> Event [Maybe a] | |
BaseEvent :: Typeable a => Field a -> Event a | |
LiftNomexNE :: NomexNE a -> Event a |
Base events
Type agnostic base event
Type agnostic result data
Input forms
forall e . (Typeable e, Show e) => EventInfo | |
|
data FieldAddressElem Source
type FieldAddress = [FieldAddressElem] Source
data FieldResult Source
forall e . (Typeable e, Show e) => FieldResult | |
|
type EventHandler e = (EventNumber, e) -> Nomex () Source
Rule
An informationnal structure about a rule
RuleInfo | |
|
data RuleStatus Source
the status of a rule.
Player
data PlayerInfo Source
informations on players
Victory
data VictoryInfo Source
concatMapM :: Monad m => (a -> m [b]) -> [a] -> m [b] Source
env :: Lens EventInfo [FieldResult] Source