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.Number.Roman

Contents

Description

This module aims to convert Roman numerals to a String of unicode characters that represent Roman numerals.

One can convert numbers to Roman numerals in upper case and lower case, and in Additive and Subtractive style.

Synopsis

Data types to represent Roman numerals

data RomanLiteral Source #

Roman numerals for which a unicode character exists.

Constructors

I

The unicode character for the Roman numeral one: Ⅰ.

II

The unicode character for the Roman numeral two: Ⅱ.

III

The unicode character for the Roman numeral three: Ⅲ.

IV

The unicode character for the Roman numeral four: Ⅳ.

V

The unicode character for the Roman numeral five: Ⅴ.

VI

The unicode character for the Roman numeral six: Ⅵ.

VII

The unicode character for the Roman numeral seven: Ⅶ.

VIII

The unicode character for the Roman numeral eight: Ⅷ.

IX

The unicode character for the Roman numeral nine: Ⅸ.

X

The unicode character for the Roman numeral ten: Ⅹ.

XI

The unicode character for the Roman numeral eleven: Ⅺ.

XII

The unicode character for the Roman numeral twelve: Ⅻ.

L

The unicode character for the Roman numeral fifty: Ⅼ.

C

The unicode character for the Roman numeral hundred: Ⅽ.

D

The unicode character for the Roman numeral five hundred: Ⅾ.

M

The unicode character for the Roman numeral thousand: Ⅿ.

data RomanStyle Source #

The style to convert a number to a Roman numeral.

Constructors

Additive

The additive style converts four to ⅠⅠⅠⅠ.

Subtractive

The subtractive style converts four to ⅠⅤ.

Convert a number to Roman literals

toLiterals Source #

Arguments

:: Integral i 
=> RomanStyle

Specifies if the Numeral is Additive or Subtractive style.

-> Ligate

Specifies if characters like ⅠⅤ are joined to .

-> i

The given number to convert.

-> Maybe [RomanLiteral]

A list of RomanLiterals if the given number can be specified with Roman numerals, Nothing otherwise.

Convert the given number with the given RomanStyle and Ligate style to a sequence of RomanLiterals, given the number can be represented with Roman numerals (is strictly larger than zero).

romanLiteral Source #

Arguments

:: RomanLiteral

The given RomanLiteral to convert.

-> Char

A unicode character that represents the given RomanLiteral.

Convert the given RomanLiteral object to a unicode character in upper case.

romanLiteral' Source #

Arguments

:: RomanLiteral

The given RomanLiteral to convert.

-> Char

A unicode character that represents the given RomanLiteral.

Convert the given RomanLiteral object to a unicode character in lower case.

Convert a number to text

romanNumeral Source #

Arguments

:: [RomanLiteral]

The given list of RomanLiteral objects to convert to a Unicode equivalent.

-> Text

A Text object that contains a sequence of unicode characters that represents the RomanLiterals.

Convert a sequence of RomanLiteral objects to a Text object that contains a sequence of corresponding Unicode characters which are Roman numberals in upper case.

romanNumeral' Source #

Arguments

:: [RomanLiteral]

The given list of RomanLiteral objects to convert to a Unicode equivalent.

-> Text

A Text object that contains a sequence of unicode characters that represents the RomanLiterals.

Convert a sequence of RomanLiteral objects to a Text object that contains a sequence of corresponding Unicode characters which are Roman numberals in lower case.

romanNumeralCase Source #

Arguments

:: LetterCase

The given LetterCase to apply.

-> [RomanLiteral]

The given list of RomanLiteral objects to convert to a Unicode equivalent.

-> Text

A Text object that contains a sequence of unicode characters that represents the RomanLiterals.

Convert a sequence of RomanLiteral objects to a Text object that contains a sequence of corresponding Unicode characters which are Roman numberals in upper case or lower case depending on the LetterCase value.

romanNumber Source #

Arguments

:: Integral i 
=> RomanStyle

Specifies if the Numeral is Additive or Subtractive style.

-> Ligate

Specifies if characters like ⅠⅤ are joined to .

-> i

The given number to convert.

-> Maybe Text

A Text if the given number can be specified with Roman numerals wrapped in a Just, Nothing otherwise.

Convert a given number to a Text wrapped in a Just data constructor, given the number, given it can be represented. Nothing in case it can not be represented. The number is written in Roman numerals in upper case.

romanNumber' Source #

Arguments

:: Integral i 
=> RomanStyle

Specifies if the Numeral is Additive or Subtractive style.

-> Ligate

Specifies if characters like ⅠⅤ are joined to .

-> i

The given number to convert.

-> Maybe Text

A Text if the given number can be specified with Roman numerals wrapped in a Just, Nothing otherwise.

Convert a given number to a Text wrapped in a Just data constructor, given the number, given it can be represented. Nothing in case it can not be represented. The number is written in Roman numerals in lower case.

romanNumberCase :: Integral i => LetterCase -> RomanStyle -> Ligate -> i -> Maybe Text Source #

Convert a given number to a Text wrapped in a Just data constructor, given the number, given it can be represented. Nothing in case it can not be represented. The number is written in Roman numerals in upper case or lower case depending on the LetterCase value.