unicode-collation-0.1.3.6: Haskell implementation of the Unicode Collation Algorithm

Safe Haskell | None
Language | Haskell2010

Text.Collate.Lang

Synopsis

- data Lang = Lang {
  - langLanguage :: Text
  - langScript :: Maybe Text
  - langRegion :: Maybe Text
  - langVariants :: [Text]
  - langExtensions :: [(Text, [(Text, Text)])]
  - langPrivateUse :: [Text]
  }
- parseLang :: Text -> Either String Lang
- renderLang :: Lang -> Text
- lookupLang :: Lang -> [(Lang, a)] -> Maybe (Lang, a)

# Documentation

data Lang Source #

Represents a BCP 47 language tag (https://tools.ietf.org/html/bcp47).

Constructors

Lang |

Fields

- langLanguage :: Text
- langScript :: Maybe Text
- langRegion :: Maybe Text
- langVariants :: [Text]
- langExtensions :: [(Text, [(Text, Text)])]
- langPrivateUse :: [Text]

#### Instances

Instances details

Binary Lang Source # |
Instance details Defined in Text.Collate.Lang Methods put :: Lang -> Put Source # get :: Get Lang Source # putList :: [Lang] -> Put Source #
IsString Lang Source # |
Instance details Defined in Text.Collate.Lang Methods fromString :: String -> Lang Source #
Show Lang Source # |
Instance details Defined in Text.Collate.Lang Methods showsPrec :: Int -> Lang -> ShowS Source # show :: Lang -> String Source # showList :: [Lang] -> ShowS Source #
Eq Lang Source # |
Instance details Defined in Text.Collate.Lang Methods (==) :: Lang -> Lang -> Bool Source # (/=) :: Lang -> Lang -> Bool Source #
Ord Lang Source # |
Instance details Defined in Text.Collate.Lang Methods compare :: Lang -> Lang -> Ordering Source # (<) :: Lang -> Lang -> Bool Source # (<=) :: Lang -> Lang -> Bool Source # (>) :: Lang -> Lang -> Bool Source # (>=) :: Lang -> Lang -> Bool Source # max :: Lang -> Lang -> Lang Source # min :: Lang -> Lang -> Lang Source #
Lift Lang Source # |
Instance details Defined in Text.Collate.Lang Methods lift :: Quote m => Lang -> m Exp Source # liftTyped :: forall (m :: Type -> Type). Quote m => Lang -> Code m Lang Source #

parseLang :: Text -> Either String Lang Source #

Parse a BCP 47 language tag as a `Lang`.

renderLang :: Lang -> Text Source #

Render a `Lang` in BCP 47 form.

lookupLang :: Lang -> [(Lang, a)] -> Maybe (Lang, a) Source #

Find best match for a `Lang` in an association list.