-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Convert integers in various bases to and from strings -- -- Parse or show positive and negative intergers in decimal, hexadecimal, -- octal, and binary. When parsing numbers, the base is determined -- automatically. @package IntFormats @version 0.1.0.0 -- | Includes functions for converting from a string to an integer, with -- the base determined automatically, and from an integer to a string, -- with the user specifying the base. Supports negative numbers. -- -- For examples, see the test source -- -- parseInt . showInt True _ == Right for all -- inputs, however the reverse is not necessarily true, even in the case -- of valid input, since parseInt accepts some rather creative -- capitalization that showInt does not produce. module Text.IntFormats -- | IntFormat specifies which base is used for showInt data IntFormat -- | 0d99, etc. This will be more commonly used without the -- prefix. Decimal :: IntFormat -- | Hexadecimal with lowercase digits, such as 0xff Hexadecimal :: IntFormat -- | 0o77, etc. In some programs, octal is denoted with a leading -- zero, however that is not used here. Octal :: IntFormat -- | 0b11, etc. Binary :: IntFormat -- | Hexadecimal with uppercase digits. This only affects the digits A-F, -- not the prefix. For example, 0xFF HexUpper :: IntFormat -- | Converts a string to an integer if able, otherwise returns an error -- message. The number may begin with 0x, 0d, -- 0o, or 0b to specify the numerical base. If no -- prefix is provided, base 10 is assumed. The prefix is case -- insensitive. If the number is negative, the sign goes in front of the -- prefix. The number must not have leading spaces. The number may have -- characters following it, as long as it is not immediately followed by -- a digit, a letter, or a decimal point. parseInt :: Integral a => String -> Either String a -- | The same as parseInt, except the parsec monad isn't evaluated. -- This is intended for use as part of a larger parser. If you simply -- want to get a value, use parseInt intParser :: (Integral a, Stream s m Char) => ParsecT s u m a -- | Converts a integer to a string, with the chosen numerical base. showInt :: Integral a => Bool -> IntFormat -> a -> String instance GHC.Classes.Eq Text.IntFormats.IntFormat instance GHC.Show.Show Text.IntFormats.IntFormat instance Test.QuickCheck.Arbitrary.Arbitrary Text.IntFormats.IntFormat