bcp47-0.1.0.0: Language tags as specified by BCP 47

bcp47-0.1.0.0: Language tags as specified by BCP 47

Language tags for use in cases where it is desirable to indicate the language used in an information object.

- https://tools.ietf.org/html/bcp47

This package exposes a language tag data type BCP47 and a Trie data structure for collecting and querying information that varies based on language tag.

import Data.BCP47 (en, enGB, sw)
import Data.BCP47.Trie (Trie, fromList, lookup)

color :: Trie Text
color = fromList [(en, "color"), (sw, "rangi")]

main = do
  print $ match en color -- Just "color"
  print $ match enGB color -- Nothing
  print $ lookup enGB color -- Just "color"

Signatures

Modules