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

Safe HaskellNone
LanguageHaskell2010

Data.StateCodes

Description

Main entry point, exposing all that needs to be

Synopsis

Documentation

data StateCode Source #

Constructors

AL 
AK 
AZ 
AR 
CA 
CO 
CT 
DE 
FL 
GA 
HI 
ID 
IL 
IN 
IA 
KS 
KY 
LA 
ME 
MD 
MA 
MI 
MN 
MS 
MO 
MT 
NE 
NV 
NH 
NJ 
NM 
NY 
NC 
ND 
OH 
OK 
OR 
PA 
RI 
SC 
SD 
TN 
TX 
UT 
VT 
VA 
WA 
WV 
WI 
WY 
DC 
AS 
GU 
MP 
PR 
UM 
VI 

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

FromJSON StateCode Source #

From JSON: as a simple string

RenderMessage master StateCode Source #

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

Methods

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

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

List all codes with names

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

List of names 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 code from the user readable name

fromMText :: Text -> Maybe StateCode Source #

Maybe get the StateCode from the text code.

fromName :: Text -> StateCode Source #

Get the StateCode from the user readable name. Errors if the name is unknown

fromText :: Text -> StateCode Source #

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

toName :: StateCode -> Text Source #

Get the user readable name

toText :: StateCode -> Text Source #

Get the code as text