| Safe Haskell | None |
|---|
Text.Numeral.Render
- render :: Repr i -> i -> Exp i -> Maybe Text
- data Repr i = Repr {
- reprUnknown :: Maybe Text
- reprValue :: i -> ℤ -> Maybe (Ctx (Exp i) -> Text)
- reprNeg :: Maybe (Exp i -> Ctx (Exp i) -> Text)
- reprAdd :: Maybe (Exp i -> Exp i -> Ctx (Exp i) -> Text)
- reprMul :: Maybe (Exp i -> Exp i -> Ctx (Exp i) -> Text)
- reprSub :: Maybe (Exp i -> Exp i -> Ctx (Exp i) -> Text)
- reprFrac :: Maybe (Exp i -> Exp i -> Ctx (Exp i) -> Text)
- reprScale :: ScaleRepr i
- reprNegCombine :: Maybe (Text -> Text -> Exp i -> Text)
- reprAddCombine :: Maybe (Text -> Text -> Exp i -> Text -> Exp i -> Text)
- reprMulCombine :: Maybe (Text -> Text -> Exp i -> Text -> Exp i -> Text)
- reprSubCombine :: Maybe (Text -> Text -> Exp i -> Text -> Exp i -> Text)
- reprFracCombine :: Maybe (Text -> Text -> Exp i -> Text -> Exp i -> Text)
- type ScaleRepr i = i -> ℤ -> ℤ -> Exp i -> Ctx (Exp i) -> Maybe Text
- defaultRepr :: Repr inf
- data Ctx α
- posIndex :: Ctx α -> ℤ
- isOutside :: Side -> Ctx α -> Bool
Rendering numerals
Arguments
| :: Repr i | Representation. |
| -> i | Initial inflection. |
| -> Exp i | The expression to render. |
| -> Maybe Text |
Renders an expression to a Text value according to a certain
representation and inflection.
Representation of numerals
A representation for numerals.
A Repr contains all the information on how to render an
Expression to a Text value.
Constructors
| Repr | |
Fields
| |
Function that renders the representation of a step in a scale of large values. The value represented by the step is 10 ^ (rank * base + offset).
defaultRepr :: Repr infSource
Context of expressions
A context in which an Expression appears.
Constructors
| CtxEmpty | The empty context. Used for top level expressions. |
| CtxNeg (Ctx α) | Negation context. |
| CtxAdd Side α (Ctx α) | Addition context. |
| CtxMul Side α (Ctx α) | Multiplication context. |
| CtxSub Side α (Ctx α) | Subtraction context. |
| CtxFrac Side α (Ctx α) | Fraction context. |
| CtxScale (Ctx α) | Scale context. |
| CtxDual (Ctx α) | Dual context. |
| CtxPlural (Ctx α) | Plural context. |