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 #

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

parseLang :: Text -> Either String Lang #

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

renderLang :: Lang -> Text #

Render a `Lang` in BCP 47 form.

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

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