-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | Parsing and pretty printing of Roman numerals
--   
--   This library provides functions for parsing and pretty printing Roman
--   numerals. Because the notation of Roman numerals has varied through
--   the centuries this package allows for some customisation using a
--   configuration that is passed to the conversion functions.
@package roman-numerals
@version 0.5.1.5


-- | Parsing and pretty printing of Roman numerals.
--   
--   This module provides functions for parsing and pretty printing Roman
--   numerals. Because the notation of Roman numerals has varied through
--   the centuries this package allows for some customisation using a
--   configuration that is passed to the conversion functions.
--   
--   Example:
--   
--   <pre>
--   &gt; <a>toRoman</a> 1729 ∷ String
--   "MDCCXXIX"
--   </pre>
--   
--   <pre>
--   &gt; <a>fromRoman</a> "MDCCXXIX" ∷ Maybe Integer
--   Just 1729
--   </pre>
--   
--   <pre>
--   &gt; <a>convertTo</a> <a>simpleRoman</a> 1729 ∷ String
--   "MDCCXXVIIII"
--   </pre>
--   
--   <pre>
--   &gt; <a>fromRoman</a> "Bla" ∷ Maybe Integer
--   Nothing
--   </pre>
module Text.Numeral.Roman

-- | A configuration with which the <a>convertTo</a> and <a>convertFrom</a>
--   functions can be parameterized.
data NumeralConfig s n

-- | Smart constructor for a <a>NumeralConfig</a>.
mkNumConfig :: (Ord n, Num n) => s -> s -> [(s, n)] -> NumeralConfig s n

-- | Converts a number to a Roman numeral according to the given
--   configuration.
convertTo :: Monoid s => Ord n => Num n => NumeralConfig s n -> n -> s

-- | Class used to overload the input of the parsing functions.
class StripPrefix s
spNull :: StripPrefix s => s -> Bool
spStripPrefix :: StripPrefix s => s -> s -> Maybe s

-- | Parses a string as a Roman numeral according to the given
--   configuration. Result is <a>Nothing</a> if the input is not a valid
--   numeral.
convertFrom :: (Monoid s, StripPrefix s, Eq s, Ord n, Num n) => NumeralConfig s n -> s -> Maybe n

-- | Configuration for Roman numerals as they are commonly used today. The
--   value 0 is represented by the empty string. It can be interpreted as
--   not writing down a number. This configuration is practically limited
--   to the range [1..3999]. Smaller numbers will result in an empty
--   string. Larger numbers will result in repeated use of the 'M' symbol.
modernRoman :: (IsString s, Ord n, Num n) => NumeralConfig s n

-- | Configuration for Roman numerals that do not use the rule that a lower
--   rank symbol can be placed before a higher rank symbol to denote the
--   difference between them. Thus a numeral like "IV" will not be accepted
--   or generated by this configuration. This configuration is practically
--   limited to the range [1..3999]. Smaller numbers will result in an
--   empty string. Larger numbers will result in repeated use of the 'M'
--   symbol.
simpleRoman :: (IsString s, Ord n, Num n) => NumeralConfig s n

-- | Converts a number to a modern Roman numeral.
toRoman :: (IsString s, Monoid s, Ord n, Num n) => n -> s

-- | Parses a string as a modern Roman numeral.
fromRoman :: (IsString s, Monoid s, StripPrefix s, Eq s, Ord n, Num n) => s -> Maybe n
instance GHC.Classes.Eq α => Text.Numeral.Roman.StripPrefix [α]
instance Text.Numeral.Roman.StripPrefix Data.ByteString.Internal.ByteString
instance Text.Numeral.Roman.StripPrefix Data.ByteString.Lazy.Internal.ByteString
instance Text.Numeral.Roman.StripPrefix Data.Text.Internal.Text
instance Text.Numeral.Roman.StripPrefix Data.Text.Internal.Lazy.Text
