unicode-tricks-0.6.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 
=> 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.

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 that specifies that number in superscript characters.

Ratio formatting

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.