digit-0.4.0: A data-type representing digits 0-9 and other combinations

Safe HaskellNone
LanguageHaskell2010

Data.Digit.Octal

Synopsis

Documentation

type OctalNoZero d = (D1 d, D2 d, D3 d, D4 d, D5 d, D6 d, D7 d) Source #

type Octal d = (D0 d, OctalNoZero d) Source #

parseOctalNoZero :: (OctalNoZero d, CharParsing p) => p d Source #

>>> parse (parseOctalNoZero <* eof) "test" "1" :: Either ParseError (OctalNoZeroDigit' ())
Right (Left ())
>>> parse parseOctalNoZero "test" "1xyz" :: Either ParseError (OctalNoZeroDigit' ())
Right (Left ())
>>> parse (parseOctalNoZero <* eof) "test" "2" :: Either ParseError (OctalNoZeroDigit' ())
Right (Left ())
>>> parse parseOctalNoZero "test" "2xyz" :: Either ParseError (OctalNoZeroDigit' ())
Right (Left ())
>>> parse (parseOctalNoZero <* eof) "test" "3" :: Either ParseError (OctalNoZeroDigit' ())
Right (Left ())
>>> parse parseOctalNoZero "test" "3xyz" :: Either ParseError (OctalNoZeroDigit' ())
Right (Left ())
>>> parse (parseOctalNoZero <* eof) "test" "4" :: Either ParseError (OctalNoZeroDigit' ())
Right (Left ())
>>> parse parseOctalNoZero "test" "4xyz" :: Either ParseError (OctalNoZeroDigit' ())
Right (Left ())
>>> parse (parseOctalNoZero <* eof) "test" "5" :: Either ParseError (OctalNoZeroDigit' ())
Right (Left ())
>>> parse parseOctalNoZero "test" "5xyz" :: Either ParseError (OctalNoZeroDigit' ())
Right (Left ())
>>> parse (parseOctalNoZero <* eof) "test" "6" :: Either ParseError (OctalNoZeroDigit' ())
Right (Left ())
>>> parse parseOctalNoZero "test" "6xyz" :: Either ParseError (OctalNoZeroDigit' ())
Right (Left ())
>>> parse (parseOctalNoZero <* eof) "test" "7" :: Either ParseError (OctalNoZeroDigit' ())
Right (Left ())
>>> parse parseOctalNoZero "test" "7xyz" :: Either ParseError (OctalNoZeroDigit' ())
Right (Left ())
>>> isn't _Right (parse parseOctalNoZero "test" "xyz" :: Either ParseError (OctalNoZeroDigit' ()))
True
\c -> (c `notElem` "1234567") ==> isn't _Right (parse parseOctalNoZero "test" [c] :: Either ParseError (OctalNoZeroDigit' ()))

parseOctal :: (Octal d, CharParsing p) => p d Source #

>>> parse (parseOctal <* eof) "test" "0" :: Either ParseError (OctalDigit' ())
Right (Left ())
>>> parse parseOctal "test" "1xyz" :: Either ParseError (OctalDigit' ())
Right (Left ())
>>> parse (parseOctal <* eof) "test" "0" :: Either ParseError (OctalDigit' ())
Right (Left ())
>>> parse parseOctal "test" "1xyz" :: Either ParseError (OctalDigit' ())
Right (Left ())
>>> parse (parseOctal <* eof) "test" "2" :: Either ParseError (OctalDigit' ())
Right (Left ())
>>> parse parseOctal "test" "2xyz" :: Either ParseError (OctalDigit' ())
Right (Left ())
>>> parse (parseOctal <* eof) "test" "3" :: Either ParseError (OctalDigit' ())
Right (Left ())
>>> parse parseOctal "test" "3xyz" :: Either ParseError (OctalDigit' ())
Right (Left ())
>>> parse (parseOctal <* eof) "test" "4" :: Either ParseError (OctalDigit' ())
Right (Left ())
>>> parse parseOctal "test" "4xyz" :: Either ParseError (OctalDigit' ())
Right (Left ())
>>> parse (parseOctal <* eof) "test" "5" :: Either ParseError (OctalDigit' ())
Right (Left ())
>>> parse parseOctal "test" "5xyz" :: Either ParseError (OctalDigit' ())
Right (Left ())
>>> parse (parseOctal <* eof) "test" "6" :: Either ParseError (OctalDigit' ())
Right (Left ())
>>> parse parseOctal "test" "6xyz" :: Either ParseError (OctalDigit' ())
Right (Left ())
>>> parse (parseOctal <* eof) "test" "7" :: Either ParseError (OctalDigit' ())
Right (Left ())
>>> parse parseOctal "test" "7xyz" :: Either ParseError (OctalDigit' ())
Right (Left ())
>>> isn't _Right (parse parseOctal "test" "xyz" :: Either ParseError (OctalDigit' ()))
True
\c -> (c `notElem` "01234567") ==> isn't _Right (parse parseOctal "test" [c] :: Either ParseError (OctalDigit' ()))

type OctalNoZeroDigit d1 d2 d3 d4 d5 d6 d7 = Either d1 (Either d2 (Either d3 (Either d4 (Either d5 (Either d5 (Either d6 (Either d7 Void))))))) Source #

type OctalDigit d0 d1 d2 d3 d4 d5 d6 d7 = Either d0 (OctalNoZeroDigit d1 d2 d3 d4 d5 d6 d7) Source #

type OctalDigit' d = OctalDigit d d d d d d d d Source #