24 lines
792 B
Haskell
24 lines
792 B
Haskell
-- Haskell types to support the language tags
|
|
|
|
module Types where
|
|
|
|
type Language = String
|
|
type Extlang = Maybe String -- Only one extlang authorized
|
|
type Script = Maybe String
|
|
type Region = Maybe String
|
|
type Singleton = Char
|
|
type Variants = [Variant]
|
|
type Variant = String
|
|
type Extension = (Singleton, [String])
|
|
type Extensions = [Extension]
|
|
|
|
type Grandfathered = String
|
|
type Privateuse = [String]
|
|
|
|
data Tag = Tag Language Extlang Script Region Variants Extensions | GF Grandfathered | Priv Privateuse deriving (Show)
|
|
-- Warning, Eq must be redefined because it needs to take into account
|
|
-- case-insensitivity and (maybe) canonicalization (see issue #10).
|
|
-- Complicated because Tag is not a string. Sopmething like:
|
|
-- instance Eq Tag where
|
|
-- a == b = (Language a) == (Language b) ...
|