packages feed

fluent-1.0.0: src/Language/Fluent/Plural.hs

-- | <https://www.unicode.org/reports/tr35/tr35-numbers.html#Language_Plural_Rules>
module Language.Fluent.Plural where

import Data.Char (toLower)
import Prelude

data Category
    = Zero
    | One
    | Two
    | Few
    | Many
    | Other
    deriving stock (Eq, Show, Bounded, Enum)

instance Read Category where
    readsPrec _ s = [(it, "") | it <- [minBound .. maxBound], fmap toLower (show it) == fmap toLower s]

data Form
    = Cardinal
    | Ordinal
    deriving stock (Eq, Show, Bounded, Enum)

instance Read Form where
    readsPrec _ s = [(it, "") | it <- [minBound .. maxBound], fmap toLower (show it) == fmap toLower s]