-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Human-friendly textual representations. -- -- This package provides an interface for converting between data and its -- (human-friendly) textual representation. @package data-textual @version 0.1 -- | Parsers for numbers written in positional numeral systems. module Data.Textual.Numerals -- | Positional numeral system. class PositionalSystem s systemName :: PositionalSystem s => s -> String radixIn :: (PositionalSystem s, Num α) => s -> α isDigitIn :: PositionalSystem s => s -> Char -> Bool isNzDigitIn :: PositionalSystem s => s -> Char -> Bool fromDigitIn :: (PositionalSystem s, Num α) => s -> Char -> Maybe α fromNzDigitIn :: (PositionalSystem s, Num α) => s -> Char -> Maybe α unsafeFromDigitIn :: (PositionalSystem s, Num α) => s -> Char -> α intToDigitIn :: PositionalSystem s => s -> Int -> Char printDigitIn :: (PositionalSystem s, Printer p) => s -> Char -> p -- | Positonal numeral system with a power of two radix. class PositionalSystem s => BitSystem s digitBitsIn :: BitSystem s => s -> Int digitMaskIn :: (BitSystem s, Num α) => s -> α lastDigitIn :: (BitSystem s, Bits α) => s -> α -> Int -- | The binary numeral system. data Binary :: * Binary :: Binary -- | The octal numeral system. data Octal :: * Octal :: Octal -- | The decimal numeral system. data Decimal :: * Decimal :: Decimal -- | The hexadecimal numeral system. data Hexadecimal :: * Hexadecimal :: Hexadecimal -- | The hexadecimal numeral system, using lower case digits. data LowHex :: * LowHex :: LowHex -- | The hexadecimal numeral system, using upper case digits. data UpHex :: * UpHex :: UpHex -- | Parse a digit of the specified positional numeral system. digitIn :: (PositionalSystem s, Num α, CharParsing μ) => s -> μ α -- | Parse a non-zero digit of the specified positional numeral system. nzDigitIn :: (PositionalSystem s, Num α, CharParsing μ) => s -> μ α -- | Parse a binary digit. binDigit :: (Num α, CharParsing μ) => μ α -- | Parse a non-zero binary digit ('1'). nzBinDigit :: (Num α, CharParsing μ) => μ α -- | Parse an octal digit. octDigit :: (Num α, CharParsing μ) => μ α -- | Parse a non-zero octal digit. nzOctDigit :: (Num α, CharParsing μ) => μ α -- | Parse a decimal digit. decDigit :: (Num α, CharParsing μ) => μ α -- | Parse a non-zero decimal digit. nzDecDigit :: (Num α, CharParsing μ) => μ α -- | Parse a hexadecimal digit. hexDigit :: (Num α, CharParsing μ) => μ α -- | Parse a non-zero hexadecimal digit. nzHexDigit :: (Num α, CharParsing μ) => μ α -- | Parse a lower case hexadecimal digit. lowHexDigit :: (Num α, CharParsing μ) => μ α -- | Parse a non-zero lower case hexadecimal digit. nzLowHexDigit :: (Num α, CharParsing μ) => μ α -- | Parse an upper case hexadecimal digit. upHexDigit :: (Num α, CharParsing μ) => μ α -- | Parse a non-zero upper case hexadecimal digit. nzUpHexDigit :: (Num α, CharParsing μ) => μ α -- | Parse a non-negative number written in the specified positional -- numeral system. nonNegative :: (PositionalSystem s, Num α, Monad μ, CharParsing μ) => s -> μ α -- | Parse a non-negative number written in the specified positional -- numeral system. Leading zeroes are not allowed. nnCompact :: (PositionalSystem s, Num α, Monad μ, CharParsing μ) => s -> μ α -- | Parse a non-negative number written in the specified positional -- numeral system (up to n digits). nnUpTo :: (PositionalSystem s, Num α, Monad μ, CharParsing μ) => s -> Int -> μ α -- | Parse a non-negative number written in the specified positional -- numeral system (up to n digits). Leading zeroes are not -- allowed. nncUpTo :: (PositionalSystem s, Num α, Monad μ, CharParsing μ) => s -> Int -> μ α -- | Parse a non-negative number written in the specified positional -- numeral system, failing on overflow. nnBounded :: (PositionalSystem s, Ord α, Bounded α, Integral α, Monad μ, CharParsing μ) => s -> μ α -- | Parse a non-negative number written in the specified positional -- numeral system, failing on overflow. Leading zeroes are not allowed. nncBounded :: (PositionalSystem s, Ord α, Bounded α, Integral α, Monad μ, CharParsing μ) => s -> μ α -- | Parse a non-negative binary number written in the specified positional -- numeral system. nnBits :: (BitSystem s, Num α, Bits α, Monad μ, CharParsing μ) => s -> μ α -- | Parse a non-negative binary number written in the specified positional -- numeral system. Leading zeroes are not allowed. nncBits :: (BitSystem s, Num α, Bits α, Monad μ, CharParsing μ) => s -> μ α -- | Parse a non-negative binary number written in the specified positional -- numeral system (up to n digits). nnBitsUpTo :: (BitSystem s, Num α, Bits α, Monad μ, CharParsing μ) => s -> Int -> μ α -- | Parse a non-negative binary number written in the specified positional -- numeral system (up to n digits). Leading zeroes are not -- allowed. nncBitsUpTo :: (BitSystem s, Num α, Bits α, Monad μ, CharParsing μ) => s -> Int -> μ α -- | Parse a non-negative binary number written in the specified positional -- numeral system, failing on overflow. nnbBits :: (BitSystem s, Ord α, Bounded α, Num α, Bits α, Monad μ, CharParsing μ) => s -> μ α -- | Parse a non-negative binary number written in the specified positional -- numeral system, failing on overflow. Leading zeroes are not allowed. nncbBits :: (BitSystem s, Ord α, Bounded α, Num α, Bits α, Monad μ, CharParsing μ) => s -> μ α -- | Parse a non-positive number written in the specified positional -- numeral system. For example, parsing "123" as a decimal would produce -- -123, not 123. nonPositive :: (PositionalSystem s, Num α, Monad μ, CharParsing μ) => s -> μ α -- | Parse a non-positive number written in the specified positional -- numeral system. Leading zeroes are not allowed. npCompact :: (PositionalSystem s, Num α, Monad μ, CharParsing μ) => s -> μ α -- | Parse a non-positive number written in the specified positional -- numeral system (up to n digits). npUpTo :: (PositionalSystem s, Num α, Monad μ, CharParsing μ) => s -> Int -> μ α -- | Parse a non-positive number written in the specified positional -- numeral system (up to n digits). Leading zeroes are not -- allowed. npcUpTo :: (PositionalSystem s, Num α, Monad μ, CharParsing μ) => s -> Int -> μ α -- | Parse a non-positive number written in the specified positional -- numeral system, failing on overflow. npBounded :: (PositionalSystem s, Ord α, Bounded α, Integral α, Monad μ, CharParsing μ) => s -> μ α -- | Parse a non-positive number written in the specified positional -- numeral system, failing on overflow. Leading zeroes are not allowed. npcBounded :: (PositionalSystem s, Ord α, Bounded α, Integral α, Monad μ, CharParsing μ) => s -> μ α -- | Parse a non-positive two's complement binary number written in the -- specified positional numeral system. npBits :: (BitSystem s, Num α, Bits α, Monad μ, CharParsing μ) => s -> μ α -- | Parse a non-positive two's complement binary number written in the -- specified positional numeral system. Leading zeroes are not allowed. npcBits :: (BitSystem s, Num α, Bits α, Monad μ, CharParsing μ) => s -> μ α -- | Parse a non-positive two's complement binary number written in the -- specified positional numeral system (up to n digits). npBitsUpTo :: (BitSystem s, Num α, Bits α, Monad μ, CharParsing μ) => s -> Int -> μ α -- | Parse a non-positive two's complement binary number written in the -- specified positional numeral system (up to n digits). Leading -- zeroes are not allowed. npcBitsUpTo :: (BitSystem s, Num α, Bits α, Monad μ, CharParsing μ) => s -> Int -> μ α -- | Parse a non-positive two's complement binary number written in the -- specified positional numeral system, failing on overflow. npbBits :: (BitSystem s, Ord α, Bounded α, Num α, Bits α, Monad μ, CharParsing μ) => s -> μ α -- | Parse a non-positive two's complement binary number written in the -- specified positional numeral system, failing on overflow. Leading -- zeroes are not allowed. npcbBits :: (BitSystem s, Ord α, Bounded α, Num α, Bits α, Monad μ, CharParsing μ) => s -> μ α -- | Sign of a number. data Sign NonNegative :: Sign NonPositive :: Sign -- | Optional minus sign. optMinus :: CharParsing μ => μ Sign -- | Optional minus or plus sign. optSign :: CharParsing μ => μ Sign -- | Parse a number written in the specified positional numeral system. The -- supplied parser is used to determine the sign of the number. number' :: (PositionalSystem s, Num α, Monad μ, CharParsing μ) => μ Sign -> s -> μ α -- | A shorthand for 'number\'' optMinus. number :: (PositionalSystem s, Num α, Monad μ, CharParsing μ) => s -> μ α -- | Parse a number written in the specified positional numeral system. The -- supplied parser is used to determine the sign of the number. Leading -- zeroes are not allowed. compact' :: (PositionalSystem s, Num α, Monad μ, CharParsing μ) => μ Sign -> s -> μ α -- | A shorthand for 'compact\'' optMinus. compact :: (PositionalSystem s, Num α, Monad μ, CharParsing μ) => s -> μ α -- | Parse a number written in the specified positional numeral system (up -- to n digits). The supplied parser is used to determine the sign -- of the number. numberUpTo' :: (PositionalSystem s, Num α, Monad μ, CharParsing μ) => μ Sign -> s -> Int -> μ α -- | A shorthand for 'numberUpTo\'' optMinus. numberUpTo :: (PositionalSystem s, Num α, Monad μ, CharParsing μ) => s -> Int -> μ α -- | Parse a number written in the specified positional numeral system (up -- to n digits). The supplied parser is used to determine the sign -- of the number. Leading zeroes are not allowed. compactUpTo' :: (PositionalSystem s, Num α, Monad μ, CharParsing μ) => μ Sign -> s -> Int -> μ α -- | A shorthand for 'compactUpTo\'' optMinus. compactUpTo :: (PositionalSystem s, Num α, Monad μ, CharParsing μ) => s -> Int -> μ α -- | Parse a number written in the specified positional numeral system, -- failing on overflow. The supplied parser is used to determine the sign -- of the number. bounded' :: (PositionalSystem s, Ord α, Bounded α, Integral α, Monad μ, CharParsing μ) => μ Sign -> s -> μ α -- | A shorthand for 'bounded\'' optMinus. bounded :: (PositionalSystem s, Ord α, Bounded α, Integral α, Monad μ, CharParsing μ) => s -> μ α -- | Parse a number written in the specified positional numeral system, -- failing on overflow. The supplied parser is used to determine the sign -- of the number. Leading zeroes are not allowed. cBounded' :: (PositionalSystem s, Ord α, Bounded α, Integral α, Monad μ, CharParsing μ) => μ Sign -> s -> μ α -- | A shorthand for 'cBounded\'' optMinus. cBounded :: (PositionalSystem s, Ord α, Bounded α, Integral α, Monad μ, CharParsing μ) => s -> μ α -- | Parse a (two's complement) binary number written in the specified -- positional numeral system. The supplied parser is used to determine -- the sign of the number. bits' :: (BitSystem s, Num α, Bits α, Monad μ, CharParsing μ) => μ Sign -> s -> μ α -- | A shorthand for 'bits\'' optMinus. bits :: (BitSystem s, Num α, Bits α, Monad μ, CharParsing μ) => s -> μ α -- | Parse a (two's complement) binary number written in the specified -- positional numeral system. The supplied parser is used to determine -- the sign of the number. Leading zeroes are not allowed. cBits' :: (BitSystem s, Num α, Bits α, Monad μ, CharParsing μ) => μ Sign -> s -> μ α -- | A shorthand for 'cBits\'' optMinus. cBits :: (BitSystem s, Num α, Bits α, Monad μ, CharParsing μ) => s -> μ α -- | Parse a (two's complement) binary number written in the specified -- positional numeral system (up to n digits). The supplied parser -- is used to determine the sign of the number. bitsUpTo' :: (BitSystem s, Num α, Bits α, Monad μ, CharParsing μ) => μ Sign -> s -> Int -> μ α -- | A shorthand for 'bitsUpTo\'' optMinus. bitsUpTo :: (BitSystem s, Num α, Bits α, Monad μ, CharParsing μ) => s -> Int -> μ α -- | Parse a (two's complement) binary number written in the specified -- positional numeral system (up to n digits). The supplied parser -- is used to determine the sign of the number. Leading zeroes are not -- allowed. cBitsUpTo' :: (BitSystem s, Num α, Bits α, Monad μ, CharParsing μ) => μ Sign -> s -> Int -> μ α -- | A shorthand for 'cBitsUpTo\'' optMinus. cBitsUpTo :: (BitSystem s, Num α, Bits α, Monad μ, CharParsing μ) => s -> Int -> μ α -- | Parse a (two's complement) binary number written in the specified -- positional numeral system, failing on overflow. The supplied parser is -- used to determine the sign of the number. bBits' :: (BitSystem s, Ord α, Bounded α, Num α, Bits α, Monad μ, CharParsing μ) => μ Sign -> s -> μ α -- | A shorthand for 'bBits\'' optMinus. bBits :: (BitSystem s, Ord α, Bounded α, Num α, Bits α, Monad μ, CharParsing μ) => s -> μ α -- | Parse a (two's complement) binary number written in the specified -- positional numeral system, failing on overflow. The supplied parser is -- used to determine the sign of the number. Leading zeroes are not -- allowed. cbBits' :: (BitSystem s, Ord α, Bounded α, Num α, Bits α, Monad μ, CharParsing μ) => μ Sign -> s -> μ α -- | A shorthand for 'cbBits\'' optMinus. cbBits :: (BitSystem s, Ord α, Bounded α, Num α, Bits α, Monad μ, CharParsing μ) => s -> μ α instance Typeable Sign instance Eq Sign instance Show Sign instance Read Sign -- | Working with human-friendly (as opposed to the compiler-friendly -- Show and Read) textual representations. module Data.Textual -- | The default printer for values of a type. class Printable α print :: (Printable α, Printer p) => α -> p -- | A shorthand for maybe mempty print. maybePrint :: (Printer p, Printable α) => Maybe α -> p -- | A shorthand for buildString . print. toString :: Printable α => α -> String -- | A shorthand for buildText . print. toText :: Printable α => α -> Text -- | A shorthand for buildLazyText . print. toLazyText :: Printable α => α -> Text -- | A shorthand for buildAscii . print. toAscii :: Printable α => α -> ByteString -- | A shorthand for buildLazyAscii . print. toLazyAscii :: Printable α => α -> ByteString -- | A shorthand for buildUtf8 . print. toUtf8 :: Printable α => α -> ByteString -- | A shorthand for buildLazyUtf8 . print. toLazyUtf8 :: Printable α => α -> ByteString -- | The default parser for values of a type, must satisfy -- fromString (toString x) = Just x -- class Printable α => Textual α textual :: (Textual α, Monad μ, CharParsing μ) => μ α -- | Hint the type system about the type of the first argument. hintType :: α -> Proxy α -> α -- | Hint the type system about the type constructor. hintType1 :: f α -> Proxy f -> f α -- | Hint the type system about the type argument. hintTypeArg :: f α -> Proxy α -> f α -- | () proxy value. aUnit :: Proxy () -- | Char proxy value. aChar :: Proxy Char -- | Integer proxy value. anInteger :: Proxy Integer -- | Int proxy value. anInt :: Proxy Int -- | Int8 proxy value. anInt8 :: Proxy Int8 -- | Int16 proxy value. anInt16 :: Proxy Int16 -- | Int32 proxy value. anInt32 :: Proxy Int32 -- | Int64 proxy value. anInt64 :: Proxy Int64 -- | Word proxy value. aWord :: Proxy Word -- | Word8 proxy value. aWord8 :: Proxy Word8 -- | Word16 proxy value. aWord16 :: Proxy Word16 -- | Word32 proxy value. aWord32 :: Proxy Word32 -- | Word64 proxy value. aWord64 :: Proxy Word64 -- | Float proxy value. aFloat :: Proxy Float -- | Double proxy value. aDouble :: Proxy Double -- | Maybe proxy value. aMaybe :: Proxy Maybe -- | Maybe α proxy value. aMaybeOf :: Proxy α -> Proxy (Maybe α) -- | List proxy value. aList :: Proxy [] -- | List of α proxy value. aListOf :: Proxy α -> Proxy ([α]) -- | Parsing result. data Parsed α Parsed :: α -> Parsed α Malformed :: [String] -> String -> Parsed α -- | Map Parsed to True and Malformed to False. isParsed :: Parsed α -> Bool -- | Map Parsed to False and Malformed to True. isMalformed :: Parsed α -> Bool -- | Map Parsed values to Just and Malformed to -- Nothing. maybeParsed :: Parsed α -> Maybe α -- | Use the built-in parser to parse a string. Intended for testing only. builtInParser :: (forall μ. (Monad μ, CharParsing μ) => μ α) -> String -> Parsed α -- | Parse a String to extract the Textual value. parseString :: Textual α => String -> Parsed α -- | Provide a hint for the type system when using parseString. parseStringAs :: Textual α => Proxy α -> String -> Parsed α -- | Parse a Text to extract the Textual value. parseText :: Textual α => Text -> Parsed α -- | Provide a hint for the type system when using parseText. parseTextAs :: Textual α => Proxy α -> Text -> Parsed α -- | Parse a lazy Text to extract the Textual value. parseLazyText :: Textual α => Text -> Parsed α -- | Provide a hint for the type system when using parseLazyText. parseLazyTextAs :: Textual α => Proxy α -> Text -> Parsed α -- | Decode and parse an ASCII ByteString to extract the -- Textual value. parseAscii :: Textual α => ByteString -> Parsed α -- | Provide a hint for the type system when using parseAscii. parseAsciiAs :: Textual α => Proxy α -> ByteString -> Parsed α -- | Decode and parse a lazy ASCII ByteString to extract the -- Textual value. parseLazyAscii :: Textual α => ByteString -> Parsed α -- | Provide a hint for the type system when using parseLazyAscii. parseLazyAsciiAs :: Textual α => ByteString -> Parsed α -- | Decode and parse a UTF-8 ByteString to extract the -- Textual value. parseUtf8 :: Textual α => ByteString -> Parsed α -- | Provide a hint for the type system when using parseUtf8. parseUtf8As :: Textual α => Proxy α -> ByteString -> Parsed α -- | Decode and parse a lazy UTF-8 ByteString to extract the -- Textual value. parseLazyUtf8 :: Textual α => ByteString -> Parsed α -- | Provide a hint for the type system when using parseLazyUtf8. parseLazyUtf8As :: Textual α => Proxy α -> ByteString -> Parsed α -- | A shorthand for maybeParsed . parseString fromString :: Textual α => String -> Maybe α -- | Provide a hint for the type system when using fromString. fromStringAs :: Textual α => Proxy α -> String -> Maybe α -- | A shorthand for maybeParsed . parseText fromText :: Textual α => Text -> Maybe α -- | Provide a hint for the type system when using fromText. fromTextAs :: Textual α => Proxy α -> Text -> Maybe α -- | A shorthand for maybeParsed . parseLazyText fromLazyText :: Textual α => Text -> Maybe α -- | Provide a hint for the type system when using fromLazyText. fromLazyTextAs :: Textual α => Proxy α -> Text -> Maybe α -- | A shorthand for maybeParsed . parseAscii fromAscii :: Textual α => ByteString -> Maybe α -- | Provide a hint for the type system when using fromAscii. fromAsciiAs :: Textual α => Proxy α -> ByteString -> Maybe α -- | A shorthand for maybeParsed . parseLazyAscii fromLazyAscii :: Textual α => ByteString -> Maybe α -- | Provide a hint for the type system when using fromLazyAscii. fromLazyAsciiAs :: Textual α => Proxy α -> ByteString -> Maybe α -- | A shorthand for maybeParsed . parseUtf8 fromUtf8 :: Textual α => ByteString -> Maybe α -- | Provide a hint for the type system when using fromUtf8. fromUtf8As :: Textual α => Proxy α -> ByteString -> Maybe α -- | A shorthand for maybeParsed . parseLazyUtf8 fromLazyUtf8 :: Textual α => ByteString -> Maybe α -- | Provide a hint for the type system when using fromLazyUtf8. fromLazyUtf8As :: Textual α => Proxy α -> ByteString -> Maybe α instance Typeable1 Parsed instance Functor Parsed instance Foldable Parsed instance Traversable Parsed instance Eq α => Eq (Parsed α) instance Show α => Show (Parsed α) instance Monad Parser instance CharParsing Parser instance Parsing Parser instance Alternative Parser instance Applicative Parser instance Functor Parser instance Alternative Parsed instance Applicative Parsed instance Textual Word64 instance Textual Word32 instance Textual Word16 instance Textual Word8 instance Textual Word instance Textual Int64 instance Textual Int32 instance Textual Int16 instance Textual Int8 instance Textual Int instance Textual Integer instance Textual Char instance Printable Double instance Printable Float instance Printable Word64 instance Printable Word32 instance Printable Word16 instance Printable Word8 instance Printable Word instance Printable Int64 instance Printable Int32 instance Printable Int16 instance Printable Int8 instance Printable Int instance Printable Integer instance Printable Text instance Printable Text instance Printable String instance Printable Char