data-standards: A collection of standards representable by simple data types.

[ data, library, mpl ] [ Propose Tags ]

Type-safe representations of the country codes described by the ISO 3166-1 specification.

[Skip to Readme]
Versions [faq],,
Change log
Dependencies base (>=4.9 && <4.12), hashable (==1.2.*), unordered-containers (<0.3) [details]
License MPL-2.0
Copyright (c) 2018 Samuel May
Author Samuel May
Revised Revision 1 made by ageitilt at Sat Jul 7 06:16:16 UTC 2018
Category Data
Home page
Bug tracker
Source repo head: git clone git://
this: git clone git:// v0.1.0.0)
Uploaded by ageitilt at Sat Jul 7 04:30:15 UTC 2018
Distributions NixOS:
Downloads 545 total (49 in the last 30 days)
Rating (no votes yet) [estimated by rule of succession]
Your Rating
  • λ
  • λ
  • λ
Status Hackage Matrix CI
Docs not available [build log]
All reported builds failed as of 2018-07-07 [all 2 reports]


  • Data
    • Standards
      • ISO
        • Country
          • Data.Standards.ISO.Country.Primary
            • Data.Standards.ISO.Country.Primary.Alpha2
            • Data.Standards.ISO.Country.Primary.Alpha3
            • Data.Standards.ISO.Country.Primary.Numeric
            • Data.Standards.ISO.Country.Primary.Translation


Note: This package has metadata revisions in the cabal description newer than included in the tarball. To unpack the package including the revisions, use 'cabal get'.

Maintainer's Corner

For package maintainers and hackage trustees

Readme for data-standards-

[back to package description]

A number of the ISO standards are particularly attractive to being implemented as static data libraries: they describe short strings that are prone to error if left as 'Text', but are large enough to strongly discourage rewriting them for each project. It is no surprise, therefore, that this package is the fourth on Hackage to implement ISO 3166-1:

However, none of those options truly seemed to provide an ideal, /complete/ experience. Only one (country) provides all three code encodings, but it doesn't expose constructors for pattern matching. None of them implement the other two parts of ISO 3166 (region codes, and historic countries), and the only package that makes an effort to do so ("Data.StateCodes" from state-codes) doesn't cover anything beyond the US. Someone who only needs the alpha-2 codes ("CA") may indeed find one of the existing packages sufficient, but for anyone who does need the full power of ISO 3166-2, none of them would serve.

The lack of people who would actually find this useful is another matter. (Eight packages using the simple alpha-2 codes from one or another of the above, as of writing.)

This package is an attempt to package that standard -- and, eventually, others like it -- in a consistent API based in standard Haskell; fromEnum rather than encodeNumeric, for example.

The following standards are implemented:

  • ISO 3166-1 (Data.Standards.ISO.Country.Primary)

    • alpha-2 (Data.Standards.ISO.Country.Primary.Alpha2)
    • alpha-3 (Data.Standards.ISO.Country.Primary.Alpha3)
    • numeric (Data.Standards.ISO.Country.Primary.Numeric)