state-codes-0.1.2: ISO 3166-2:US state codes and i18n names

Safe HaskellNone
LanguageHaskell2010

Data.StateCodes

Description

This module defines codes for the names of the principal subdivisions for the United States according to ISO 3166-2:US.

Synopsis

Documentation

data StateCode Source #

Constructors

AL

Alabama

AK

Alaska

AZ

Arizona

AR

Arkansas

CA

California

CO

Colorado

CT

Connecticut

DE

Delaware

FL

Florida

GA

Georgia

HI

Hawaii

ID

Idaho

IL

Illinois

IN

Indiana

IA

Iowa

KS

Kansas

KY

Kentucky

LA

Louisiana

ME

Maine

MD

Maryland

MA

Massachusetts

MI

Michigan

MN

Minnesota

MS

Mississippi

MO

Missouri

MT

Montana

NE

Nebraska

NV

Nevada

NH

New Hampshire

NJ

New Jersey

NM

New Mexico

NY

New York

NC

North Carolina

ND

North Dakota

OH

Ohio

OK

Oklahoma

OR

Oregon

PA

Pennsylvania

RI

Rhode Island

SC

South Carolina

SD

South Dakota

TN

Tennessee

TX

Texas

UT

Utah

VT

Vermont

VA

Virginia

WA

Washington

WV

West Virginia

WI

Wisconsin

WY

Wyoming

DC

District of Columbia

AS

American Samoa

GU

Guam

MP

Northern Mariana Islands

PR

Puerto Rico

UM

United States Minor Outlying Islands

VI

Virgin Islands, U.S.

Instances

Bounded StateCode Source # 
Enum StateCode Source # 
Eq StateCode Source # 
Ord StateCode Source # 
Read StateCode Source # 
Show StateCode Source # 
ToJSON StateCode Source #

To JSON: as a simple string

Methods

toJSON :: StateCode -> Value

toEncoding :: StateCode -> Encoding

toJSONList :: [StateCode] -> Value

toEncodingList :: [StateCode] -> Encoding

FromJSON StateCode Source #

From JSON: as a simple string

Methods

parseJSON :: Value -> Parser StateCode

parseJSONList :: Value -> Parser [StateCode]

RenderMessage master StateCode Source #

Show state readable name, in English (ignoring locale for now)

Methods

renderMessage :: master -> [Lang] -> StateCode -> Text

allNames :: [(StateCode, Text)] Source #

List all codes with names

allStates :: [(Text, StateCode)] Source #

List all states with codes. This is ready to be used in a yesod selectField, for example

stateList :: [(Text, StateCode)] Source #

List of states sorted by alphabetical order, with state code this is ready to be used in a yesod selectField, for example

districtList :: [(Text, StateCode)] Source #

List of districts sorted by alphabetical order, with state code this is ready to be used in a yesod selectField, for example

outlyingAreasList :: [(Text, StateCode)] Source #

List of outlying areas sorted by alphabetical order, with state code this is ready to be used in a yesod selectField, for example

fromMName :: Text -> Maybe StateCode Source #

Maybe get the state code from the state readable name

fromMText :: Text -> Maybe StateCode Source #

Maybe get the state code from the text code

fromName :: Text -> StateCode Source #

Get the state code from the state readable name. Errors if the name is unknown

fromText :: Text -> StateCode Source #

Get the state code from the text code. Errors if the code is unknown

toName :: StateCode -> Text Source #

Get the state readable name

toText :: StateCode -> Text Source #

Get the state code as text