unicode-tricks-0.10.1.0: Functions to work with unicode blocks more convenient.
Maintainerhapytexeu+gh@gmail.com
Stabilityexperimental
PortabilityPOSIX
Safe HaskellSafe
LanguageHaskell2010

Data.Char.Number.VulgarFraction

Description

Uncode has two blocks where vulgar fractions are defined: C1 controls and latin supplement 1 and Number forms. These are fractions that are commenly used.

The module exports function toVulgar and ratioToVulgar to convert the ratio to a Char with that fraction if that exists. The functon ratioToVulgarFallback and ratioToVulgarFallback are used to try to find a vulgar fraction character, and if that fails, it prints the fraction with the help of the Small module.

Synopsis

Render to a vulgar fraction

ratioToVulgar Source #

Arguments

:: Integral i 
=> Ratio i

The Ratio for which we try to find the corresponding Character.

-> Maybe Char

The corresponding Character wrapped in a Just if such character exists; Nothing otherwise.

Convert the given Ratio item to a vulgar fraction character, if such character exists; Nothing otherwise.

toVulgar Source #

Arguments

:: (Integral i, Integral j) 
=> i

The given numerator.

-> j

The given denominator.

-> Maybe Char

The corresponding Character wrapped in a Just if such character exists; Nothing otherwise.

Convert the given numerator den denominator to a vulgar fraction character, if such character exists; Nothing otherwise.

Render to a vulgar fraction, with a fallback to using small characters

ratioToVulgarFallback Source #

Arguments

:: Integral i 
=> Ratio i

The given Ratio to convert.

-> Text

A Text object with a single Character if a vulgar fraction character exists; otherwise a Text object created by ratioPartsToUnicode'.

Convert the given Ratio to a singleton Text with the vulgar fraction character, if such character exists; it will make ue of the ratioPartsToUnicode' to generate a Text object (with multiple Characters) that looks like a fraction.

toVulgarFallback Source #

Arguments

:: (Integral i, Integral j) 
=> i

The given numerator.

-> j

The given denominator.

-> Text

A Text object with a single Character if a vulgar fraction character exists; otherwise a Text object created by ratioPartsToUnicode'.

Convert the given numerator and denominator to a singleton Text with the vulgar fraction character, if such character exists; it will make ue of the ratioPartsToUnicode' to generate a Text object (with multiple Characters) that looks like a fraction.