Nomyx-Language-0.7.2: Language to express rules for Nomic

Safe HaskellNone
LanguageHaskell98

Language.Nomyx.Inputs

Description

All the building blocks to allow rules to get inputs. for example, you can create a button that will display a message like this: do void $ onInputButton_ "Click here:" (const $ outputAll_ "Bravo!") 1

Synopsis

Documentation

data InputForm a where Source

Input forms

Constructors

Text :: InputForm String 
TextArea :: InputForm String 
Button :: InputForm () 
Radio :: (Show a, Eq a) => [(a, String)] -> InputForm a 
Checkbox :: (Show a, Eq a) => [(a, String)] -> InputForm [a] 

Instances

inputRadio :: (Eq c, Show c, Typeable c) => PlayerNumber -> String -> [(c, String)] -> Event c Source

event based on a radio input choice

inputText :: PlayerNumber -> String -> Event String Source

event based on a text input

inputCheckbox :: (Eq c, Show c, Typeable c) => PlayerNumber -> String -> [(c, String)] -> Event [c] Source

event based on a checkbox input

inputButton :: PlayerNumber -> String -> Event () Source

event based on a button

inputTextarea :: PlayerNumber -> String -> Event String Source

event based on a text area

onInputRadio :: (Typeable a, Eq a, Show a) => String -> [a] -> (EventNumber -> a -> Nomex ()) -> PlayerNumber -> Nomex EventNumber Source

triggers a choice input to the user. The result will be sent to the callback

onInputRadio_ :: (Typeable a, Eq a, Show a) => String -> [a] -> (a -> Nomex ()) -> PlayerNumber -> Nomex EventNumber Source

the same, disregard the event number

onInputRadioOnce :: (Typeable a, Eq a, Show a) => String -> [a] -> (a -> Nomex ()) -> PlayerNumber -> Nomex EventNumber Source

the same, suppress the event after first trigger

inputRadio' :: (Eq c, Show c, Typeable c) => PlayerNumber -> String -> [c] -> Event c Source

onInputText :: String -> (EventNumber -> String -> Nomex ()) -> PlayerNumber -> Nomex EventNumber Source

triggers a string input to the user. The result will be sent to the callback

onInputText_ :: String -> (String -> Nomex ()) -> PlayerNumber -> Nomex EventNumber Source

asks the player pn to answer a question, and feed the callback with this data.

onInputTextOnce :: String -> (String -> Nomex ()) -> PlayerNumber -> Nomex EventNumber Source

asks the player pn to answer a question, and feed the callback with this data.

onInputCheckbox :: (Typeable a, Eq a, Show a) => String -> [(a, String)] -> (EventNumber -> [a] -> Nomex ()) -> PlayerNumber -> Nomex EventNumber Source

onInputCheckbox_ :: (Typeable a, Eq a, Show a) => String -> [(a, String)] -> ([a] -> Nomex ()) -> PlayerNumber -> Nomex EventNumber Source

onInputCheckboxOnce :: (Typeable a, Eq a, Show a) => String -> [(a, String)] -> ([a] -> Nomex ()) -> PlayerNumber -> Nomex EventNumber Source