libroman-3.1.1: Use Roman Numerals as a Numeric Datatype (sort of)

Copyright(c) Alexander Hakki
LicenseBSD3
Maintainerahk@ahakki.xyz
Stabilityexperimental
Portabilityportable
Safe HaskellSafe
LanguageHaskell2010

Data.Roman

Description

 

Synopsis

Documentation

class Roman r where Source #

A type class for all types that can represent roman numerals

Minimal complete definition

fromRoman

Methods

fromRoman :: Integral b => r -> b Source #

The Class Roman implements a single Method, fromRoman, to convert to an Integral Type

Instances

Roman RomanNumeral Source #

fromRoman on a RomanNumeral also returns the expected result, if the Roman Number is not stricly "correct", such as XIIX -> 18.

Methods

fromRoman :: Integral b => RomanNumeral -> b Source #

Roman RomanSymbol Source # 

Methods

fromRoman :: Integral b => RomanSymbol -> b Source #

data RomanSymbol Source #

RomanSymbols from I to M

Zero is represented as the latin word Nulla

Constructors

Nulla 
I 
V 
X 
L 
C 
D 
M 

Instances

Enum RomanNumeral Source # 
Enum RomanSymbol Source # 
Eq RomanSymbol Source # 
Integral RomanNumeral Source # 
Num RomanNumeral Source #

Be aware that, Roman Numerals can never be negative.

Ord RomanNumeral Source # 
Ord RomanSymbol Source # 
Read RomanNumeral Source #

Overlaps instance Read [a] with a specific version, so that "xxi" -> [X, X, I]

Read RomanSymbol Source #

Read is case insensitive

Real RomanNumeral Source # 
Show RomanNumeral Source # 
Show RomanSymbol Source # 
Roman RomanNumeral Source #

fromRoman on a RomanNumeral also returns the expected result, if the Roman Number is not stricly "correct", such as XIIX -> 18.

Methods

fromRoman :: Integral b => RomanNumeral -> b Source #

Roman RomanSymbol Source # 

Methods

fromRoman :: Integral b => RomanSymbol -> b Source #

type RomanNumeral = [RomanSymbol] Source #

Roman Numerals are represented as Lists of RomanSymbols