| Maintainer | hapytexeu+gh@gmail.com |
|---|---|
| Stability | experimental |
| Portability | POSIX |
| Safe Haskell | Safe |
| Language | Haskell2010 |
Data.Char.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 uppercase and lowercase, and in Additive and Subtractive style.
Synopsis
- data RomanLiteral
- data RomanStyle
- toLiterals :: Integral i => RomanStyle -> Ligate -> i -> Maybe [RomanLiteral]
- romanLiteral :: RomanLiteral -> Char
- romanLiteral' :: RomanLiteral -> Char
- romanNumeral :: [RomanLiteral] -> Text
- romanNumeral' :: [RomanLiteral] -> Text
- romanNumber :: Integral i => RomanStyle -> Ligate -> i -> Maybe Text
- romanNumber' :: Integral i => RomanStyle -> Ligate -> i -> Maybe Text
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: Ⅿ. |
Instances
| Bounded RomanLiteral Source # | |
Defined in Data.Char.Roman | |
| Enum RomanLiteral Source # | |
Defined in Data.Char.Roman Methods succ :: RomanLiteral -> RomanLiteral # pred :: RomanLiteral -> RomanLiteral # toEnum :: Int -> RomanLiteral # fromEnum :: RomanLiteral -> Int # enumFrom :: RomanLiteral -> [RomanLiteral] # enumFromThen :: RomanLiteral -> RomanLiteral -> [RomanLiteral] # enumFromTo :: RomanLiteral -> RomanLiteral -> [RomanLiteral] # enumFromThenTo :: RomanLiteral -> RomanLiteral -> RomanLiteral -> [RomanLiteral] # | |
| Eq RomanLiteral Source # | |
Defined in Data.Char.Roman | |
| Read RomanLiteral Source # | |
Defined in Data.Char.Roman Methods readsPrec :: Int -> ReadS RomanLiteral # readList :: ReadS [RomanLiteral] # | |
| Show RomanLiteral Source # | |
Defined in Data.Char.Roman Methods showsPrec :: Int -> RomanLiteral -> ShowS # show :: RomanLiteral -> String # showList :: [RomanLiteral] -> ShowS # | |
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 ⅠⅤ. |
Instances
Convert a number to Roman literals
Arguments
| :: Integral i | |
| => RomanStyle | Specifies if the Numeral is |
| -> Ligate | Specifies if characters like |
| -> i | The given number to convert. |
| -> Maybe [RomanLiteral] | A list of |
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).
Arguments
| :: RomanLiteral | The given |
| -> Char | A unicode character that represents the given |
Convert the given RomanLiteral object to a unicode character in
uppercase.
Arguments
| :: RomanLiteral | The given |
| -> Char | A unicode character that represents the given |
Convert the given RomanLiteral object to a unicode character in
lowercase.
Convert a number to text
Arguments
| :: [RomanLiteral] | The given list of |
| -> Text | A |
Convert a sequence of RomanLiteral objects to a Text object that
contains a sequence of corresponding Unicode characters which are Roman
numberals in uppercase.
Arguments
| :: [RomanLiteral] | The given list of |
| -> Text | A |
Convert a sequence of RomanLiteral objects to a Text object that
contains a sequence of corresponding Unicode characters which are Roman
numberals in lowercase.
Arguments
| :: Integral i | |
| => RomanStyle | Specifies if the Numeral is |
| -> Ligate | Specifies if characters like |
| -> i | The given number to convert. |
| -> Maybe Text | A |
Arguments
| :: Integral i | |
| => RomanStyle | Specifies if the Numeral is |
| -> Ligate | Specifies if characters like |
| -> i | The given number to convert. |
| -> Maybe Text | A |