Safe Haskell | None |
---|---|
Language | Haskell2010 |
The Nation API.
This module should be imported qualified, to prevent name clashes:
import NationStates import qualified NationStates.Nation as Nation
In general, this module follows the terminology used in the
official documentation,
except when it clashes with Haskell keywords. For instance, the
type
shard has been renamed to type_
.
Here's a short example:
import NationStates import qualified NationStates.Nation as Nation import Text.Printf main = do c <-newContext
"ExampleBot/2000" (name, motto) <- Nation.run
"Montesardo-East Adanzi" ((,) <$> Nation.name
<*> Nation.motto
) c printf "%s has the motto: %s\n" name motto
- newtype Nation a = Nation {}
- run :: String -> Nation a -> Context -> IO a
- name :: Nation String
- fullname :: Nation String
- type_ :: Nation String
- motto :: Nation String
- category :: Nation WACategory
- wa :: Nation Bool
- endorsements :: Nation [String]
- gavote :: Nation (Maybe WAVote)
- scvote :: Nation (Maybe WAVote)
- freedom :: Nation (String, String, String)
- region :: Nation String
- population :: Nation Integer
- tax :: Nation Double
- animal :: Nation String
- animaltrait :: Nation String
- currency :: Nation String
- flag :: Nation String
- banner :: Nation String
- banners :: Nation [String]
- censusscore :: Nation (Integer, Double)
- censusscore' :: Integer -> Nation Double
Running queries
A request to the Nation API.
Perform a request to the Nation API.
Shards
category :: Nation WACategory Source
Nation category.
InoffensiveCentristDemocracy
endorsements :: Nation [String] Source
List of endorsements received.
["jlink","translenia","the_vines"]
freedom :: Nation (String, String, String) Source
Description of civil rights, economy, and political freedoms.
("Excellent","Strong","Very Good")
population :: Nation Integer Source
Population, in millions.
25764
animaltrait :: Nation String Source
A short phrase describing the animal.
"is also the nation's favorite main course"
banners :: Nation [String] Source
A list of suitable banners for this nation.
["v1","o4","b14","t23","m3"]
censusscore :: Nation (Integer, Double) Source
Query today's census.
Returns the current census ID, along with its value.
(24,6.0)
censusscore' :: Integer -> Nation Double Source
Query a census by its census ID.
94.0