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 #

A request to the Nation API.

Constructors

Nation 

Fields

Instances

Functor Nation # 

Methods

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

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

Applicative Nation # 

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 #

Arguments

:: String

Nation name

-> Nation a

Requested shards

-> Context

Connection manager

-> IO a 

Perform a request to the Nation API.

Shards

name :: Nation String #

Short name.

"Testlandia"

fullname :: Nation String #

Full name, including pre-title.

"The Republic of Testlandia"

type_ :: Nation String #

Nation type.

"Republic"

motto :: Nation String #

Motto.

"It's a feature!"

category :: Nation WACategory #

Nation category.

InoffensiveCentristDemocracy

wa :: Nation Bool #

Whether the nation is in the World Assembly.

True

endorsements :: Nation [String] #

List of endorsements received.

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

gavote :: Nation (Maybe WAVote) #

General assembly vote.

Just True

scvote :: Nation (Maybe WAVote) #

Security council vote.

Nothing

freedom :: Nation (String, String, String) #

Description of civil rights, economy, and political freedoms.

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

region :: Nation String #

Resident region.

"Testregionia"

population :: Nation Integer #

Population, in millions.

25764

tax :: Nation Double #

Income tax, percent.

83.6

animal :: Nation String #

National animal.

"sea-snake"

animaltrait :: Nation String #

A short phrase describing the animal.

"is also the nation's favorite main course"

currency :: Nation String #

Currency.

"☆star☆"

flag :: Nation String #

Flag URL.

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

banner :: Nation String #

A suitable banner for this nation.

"v1"

banners :: Nation [String] #

A list of suitable banners for this nation.

["v1","o4","b14","t23","m3"]

censusscore :: Nation (Integer, Double) #

Query today's census.

Returns the current census ID, along with its value.

(24,6.0)

censusscore' :: Integer -> Nation Double #

Query a census by its census ID.

94.0