Safe Haskell | None |
---|---|
Language | Haskell2010 |
- type BinaryNoZero d = D1 d
- type Binary d = (D0 d, BinaryNoZero d)
- parseBinaryNoZero :: (BinaryNoZero d, CharParsing p) => p d
- parseBinary :: (Binary d, CharParsing p) => p d
Documentation
type BinaryNoZero d = D1 d Source #
type Binary d = (D0 d, BinaryNoZero d) Source #
parseBinaryNoZero :: (BinaryNoZero d, CharParsing p) => p d Source #
>>>
parse (parseBinaryNoZero <* eof) "test" "1" :: Either ParseError Digit
Right 1
>>>
parse parseBinaryNoZero "test" "1xyz" :: Either ParseError Digit
Right 1
>>>
isn't _Right (parse parseBinaryNoZero "test" "xyz" :: Either ParseError Digit)
True
\c -> (c `notElem` "1") ==> isn't _Right (parse parseBinaryNoZero "test" [c] :: Either ParseError Digit)
parseBinary :: (Binary d, CharParsing p) => p d Source #
>>>
parse (parseBinary <* eof) "test" "0" :: Either ParseError Digit
Right 0
>>>
parse parseBinary "test" "0xyz" :: Either ParseError Digit
Right 0
>>>
parse (parseBinary <* eof) "test" "1" :: Either ParseError Digit
Right 1
>>>
parse parseBinary "test" "1xyz" :: Either ParseError Digit
Right 1
>>>
isn't _Right (parse parseBinary "test" "xyz" :: Either ParseError Digit)
True
\c -> (c `notElem` "01") ==> isn't _Right (parse parseBinary "test" [c] :: Either ParseError Digit)