Apache-2.0 licensed by Chris Wong
Maintained by [email protected]
This version can be pinned in stack with:nationstates-0.1.0.2@sha256:f7cc6d9e2d88214d49f6fd14aade05d91ddd6fe1e28fd53e2e1d35cacaf96006,921

NationStates for Haskell Build Status

NationStates is an online government simulation game, created by Max Barry. The site generates a wealth of data, some of which can be accessed through its official API.

This library lets you query this API using the Haskell programming language.

Features

  • Type safe: you can’t refer to a shard unless you explicitly request it.

  • Automatic rate limiting, which can be disabled or overridden if you want.

  • HTTP support via the tls library.

  • Free and open source under the Apache License, version 2.0.

Dependencies

  • GHC 7.6 or newer

Installation

nationstates is hosted on Hackage.

cabal install nationstates

Example

import NationStates
import qualified NationStates.Nation as Nation
import Text.Printf

main = withContext "ExampleBot/2000" $ \c -> do
    (name, motto) <- Nation.run "Montesardo-East Adanzi" shards c
    printf "%s has the motto: %s\n" name motto
  where
    shards = (,) <$> Nation.name <*> Nation.motto