GaBuZoMeu/Types.hs

24 lines
792 B
Haskell
Raw Normal View History

2023-06-08 21:49:35 +02:00
-- 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]
2023-10-01 18:47:01 +02:00
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) ...