nationstates-0.5.0.0: NationStates API client

Safe HaskellNone
LanguageHaskell2010

NationStates.Nation

Contents

Description

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

Synopsis

Running queries

newtype Nation a Source

A request to the Nation API.

Constructors

Nation 

Fields

Instances

Functor Nation Source 

Methods

fmap :: (a -> b) -> Nation a -> Nation b

(<$) :: a -> Nation b -> Nation a

Applicative Nation Source 

Methods

pure :: a -> Nation a

(<*>) :: Nation (a -> b) -> Nation a -> Nation b

(*>) :: Nation a -> Nation b -> Nation b

(<*) :: Nation a -> Nation b -> Nation a

run Source

Arguments

:: String

Nation name

-> Nation a

Requested shards

-> Context

Connection manager

-> IO a 

Perform a request to the Nation API.

Shards

name :: Nation String Source

Short name.

"Testlandia"

fullname :: Nation String Source

Full name, including pre-title.

"The Republic of Testlandia"

type_ :: Nation String Source

Nation type.

"Republic"

motto :: Nation String Source

Motto.

"It's a feature!"

category :: Nation WACategory Source

Nation category.

InoffensiveCentristDemocracy

wa :: Nation Bool Source

Whether the nation is in the World Assembly.

True

endorsements :: Nation [String] Source

List of endorsements received.

["jlink","translenia","the_vines"]

gavote :: Nation (Maybe WAVote) Source

General assembly vote.

Just True

scvote :: Nation (Maybe WAVote) Source

Security council vote.

Nothing

freedom :: Nation (String, String, String) Source

Description of civil rights, economy, and political freedoms.

("Excellent","Strong","Very Good")

region :: Nation String Source

Resident region.

"Testregionia"

population :: Nation Integer Source

Population, in millions.

25764

tax :: Nation Double Source

Income tax, percent.

83.6

animal :: Nation String Source

National animal.

"sea-snake"

animaltrait :: Nation String Source

A short phrase describing the animal.

"is also the nation's favorite main course"

currency :: Nation String Source

Currency.

"☆star☆"

flag :: Nation String Source

Flag URL.

"http://www.nationstates.net/images/flags/Switzerland.png"

banner :: Nation String Source

A suitable banner for this nation.

"v1"

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