bcp47-0.2.0.6: Language tags as specified by BCP 47
Safe HaskellNone
LanguageHaskell2010

Data.BCP47.Internal.Region

Synopsis

Documentation

data Country #

Instances

Instances details
Bounded Country 
Instance details

Defined in Country.Unexposed.Names

Enum Country 
Instance details

Defined in Country.Unexposed.Names

Eq Country 
Instance details

Defined in Country.Unexposed.Names

Methods

(==) :: Country -> Country -> Bool #

(/=) :: Country -> Country -> Bool #

Data Country 
Instance details

Defined in Country.Unexposed.Names

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Country -> c Country #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Country #

toConstr :: Country -> Constr #

dataTypeOf :: Country -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Country) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Country) #

gmapT :: (forall b. Data b => b -> b) -> Country -> Country #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Country -> r #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Country -> r #

gmapQ :: (forall d. Data d => d -> u) -> Country -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Country -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Country -> m Country #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Country -> m Country #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Country -> m Country #

Ord Country 
Instance details

Defined in Country.Unexposed.Names

Show Country 
Instance details

Defined in Country.Unexposed.Names

Generic Country 
Instance details

Defined in Country.Unexposed.Names

Associated Types

type Rep Country :: Type -> Type #

Methods

from :: Country -> Rep Country x #

to :: Rep Country x -> Country #

Hashable Country 
Instance details

Defined in Country.Unexposed.Names

Methods

hashWithSalt :: Int -> Country -> Int #

hash :: Country -> Int #

ToJSON Country 
Instance details

Defined in Country.Unexposed.Names

FromJSON Country 
Instance details

Defined in Country.Unexposed.Names

Storable Country 
Instance details

Defined in Country.Unexposed.Names

Prim Country 
Instance details

Defined in Country.Unexposed.Names

NFData Country 
Instance details

Defined in Country.Unexposed.Names

Methods

rnf :: Country -> () #

type Rep Country 
Instance details

Defined in Country.Unexposed.Names

type Rep Country = D1 ('MetaData "Country" "Country.Unexposed.Names" "country-0.2.2-Js8nYtOAN0T8anTWvLG9Xb" 'True) (C1 ('MetaCons "Country" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Word16)))

regionFromText :: Text -> Either Text Country Source #

Parse a region subtag from Text

>>> regionFromText $ pack "ZW"
Right zimbabwe
>>> regionFromText $ pack "012"
Right algeria
>>> regionFromText $ pack "asdf"
Left "regionFromText:1:1:\n  |\n1 | asdf\n  | ^\nunexpected 'a'\nexpecting 2 or 3 character country code\n"

regionP :: Parsec Void Text Country Source #

BCP-47 region parser

@ region = 2ALPHA ; ISO 3166-1 code / 3DIGIT ; UN M.49 code @