fluent
Safe HaskellNone
LanguageHaskell2010

Language.Fluent.Value

Synopsis

Documentation

data Value Source #

The concrete representation of a Fluent value, along with any formatting options.

Constructors

Formatted (forall l. Locale l => NonEmpty l -> Either String Text)

A value with custom locale-aware formatting logic.

String Text

Text that is already formatted.

Number Scientific NumberOptions

A number and its formatting options.

Time UTCTime TimeOptions

A point in time and its formatting options.

Invalid String

A failed or invalid argument and the error reason.

Instances

Instances details
ToValue Value Source # 
Instance details

Defined in Language.Fluent.Value

Methods

toValue :: Value -> Value Source #

IsString Value Source # 
Instance details

Defined in Language.Fluent.Value

Methods

fromString :: String -> Value #

Show Value Source # 
Instance details

Defined in Language.Fluent.Value

Methods

showsPrec :: Int -> Value -> ShowS #

show :: Value -> String #

showList :: [Value] -> ShowS #

format :: Locale l => NonEmpty l -> Value -> Either String Text Source #

Renders a Value into text for the given locale fallback chain.

asText :: Value -> Text Source #

The raw string representation of a Value without applying locale formatting.

matchesExact :: Value -> Value -> Bool Source #

Whether a selector matches a variant key by exact equality.

matchesCategory :: Locale l => l -> Value -> Value -> Bool Source #

Whether a numeric selector matches a plural category key (e.g. 1 matching "one").

fromIntegral :: Integral a => a -> Value Source #

Converts an integer into an arbitrary-precision numeric Value.

fromFloatDigits :: RealFloat a => a -> Value Source #

Converts a floating-point number into an arbitrary-precision numeric Value. Evaluates to Invalid for NaN and infinities.

class ToValue v where Source #

Types usable as arguments in Fluent message formatting.

Methods

toValue :: v -> Value Source #

Instances

Instances details
ToValue Value Source # 
Instance details

Defined in Language.Fluent.Value

Methods

toValue :: Value -> Value Source #

ToValue Int16 Source # 
Instance details

Defined in Language.Fluent.Value

Methods

toValue :: Int16 -> Value Source #

ToValue Int32 Source # 
Instance details

Defined in Language.Fluent.Value

Methods

toValue :: Int32 -> Value Source #

ToValue Int64 Source # 
Instance details

Defined in Language.Fluent.Value

Methods

toValue :: Int64 -> Value Source #

ToValue Int8 Source # 
Instance details

Defined in Language.Fluent.Value

Methods

toValue :: Int8 -> Value Source #

ToValue Word16 Source # 
Instance details

Defined in Language.Fluent.Value

Methods

toValue :: Word16 -> Value Source #

ToValue Word32 Source # 
Instance details

Defined in Language.Fluent.Value

Methods

toValue :: Word32 -> Value Source #

ToValue Word64 Source # 
Instance details

Defined in Language.Fluent.Value

Methods

toValue :: Word64 -> Value Source #

ToValue Word8 Source # 
Instance details

Defined in Language.Fluent.Value

Methods

toValue :: Word8 -> Value Source #

ToValue Scientific Source # 
Instance details

Defined in Language.Fluent.Value

ToValue Text Source # 
Instance details

Defined in Language.Fluent.Value

Methods

toValue :: Text -> Value Source #

ToValue UTCTime Source # 
Instance details

Defined in Language.Fluent.Value

ToValue Integer Source # 
Instance details

Defined in Language.Fluent.Value

ToValue Natural Source # 
Instance details

Defined in Language.Fluent.Value

ToValue String Source # 
Instance details

Defined in Language.Fluent.Value

Methods

toValue :: String -> Value Source #

ToValue Double Source # 
Instance details

Defined in Language.Fluent.Value

Methods

toValue :: Double -> Value Source #

ToValue Float Source # 
Instance details

Defined in Language.Fluent.Value

Methods

toValue :: Float -> Value Source #

ToValue Int Source # 
Instance details

Defined in Language.Fluent.Value

Methods

toValue :: Int -> Value Source #

ToValue Word Source # 
Instance details

Defined in Language.Fluent.Value

Methods

toValue :: Word -> Value Source #