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

Safe HaskellNone
LanguageHaskell2010

Data.Digit.DCc

Synopsis

Documentation

type DCc a = (DC a, Dc a) Source #

parseCc :: (DCc d, CharParsing p) => p d Source #

>>> parse (parseCc <* eof) "test" "C" :: Either ParseError Digit
Right C
>>> parse parseCc "test" "Cxyz" :: Either ParseError Digit
Right C
>>> parse (parseCc <* eof) "test" "c" :: Either ParseError Digit
Right c
>>> parse parseCc "test" "cxyz" :: Either ParseError Digit
Right c
>>> isn't _Right (parse parseCc "test" "xyz" :: Either ParseError Digit)
True
\c -> (c `notElem` "Cc") ==> isn't _Right (parse parseCc "test" [c] :: Either ParseError Digit)