unicode-tricks-0.8.0.0: Functions to work with unicode blocks more convenient.

Maintainerhapytexeu+gh@gmail.com
Stabilityexperimental
PortabilityPOSIX
Safe HaskellSafe
LanguageHaskell2010

Data.Char.Small

Contents

Description

One can make use of a block of Unicode characters to emulate subscript and superscript. Note that the subscript and superscript will be aligned with the baseline and the cap line respectively, and is thus not equivalent to sub.../sub and sup.../sup in HTML. Furthermore only a small subset of characters is supported.

This module allows one to map certain characters to their subscript and superscript counterpart, and furthermore makes it more convenient to transform a number (both positive and negative) to a Text that specifies this number in subscript and superscript.

Synopsis

Convert characters to their subscript and superscript counterpart

toSub Source #

Arguments

:: Char

The given character to convert to its subscript counterpart.

-> Maybe Char

A character wrapped in a Just given the counterpart exists, Nothing otherwise.

Convert a set of characters to their subscript counterpart, given that characters exists.

toSup Source #

Arguments

:: Char

The given character to convert to its superscript counterpart.

-> Maybe Char

A character wrapped in a Just given the counterpart exists, Nothing otherwise.

Convert a set of characters to their superscript counterpart, given that characters exists.

Numbers as subscript and superscript.

asSub Source #

Arguments

:: Integral i 
=> PlusStyle

The given PlusStyle to use.

-> i

The given number to convert.

-> Text

A Text value that denotes the number as a sequence of subscript characters.

Convert a number (positive or negative) to a Text object that denotes that number in subscript characters.

asSub' Source #

Arguments

:: Integral i 
=> i

The number to convert.

-> Text

A Text value that contains the number as a sequence of subscript characters.

Convert a number (positive or negative) to a Text that specifies that number in subscript characters.

asSubPlus Source #

Arguments

:: Integral i 
=> i

The number to convert.

-> Text

A Text value that contains the number as a sequence of subscript characters.

Convert a number (positive or negative) to a Text that specifies that number in subscript characters. For positive characters, the subscript contains a plus character ().

asSup Source #

Arguments

:: Integral i 
=> PlusStyle

The given PlusStyle to use.

-> i

The given number to convert.

-> Text

A Text value that denotes the number as a sequence of superscript characters.

Convert a number (positive or negative) to a Text object that denotes that number in superscript characters.

asSup' Source #

Arguments

:: Integral i 
=> i

The number to convert.

-> Text

A Text value that contains the number as a sequence of superscript characters.

Convert a number (positive or negative) to a Text object that denotes that number in superscript characters.

asSupPlus Source #

Arguments

:: Integral i 
=> i

The number to convert.

-> Text

A Text value that contains the number as a sequence of superscript characters.

Convert a number (positive or negative) to a Text that specifies that number in superscript characters. For positive characters, the superscript contains a plus character ().

Ratio formatting

ratioToUnicode Source #

Arguments

:: Integral i 
=> PlusStyle

The given PlusStyle to use.

-> Ratio i

The given Ratio object to convert to a Text.

-> Text

A Text object that denotes the given Ratio making use of superscript and subscript.

Convert the given Ratio object to a sequence of characters with the numerator in superscript and the denominator in subscript. The given PlusStyle is applied to the numerator.

ratioToUnicode' Source #

Arguments

:: Integral i 
=> Ratio i

The given Ratio value to format.

-> Text

The Text block that contains a textual representation of the Ratio.

Format a given Ratio object to a Text value that formats the ratio with superscript and subscript using the Default PlusStyle.