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

Safe HaskellNone
LanguageHaskell2010

Data.Digit.HEXADECIMAL

Synopsis

Documentation

type HEXADECIMALNoZero d = (D1 d, D2 d, D3 d, D4 d, D5 d, D6 d, D7 d, D8 d, D9 d, DA d, DB d, DC d, DD d, DE d, DF d) Source #

parseHEXADECIMALNoZero :: (HEXADECIMALNoZero d, CharParsing p) => p d Source #

>>> parse (parseHEXADECIMALNoZero <* eof) "test" "1" :: Either ParseError Digit
Right 1
>>> parse parseHEXADECIMALNoZero "test" "1xyz" :: Either ParseError Digit
Right 1
>>> parse (parseHEXADECIMALNoZero <* eof) "test" "2" :: Either ParseError Digit
Right 2
>>> parse parseHEXADECIMALNoZero "test" "2xyz" :: Either ParseError Digit
Right 2
>>> parse (parseHEXADECIMALNoZero <* eof) "test" "3" :: Either ParseError Digit
Right 3
>>> parse parseHEXADECIMALNoZero "test" "3xyz" :: Either ParseError Digit
Right 3
>>> parse (parseHEXADECIMALNoZero <* eof) "test" "4" :: Either ParseError Digit
Right 4
>>> parse parseHEXADECIMALNoZero "test" "4xyz" :: Either ParseError Digit
Right 4
>>> parse (parseHEXADECIMALNoZero <* eof) "test" "5" :: Either ParseError Digit
Right 5
>>> parse parseHEXADECIMALNoZero "test" "5xyz" :: Either ParseError Digit
Right 5
>>> parse (parseHEXADECIMALNoZero <* eof) "test" "6" :: Either ParseError Digit
Right 6
>>> parse parseHEXADECIMALNoZero "test" "6xyz" :: Either ParseError Digit
Right 6
>>> parse (parseHEXADECIMALNoZero <* eof) "test" "7" :: Either ParseError Digit
Right 7
>>> parse parseHEXADECIMALNoZero "test" "7xyz" :: Either ParseError Digit
Right 7
>>> parse (parseHEXADECIMALNoZero <* eof) "test" "8" :: Either ParseError Digit
Right 8
>>> parse parseHEXADECIMALNoZero "test" "8xyz" :: Either ParseError Digit
Right 8
>>> parse (parseHEXADECIMALNoZero <* eof) "test" "9" :: Either ParseError Digit
Right 9
>>> parse parseHEXADECIMALNoZero "test" "9xyz" :: Either ParseError Digit
Right 9
>>> parse (parseHEXADECIMALNoZero <* eof) "test" "A" :: Either ParseError Digit
Right A
>>> parse parseHEXADECIMALNoZero "test" "Axyz" :: Either ParseError Digit
Right A
>>> parse (parseHEXADECIMALNoZero <* eof) "test" "B" :: Either ParseError Digit
Right B
>>> parse parseHEXADECIMALNoZero "test" "Bxyz" :: Either ParseError Digit
Right B
>>> parse (parseHEXADECIMALNoZero <* eof) "test" "C" :: Either ParseError Digit
Right C
>>> parse parseHEXADECIMALNoZero "test" "Cxyz" :: Either ParseError Digit
Right C
>>> parse (parseHEXADECIMALNoZero <* eof) "test" "D" :: Either ParseError Digit
Right D
>>> parse parseHEXADECIMALNoZero "test" "Dxyz" :: Either ParseError Digit
Right D
>>> parse (parseHEXADECIMALNoZero <* eof) "test" "E" :: Either ParseError Digit
Right E
>>> parse parseHEXADECIMALNoZero "test" "Exyz" :: Either ParseError Digit
Right E
>>> parse (parseHEXADECIMALNoZero <* eof) "test" "F" :: Either ParseError Digit
Right F
>>> parse parseHEXADECIMALNoZero "test" "Fxyz" :: Either ParseError Digit
Right F
>>> isn't _Right (parse parseHEXADECIMALNoZero "test" "xyz" :: Either ParseError Digit)
True
\c -> (c `notElem` "123456789ABCDEF") ==> isn't _Right (parse parseHEXADECIMALNoZero "test" [c] :: Either ParseError Digit)

parseHEXADECIMAL :: (HEXADECIMAL d, CharParsing p) => p d Source #

>>> parse (parseHEXADECIMAL <* eof) "test" "0" :: Either ParseError Digit
Right 0
>>> parse parseHEXADECIMAL "test" "0xyz" :: Either ParseError Digit
Right 0
>>> parse (parseHEXADECIMAL <* eof) "test" "1" :: Either ParseError Digit
Right 1
>>> parse parseHEXADECIMAL "test" "1xyz" :: Either ParseError Digit
Right 1
>>> parse (parseHEXADECIMAL <* eof) "test" "2" :: Either ParseError Digit
Right 2
>>> parse parseHEXADECIMAL "test" "2xyz" :: Either ParseError Digit
Right 2
>>> parse (parseHEXADECIMAL <* eof) "test" "3" :: Either ParseError Digit
Right 3
>>> parse parseHEXADECIMAL "test" "3xyz" :: Either ParseError Digit
Right 3
>>> parse (parseHEXADECIMAL <* eof) "test" "4" :: Either ParseError Digit
Right 4
>>> parse parseHEXADECIMAL "test" "4xyz" :: Either ParseError Digit
Right 4
>>> parse (parseHEXADECIMAL <* eof) "test" "5" :: Either ParseError Digit
Right 5
>>> parse parseHEXADECIMAL "test" "5xyz" :: Either ParseError Digit
Right 5
>>> parse (parseHEXADECIMAL <* eof) "test" "6" :: Either ParseError Digit
Right 6
>>> parse parseHEXADECIMAL "test" "6xyz" :: Either ParseError Digit
Right 6
>>> parse (parseHEXADECIMAL <* eof) "test" "7" :: Either ParseError Digit
Right 7
>>> parse parseHEXADECIMAL "test" "7xyz" :: Either ParseError Digit
Right 7
>>> parse (parseHEXADECIMAL <* eof) "test" "8" :: Either ParseError Digit
Right 8
>>> parse parseHEXADECIMAL "test" "8xyz" :: Either ParseError Digit
Right 8
>>> parse (parseHEXADECIMAL <* eof) "test" "9" :: Either ParseError Digit
Right 9
>>> parse parseHEXADECIMAL "test" "9xyz" :: Either ParseError Digit
Right 9
>>> parse (parseHEXADECIMAL <* eof) "test" "A" :: Either ParseError Digit
Right A
>>> parse parseHEXADECIMAL "test" "Axyz" :: Either ParseError Digit
Right A
>>> parse (parseHEXADECIMAL <* eof) "test" "B" :: Either ParseError Digit
Right B
>>> parse parseHEXADECIMAL "test" "Bxyz" :: Either ParseError Digit
Right B
>>> parse (parseHEXADECIMAL <* eof) "test" "C" :: Either ParseError Digit
Right C
>>> parse parseHEXADECIMAL "test" "Cxyz" :: Either ParseError Digit
Right C
>>> parse (parseHEXADECIMAL <* eof) "test" "D" :: Either ParseError Digit
Right D
>>> parse parseHEXADECIMAL "test" "Dxyz" :: Either ParseError Digit
Right D
>>> parse (parseHEXADECIMAL <* eof) "test" "E" :: Either ParseError Digit
Right E
>>> parse parseHEXADECIMAL "test" "Exyz" :: Either ParseError Digit
Right E
>>> parse (parseHEXADECIMAL <* eof) "test" "F" :: Either ParseError Digit
Right F
>>> parse parseHEXADECIMAL "test" "Fxyz" :: Either ParseError Digit
Right F
>>> isn't _Right (parse parseHEXADECIMAL "test" "xyz" :: Either ParseError Digit)
True
\c -> (c `notElem` "0123456789ABCDEF") ==> isn't _Right (parse parseHEXADECIMAL "test" [c] :: Either ParseError Digit)