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

Safe HaskellNone
LanguageHaskell2010

Data.Digit.DDd

Synopsis

Documentation

type DDd a = (DD a, Dd a) Source #

parseDd :: (DDd d, CharParsing p) => p d Source #

>>> parse (parseDd <* eof) "test" "D" :: Either ParseError Digit
Right D
>>> parse parseDd "test" "Dxyz" :: Either ParseError Digit
Right D
>>> parse (parseDd <* eof) "test" "d" :: Either ParseError Digit
Right d
>>> parse parseDd "test" "dxyz" :: Either ParseError Digit
Right d
>>> isn't _Right (parse parseDd "test" "xyz" :: Either ParseError Digit)
True
\c -> (c `notElem` "Dd") ==> isn't _Right (parse parseDd "test" [c] :: Either ParseError Digit)