Maintainer | hapytexeu+gh@gmail.com |
---|---|
Stability | experimental |
Portability | POSIX |
Safe Haskell | Safe |
Language | Haskell2010 |
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 RomanLiteral
- data RomanStyle
- toLiterals :: Integral i => RomanStyle -> Ligate -> i -> Maybe [RomanLiteral]
- romanLiteral :: RomanLiteral -> Char
- romanLiteral' :: RomanLiteral -> Char
- romanNumeral :: [RomanLiteral] -> Text
- romanNumeral' :: [RomanLiteral] -> Text
- romanNumeralCase :: LetterCase -> [RomanLiteral] -> Text
- romanNumber :: Integral i => RomanStyle -> Ligate -> i -> Maybe Text
- romanNumber' :: Integral i => RomanStyle -> Ligate -> i -> Maybe Text
- romanNumberCase :: Integral i => LetterCase -> RomanStyle -> Ligate -> i -> Maybe Text
Data types to represent Roman numerals
data RomanLiteral Source #
Roman numerals for which a unicode character exists.
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.Number.Roman | |
Enum RomanLiteral Source # | |
Defined in Data.Char.Number.Roman 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.Number.Roman (==) :: RomanLiteral -> RomanLiteral -> Bool # (/=) :: RomanLiteral -> RomanLiteral -> Bool # | |
Read RomanLiteral Source # | |
Defined in Data.Char.Number.Roman readsPrec :: Int -> ReadS RomanLiteral # readList :: ReadS [RomanLiteral] # | |
Show RomanLiteral Source # | |
Defined in Data.Char.Number.Roman showsPrec :: Int -> RomanLiteral -> ShowS # show :: RomanLiteral -> String # showList :: [RomanLiteral] -> ShowS # |
data RomanStyle Source #
The style to convert a number to a Roman numeral.
Additive | The additive style converts four to ⅠⅠⅠⅠ. |
Subtractive | The subtractive style converts four to ⅠⅤ. |
Instances
Convert a number to Roman literals
:: 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 RomanLiteral
s, given the number can be represented
with Roman numerals (is strictly larger than zero).
:: RomanLiteral | The given |
-> Char | A unicode character that represents the given |
Convert the given RomanLiteral
object to a unicode character in
upper case.
:: RomanLiteral | The given |
-> Char | A unicode character that represents the given |
Convert the given RomanLiteral
object to a unicode character in
lower case.
Convert a number to text
:: [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 upper case.
:: [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 lower case.
:: LetterCase | The given |
-> [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 upper case or lower case depending on the LetterCase
value.
:: Integral i | |
=> RomanStyle | Specifies if the Numeral is |
-> Ligate | Specifies if characters like |
-> i | The given number to convert. |
-> Maybe Text | A |
:: Integral i | |
=> RomanStyle | Specifies if the Numeral is |
-> Ligate | Specifies if characters like |
-> i | The given number to convert. |
-> Maybe Text | A |
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.